[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(int16_t, int16_t);
54 DECL_ARR_TYPE(uint32_t, uint32_t);
55 DECL_ARR_TYPE(void*, ptr);
56 DECL_ARR_TYPE(char, char);
57 typedef charArray jstring;
58
59 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
60         charArray arr = init_charArray(len, __LINE__);
61         memcpy(arr->elems, chars, len);
62         return arr;
63 }
64 static inline LDKStr str_ref_to_owned_c(const jstring str) {
65         char* newchars = MALLOC(str->arr_len + 1, "String chars");
66         memcpy(newchars, str->elems, str->arr_len);
67         newchars[str->arr_len] = 0;
68         LDKStr res = {
69                 .chars = newchars,
70                 .len = str->arr_len,
71                 .chars_is_owned = true
72         };
73         return res;
74 }
75
76 typedef bool jboolean;
77
78 uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) {
79         return (uint32_t)MALLOC(size, "JS-Called malloc");
80 }
81 void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
82         FREE((void*)ptr);
83 }
84
85 jstring __attribute__((export_name("TS_get_ldk_c_bindings_version"))) TS_get_ldk_c_bindings_version() {
86         const char *res = check_get_ldk_bindings_version();
87         if (res == NULL) return NULL;
88         return str_ref_to_ts(res, strlen(res));
89 }
90 jstring __attribute__((export_name("TS_get_ldk_version"))) get_ldk_version() {
91         const char *res = check_get_ldk_version();
92         if (res == NULL) return NULL;
93         return str_ref_to_ts(res, strlen(res));
94 }
95 #include "version.c"
96 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
97
98 static inline void* untag_ptr(uint64_t ptr) {
99         if (ptr < 4096) return (void*)ptr;
100         if (sizeof(void*) == 4) {
101                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
102                 return (void*)(uintptr_t)ptr;
103         } else {
104                 // For 64-bit systems, assume the top byte is used for tagging, then
105                 // use bit 9 ^ bit 10.
106                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
107                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
108 #ifdef LDK_DEBUG_BUILD
109                 // On debug builds we also use the 11th bit as a debug flag
110                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
111                 CHECK(tenth_bit != eleventh_bit);
112                 p ^= 1ULL << 53;
113 #endif
114                 return (void*)p;
115         }
116 }
117 static inline bool ptr_is_owned(uint64_t ptr) {
118         if(ptr < 4096) return true;
119         if (sizeof(void*) == 4) {
120                 return ptr & (1ULL << 32);
121         } else {
122                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
123                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
124 #ifdef LDK_DEBUG_BUILD
125                 // On debug builds we also use the 11th bit as a debug flag
126                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
127                 CHECK(tenth_bit != eleventh_bit);
128 #endif
129                 return (ninth_bit ^ tenth_bit) ? true : false;
130         }
131 }
132 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
133         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
134         if (sizeof(void*) == 4) {
135                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
136         } else {
137                 CHECK(sizeof(uintptr_t) == 8);
138                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
139                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
140 #ifdef LDK_DEBUG_BUILD
141                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
142                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
143                 CHECK(ninth_bit == tenth_bit);
144                 CHECK(ninth_bit == eleventh_bit);
145                 t ^= 1ULL << 53;
146 #endif
147                 CHECK(ptr_is_owned(t) == is_owned);
148                 CHECK(untag_ptr(t) == ptr);
149                 return t;
150         }
151 }
152
153 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
154         switch (ord) {
155                 case 0: return LDKCOption_NoneZ_Some;
156                 case 1: return LDKCOption_NoneZ_None;
157         }
158         abort();
159 }
160 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
161         switch (val) {
162                 case LDKCOption_NoneZ_Some: return 0;
163                 case LDKCOption_NoneZ_None: return 1;
164                 default: abort();
165         }
166 }
167 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_js(int32_t ord) {
168         switch (ord) {
169                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
170                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
171                 case 2: return LDKChannelMonitorUpdateStatus_PermanentFailure;
172         }
173         abort();
174 }
175 static inline int32_t LDKChannelMonitorUpdateStatus_to_js(LDKChannelMonitorUpdateStatus val) {
176         switch (val) {
177                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
178                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
179                 case LDKChannelMonitorUpdateStatus_PermanentFailure: return 2;
180                 default: abort();
181         }
182 }
183 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
184         switch (ord) {
185                 case 0: return LDKConfirmationTarget_Background;
186                 case 1: return LDKConfirmationTarget_Normal;
187                 case 2: return LDKConfirmationTarget_HighPriority;
188         }
189         abort();
190 }
191 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
192         switch (val) {
193                 case LDKConfirmationTarget_Background: return 0;
194                 case LDKConfirmationTarget_Normal: return 1;
195                 case LDKConfirmationTarget_HighPriority: return 2;
196                 default: abort();
197         }
198 }
199 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
200         switch (ord) {
201                 case 0: return LDKCreationError_DescriptionTooLong;
202                 case 1: return LDKCreationError_RouteTooLong;
203                 case 2: return LDKCreationError_TimestampOutOfBounds;
204                 case 3: return LDKCreationError_InvalidAmount;
205                 case 4: return LDKCreationError_MissingRouteHints;
206                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
207         }
208         abort();
209 }
210 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
211         switch (val) {
212                 case LDKCreationError_DescriptionTooLong: return 0;
213                 case LDKCreationError_RouteTooLong: return 1;
214                 case LDKCreationError_TimestampOutOfBounds: return 2;
215                 case LDKCreationError_InvalidAmount: return 3;
216                 case LDKCreationError_MissingRouteHints: return 4;
217                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort: return 5;
218                 default: abort();
219         }
220 }
221 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
222         switch (ord) {
223                 case 0: return LDKCurrency_Bitcoin;
224                 case 1: return LDKCurrency_BitcoinTestnet;
225                 case 2: return LDKCurrency_Regtest;
226                 case 3: return LDKCurrency_Simnet;
227                 case 4: return LDKCurrency_Signet;
228         }
229         abort();
230 }
231 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
232         switch (val) {
233                 case LDKCurrency_Bitcoin: return 0;
234                 case LDKCurrency_BitcoinTestnet: return 1;
235                 case LDKCurrency_Regtest: return 2;
236                 case LDKCurrency_Simnet: return 3;
237                 case LDKCurrency_Signet: return 4;
238                 default: abort();
239         }
240 }
241 static inline LDKFailureCode LDKFailureCode_from_js(int32_t ord) {
242         switch (ord) {
243                 case 0: return LDKFailureCode_TemporaryNodeFailure;
244                 case 1: return LDKFailureCode_RequiredNodeFeatureMissing;
245                 case 2: return LDKFailureCode_IncorrectOrUnknownPaymentDetails;
246         }
247         abort();
248 }
249 static inline int32_t LDKFailureCode_to_js(LDKFailureCode val) {
250         switch (val) {
251                 case LDKFailureCode_TemporaryNodeFailure: return 0;
252                 case LDKFailureCode_RequiredNodeFeatureMissing: return 1;
253                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: return 2;
254                 default: abort();
255         }
256 }
257 static inline LDKHTLCClaim LDKHTLCClaim_from_js(int32_t ord) {
258         switch (ord) {
259                 case 0: return LDKHTLCClaim_OfferedTimeout;
260                 case 1: return LDKHTLCClaim_OfferedPreimage;
261                 case 2: return LDKHTLCClaim_AcceptedTimeout;
262                 case 3: return LDKHTLCClaim_AcceptedPreimage;
263                 case 4: return LDKHTLCClaim_Revocation;
264         }
265         abort();
266 }
267 static inline int32_t LDKHTLCClaim_to_js(LDKHTLCClaim val) {
268         switch (val) {
269                 case LDKHTLCClaim_OfferedTimeout: return 0;
270                 case LDKHTLCClaim_OfferedPreimage: return 1;
271                 case LDKHTLCClaim_AcceptedTimeout: return 2;
272                 case LDKHTLCClaim_AcceptedPreimage: return 3;
273                 case LDKHTLCClaim_Revocation: return 4;
274                 default: abort();
275         }
276 }
277 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
278         switch (ord) {
279                 case 0: return LDKIOError_NotFound;
280                 case 1: return LDKIOError_PermissionDenied;
281                 case 2: return LDKIOError_ConnectionRefused;
282                 case 3: return LDKIOError_ConnectionReset;
283                 case 4: return LDKIOError_ConnectionAborted;
284                 case 5: return LDKIOError_NotConnected;
285                 case 6: return LDKIOError_AddrInUse;
286                 case 7: return LDKIOError_AddrNotAvailable;
287                 case 8: return LDKIOError_BrokenPipe;
288                 case 9: return LDKIOError_AlreadyExists;
289                 case 10: return LDKIOError_WouldBlock;
290                 case 11: return LDKIOError_InvalidInput;
291                 case 12: return LDKIOError_InvalidData;
292                 case 13: return LDKIOError_TimedOut;
293                 case 14: return LDKIOError_WriteZero;
294                 case 15: return LDKIOError_Interrupted;
295                 case 16: return LDKIOError_Other;
296                 case 17: return LDKIOError_UnexpectedEof;
297         }
298         abort();
299 }
300 static inline int32_t LDKIOError_to_js(LDKIOError val) {
301         switch (val) {
302                 case LDKIOError_NotFound: return 0;
303                 case LDKIOError_PermissionDenied: return 1;
304                 case LDKIOError_ConnectionRefused: return 2;
305                 case LDKIOError_ConnectionReset: return 3;
306                 case LDKIOError_ConnectionAborted: return 4;
307                 case LDKIOError_NotConnected: return 5;
308                 case LDKIOError_AddrInUse: return 6;
309                 case LDKIOError_AddrNotAvailable: return 7;
310                 case LDKIOError_BrokenPipe: return 8;
311                 case LDKIOError_AlreadyExists: return 9;
312                 case LDKIOError_WouldBlock: return 10;
313                 case LDKIOError_InvalidInput: return 11;
314                 case LDKIOError_InvalidData: return 12;
315                 case LDKIOError_TimedOut: return 13;
316                 case LDKIOError_WriteZero: return 14;
317                 case LDKIOError_Interrupted: return 15;
318                 case LDKIOError_Other: return 16;
319                 case LDKIOError_UnexpectedEof: return 17;
320                 default: abort();
321         }
322 }
323 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
324         switch (ord) {
325                 case 0: return LDKLevel_Gossip;
326                 case 1: return LDKLevel_Trace;
327                 case 2: return LDKLevel_Debug;
328                 case 3: return LDKLevel_Info;
329                 case 4: return LDKLevel_Warn;
330                 case 5: return LDKLevel_Error;
331         }
332         abort();
333 }
334 static inline int32_t LDKLevel_to_js(LDKLevel val) {
335         switch (val) {
336                 case LDKLevel_Gossip: return 0;
337                 case LDKLevel_Trace: return 1;
338                 case LDKLevel_Debug: return 2;
339                 case LDKLevel_Info: return 3;
340                 case LDKLevel_Warn: return 4;
341                 case LDKLevel_Error: return 5;
342                 default: abort();
343         }
344 }
345 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
346         switch (ord) {
347                 case 0: return LDKNetwork_Bitcoin;
348                 case 1: return LDKNetwork_Testnet;
349                 case 2: return LDKNetwork_Regtest;
350                 case 3: return LDKNetwork_Signet;
351         }
352         abort();
353 }
354 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
355         switch (val) {
356                 case LDKNetwork_Bitcoin: return 0;
357                 case LDKNetwork_Testnet: return 1;
358                 case LDKNetwork_Regtest: return 2;
359                 case LDKNetwork_Signet: return 3;
360                 default: abort();
361         }
362 }
363 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
364         switch (ord) {
365                 case 0: return LDKRecipient_Node;
366                 case 1: return LDKRecipient_PhantomNode;
367         }
368         abort();
369 }
370 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
371         switch (val) {
372                 case LDKRecipient_Node: return 0;
373                 case LDKRecipient_PhantomNode: return 1;
374                 default: abort();
375         }
376 }
377 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_js(int32_t ord) {
378         switch (ord) {
379                 case 0: return LDKRetryableSendFailure_PaymentExpired;
380                 case 1: return LDKRetryableSendFailure_RouteNotFound;
381                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
382         }
383         abort();
384 }
385 static inline int32_t LDKRetryableSendFailure_to_js(LDKRetryableSendFailure val) {
386         switch (val) {
387                 case LDKRetryableSendFailure_PaymentExpired: return 0;
388                 case LDKRetryableSendFailure_RouteNotFound: return 1;
389                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
390                 default: abort();
391         }
392 }
393 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
394         switch (ord) {
395                 case 0: return LDKSecp256k1Error_IncorrectSignature;
396                 case 1: return LDKSecp256k1Error_InvalidMessage;
397                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
398                 case 3: return LDKSecp256k1Error_InvalidSignature;
399                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
400                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
401                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
402                 case 7: return LDKSecp256k1Error_InvalidTweak;
403                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
404                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
405                 case 10: return LDKSecp256k1Error_InvalidParityValue;
406         }
407         abort();
408 }
409 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
410         switch (val) {
411                 case LDKSecp256k1Error_IncorrectSignature: return 0;
412                 case LDKSecp256k1Error_InvalidMessage: return 1;
413                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
414                 case LDKSecp256k1Error_InvalidSignature: return 3;
415                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
416                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
417                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
418                 case LDKSecp256k1Error_InvalidTweak: return 7;
419                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
420                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
421                 case LDKSecp256k1Error_InvalidParityValue: return 10;
422                 default: abort();
423         }
424 }
425 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
426         switch (ord) {
427                 case 0: return LDKSemanticError_NoPaymentHash;
428                 case 1: return LDKSemanticError_MultiplePaymentHashes;
429                 case 2: return LDKSemanticError_NoDescription;
430                 case 3: return LDKSemanticError_MultipleDescriptions;
431                 case 4: return LDKSemanticError_NoPaymentSecret;
432                 case 5: return LDKSemanticError_MultiplePaymentSecrets;
433                 case 6: return LDKSemanticError_InvalidFeatures;
434                 case 7: return LDKSemanticError_InvalidRecoveryId;
435                 case 8: return LDKSemanticError_InvalidSignature;
436                 case 9: return LDKSemanticError_ImpreciseAmount;
437         }
438         abort();
439 }
440 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
441         switch (val) {
442                 case LDKSemanticError_NoPaymentHash: return 0;
443                 case LDKSemanticError_MultiplePaymentHashes: return 1;
444                 case LDKSemanticError_NoDescription: return 2;
445                 case LDKSemanticError_MultipleDescriptions: return 3;
446                 case LDKSemanticError_NoPaymentSecret: return 4;
447                 case LDKSemanticError_MultiplePaymentSecrets: return 5;
448                 case LDKSemanticError_InvalidFeatures: return 6;
449                 case LDKSemanticError_InvalidRecoveryId: return 7;
450                 case LDKSemanticError_InvalidSignature: return 8;
451                 case LDKSemanticError_ImpreciseAmount: return 9;
452                 default: abort();
453         }
454 }
455 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
456         switch (ord) {
457                 case 0: return LDKSiPrefix_Milli;
458                 case 1: return LDKSiPrefix_Micro;
459                 case 2: return LDKSiPrefix_Nano;
460                 case 3: return LDKSiPrefix_Pico;
461         }
462         abort();
463 }
464 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
465         switch (val) {
466                 case LDKSiPrefix_Milli: return 0;
467                 case LDKSiPrefix_Micro: return 1;
468                 case LDKSiPrefix_Nano: return 2;
469                 case LDKSiPrefix_Pico: return 3;
470                 default: abort();
471         }
472 }
473 static inline LDKUtxoLookupError LDKUtxoLookupError_from_js(int32_t ord) {
474         switch (ord) {
475                 case 0: return LDKUtxoLookupError_UnknownChain;
476                 case 1: return LDKUtxoLookupError_UnknownTx;
477         }
478         abort();
479 }
480 static inline int32_t LDKUtxoLookupError_to_js(LDKUtxoLookupError val) {
481         switch (val) {
482                 case LDKUtxoLookupError_UnknownChain: return 0;
483                 case LDKUtxoLookupError_UnknownTx: return 1;
484                 default: abort();
485         }
486 }
487 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
488         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
489         return ret;
490 }
491 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
492         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
493         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
494         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
495         return ret_arr;
496 }
497
498 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
499 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
500         if (!ptr_is_owned(thing)) return;
501         void* thing_ptr = untag_ptr(thing);
502         CHECK_ACCESS(thing_ptr);
503         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
504         FREE(untag_ptr(thing));
505         BigEndianScalar_free(thing_conv);
506 }
507
508 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
509         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
510         switch(obj->tag) {
511                 case LDKBech32Error_MissingSeparator: return 0;
512                 case LDKBech32Error_InvalidChecksum: return 1;
513                 case LDKBech32Error_InvalidLength: return 2;
514                 case LDKBech32Error_InvalidChar: return 3;
515                 case LDKBech32Error_InvalidData: return 4;
516                 case LDKBech32Error_InvalidPadding: return 5;
517                 case LDKBech32Error_MixedCase: return 6;
518                 default: abort();
519         }
520 }
521 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
522         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
523         assert(obj->tag == LDKBech32Error_InvalidChar);
524                         int32_t invalid_char_conv = obj->invalid_char;
525         return invalid_char_conv;
526 }
527 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
528         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
529         assert(obj->tag == LDKBech32Error_InvalidData);
530                         int8_t invalid_data_conv = obj->invalid_data;
531         return invalid_data_conv;
532 }
533 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
534         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
535         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
536         return ret;
537 }
538 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) {
539         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
540         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
541         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
542         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
543         CVec_u8Z_free(ret_var);
544         return ret_arr;
545 }
546
547 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) {
548         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
549         int64_t ret_conv = TxOut_get_value(thing_conv);
550         return ret_conv;
551 }
552
553 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
554         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
555         switch(obj->tag) {
556                 case LDKAPIError_APIMisuseError: return 0;
557                 case LDKAPIError_FeeRateTooHigh: return 1;
558                 case LDKAPIError_InvalidRoute: return 2;
559                 case LDKAPIError_ChannelUnavailable: return 3;
560                 case LDKAPIError_MonitorUpdateInProgress: return 4;
561                 case LDKAPIError_IncompatibleShutdownScript: return 5;
562                 default: abort();
563         }
564 }
565 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
566         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
567         assert(obj->tag == LDKAPIError_APIMisuseError);
568                         LDKStr err_str = obj->api_misuse_error.err;
569                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
570         return err_conv;
571 }
572 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
573         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
574         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
575                         LDKStr err_str = obj->fee_rate_too_high.err;
576                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
577         return err_conv;
578 }
579 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
580         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
581         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
582                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
583         return feerate_conv;
584 }
585 jstring __attribute__((export_name("TS_LDKAPIError_InvalidRoute_get_err"))) TS_LDKAPIError_InvalidRoute_get_err(uint64_t ptr) {
586         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
587         assert(obj->tag == LDKAPIError_InvalidRoute);
588                         LDKStr err_str = obj->invalid_route.err;
589                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
590         return err_conv;
591 }
592 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
593         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
594         assert(obj->tag == LDKAPIError_ChannelUnavailable);
595                         LDKStr err_str = obj->channel_unavailable.err;
596                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
597         return err_conv;
598 }
599 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
600         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
601         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
602                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
603                         uint64_t script_ref = 0;
604                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
605                         script_ref = tag_ptr(script_var.inner, false);
606         return script_ref;
607 }
608 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
609 CHECK(owner->result_ok);
610         return *owner->contents.result;
611 }
612 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
613         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
614         CResult_NoneAPIErrorZ_get_ok(owner_conv);
615 }
616
617 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
618 CHECK(!owner->result_ok);
619         return APIError_clone(&*owner->contents.err);
620 }
621 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
622         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
623         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
624         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
625         uint64_t ret_ref = tag_ptr(ret_copy, true);
626         return ret_ref;
627 }
628
629 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
630         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
631         for (size_t i = 0; i < ret.datalen; i++) {
632                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
633         }
634         return ret;
635 }
636 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
637         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
638         for (size_t i = 0; i < ret.datalen; i++) {
639                 ret.data[i] = APIError_clone(&orig->data[i]);
640         }
641         return ret;
642 }
643 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_ty_from_ptr"))) TS_LDKCOption_HTLCClaimZ_ty_from_ptr(uint64_t ptr) {
644         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
645         switch(obj->tag) {
646                 case LDKCOption_HTLCClaimZ_Some: return 0;
647                 case LDKCOption_HTLCClaimZ_None: return 1;
648                 default: abort();
649         }
650 }
651 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_Some_get_some"))) TS_LDKCOption_HTLCClaimZ_Some_get_some(uint64_t ptr) {
652         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
653         assert(obj->tag == LDKCOption_HTLCClaimZ_Some);
654                         uint32_t some_conv = LDKHTLCClaim_to_js(obj->some);
655         return some_conv;
656 }
657 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
658 CHECK(owner->result_ok);
659         return *owner->contents.result;
660 }
661 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
662         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
663         CResult_NoneNoneZ_get_ok(owner_conv);
664 }
665
666 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
667 CHECK(!owner->result_ok);
668         return *owner->contents.err;
669 }
670 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
671         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
672         CResult_NoneNoneZ_get_err(owner_conv);
673 }
674
675 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
676         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
677         switch(obj->tag) {
678                 case LDKDecodeError_UnknownVersion: return 0;
679                 case LDKDecodeError_UnknownRequiredFeature: return 1;
680                 case LDKDecodeError_InvalidValue: return 2;
681                 case LDKDecodeError_ShortRead: return 3;
682                 case LDKDecodeError_BadLengthDescriptor: return 4;
683                 case LDKDecodeError_Io: return 5;
684                 case LDKDecodeError_UnsupportedCompression: return 6;
685                 default: abort();
686         }
687 }
688 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
689         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
690         assert(obj->tag == LDKDecodeError_Io);
691                         uint32_t io_conv = LDKIOError_to_js(obj->io);
692         return io_conv;
693 }
694 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
695         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
696         ret.is_owned = false;
697         return ret;
698 }
699 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
700         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
701         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
702         uint64_t ret_ref = 0;
703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
705         return ret_ref;
706 }
707
708 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
709 CHECK(!owner->result_ok);
710         return DecodeError_clone(&*owner->contents.err);
711 }
712 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
713         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
714         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
715         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
716         uint64_t ret_ref = tag_ptr(ret_copy, true);
717         return ret_ref;
718 }
719
720 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
721         LDKTxCreationKeys ret = *owner->contents.result;
722         ret.is_owned = false;
723         return ret;
724 }
725 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
726         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
727         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
728         uint64_t ret_ref = 0;
729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
731         return ret_ref;
732 }
733
734 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
735 CHECK(!owner->result_ok);
736         return DecodeError_clone(&*owner->contents.err);
737 }
738 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
739         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
740         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
741         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
742         uint64_t ret_ref = tag_ptr(ret_copy, true);
743         return ret_ref;
744 }
745
746 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
747         LDKChannelPublicKeys ret = *owner->contents.result;
748         ret.is_owned = false;
749         return ret;
750 }
751 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
752         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
753         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
754         uint64_t ret_ref = 0;
755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
757         return ret_ref;
758 }
759
760 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
761 CHECK(!owner->result_ok);
762         return DecodeError_clone(&*owner->contents.err);
763 }
764 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
765         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
766         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
767         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
768         uint64_t ret_ref = tag_ptr(ret_copy, true);
769         return ret_ref;
770 }
771
772 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
773         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
774         switch(obj->tag) {
775                 case LDKCOption_u32Z_Some: return 0;
776                 case LDKCOption_u32Z_None: return 1;
777                 default: abort();
778         }
779 }
780 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
781         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
782         assert(obj->tag == LDKCOption_u32Z_Some);
783                         int32_t some_conv = obj->some;
784         return some_conv;
785 }
786 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
787         LDKHTLCOutputInCommitment ret = *owner->contents.result;
788         ret.is_owned = false;
789         return ret;
790 }
791 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
792         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
793         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
794         uint64_t ret_ref = 0;
795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
797         return ret_ref;
798 }
799
800 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
801 CHECK(!owner->result_ok);
802         return DecodeError_clone(&*owner->contents.err);
803 }
804 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
805         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
806         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
807         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
808         uint64_t ret_ref = tag_ptr(ret_copy, true);
809         return ret_ref;
810 }
811
812 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
813         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
814         ret.is_owned = false;
815         return ret;
816 }
817 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
818         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
819         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
820         uint64_t ret_ref = 0;
821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
823         return ret_ref;
824 }
825
826 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
827 CHECK(!owner->result_ok);
828         return DecodeError_clone(&*owner->contents.err);
829 }
830 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
831         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
832         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
833         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
834         uint64_t ret_ref = tag_ptr(ret_copy, true);
835         return ret_ref;
836 }
837
838 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
839         LDKChannelTransactionParameters ret = *owner->contents.result;
840         ret.is_owned = false;
841         return ret;
842 }
843 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
844         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
845         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
846         uint64_t ret_ref = 0;
847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
849         return ret_ref;
850 }
851
852 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
853 CHECK(!owner->result_ok);
854         return DecodeError_clone(&*owner->contents.err);
855 }
856 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
857         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
858         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
859         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
860         uint64_t ret_ref = tag_ptr(ret_copy, true);
861         return ret_ref;
862 }
863
864 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
865         LDKHolderCommitmentTransaction ret = *owner->contents.result;
866         ret.is_owned = false;
867         return ret;
868 }
869 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
870         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
871         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
872         uint64_t ret_ref = 0;
873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
875         return ret_ref;
876 }
877
878 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
879 CHECK(!owner->result_ok);
880         return DecodeError_clone(&*owner->contents.err);
881 }
882 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
883         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
884         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
885         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
886         uint64_t ret_ref = tag_ptr(ret_copy, true);
887         return ret_ref;
888 }
889
890 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
891         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
892         ret.is_owned = false;
893         return ret;
894 }
895 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
896         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
897         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(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 LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
905 CHECK(!owner->result_ok);
906         return DecodeError_clone(&*owner->contents.err);
907 }
908 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
909         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
910         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
911         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
912         uint64_t ret_ref = tag_ptr(ret_copy, true);
913         return ret_ref;
914 }
915
916 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
917         LDKTrustedClosingTransaction ret = *owner->contents.result;
918         ret.is_owned = false;
919         return ret;
920 }
921 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
922         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
923         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(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 void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
931 CHECK(!owner->result_ok);
932         return *owner->contents.err;
933 }
934 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
935         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
936         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
937 }
938
939 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
940         LDKCommitmentTransaction ret = *owner->contents.result;
941         ret.is_owned = false;
942         return ret;
943 }
944 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
945         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
946         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
947         uint64_t ret_ref = 0;
948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
950         return ret_ref;
951 }
952
953 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
954 CHECK(!owner->result_ok);
955         return DecodeError_clone(&*owner->contents.err);
956 }
957 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
958         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
959         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
960         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
961         uint64_t ret_ref = tag_ptr(ret_copy, true);
962         return ret_ref;
963 }
964
965 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
966         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
967         ret.is_owned = false;
968         return ret;
969 }
970 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
971         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
972         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
973         uint64_t ret_ref = 0;
974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
976         return ret_ref;
977 }
978
979 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
980 CHECK(!owner->result_ok);
981         return *owner->contents.err;
982 }
983 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
984         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
985         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
986 }
987
988 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
989 CHECK(owner->result_ok);
990         return *owner->contents.result;
991 }
992 ptrArray  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint64_t owner) {
993         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
994         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
995         ptrArray ret_arr = NULL;
996         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
997         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
998         for (size_t m = 0; m < ret_var.datalen; m++) {
999                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
1000                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1001                 ret_arr_ptr[m] = ret_conv_12_arr;
1002         }
1003         
1004         return ret_arr;
1005 }
1006
1007 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1008 CHECK(!owner->result_ok);
1009         return *owner->contents.err;
1010 }
1011 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint64_t owner) {
1012         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1013         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
1014 }
1015
1016 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1017         LDKShutdownScript ret = *owner->contents.result;
1018         ret.is_owned = false;
1019         return ret;
1020 }
1021 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
1022         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1023         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1024         uint64_t ret_ref = 0;
1025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1027         return ret_ref;
1028 }
1029
1030 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1031 CHECK(!owner->result_ok);
1032         return DecodeError_clone(&*owner->contents.err);
1033 }
1034 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
1035         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1036         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1037         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1038         uint64_t ret_ref = tag_ptr(ret_copy, true);
1039         return ret_ref;
1040 }
1041
1042 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1043         LDKShutdownScript ret = *owner->contents.result;
1044         ret.is_owned = false;
1045         return ret;
1046 }
1047 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
1048         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1049         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1050         uint64_t ret_ref = 0;
1051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1053         return ret_ref;
1054 }
1055
1056 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1057         LDKInvalidShutdownScript ret = *owner->contents.err;
1058         ret.is_owned = false;
1059         return ret;
1060 }
1061 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
1062         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1063         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1064         uint64_t ret_ref = 0;
1065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1067         return ret_ref;
1068 }
1069
1070 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
1071         LDKBlindedPath ret = *owner->contents.result;
1072         ret.is_owned = false;
1073         return ret;
1074 }
1075 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_ok"))) TS_CResult_BlindedPathNoneZ_get_ok(uint64_t owner) {
1076         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
1077         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
1078         uint64_t ret_ref = 0;
1079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1081         return ret_ref;
1082 }
1083
1084 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
1085 CHECK(!owner->result_ok);
1086         return *owner->contents.err;
1087 }
1088 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_err"))) TS_CResult_BlindedPathNoneZ_get_err(uint64_t owner) {
1089         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
1090         CResult_BlindedPathNoneZ_get_err(owner_conv);
1091 }
1092
1093 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
1094         LDKBlindedPath ret = *owner->contents.result;
1095         ret.is_owned = false;
1096         return ret;
1097 }
1098 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_ok"))) TS_CResult_BlindedPathDecodeErrorZ_get_ok(uint64_t owner) {
1099         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
1100         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(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 LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
1108 CHECK(!owner->result_ok);
1109         return DecodeError_clone(&*owner->contents.err);
1110 }
1111 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_err"))) TS_CResult_BlindedPathDecodeErrorZ_get_err(uint64_t owner) {
1112         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
1113         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1114         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
1115         uint64_t ret_ref = tag_ptr(ret_copy, true);
1116         return ret_ref;
1117 }
1118
1119 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
1120         LDKBlindedHop ret = *owner->contents.result;
1121         ret.is_owned = false;
1122         return ret;
1123 }
1124 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
1125         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
1126         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(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 struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
1134 CHECK(!owner->result_ok);
1135         return DecodeError_clone(&*owner->contents.err);
1136 }
1137 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
1138         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
1139         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1140         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
1141         uint64_t ret_ref = tag_ptr(ret_copy, true);
1142         return ret_ref;
1143 }
1144
1145 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1146         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1147         for (size_t i = 0; i < ret.datalen; i++) {
1148                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1149         }
1150         return ret;
1151 }
1152 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1153         LDKRoute ret = *owner->contents.result;
1154         ret.is_owned = false;
1155         return ret;
1156 }
1157 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
1158         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1159         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(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 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1167         LDKLightningError ret = *owner->contents.err;
1168         ret.is_owned = false;
1169         return ret;
1170 }
1171 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
1172         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1173         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1174         uint64_t ret_ref = 0;
1175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1177         return ret_ref;
1178 }
1179
1180 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1181         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1182         for (size_t i = 0; i < ret.datalen; i++) {
1183                 ret.data[i] = RouteHop_clone(&orig->data[i]);
1184         }
1185         return ret;
1186 }
1187 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
1188         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1189         switch(obj->tag) {
1190                 case LDKCOption_u64Z_Some: return 0;
1191                 case LDKCOption_u64Z_None: return 1;
1192                 default: abort();
1193         }
1194 }
1195 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
1196         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1197         assert(obj->tag == LDKCOption_u64Z_Some);
1198                         int64_t some_conv = obj->some;
1199         return some_conv;
1200 }
1201 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
1202         LDKInFlightHtlcs ret = *owner->contents.result;
1203         ret.is_owned = false;
1204         return ret;
1205 }
1206 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
1207         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
1208         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
1209         uint64_t ret_ref = 0;
1210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1212         return ret_ref;
1213 }
1214
1215 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
1216 CHECK(!owner->result_ok);
1217         return DecodeError_clone(&*owner->contents.err);
1218 }
1219 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
1220         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
1221         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1222         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
1223         uint64_t ret_ref = tag_ptr(ret_copy, true);
1224         return ret_ref;
1225 }
1226
1227 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1228         LDKRouteHop ret = *owner->contents.result;
1229         ret.is_owned = false;
1230         return ret;
1231 }
1232 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
1233         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1234         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1235         uint64_t ret_ref = 0;
1236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1238         return ret_ref;
1239 }
1240
1241 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1242 CHECK(!owner->result_ok);
1243         return DecodeError_clone(&*owner->contents.err);
1244 }
1245 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
1246         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1247         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1248         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1249         uint64_t ret_ref = tag_ptr(ret_copy, true);
1250         return ret_ref;
1251 }
1252
1253 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1254         LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1255         for (size_t i = 0; i < ret.datalen; i++) {
1256                 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1257         }
1258         return ret;
1259 }
1260 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1261         LDKRoute ret = *owner->contents.result;
1262         ret.is_owned = false;
1263         return ret;
1264 }
1265 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
1266         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1267         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1268         uint64_t ret_ref = 0;
1269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1271         return ret_ref;
1272 }
1273
1274 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1275 CHECK(!owner->result_ok);
1276         return DecodeError_clone(&*owner->contents.err);
1277 }
1278 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
1279         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1280         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1281         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1282         uint64_t ret_ref = tag_ptr(ret_copy, true);
1283         return ret_ref;
1284 }
1285
1286 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1287         LDKRouteParameters ret = *owner->contents.result;
1288         ret.is_owned = false;
1289         return ret;
1290 }
1291 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
1292         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1293         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1294         uint64_t ret_ref = 0;
1295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1297         return ret_ref;
1298 }
1299
1300 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1301 CHECK(!owner->result_ok);
1302         return DecodeError_clone(&*owner->contents.err);
1303 }
1304 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
1305         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1306         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1307         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1308         uint64_t ret_ref = tag_ptr(ret_copy, true);
1309         return ret_ref;
1310 }
1311
1312 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1313         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1314         for (size_t i = 0; i < ret.datalen; i++) {
1315                 ret.data[i] = RouteHint_clone(&orig->data[i]);
1316         }
1317         return ret;
1318 }
1319 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1320         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1321         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1322         return ret;
1323 }
1324 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1325         LDKPaymentParameters ret = *owner->contents.result;
1326         ret.is_owned = false;
1327         return ret;
1328 }
1329 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
1330         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1331         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1332         uint64_t ret_ref = 0;
1333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1335         return ret_ref;
1336 }
1337
1338 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1339 CHECK(!owner->result_ok);
1340         return DecodeError_clone(&*owner->contents.err);
1341 }
1342 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
1343         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1344         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1345         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1346         uint64_t ret_ref = tag_ptr(ret_copy, true);
1347         return ret_ref;
1348 }
1349
1350 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1351         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1352         for (size_t i = 0; i < ret.datalen; i++) {
1353                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1354         }
1355         return ret;
1356 }
1357 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1358         LDKRouteHint ret = *owner->contents.result;
1359         ret.is_owned = false;
1360         return ret;
1361 }
1362 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
1363         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1364         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1365         uint64_t ret_ref = 0;
1366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1368         return ret_ref;
1369 }
1370
1371 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1372 CHECK(!owner->result_ok);
1373         return DecodeError_clone(&*owner->contents.err);
1374 }
1375 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
1376         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1377         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1378         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1379         uint64_t ret_ref = tag_ptr(ret_copy, true);
1380         return ret_ref;
1381 }
1382
1383 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1384         LDKRouteHintHop ret = *owner->contents.result;
1385         ret.is_owned = false;
1386         return ret;
1387 }
1388 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
1389         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1390         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1391         uint64_t ret_ref = 0;
1392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1394         return ret_ref;
1395 }
1396
1397 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1398 CHECK(!owner->result_ok);
1399         return DecodeError_clone(&*owner->contents.err);
1400 }
1401 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
1402         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1403         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1404         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1405         uint64_t ret_ref = tag_ptr(ret_copy, true);
1406         return ret_ref;
1407 }
1408
1409 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
1410         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1411         switch(obj->tag) {
1412                 case LDKPaymentPurpose_InvoicePayment: return 0;
1413                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
1414                 default: abort();
1415         }
1416 }
1417 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
1418         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1419         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1420                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1421                         memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1422         return payment_preimage_arr;
1423 }
1424 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
1425         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1426         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1427                         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
1428                         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1429         return payment_secret_arr;
1430 }
1431 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
1432         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1433         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
1434                         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
1435                         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1436         return spontaneous_payment_arr;
1437 }
1438 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1439 CHECK(owner->result_ok);
1440         return PaymentPurpose_clone(&*owner->contents.result);
1441 }
1442 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
1443         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1444         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1445         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1446         uint64_t ret_ref = tag_ptr(ret_copy, true);
1447         return ret_ref;
1448 }
1449
1450 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1451 CHECK(!owner->result_ok);
1452         return DecodeError_clone(&*owner->contents.err);
1453 }
1454 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
1455         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1456         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1457         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1458         uint64_t ret_ref = tag_ptr(ret_copy, true);
1459         return ret_ref;
1460 }
1461
1462 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
1463         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1464         switch(obj->tag) {
1465                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
1466                 case LDKNetworkUpdate_ChannelFailure: return 1;
1467                 case LDKNetworkUpdate_NodeFailure: return 2;
1468                 default: abort();
1469         }
1470 }
1471 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
1472         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1473         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
1474                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1475                         uint64_t msg_ref = 0;
1476                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1477                         msg_ref = tag_ptr(msg_var.inner, false);
1478         return msg_ref;
1479 }
1480 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
1481         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1482         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1483                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
1484         return short_channel_id_conv;
1485 }
1486 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
1487         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1488         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1489                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
1490         return is_permanent_conv;
1491 }
1492 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
1493         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1494         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1495                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1496                         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1497         return node_id_arr;
1498 }
1499 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
1500         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1501         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1502                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
1503         return is_permanent_conv;
1504 }
1505 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
1506         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1507         switch(obj->tag) {
1508                 case LDKCOption_NetworkUpdateZ_Some: return 0;
1509                 case LDKCOption_NetworkUpdateZ_None: return 1;
1510                 default: abort();
1511         }
1512 }
1513 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
1514         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1515         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
1516                         uint64_t some_ref = tag_ptr(&obj->some, false);
1517         return some_ref;
1518 }
1519 uint32_t __attribute__((export_name("TS_LDKPathFailure_ty_from_ptr"))) TS_LDKPathFailure_ty_from_ptr(uint64_t ptr) {
1520         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
1521         switch(obj->tag) {
1522                 case LDKPathFailure_InitialSend: return 0;
1523                 case LDKPathFailure_OnPath: return 1;
1524                 default: abort();
1525         }
1526 }
1527 uint64_t __attribute__((export_name("TS_LDKPathFailure_InitialSend_get_err"))) TS_LDKPathFailure_InitialSend_get_err(uint64_t ptr) {
1528         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
1529         assert(obj->tag == LDKPathFailure_InitialSend);
1530                         uint64_t err_ref = tag_ptr(&obj->initial_send.err, false);
1531         return err_ref;
1532 }
1533 uint64_t __attribute__((export_name("TS_LDKPathFailure_OnPath_get_network_update"))) TS_LDKPathFailure_OnPath_get_network_update(uint64_t ptr) {
1534         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
1535         assert(obj->tag == LDKPathFailure_OnPath);
1536                         uint64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
1537         return network_update_ref;
1538 }
1539 uint32_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_ty_from_ptr"))) TS_LDKCOption_PathFailureZ_ty_from_ptr(uint64_t ptr) {
1540         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
1541         switch(obj->tag) {
1542                 case LDKCOption_PathFailureZ_Some: return 0;
1543                 case LDKCOption_PathFailureZ_None: return 1;
1544                 default: abort();
1545         }
1546 }
1547 uint64_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_Some_get_some"))) TS_LDKCOption_PathFailureZ_Some_get_some(uint64_t ptr) {
1548         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
1549         assert(obj->tag == LDKCOption_PathFailureZ_Some);
1550                         uint64_t some_ref = tag_ptr(&obj->some, false);
1551         return some_ref;
1552 }
1553 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
1554 CHECK(owner->result_ok);
1555         return COption_PathFailureZ_clone(&*owner->contents.result);
1556 }
1557 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok(uint64_t owner) {
1558         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
1559         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
1560         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
1561         uint64_t ret_ref = tag_ptr(ret_copy, true);
1562         return ret_ref;
1563 }
1564
1565 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
1566 CHECK(!owner->result_ok);
1567         return DecodeError_clone(&*owner->contents.err);
1568 }
1569 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_err(uint64_t owner) {
1570         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
1571         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1572         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
1573         uint64_t ret_ref = tag_ptr(ret_copy, true);
1574         return ret_ref;
1575 }
1576
1577 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
1578         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1579         switch(obj->tag) {
1580                 case LDKClosureReason_CounterpartyForceClosed: return 0;
1581                 case LDKClosureReason_HolderForceClosed: return 1;
1582                 case LDKClosureReason_CooperativeClosure: return 2;
1583                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
1584                 case LDKClosureReason_FundingTimedOut: return 4;
1585                 case LDKClosureReason_ProcessingError: return 5;
1586                 case LDKClosureReason_DisconnectedPeer: return 6;
1587                 case LDKClosureReason_OutdatedChannelManager: return 7;
1588                 default: abort();
1589         }
1590 }
1591 jstring __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
1592         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1593         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
1594                         LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1595                         jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1596         return peer_msg_conv;
1597 }
1598 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
1599         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1600         assert(obj->tag == LDKClosureReason_ProcessingError);
1601                         LDKStr err_str = obj->processing_error.err;
1602                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1603         return err_conv;
1604 }
1605 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
1606         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1607         switch(obj->tag) {
1608                 case LDKCOption_ClosureReasonZ_Some: return 0;
1609                 case LDKCOption_ClosureReasonZ_None: return 1;
1610                 default: abort();
1611         }
1612 }
1613 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
1614         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1615         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
1616                         uint64_t some_ref = tag_ptr(&obj->some, false);
1617         return some_ref;
1618 }
1619 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1620 CHECK(owner->result_ok);
1621         return COption_ClosureReasonZ_clone(&*owner->contents.result);
1622 }
1623 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
1624         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1625         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
1626         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
1627         uint64_t ret_ref = tag_ptr(ret_copy, true);
1628         return ret_ref;
1629 }
1630
1631 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1632 CHECK(!owner->result_ok);
1633         return DecodeError_clone(&*owner->contents.err);
1634 }
1635 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
1636         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1637         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1638         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
1639         uint64_t ret_ref = tag_ptr(ret_copy, true);
1640         return ret_ref;
1641 }
1642
1643 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
1644         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1645         switch(obj->tag) {
1646                 case LDKHTLCDestination_NextHopChannel: return 0;
1647                 case LDKHTLCDestination_UnknownNextHop: return 1;
1648                 case LDKHTLCDestination_InvalidForward: return 2;
1649                 case LDKHTLCDestination_FailedPayment: return 3;
1650                 default: abort();
1651         }
1652 }
1653 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
1654         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1655         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1656                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1657                         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
1658         return node_id_arr;
1659 }
1660 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
1661         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1662         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1663                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1664                         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
1665         return channel_id_arr;
1666 }
1667 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
1668         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1669         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
1670                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
1671         return requested_forward_scid_conv;
1672 }
1673 int64_t __attribute__((export_name("TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid"))) TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(uint64_t ptr) {
1674         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1675         assert(obj->tag == LDKHTLCDestination_InvalidForward);
1676                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
1677         return requested_forward_scid_conv;
1678 }
1679 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
1680         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1681         assert(obj->tag == LDKHTLCDestination_FailedPayment);
1682                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1683                         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
1684         return payment_hash_arr;
1685 }
1686 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
1687         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1688         switch(obj->tag) {
1689                 case LDKCOption_HTLCDestinationZ_Some: return 0;
1690                 case LDKCOption_HTLCDestinationZ_None: return 1;
1691                 default: abort();
1692         }
1693 }
1694 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
1695         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1696         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
1697                         uint64_t some_ref = tag_ptr(&obj->some, false);
1698         return some_ref;
1699 }
1700 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1701 CHECK(owner->result_ok);
1702         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
1703 }
1704 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
1705         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1706         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
1707         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
1708         uint64_t ret_ref = tag_ptr(ret_copy, true);
1709         return ret_ref;
1710 }
1711
1712 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1713 CHECK(!owner->result_ok);
1714         return DecodeError_clone(&*owner->contents.err);
1715 }
1716 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
1717         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1718         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1719         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
1720         uint64_t ret_ref = tag_ptr(ret_copy, true);
1721         return ret_ref;
1722 }
1723
1724 uint32_t __attribute__((export_name("TS_LDKCOption_u128Z_ty_from_ptr"))) TS_LDKCOption_u128Z_ty_from_ptr(uint64_t ptr) {
1725         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
1726         switch(obj->tag) {
1727                 case LDKCOption_u128Z_Some: return 0;
1728                 case LDKCOption_u128Z_None: return 1;
1729                 default: abort();
1730         }
1731 }
1732 int8_tArray __attribute__((export_name("TS_LDKCOption_u128Z_Some_get_some"))) TS_LDKCOption_u128Z_Some_get_some(uint64_t ptr) {
1733         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
1734         assert(obj->tag == LDKCOption_u128Z_Some);
1735                         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
1736                         memcpy(some_arr->elems, obj->some.le_bytes, 16);
1737         return some_arr;
1738 }
1739 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1740         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1741         switch(obj->tag) {
1742                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1743                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1744                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1745                 default: abort();
1746         }
1747 }
1748 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1749         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1750         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1751                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1752                         uint64_t outpoint_ref = 0;
1753                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1754                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1755         return outpoint_ref;
1756 }
1757 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1758         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1759         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1760                         LDKTxOut* output_ref = &obj->static_output.output;
1761         return tag_ptr(output_ref, false);
1762 }
1763 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1764         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1765         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1766                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1767                         uint64_t delayed_payment_output_ref = 0;
1768                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1769                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1770         return delayed_payment_output_ref;
1771 }
1772 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1773         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1774         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1775                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1776                         uint64_t static_payment_output_ref = 0;
1777                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1778                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1779         return static_payment_output_ref;
1780 }
1781 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1782         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1783         for (size_t i = 0; i < ret.datalen; i++) {
1784                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1785         }
1786         return ret;
1787 }
1788 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
1789         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1790         switch(obj->tag) {
1791                 case LDKEvent_FundingGenerationReady: return 0;
1792                 case LDKEvent_PaymentClaimable: return 1;
1793                 case LDKEvent_PaymentClaimed: return 2;
1794                 case LDKEvent_PaymentSent: return 3;
1795                 case LDKEvent_PaymentFailed: return 4;
1796                 case LDKEvent_PaymentPathSuccessful: return 5;
1797                 case LDKEvent_PaymentPathFailed: return 6;
1798                 case LDKEvent_ProbeSuccessful: return 7;
1799                 case LDKEvent_ProbeFailed: return 8;
1800                 case LDKEvent_PendingHTLCsForwardable: return 9;
1801                 case LDKEvent_HTLCIntercepted: return 10;
1802                 case LDKEvent_SpendableOutputs: return 11;
1803                 case LDKEvent_PaymentForwarded: return 12;
1804                 case LDKEvent_ChannelReady: return 13;
1805                 case LDKEvent_ChannelClosed: return 14;
1806                 case LDKEvent_DiscardFunding: return 15;
1807                 case LDKEvent_OpenChannelRequest: return 16;
1808                 case LDKEvent_HTLCHandlingFailed: return 17;
1809                 default: abort();
1810         }
1811 }
1812 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
1813         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1814         assert(obj->tag == LDKEvent_FundingGenerationReady);
1815                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1816                         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1817         return temporary_channel_id_arr;
1818 }
1819 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
1820         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1821         assert(obj->tag == LDKEvent_FundingGenerationReady);
1822                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1823                         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
1824         return counterparty_node_id_arr;
1825 }
1826 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
1827         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1828         assert(obj->tag == LDKEvent_FundingGenerationReady);
1829                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
1830         return channel_value_satoshis_conv;
1831 }
1832 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
1833         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1834         assert(obj->tag == LDKEvent_FundingGenerationReady);
1835                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1836                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
1837                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1838         return output_script_arr;
1839 }
1840 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
1841         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1842         assert(obj->tag == LDKEvent_FundingGenerationReady);
1843                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
1844                         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
1845         return user_channel_id_arr;
1846 }
1847 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimable_get_receiver_node_id(uint64_t ptr) {
1848         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1849         assert(obj->tag == LDKEvent_PaymentClaimable);
1850                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
1851                         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
1852         return receiver_node_id_arr;
1853 }
1854 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_payment_hash"))) TS_LDKEvent_PaymentClaimable_get_payment_hash(uint64_t ptr) {
1855         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1856         assert(obj->tag == LDKEvent_PaymentClaimable);
1857                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1858                         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
1859         return payment_hash_arr;
1860 }
1861 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_amount_msat"))) TS_LDKEvent_PaymentClaimable_get_amount_msat(uint64_t ptr) {
1862         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1863         assert(obj->tag == LDKEvent_PaymentClaimable);
1864                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
1865         return amount_msat_conv;
1866 }
1867 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_purpose"))) TS_LDKEvent_PaymentClaimable_get_purpose(uint64_t ptr) {
1868         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1869         assert(obj->tag == LDKEvent_PaymentClaimable);
1870                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
1871         return purpose_ref;
1872 }
1873 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_channel_id(uint64_t ptr) {
1874         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1875         assert(obj->tag == LDKEvent_PaymentClaimable);
1876                         int8_tArray via_channel_id_arr = init_int8_tArray(32, __LINE__);
1877                         memcpy(via_channel_id_arr->elems, obj->payment_claimable.via_channel_id.data, 32);
1878         return via_channel_id_arr;
1879 }
1880 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_user_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_user_channel_id(uint64_t ptr) {
1881         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1882         assert(obj->tag == LDKEvent_PaymentClaimable);
1883                         uint64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
1884         return via_user_channel_id_ref;
1885 }
1886 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimed_get_receiver_node_id(uint64_t ptr) {
1887         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1888         assert(obj->tag == LDKEvent_PaymentClaimed);
1889                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
1890                         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
1891         return receiver_node_id_arr;
1892 }
1893 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
1894         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1895         assert(obj->tag == LDKEvent_PaymentClaimed);
1896                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1897                         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
1898         return payment_hash_arr;
1899 }
1900 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
1901         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1902         assert(obj->tag == LDKEvent_PaymentClaimed);
1903                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
1904         return amount_msat_conv;
1905 }
1906 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
1907         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1908         assert(obj->tag == LDKEvent_PaymentClaimed);
1909                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
1910         return purpose_ref;
1911 }
1912 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
1913         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1914         assert(obj->tag == LDKEvent_PaymentSent);
1915                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1916                         memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1917         return payment_id_arr;
1918 }
1919 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
1920         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1921         assert(obj->tag == LDKEvent_PaymentSent);
1922                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1923                         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1924         return payment_preimage_arr;
1925 }
1926 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
1927         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1928         assert(obj->tag == LDKEvent_PaymentSent);
1929                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1930                         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1931         return payment_hash_arr;
1932 }
1933 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
1934         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1935         assert(obj->tag == LDKEvent_PaymentSent);
1936                         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
1937         return fee_paid_msat_ref;
1938 }
1939 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
1940         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1941         assert(obj->tag == LDKEvent_PaymentFailed);
1942                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1943                         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1944         return payment_id_arr;
1945 }
1946 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
1947         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1948         assert(obj->tag == LDKEvent_PaymentFailed);
1949                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1950                         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1951         return payment_hash_arr;
1952 }
1953 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
1954         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1955         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1956                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1957                         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1958         return payment_id_arr;
1959 }
1960 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
1961         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1962         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1963                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1964                         memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1965         return payment_hash_arr;
1966 }
1967 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
1968         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1969         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1970                         LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1971                         uint64_tArray path_arr = NULL;
1972                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1973                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1974                         for (size_t k = 0; k < path_var.datalen; k++) {
1975                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1976                                 uint64_t path_conv_10_ref = 0;
1977                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1978                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1979                                 path_arr_ptr[k] = path_conv_10_ref;
1980                         }
1981                         
1982         return path_arr;
1983 }
1984 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
1985         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1986         assert(obj->tag == LDKEvent_PaymentPathFailed);
1987                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1988                         memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1989         return payment_id_arr;
1990 }
1991 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
1992         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1993         assert(obj->tag == LDKEvent_PaymentPathFailed);
1994                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1995                         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1996         return payment_hash_arr;
1997 }
1998 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
1999         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2000         assert(obj->tag == LDKEvent_PaymentPathFailed);
2001                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
2002         return payment_failed_permanently_conv;
2003 }
2004 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_failure"))) TS_LDKEvent_PaymentPathFailed_get_failure(uint64_t ptr) {
2005         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2006         assert(obj->tag == LDKEvent_PaymentPathFailed);
2007                         uint64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
2008         return failure_ref;
2009 }
2010 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
2011         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2012         assert(obj->tag == LDKEvent_PaymentPathFailed);
2013                         LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
2014                         uint64_tArray path_arr = NULL;
2015                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
2016                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
2017                         for (size_t k = 0; k < path_var.datalen; k++) {
2018                                 LDKRouteHop path_conv_10_var = path_var.data[k];
2019                                 uint64_t path_conv_10_ref = 0;
2020                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2021                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
2022                                 path_arr_ptr[k] = path_conv_10_ref;
2023                         }
2024                         
2025         return path_arr;
2026 }
2027 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
2028         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2029         assert(obj->tag == LDKEvent_PaymentPathFailed);
2030                         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
2031         return short_channel_id_ref;
2032 }
2033 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_retry"))) TS_LDKEvent_PaymentPathFailed_get_retry(uint64_t ptr) {
2034         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2035         assert(obj->tag == LDKEvent_PaymentPathFailed);
2036                         LDKRouteParameters retry_var = obj->payment_path_failed.retry;
2037                         uint64_t retry_ref = 0;
2038                         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
2039                         retry_ref = tag_ptr(retry_var.inner, false);
2040         return retry_ref;
2041 }
2042 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
2043         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2044         assert(obj->tag == LDKEvent_ProbeSuccessful);
2045                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
2046                         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
2047         return payment_id_arr;
2048 }
2049 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
2050         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2051         assert(obj->tag == LDKEvent_ProbeSuccessful);
2052                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2053                         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
2054         return payment_hash_arr;
2055 }
2056 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
2057         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2058         assert(obj->tag == LDKEvent_ProbeSuccessful);
2059                         LDKCVec_RouteHopZ path_var = obj->probe_successful.path;
2060                         uint64_tArray path_arr = NULL;
2061                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
2062                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
2063                         for (size_t k = 0; k < path_var.datalen; k++) {
2064                                 LDKRouteHop path_conv_10_var = path_var.data[k];
2065                                 uint64_t path_conv_10_ref = 0;
2066                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2067                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
2068                                 path_arr_ptr[k] = path_conv_10_ref;
2069                         }
2070                         
2071         return path_arr;
2072 }
2073 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
2074         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2075         assert(obj->tag == LDKEvent_ProbeFailed);
2076                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
2077                         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
2078         return payment_id_arr;
2079 }
2080 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
2081         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2082         assert(obj->tag == LDKEvent_ProbeFailed);
2083                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2084                         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
2085         return payment_hash_arr;
2086 }
2087 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
2088         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2089         assert(obj->tag == LDKEvent_ProbeFailed);
2090                         LDKCVec_RouteHopZ path_var = obj->probe_failed.path;
2091                         uint64_tArray path_arr = NULL;
2092                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
2093                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
2094                         for (size_t k = 0; k < path_var.datalen; k++) {
2095                                 LDKRouteHop path_conv_10_var = path_var.data[k];
2096                                 uint64_t path_conv_10_ref = 0;
2097                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2098                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
2099                                 path_arr_ptr[k] = path_conv_10_ref;
2100                         }
2101                         
2102         return path_arr;
2103 }
2104 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
2105         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2106         assert(obj->tag == LDKEvent_ProbeFailed);
2107                         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
2108         return short_channel_id_ref;
2109 }
2110 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
2111         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2112         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
2113                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
2114         return time_forwardable_conv;
2115 }
2116 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_intercept_id"))) TS_LDKEvent_HTLCIntercepted_get_intercept_id(uint64_t ptr) {
2117         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2118         assert(obj->tag == LDKEvent_HTLCIntercepted);
2119                         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
2120                         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
2121         return intercept_id_arr;
2122 }
2123 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid"))) TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(uint64_t ptr) {
2124         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2125         assert(obj->tag == LDKEvent_HTLCIntercepted);
2126                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
2127         return requested_next_hop_scid_conv;
2128 }
2129 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_payment_hash"))) TS_LDKEvent_HTLCIntercepted_get_payment_hash(uint64_t ptr) {
2130         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2131         assert(obj->tag == LDKEvent_HTLCIntercepted);
2132                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2133                         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
2134         return payment_hash_arr;
2135 }
2136 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(uint64_t ptr) {
2137         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2138         assert(obj->tag == LDKEvent_HTLCIntercepted);
2139                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
2140         return inbound_amount_msat_conv;
2141 }
2142 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(uint64_t ptr) {
2143         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2144         assert(obj->tag == LDKEvent_HTLCIntercepted);
2145                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
2146         return expected_outbound_amount_msat_conv;
2147 }
2148 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
2149         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2150         assert(obj->tag == LDKEvent_SpendableOutputs);
2151                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
2152                         uint64_tArray outputs_arr = NULL;
2153                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
2154                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
2155                         for (size_t b = 0; b < outputs_var.datalen; b++) {
2156                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
2157                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
2158                         }
2159                         
2160         return outputs_arr;
2161 }
2162 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
2163         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2164         assert(obj->tag == LDKEvent_PaymentForwarded);
2165                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
2166                         memcpy(prev_channel_id_arr->elems, obj->payment_forwarded.prev_channel_id.data, 32);
2167         return prev_channel_id_arr;
2168 }
2169 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
2170         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2171         assert(obj->tag == LDKEvent_PaymentForwarded);
2172                         int8_tArray next_channel_id_arr = init_int8_tArray(32, __LINE__);
2173                         memcpy(next_channel_id_arr->elems, obj->payment_forwarded.next_channel_id.data, 32);
2174         return next_channel_id_arr;
2175 }
2176 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
2177         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2178         assert(obj->tag == LDKEvent_PaymentForwarded);
2179                         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
2180         return fee_earned_msat_ref;
2181 }
2182 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
2183         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2184         assert(obj->tag == LDKEvent_PaymentForwarded);
2185                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
2186         return claim_from_onchain_tx_conv;
2187 }
2188 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_id"))) TS_LDKEvent_ChannelReady_get_channel_id(uint64_t ptr) {
2189         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2190         assert(obj->tag == LDKEvent_ChannelReady);
2191                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2192                         memcpy(channel_id_arr->elems, obj->channel_ready.channel_id.data, 32);
2193         return channel_id_arr;
2194 }
2195 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_user_channel_id"))) TS_LDKEvent_ChannelReady_get_user_channel_id(uint64_t ptr) {
2196         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2197         assert(obj->tag == LDKEvent_ChannelReady);
2198                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
2199                         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
2200         return user_channel_id_arr;
2201 }
2202 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_counterparty_node_id"))) TS_LDKEvent_ChannelReady_get_counterparty_node_id(uint64_t ptr) {
2203         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2204         assert(obj->tag == LDKEvent_ChannelReady);
2205                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
2206                         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
2207         return counterparty_node_id_arr;
2208 }
2209 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_type"))) TS_LDKEvent_ChannelReady_get_channel_type(uint64_t ptr) {
2210         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2211         assert(obj->tag == LDKEvent_ChannelReady);
2212                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
2213                         uint64_t channel_type_ref = 0;
2214                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2215                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2216         return channel_type_ref;
2217 }
2218 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
2219         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2220         assert(obj->tag == LDKEvent_ChannelClosed);
2221                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2222                         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
2223         return channel_id_arr;
2224 }
2225 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
2226         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2227         assert(obj->tag == LDKEvent_ChannelClosed);
2228                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
2229                         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
2230         return user_channel_id_arr;
2231 }
2232 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
2233         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2234         assert(obj->tag == LDKEvent_ChannelClosed);
2235                         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
2236         return reason_ref;
2237 }
2238 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
2239         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2240         assert(obj->tag == LDKEvent_DiscardFunding);
2241                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2242                         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
2243         return channel_id_arr;
2244 }
2245 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
2246         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2247         assert(obj->tag == LDKEvent_DiscardFunding);
2248                         LDKTransaction transaction_var = obj->discard_funding.transaction;
2249                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
2250                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
2251         return transaction_arr;
2252 }
2253 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
2254         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2255         assert(obj->tag == LDKEvent_OpenChannelRequest);
2256                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
2257                         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
2258         return temporary_channel_id_arr;
2259 }
2260 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
2261         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2262         assert(obj->tag == LDKEvent_OpenChannelRequest);
2263                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
2264                         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
2265         return counterparty_node_id_arr;
2266 }
2267 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
2268         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2269         assert(obj->tag == LDKEvent_OpenChannelRequest);
2270                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
2271         return funding_satoshis_conv;
2272 }
2273 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
2274         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2275         assert(obj->tag == LDKEvent_OpenChannelRequest);
2276                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
2277         return push_msat_conv;
2278 }
2279 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
2280         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2281         assert(obj->tag == LDKEvent_OpenChannelRequest);
2282                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
2283                         uint64_t channel_type_ref = 0;
2284                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2285                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2286         return channel_type_ref;
2287 }
2288 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
2289         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2290         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2291                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
2292                         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
2293         return prev_channel_id_arr;
2294 }
2295 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
2296         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2297         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2298                         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
2299         return failed_next_destination_ref;
2300 }
2301 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
2302         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2303         switch(obj->tag) {
2304                 case LDKCOption_EventZ_Some: return 0;
2305                 case LDKCOption_EventZ_None: return 1;
2306                 default: abort();
2307         }
2308 }
2309 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
2310         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2311         assert(obj->tag == LDKCOption_EventZ_Some);
2312                         uint64_t some_ref = tag_ptr(&obj->some, false);
2313         return some_ref;
2314 }
2315 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2316 CHECK(owner->result_ok);
2317         return COption_EventZ_clone(&*owner->contents.result);
2318 }
2319 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
2320         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2321         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2322         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2323         uint64_t ret_ref = tag_ptr(ret_copy, true);
2324         return ret_ref;
2325 }
2326
2327 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2328 CHECK(!owner->result_ok);
2329         return DecodeError_clone(&*owner->contents.err);
2330 }
2331 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
2332         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2333         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2334         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2335         uint64_t ret_ref = tag_ptr(ret_copy, true);
2336         return ret_ref;
2337 }
2338
2339 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
2340         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2341         switch(obj->tag) {
2342                 case LDKErrorAction_DisconnectPeer: return 0;
2343                 case LDKErrorAction_IgnoreError: return 1;
2344                 case LDKErrorAction_IgnoreAndLog: return 2;
2345                 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
2346                 case LDKErrorAction_SendErrorMessage: return 4;
2347                 case LDKErrorAction_SendWarningMessage: return 5;
2348                 default: abort();
2349         }
2350 }
2351 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
2352         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2353         assert(obj->tag == LDKErrorAction_DisconnectPeer);
2354                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2355                         uint64_t msg_ref = 0;
2356                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2357                         msg_ref = tag_ptr(msg_var.inner, false);
2358         return msg_ref;
2359 }
2360 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
2361         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2362         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
2363                         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
2364         return ignore_and_log_conv;
2365 }
2366 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
2367         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2368         assert(obj->tag == LDKErrorAction_SendErrorMessage);
2369                         LDKErrorMessage msg_var = obj->send_error_message.msg;
2370                         uint64_t msg_ref = 0;
2371                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2372                         msg_ref = tag_ptr(msg_var.inner, false);
2373         return msg_ref;
2374 }
2375 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
2376         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2377         assert(obj->tag == LDKErrorAction_SendWarningMessage);
2378                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
2379                         uint64_t msg_ref = 0;
2380                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2381                         msg_ref = tag_ptr(msg_var.inner, false);
2382         return msg_ref;
2383 }
2384 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
2385         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2386         assert(obj->tag == LDKErrorAction_SendWarningMessage);
2387                         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
2388         return log_level_conv;
2389 }
2390 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
2391         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2392         switch(obj->tag) {
2393                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
2394                 case LDKMessageSendEvent_SendOpenChannel: return 1;
2395                 case LDKMessageSendEvent_SendFundingCreated: return 2;
2396                 case LDKMessageSendEvent_SendFundingSigned: return 3;
2397                 case LDKMessageSendEvent_SendChannelReady: return 4;
2398                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
2399                 case LDKMessageSendEvent_UpdateHTLCs: return 6;
2400                 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
2401                 case LDKMessageSendEvent_SendClosingSigned: return 8;
2402                 case LDKMessageSendEvent_SendShutdown: return 9;
2403                 case LDKMessageSendEvent_SendChannelReestablish: return 10;
2404                 case LDKMessageSendEvent_SendChannelAnnouncement: return 11;
2405                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 12;
2406                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
2407                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 14;
2408                 case LDKMessageSendEvent_SendChannelUpdate: return 15;
2409                 case LDKMessageSendEvent_HandleError: return 16;
2410                 case LDKMessageSendEvent_SendChannelRangeQuery: return 17;
2411                 case LDKMessageSendEvent_SendShortIdsQuery: return 18;
2412                 case LDKMessageSendEvent_SendReplyChannelRange: return 19;
2413                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 20;
2414                 default: abort();
2415         }
2416 }
2417 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
2418         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2419         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2420                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2421                         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2422         return node_id_arr;
2423 }
2424 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
2425         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2426         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2427                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2428                         uint64_t msg_ref = 0;
2429                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2430                         msg_ref = tag_ptr(msg_var.inner, false);
2431         return msg_ref;
2432 }
2433 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
2434         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2435         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2436                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2437                         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2438         return node_id_arr;
2439 }
2440 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
2441         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2442         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2443                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
2444                         uint64_t msg_ref = 0;
2445                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2446                         msg_ref = tag_ptr(msg_var.inner, false);
2447         return msg_ref;
2448 }
2449 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
2450         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2451         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2452                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2453                         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2454         return node_id_arr;
2455 }
2456 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
2457         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2458         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2459                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
2460                         uint64_t msg_ref = 0;
2461                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2462                         msg_ref = tag_ptr(msg_var.inner, false);
2463         return msg_ref;
2464 }
2465 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
2466         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2467         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2468                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2469                         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2470         return node_id_arr;
2471 }
2472 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
2473         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2474         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2475                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2476                         uint64_t msg_ref = 0;
2477                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2478                         msg_ref = tag_ptr(msg_var.inner, false);
2479         return msg_ref;
2480 }
2481 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
2482         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2483         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2484                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2485                         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
2486         return node_id_arr;
2487 }
2488 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
2489         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2490         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2491                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
2492                         uint64_t msg_ref = 0;
2493                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2494                         msg_ref = tag_ptr(msg_var.inner, false);
2495         return msg_ref;
2496 }
2497 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
2498         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2499         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2500                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2501                         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2502         return node_id_arr;
2503 }
2504 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
2505         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2506         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2507                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2508                         uint64_t msg_ref = 0;
2509                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2510                         msg_ref = tag_ptr(msg_var.inner, false);
2511         return msg_ref;
2512 }
2513 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
2514         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2515         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2516                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2517                         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
2518         return node_id_arr;
2519 }
2520 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
2521         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2522         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2523                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2524                         uint64_t updates_ref = 0;
2525                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2526                         updates_ref = tag_ptr(updates_var.inner, false);
2527         return updates_ref;
2528 }
2529 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
2530         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2531         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2532                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2533                         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
2534         return node_id_arr;
2535 }
2536 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
2537         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2538         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2539                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2540                         uint64_t msg_ref = 0;
2541                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2542                         msg_ref = tag_ptr(msg_var.inner, false);
2543         return msg_ref;
2544 }
2545 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
2546         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2547         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2548                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2549                         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
2550         return node_id_arr;
2551 }
2552 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
2553         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2554         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2555                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2556                         uint64_t msg_ref = 0;
2557                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2558                         msg_ref = tag_ptr(msg_var.inner, false);
2559         return msg_ref;
2560 }
2561 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
2562         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2563         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2564                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2565                         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
2566         return node_id_arr;
2567 }
2568 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
2569         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2570         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2571                         LDKShutdown msg_var = obj->send_shutdown.msg;
2572                         uint64_t msg_ref = 0;
2573                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2574                         msg_ref = tag_ptr(msg_var.inner, false);
2575         return msg_ref;
2576 }
2577 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
2578         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2579         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2580                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2581                         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
2582         return node_id_arr;
2583 }
2584 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
2585         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2586         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2587                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2588                         uint64_t msg_ref = 0;
2589                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2590                         msg_ref = tag_ptr(msg_var.inner, false);
2591         return msg_ref;
2592 }
2593 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
2594         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2595         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2596                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2597                         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
2598         return node_id_arr;
2599 }
2600 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
2601         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2602         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2603                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
2604                         uint64_t msg_ref = 0;
2605                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2606                         msg_ref = tag_ptr(msg_var.inner, false);
2607         return msg_ref;
2608 }
2609 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
2610         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2611         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2612                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
2613                         uint64_t update_msg_ref = 0;
2614                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2615                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2616         return update_msg_ref;
2617 }
2618 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
2619         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2620         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2621                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2622                         uint64_t msg_ref = 0;
2623                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2624                         msg_ref = tag_ptr(msg_var.inner, false);
2625         return msg_ref;
2626 }
2627 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
2628         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2629         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2630                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2631                         uint64_t update_msg_ref = 0;
2632                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2633                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2634         return update_msg_ref;
2635 }
2636 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
2637         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2638         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
2639                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2640                         uint64_t msg_ref = 0;
2641                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2642                         msg_ref = tag_ptr(msg_var.inner, false);
2643         return msg_ref;
2644 }
2645 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint64_t ptr) {
2646         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2647         assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
2648                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2649                         uint64_t msg_ref = 0;
2650                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2651                         msg_ref = tag_ptr(msg_var.inner, false);
2652         return msg_ref;
2653 }
2654 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
2655         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2656         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2657                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2658                         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
2659         return node_id_arr;
2660 }
2661 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
2662         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2663         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2664                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2665                         uint64_t msg_ref = 0;
2666                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2667                         msg_ref = tag_ptr(msg_var.inner, false);
2668         return msg_ref;
2669 }
2670 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
2671         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2672         assert(obj->tag == LDKMessageSendEvent_HandleError);
2673                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2674                         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
2675         return node_id_arr;
2676 }
2677 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
2678         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2679         assert(obj->tag == LDKMessageSendEvent_HandleError);
2680                         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
2681         return action_ref;
2682 }
2683 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
2684         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2685         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2686                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2687                         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
2688         return node_id_arr;
2689 }
2690 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
2691         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2692         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2693                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2694                         uint64_t msg_ref = 0;
2695                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2696                         msg_ref = tag_ptr(msg_var.inner, false);
2697         return msg_ref;
2698 }
2699 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
2700         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2701         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2702                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2703                         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
2704         return node_id_arr;
2705 }
2706 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
2707         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2708         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2709                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2710                         uint64_t msg_ref = 0;
2711                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2712                         msg_ref = tag_ptr(msg_var.inner, false);
2713         return msg_ref;
2714 }
2715 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
2716         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2717         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2718                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2719                         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
2720         return node_id_arr;
2721 }
2722 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
2723         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2724         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2725                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2726                         uint64_t msg_ref = 0;
2727                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2728                         msg_ref = tag_ptr(msg_var.inner, false);
2729         return msg_ref;
2730 }
2731 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
2732         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2733         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2734                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2735                         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
2736         return node_id_arr;
2737 }
2738 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
2739         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2740         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2741                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
2742                         uint64_t msg_ref = 0;
2743                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2744                         msg_ref = tag_ptr(msg_var.inner, false);
2745         return msg_ref;
2746 }
2747 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2748         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2749         for (size_t i = 0; i < ret.datalen; i++) {
2750                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2751         }
2752         return ret;
2753 }
2754 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2755         return owner->a;
2756 }
2757 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
2758         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2759         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2760         return ret_conv;
2761 }
2762
2763 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2764         return owner->b;
2765 }
2766 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
2767         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2768         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2769         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2770         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2771         return ret_arr;
2772 }
2773
2774 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2775         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2776         for (size_t i = 0; i < ret.datalen; i++) {
2777                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2778         }
2779         return ret;
2780 }
2781 static inline struct LDKThirtyTwoBytes C2Tuple_TxidBlockHashZ_get_a(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR owner){
2782         return ThirtyTwoBytes_clone(&owner->a);
2783 }
2784 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_get_a"))) TS_C2Tuple_TxidBlockHashZ_get_a(uint64_t owner) {
2785         LDKC2Tuple_TxidBlockHashZ* owner_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(owner);
2786         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2787         memcpy(ret_arr->elems, C2Tuple_TxidBlockHashZ_get_a(owner_conv).data, 32);
2788         return ret_arr;
2789 }
2790
2791 static inline struct LDKThirtyTwoBytes C2Tuple_TxidBlockHashZ_get_b(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR owner){
2792         return ThirtyTwoBytes_clone(&owner->b);
2793 }
2794 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_get_b"))) TS_C2Tuple_TxidBlockHashZ_get_b(uint64_t owner) {
2795         LDKC2Tuple_TxidBlockHashZ* owner_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(owner);
2796         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2797         memcpy(ret_arr->elems, C2Tuple_TxidBlockHashZ_get_b(owner_conv).data, 32);
2798         return ret_arr;
2799 }
2800
2801 static inline LDKCVec_C2Tuple_TxidBlockHashZZ CVec_C2Tuple_TxidBlockHashZZ_clone(const LDKCVec_C2Tuple_TxidBlockHashZZ *orig) {
2802         LDKCVec_C2Tuple_TxidBlockHashZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ) * orig->datalen, "LDKCVec_C2Tuple_TxidBlockHashZZ clone bytes"), .datalen = orig->datalen };
2803         for (size_t i = 0; i < ret.datalen; i++) {
2804                 ret.data[i] = C2Tuple_TxidBlockHashZ_clone(&orig->data[i]);
2805         }
2806         return ret;
2807 }
2808 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
2809         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2810         switch(obj->tag) {
2811                 case LDKMonitorEvent_HTLCEvent: return 0;
2812                 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
2813                 case LDKMonitorEvent_Completed: return 2;
2814                 case LDKMonitorEvent_UpdateFailed: return 3;
2815                 default: abort();
2816         }
2817 }
2818 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
2819         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2820         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2821                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2822                         uint64_t htlc_event_ref = 0;
2823                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2824                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
2825         return htlc_event_ref;
2826 }
2827 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint64_t ptr) {
2828         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2829         assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
2830                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
2831                         uint64_t commitment_tx_confirmed_ref = 0;
2832                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
2833                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
2834         return commitment_tx_confirmed_ref;
2835 }
2836 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
2837         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2838         assert(obj->tag == LDKMonitorEvent_Completed);
2839                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
2840                         uint64_t funding_txo_ref = 0;
2841                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2842                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
2843         return funding_txo_ref;
2844 }
2845 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
2846         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2847         assert(obj->tag == LDKMonitorEvent_Completed);
2848                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
2849         return monitor_update_id_conv;
2850 }
2851 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint64_t ptr) {
2852         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2853         assert(obj->tag == LDKMonitorEvent_UpdateFailed);
2854                         LDKOutPoint update_failed_var = obj->update_failed;
2855                         uint64_t update_failed_ref = 0;
2856                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
2857                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
2858         return update_failed_ref;
2859 }
2860 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2861         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2862         for (size_t i = 0; i < ret.datalen; i++) {
2863                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2864         }
2865         return ret;
2866 }
2867 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2868         LDKOutPoint ret = owner->a;
2869         ret.is_owned = false;
2870         return ret;
2871 }
2872 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
2873         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2874         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
2875         uint64_t ret_ref = 0;
2876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2878         return ret_ref;
2879 }
2880
2881 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2882         return CVec_MonitorEventZ_clone(&owner->b);
2883 }
2884 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
2885         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2886         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
2887         uint64_tArray ret_arr = NULL;
2888         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2889         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2890         for (size_t o = 0; o < ret_var.datalen; o++) {
2891                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2892                 *ret_conv_14_copy = ret_var.data[o];
2893                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
2894                 ret_arr_ptr[o] = ret_conv_14_ref;
2895         }
2896         
2897         FREE(ret_var.data);
2898         return ret_arr;
2899 }
2900
2901 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2902         return owner->c;
2903 }
2904 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
2905         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2906         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
2907         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
2908         return ret_arr;
2909 }
2910
2911 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
2912         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
2913         for (size_t i = 0; i < ret.datalen; i++) {
2914                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
2915         }
2916         return ret;
2917 }
2918 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2919         LDKFixedPenaltyScorer ret = *owner->contents.result;
2920         ret.is_owned = false;
2921         return ret;
2922 }
2923 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2924         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2925         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2926         uint64_t ret_ref = 0;
2927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2929         return ret_ref;
2930 }
2931
2932 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2933 CHECK(!owner->result_ok);
2934         return DecodeError_clone(&*owner->contents.err);
2935 }
2936 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2937         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2938         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2939         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2940         uint64_t ret_ref = tag_ptr(ret_copy, true);
2941         return ret_ref;
2942 }
2943
2944 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2945         return owner->a;
2946 }
2947 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2948         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2949         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2950         return ret_conv;
2951 }
2952
2953 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2954         return owner->b;
2955 }
2956 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2957         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2958         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2959         return ret_conv;
2960 }
2961
2962 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2963         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2964         switch(obj->tag) {
2965                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2966                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2967                 default: abort();
2968         }
2969 }
2970 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2971         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2972         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2973                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2974                         *some_conv = obj->some;
2975                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2976         return tag_ptr(some_conv, true);
2977 }
2978 static inline struct LDKEightU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
2979         return owner->a;
2980 }
2981 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_a"))) TS_C2Tuple_Z_get_a(uint64_t owner) {
2982         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2983         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
2984         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 8 * 2);
2985         return ret_arr;
2986 }
2987
2988 static inline struct LDKEightU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
2989         return owner->b;
2990 }
2991 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_b"))) TS_C2Tuple_Z_get_b(uint64_t owner) {
2992         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2993         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
2994         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 8 * 2);
2995         return ret_arr;
2996 }
2997
2998 static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_a(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){
2999         return owner->a;
3000 }
3001 int16_tArray  __attribute__((export_name("TS_C2Tuple__u168_u168Z_get_a"))) TS_C2Tuple__u168_u168Z_get_a(uint64_t owner) {
3002         LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner);
3003         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
3004         memcpy(ret_arr->elems, C2Tuple__u168_u168Z_get_a(owner_conv).data, 8 * 2);
3005         return ret_arr;
3006 }
3007
3008 static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_b(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){
3009         return owner->b;
3010 }
3011 int16_tArray  __attribute__((export_name("TS_C2Tuple__u168_u168Z_get_b"))) TS_C2Tuple__u168_u168Z_get_b(uint64_t owner) {
3012         LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner);
3013         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
3014         memcpy(ret_arr->elems, C2Tuple__u168_u168Z_get_b(owner_conv).data, 8 * 2);
3015         return ret_arr;
3016 }
3017
3018 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_ty_from_ptr(uint64_t ptr) {
3019         LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr);
3020         switch(obj->tag) {
3021                 case LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some: return 0;
3022                 case LDKCOption_C2Tuple_EightU16sEightU16sZZ_None: return 1;
3023                 default: abort();
3024         }
3025 }
3026 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_get_some(uint64_t ptr) {
3027         LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr);
3028         assert(obj->tag == LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some);
3029                         LDKC2Tuple__u168_u168Z* some_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
3030                         *some_conv = obj->some;
3031                         *some_conv = C2Tuple__u168_u168Z_clone(some_conv);
3032         return tag_ptr(some_conv, true);
3033 }
3034 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
3035         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
3036         for (size_t i = 0; i < ret.datalen; i++) {
3037                 ret.data[i] = NodeId_clone(&orig->data[i]);
3038         }
3039         return ret;
3040 }
3041 typedef struct LDKLogger_JCalls {
3042         atomic_size_t refcnt;
3043         uint32_t instance_ptr;
3044 } LDKLogger_JCalls;
3045 static void LDKLogger_JCalls_free(void* this_arg) {
3046         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3047         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3048                 FREE(j_calls);
3049         }
3050 }
3051 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
3052         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3053         LDKRecord record_var = *record;
3054         uint64_t record_ref = 0;
3055         record_var = Record_clone(&record_var);
3056         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3057         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
3058         js_invoke_function_buuuuu(j_calls->instance_ptr, 0, record_ref, 0, 0, 0, 0, 0);
3059 }
3060 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3061         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3062         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3063 }
3064 static inline LDKLogger LDKLogger_init (JSValue o) {
3065         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3066         atomic_init(&calls->refcnt, 1);
3067         calls->instance_ptr = o;
3068
3069         LDKLogger ret = {
3070                 .this_arg = (void*) calls,
3071                 .log = log_LDKLogger_jcall,
3072                 .free = LDKLogger_JCalls_free,
3073         };
3074         return ret;
3075 }
3076 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
3077         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3078         *res_ptr = LDKLogger_init(o);
3079         return tag_ptr(res_ptr, true);
3080 }
3081 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3082         LDKProbabilisticScorer ret = *owner->contents.result;
3083         ret.is_owned = false;
3084         return ret;
3085 }
3086 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
3087         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3088         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3089         uint64_t ret_ref = 0;
3090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3092         return ret_ref;
3093 }
3094
3095 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3096 CHECK(!owner->result_ok);
3097         return DecodeError_clone(&*owner->contents.err);
3098 }
3099 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
3100         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3101         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3102         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3103         uint64_t ret_ref = tag_ptr(ret_copy, true);
3104         return ret_ref;
3105 }
3106
3107 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3108         LDKInitFeatures ret = *owner->contents.result;
3109         ret.is_owned = false;
3110         return ret;
3111 }
3112 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3113         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3114         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3115         uint64_t ret_ref = 0;
3116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3118         return ret_ref;
3119 }
3120
3121 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3122 CHECK(!owner->result_ok);
3123         return DecodeError_clone(&*owner->contents.err);
3124 }
3125 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3126         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3127         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3128         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3129         uint64_t ret_ref = tag_ptr(ret_copy, true);
3130         return ret_ref;
3131 }
3132
3133 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3134         LDKChannelFeatures ret = *owner->contents.result;
3135         ret.is_owned = false;
3136         return ret;
3137 }
3138 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3139         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3140         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3141         uint64_t ret_ref = 0;
3142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3144         return ret_ref;
3145 }
3146
3147 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3148 CHECK(!owner->result_ok);
3149         return DecodeError_clone(&*owner->contents.err);
3150 }
3151 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3152         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3153         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3154         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3155         uint64_t ret_ref = tag_ptr(ret_copy, true);
3156         return ret_ref;
3157 }
3158
3159 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3160         LDKNodeFeatures ret = *owner->contents.result;
3161         ret.is_owned = false;
3162         return ret;
3163 }
3164 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3165         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3166         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3167         uint64_t ret_ref = 0;
3168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3170         return ret_ref;
3171 }
3172
3173 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3174 CHECK(!owner->result_ok);
3175         return DecodeError_clone(&*owner->contents.err);
3176 }
3177 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3178         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3179         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3180         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3181         uint64_t ret_ref = tag_ptr(ret_copy, true);
3182         return ret_ref;
3183 }
3184
3185 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3186         LDKInvoiceFeatures ret = *owner->contents.result;
3187         ret.is_owned = false;
3188         return ret;
3189 }
3190 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3191         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3192         LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3193         uint64_t ret_ref = 0;
3194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3196         return ret_ref;
3197 }
3198
3199 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3200 CHECK(!owner->result_ok);
3201         return DecodeError_clone(&*owner->contents.err);
3202 }
3203 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3204         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3205         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3206         *ret_copy = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3207         uint64_t ret_ref = tag_ptr(ret_copy, true);
3208         return ret_ref;
3209 }
3210
3211 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3212         LDKBlindedHopFeatures ret = *owner->contents.result;
3213         ret.is_owned = false;
3214         return ret;
3215 }
3216 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3217         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3218         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
3219         uint64_t ret_ref = 0;
3220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3222         return ret_ref;
3223 }
3224
3225 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3226 CHECK(!owner->result_ok);
3227         return DecodeError_clone(&*owner->contents.err);
3228 }
3229 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3230         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3231         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3232         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
3233         uint64_t ret_ref = tag_ptr(ret_copy, true);
3234         return ret_ref;
3235 }
3236
3237 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3238         LDKChannelTypeFeatures ret = *owner->contents.result;
3239         ret.is_owned = false;
3240         return ret;
3241 }
3242 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3243         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3244         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3245         uint64_t ret_ref = 0;
3246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3248         return ret_ref;
3249 }
3250
3251 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3252 CHECK(!owner->result_ok);
3253         return DecodeError_clone(&*owner->contents.err);
3254 }
3255 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3256         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3257         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3258         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3259         uint64_t ret_ref = tag_ptr(ret_copy, true);
3260         return ret_ref;
3261 }
3262
3263 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3264         LDKNodeId ret = *owner->contents.result;
3265         ret.is_owned = false;
3266         return ret;
3267 }
3268 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
3269         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3270         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3271         uint64_t ret_ref = 0;
3272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3274         return ret_ref;
3275 }
3276
3277 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3278 CHECK(!owner->result_ok);
3279         return DecodeError_clone(&*owner->contents.err);
3280 }
3281 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
3282         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3283         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3284         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3285         uint64_t ret_ref = tag_ptr(ret_copy, true);
3286         return ret_ref;
3287 }
3288
3289 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3290 CHECK(owner->result_ok);
3291         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3292 }
3293 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
3294         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3295         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3296         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3297         uint64_t ret_ref = tag_ptr(ret_copy, true);
3298         return ret_ref;
3299 }
3300
3301 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3302 CHECK(!owner->result_ok);
3303         return DecodeError_clone(&*owner->contents.err);
3304 }
3305 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
3306         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3307         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3308         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3309         uint64_t ret_ref = tag_ptr(ret_copy, true);
3310         return ret_ref;
3311 }
3312
3313 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3314 CHECK(owner->result_ok);
3315         return TxOut_clone(&*owner->contents.result);
3316 }
3317 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_get_ok(uint64_t owner) {
3318         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3319         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3320         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
3321         return tag_ptr(ret_ref, true);
3322 }
3323
3324 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3325 CHECK(!owner->result_ok);
3326         return UtxoLookupError_clone(&*owner->contents.err);
3327 }
3328 uint32_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_err"))) TS_CResult_TxOutUtxoLookupErrorZ_get_err(uint64_t owner) {
3329         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3330         uint32_t ret_conv = LDKUtxoLookupError_to_js(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
3331         return ret_conv;
3332 }
3333
3334 uint32_t __attribute__((export_name("TS_LDKUtxoResult_ty_from_ptr"))) TS_LDKUtxoResult_ty_from_ptr(uint64_t ptr) {
3335         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3336         switch(obj->tag) {
3337                 case LDKUtxoResult_Sync: return 0;
3338                 case LDKUtxoResult_Async: return 1;
3339                 default: abort();
3340         }
3341 }
3342 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Sync_get_sync"))) TS_LDKUtxoResult_Sync_get_sync(uint64_t ptr) {
3343         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3344         assert(obj->tag == LDKUtxoResult_Sync);
3345                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
3346                         *sync_conv = obj->sync;
3347                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
3348         return tag_ptr(sync_conv, true);
3349 }
3350 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Async_get_async"))) TS_LDKUtxoResult_Async_get_async(uint64_t ptr) {
3351         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3352         assert(obj->tag == LDKUtxoResult_Async);
3353                         LDKUtxoFuture async_var = obj->async;
3354                         uint64_t async_ref = 0;
3355                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
3356                         async_ref = tag_ptr(async_var.inner, false);
3357         return async_ref;
3358 }
3359 typedef struct LDKUtxoLookup_JCalls {
3360         atomic_size_t refcnt;
3361         uint32_t instance_ptr;
3362 } LDKUtxoLookup_JCalls;
3363 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
3364         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3365         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3366                 FREE(j_calls);
3367         }
3368 }
3369 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3370         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3371         int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
3372         memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
3373         int64_t short_channel_id_conv = short_channel_id;
3374         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 1, (uint32_t)genesis_hash_arr, short_channel_id_conv, 0, 0, 0, 0);
3375         void* ret_ptr = untag_ptr(ret);
3376         CHECK_ACCESS(ret_ptr);
3377         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
3378         FREE(untag_ptr(ret));
3379         return ret_conv;
3380 }
3381 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
3382         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
3383         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3384 }
3385 static inline LDKUtxoLookup LDKUtxoLookup_init (JSValue o) {
3386         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
3387         atomic_init(&calls->refcnt, 1);
3388         calls->instance_ptr = o;
3389
3390         LDKUtxoLookup ret = {
3391                 .this_arg = (void*) calls,
3392                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
3393                 .free = LDKUtxoLookup_JCalls_free,
3394         };
3395         return ret;
3396 }
3397 uint64_t  __attribute__((export_name("TS_LDKUtxoLookup_new"))) TS_LDKUtxoLookup_new(JSValue o) {
3398         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3399         *res_ptr = LDKUtxoLookup_init(o);
3400         return tag_ptr(res_ptr, true);
3401 }
3402 uint64_t  __attribute__((export_name("TS_UtxoLookup_get_utxo"))) TS_UtxoLookup_get_utxo(uint64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
3403         void* this_arg_ptr = untag_ptr(this_arg);
3404         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3405         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
3406         uint8_t genesis_hash_arr[32];
3407         CHECK(genesis_hash->arr_len == 32);
3408         memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
3409         uint8_t (*genesis_hash_ref)[32] = &genesis_hash_arr;
3410         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
3411         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3412         uint64_t ret_ref = tag_ptr(ret_copy, true);
3413         return ret_ref;
3414 }
3415
3416 uint32_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_ty_from_ptr"))) TS_LDKCOption_UtxoLookupZ_ty_from_ptr(uint64_t ptr) {
3417         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3418         switch(obj->tag) {
3419                 case LDKCOption_UtxoLookupZ_Some: return 0;
3420                 case LDKCOption_UtxoLookupZ_None: return 1;
3421                 default: abort();
3422         }
3423 }
3424 uint64_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_Some_get_some"))) TS_LDKCOption_UtxoLookupZ_Some_get_some(uint64_t ptr) {
3425         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3426         assert(obj->tag == LDKCOption_UtxoLookupZ_Some);
3427                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3428                         *some_ret = obj->some;
3429                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3430                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
3431                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3432                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
3433                         }
3434         return tag_ptr(some_ret, true);
3435 }
3436 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3437 CHECK(owner->result_ok);
3438         return *owner->contents.result;
3439 }
3440 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
3441         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3442         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3443         return ret_conv;
3444 }
3445
3446 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3447         LDKLightningError ret = *owner->contents.err;
3448         ret.is_owned = false;
3449         return ret;
3450 }
3451 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
3452         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3453         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3454         uint64_t ret_ref = 0;
3455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3457         return ret_ref;
3458 }
3459
3460 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3461         LDKChannelAnnouncement ret = owner->a;
3462         ret.is_owned = false;
3463         return ret;
3464 }
3465 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
3466         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3467         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3468         uint64_t ret_ref = 0;
3469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3471         return ret_ref;
3472 }
3473
3474 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3475         LDKChannelUpdate ret = owner->b;
3476         ret.is_owned = false;
3477         return ret;
3478 }
3479 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
3480         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3481         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3482         uint64_t ret_ref = 0;
3483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3485         return ret_ref;
3486 }
3487
3488 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3489         LDKChannelUpdate ret = owner->c;
3490         ret.is_owned = false;
3491         return ret;
3492 }
3493 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
3494         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3495         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3496         uint64_t ret_ref = 0;
3497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3499         return ret_ref;
3500 }
3501
3502 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
3503         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3504         switch(obj->tag) {
3505                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
3506                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
3507                 default: abort();
3508         }
3509 }
3510 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
3511         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3512         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
3513                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3514                         *some_conv = obj->some;
3515                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
3516         return tag_ptr(some_conv, true);
3517 }
3518 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3519 CHECK(owner->result_ok);
3520         return *owner->contents.result;
3521 }
3522 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3523         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3524         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3525 }
3526
3527 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3528         LDKLightningError ret = *owner->contents.err;
3529         ret.is_owned = false;
3530         return ret;
3531 }
3532 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3533         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3534         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3535         uint64_t ret_ref = 0;
3536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3538         return ret_ref;
3539 }
3540
3541 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3542         LDKChannelUpdateInfo ret = *owner->contents.result;
3543         ret.is_owned = false;
3544         return ret;
3545 }
3546 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
3547         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3548         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3549         uint64_t ret_ref = 0;
3550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3552         return ret_ref;
3553 }
3554
3555 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3556 CHECK(!owner->result_ok);
3557         return DecodeError_clone(&*owner->contents.err);
3558 }
3559 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
3560         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3561         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3562         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3563         uint64_t ret_ref = tag_ptr(ret_copy, true);
3564         return ret_ref;
3565 }
3566
3567 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3568         LDKChannelInfo ret = *owner->contents.result;
3569         ret.is_owned = false;
3570         return ret;
3571 }
3572 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
3573         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3574         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3575         uint64_t ret_ref = 0;
3576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3578         return ret_ref;
3579 }
3580
3581 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3582 CHECK(!owner->result_ok);
3583         return DecodeError_clone(&*owner->contents.err);
3584 }
3585 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
3586         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3587         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3588         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3589         uint64_t ret_ref = tag_ptr(ret_copy, true);
3590         return ret_ref;
3591 }
3592
3593 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3594         LDKRoutingFees ret = *owner->contents.result;
3595         ret.is_owned = false;
3596         return ret;
3597 }
3598 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
3599         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3600         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3601         uint64_t ret_ref = 0;
3602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3604         return ret_ref;
3605 }
3606
3607 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3608 CHECK(!owner->result_ok);
3609         return DecodeError_clone(&*owner->contents.err);
3610 }
3611 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
3612         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3613         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3614         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3615         uint64_t ret_ref = tag_ptr(ret_copy, true);
3616         return ret_ref;
3617 }
3618
3619 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint64_t ptr) {
3620         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3621         switch(obj->tag) {
3622                 case LDKNetAddress_IPv4: return 0;
3623                 case LDKNetAddress_IPv6: return 1;
3624                 case LDKNetAddress_OnionV2: return 2;
3625                 case LDKNetAddress_OnionV3: return 3;
3626                 case LDKNetAddress_Hostname: return 4;
3627                 default: abort();
3628         }
3629 }
3630 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint64_t ptr) {
3631         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3632         assert(obj->tag == LDKNetAddress_IPv4);
3633                         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
3634                         memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3635         return addr_arr;
3636 }
3637 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint64_t ptr) {
3638         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3639         assert(obj->tag == LDKNetAddress_IPv4);
3640                         int16_t port_conv = obj->i_pv4.port;
3641         return port_conv;
3642 }
3643 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint64_t ptr) {
3644         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3645         assert(obj->tag == LDKNetAddress_IPv6);
3646                         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
3647                         memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3648         return addr_arr;
3649 }
3650 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint64_t ptr) {
3651         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3652         assert(obj->tag == LDKNetAddress_IPv6);
3653                         int16_t port_conv = obj->i_pv6.port;
3654         return port_conv;
3655 }
3656 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint64_t ptr) {
3657         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3658         assert(obj->tag == LDKNetAddress_OnionV2);
3659                         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
3660                         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3661         return onion_v2_arr;
3662 }
3663 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
3664         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3665         assert(obj->tag == LDKNetAddress_OnionV3);
3666                         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
3667                         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3668         return ed25519_pubkey_arr;
3669 }
3670 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint64_t ptr) {
3671         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3672         assert(obj->tag == LDKNetAddress_OnionV3);
3673                         int16_t checksum_conv = obj->onion_v3.checksum;
3674         return checksum_conv;
3675 }
3676 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint64_t ptr) {
3677         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3678         assert(obj->tag == LDKNetAddress_OnionV3);
3679                         int8_t version_conv = obj->onion_v3.version;
3680         return version_conv;
3681 }
3682 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint64_t ptr) {
3683         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3684         assert(obj->tag == LDKNetAddress_OnionV3);
3685                         int16_t port_conv = obj->onion_v3.port;
3686         return port_conv;
3687 }
3688 uint64_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_hostname"))) TS_LDKNetAddress_Hostname_get_hostname(uint64_t ptr) {
3689         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3690         assert(obj->tag == LDKNetAddress_Hostname);
3691                         LDKHostname hostname_var = obj->hostname.hostname;
3692                         uint64_t hostname_ref = 0;
3693                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
3694                         hostname_ref = tag_ptr(hostname_var.inner, false);
3695         return hostname_ref;
3696 }
3697 int16_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_port"))) TS_LDKNetAddress_Hostname_get_port(uint64_t ptr) {
3698         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3699         assert(obj->tag == LDKNetAddress_Hostname);
3700                         int16_t port_conv = obj->hostname.port;
3701         return port_conv;
3702 }
3703 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3704         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3705         for (size_t i = 0; i < ret.datalen; i++) {
3706                 ret.data[i] = NetAddress_clone(&orig->data[i]);
3707         }
3708         return ret;
3709 }
3710 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3711         LDKNodeAnnouncementInfo ret = *owner->contents.result;
3712         ret.is_owned = false;
3713         return ret;
3714 }
3715 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
3716         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3717         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3718         uint64_t ret_ref = 0;
3719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3721         return ret_ref;
3722 }
3723
3724 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3725 CHECK(!owner->result_ok);
3726         return DecodeError_clone(&*owner->contents.err);
3727 }
3728 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
3729         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3730         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3731         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3732         uint64_t ret_ref = tag_ptr(ret_copy, true);
3733         return ret_ref;
3734 }
3735
3736 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3737         LDKNodeAlias ret = *owner->contents.result;
3738         ret.is_owned = false;
3739         return ret;
3740 }
3741 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
3742         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3743         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
3744         uint64_t ret_ref = 0;
3745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3747         return ret_ref;
3748 }
3749
3750 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3751 CHECK(!owner->result_ok);
3752         return DecodeError_clone(&*owner->contents.err);
3753 }
3754 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
3755         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3756         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3757         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
3758         uint64_t ret_ref = tag_ptr(ret_copy, true);
3759         return ret_ref;
3760 }
3761
3762 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3763         LDKNodeInfo ret = *owner->contents.result;
3764         ret.is_owned = false;
3765         return ret;
3766 }
3767 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
3768         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3769         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3770         uint64_t ret_ref = 0;
3771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3773         return ret_ref;
3774 }
3775
3776 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3777 CHECK(!owner->result_ok);
3778         return DecodeError_clone(&*owner->contents.err);
3779 }
3780 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
3781         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3782         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3783         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3784         uint64_t ret_ref = tag_ptr(ret_copy, true);
3785         return ret_ref;
3786 }
3787
3788 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3789         LDKNetworkGraph ret = *owner->contents.result;
3790         ret.is_owned = false;
3791         return ret;
3792 }
3793 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
3794         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3795         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3796         uint64_t ret_ref = 0;
3797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3799         return ret_ref;
3800 }
3801
3802 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3803 CHECK(!owner->result_ok);
3804         return DecodeError_clone(&*owner->contents.err);
3805 }
3806 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
3807         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3808         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3809         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
3810         uint64_t ret_ref = tag_ptr(ret_copy, true);
3811         return ret_ref;
3812 }
3813
3814 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint64_t ptr) {
3815         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3816         switch(obj->tag) {
3817                 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
3818                 case LDKCOption_CVec_NetAddressZZ_None: return 1;
3819                 default: abort();
3820         }
3821 }
3822 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint64_t ptr) {
3823         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3824         assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
3825                         LDKCVec_NetAddressZ some_var = obj->some;
3826                         uint64_tArray some_arr = NULL;
3827                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
3828                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
3829                         for (size_t m = 0; m < some_var.datalen; m++) {
3830                                 uint64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
3831                                 some_arr_ptr[m] = some_conv_12_ref;
3832                         }
3833                         
3834         return some_arr;
3835 }
3836 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3837         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
3838         ret.is_owned = false;
3839         return ret;
3840 }
3841 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3842         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3843         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3844         uint64_t ret_ref = 0;
3845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3847         return ret_ref;
3848 }
3849
3850 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3851 CHECK(!owner->result_ok);
3852         return DecodeError_clone(&*owner->contents.err);
3853 }
3854 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3855         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3856         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3857         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3858         uint64_t ret_ref = tag_ptr(ret_copy, true);
3859         return ret_ref;
3860 }
3861
3862 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3863         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
3864         ret.is_owned = false;
3865         return ret;
3866 }
3867 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3868         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3869         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3870         uint64_t ret_ref = 0;
3871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3873         return ret_ref;
3874 }
3875
3876 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3877 CHECK(!owner->result_ok);
3878         return DecodeError_clone(&*owner->contents.err);
3879 }
3880 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3881         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3882         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3883         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3884         uint64_t ret_ref = tag_ptr(ret_copy, true);
3885         return ret_ref;
3886 }
3887
3888 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3889 CHECK(owner->result_ok);
3890         return SpendableOutputDescriptor_clone(&*owner->contents.result);
3891 }
3892 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3893         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3894         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3895         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3896         uint64_t ret_ref = tag_ptr(ret_copy, true);
3897         return ret_ref;
3898 }
3899
3900 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3901 CHECK(!owner->result_ok);
3902         return DecodeError_clone(&*owner->contents.err);
3903 }
3904 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3905         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3906         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3907         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3908         uint64_t ret_ref = tag_ptr(ret_copy, true);
3909         return ret_ref;
3910 }
3911
3912 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
3913         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
3914         for (size_t i = 0; i < ret.datalen; i++) {
3915                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3916         }
3917         return ret;
3918 }
3919 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3920         return owner->a;
3921 }
3922 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint64_t owner) {
3923         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3924         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3925         memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
3926         return ret_arr;
3927 }
3928
3929 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3930         return owner->b;
3931 }
3932 ptrArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint64_t owner) {
3933         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3934         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3935         ptrArray ret_arr = NULL;
3936         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
3937         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
3938         for (size_t m = 0; m < ret_var.datalen; m++) {
3939                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
3940                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
3941                 ret_arr_ptr[m] = ret_conv_12_arr;
3942         }
3943         
3944         return ret_arr;
3945 }
3946
3947 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3948 CHECK(owner->result_ok);
3949         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3950 }
3951 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint64_t owner) {
3952         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3953         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3954         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3955         return tag_ptr(ret_conv, true);
3956 }
3957
3958 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3959 CHECK(!owner->result_ok);
3960         return *owner->contents.err;
3961 }
3962 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint64_t owner) {
3963         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3964         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3965 }
3966
3967 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3968 CHECK(owner->result_ok);
3969         return *owner->contents.result;
3970 }
3971 int8_tArray  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint64_t owner) {
3972         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3973         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3974         memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
3975         return ret_arr;
3976 }
3977
3978 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3979 CHECK(!owner->result_ok);
3980         return *owner->contents.err;
3981 }
3982 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint64_t owner) {
3983         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3984         CResult_SignatureNoneZ_get_err(owner_conv);
3985 }
3986
3987 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
3988 CHECK(owner->result_ok);
3989         return *owner->contents.result;
3990 }
3991 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
3992         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
3993         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3994         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
3995         return ret_arr;
3996 }
3997
3998 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
3999 CHECK(!owner->result_ok);
4000         return *owner->contents.err;
4001 }
4002 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
4003         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
4004         CResult_PublicKeyNoneZ_get_err(owner_conv);
4005 }
4006
4007 uint32_t __attribute__((export_name("TS_LDKCOption_ScalarZ_ty_from_ptr"))) TS_LDKCOption_ScalarZ_ty_from_ptr(uint64_t ptr) {
4008         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
4009         switch(obj->tag) {
4010                 case LDKCOption_ScalarZ_Some: return 0;
4011                 case LDKCOption_ScalarZ_None: return 1;
4012                 default: abort();
4013         }
4014 }
4015 uint64_t __attribute__((export_name("TS_LDKCOption_ScalarZ_Some_get_some"))) TS_LDKCOption_ScalarZ_Some_get_some(uint64_t ptr) {
4016         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
4017         assert(obj->tag == LDKCOption_ScalarZ_Some);
4018                         LDKBigEndianScalar* some_ref = &obj->some;
4019         return tag_ptr(some_ref, false);
4020 }
4021 static inline struct LDKThirtyTwoBytes CResult_SharedSecretNoneZ_get_ok(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
4022 CHECK(owner->result_ok);
4023         return ThirtyTwoBytes_clone(&*owner->contents.result);
4024 }
4025 int8_tArray  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_ok"))) TS_CResult_SharedSecretNoneZ_get_ok(uint64_t owner) {
4026         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
4027         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4028         memcpy(ret_arr->elems, CResult_SharedSecretNoneZ_get_ok(owner_conv).data, 32);
4029         return ret_arr;
4030 }
4031
4032 static inline void CResult_SharedSecretNoneZ_get_err(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
4033 CHECK(!owner->result_ok);
4034         return *owner->contents.err;
4035 }
4036 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_err"))) TS_CResult_SharedSecretNoneZ_get_err(uint64_t owner) {
4037         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
4038         CResult_SharedSecretNoneZ_get_err(owner_conv);
4039 }
4040
4041 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4042 CHECK(owner->result_ok);
4043         return *owner->contents.result;
4044 }
4045 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
4046         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4047         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
4048         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
4049         return ret_arr;
4050 }
4051
4052 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4053 CHECK(!owner->result_ok);
4054         return *owner->contents.err;
4055 }
4056 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
4057         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4058         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4059 }
4060
4061 typedef struct LDKChannelSigner_JCalls {
4062         atomic_size_t refcnt;
4063         uint32_t instance_ptr;
4064 } LDKChannelSigner_JCalls;
4065 static void LDKChannelSigner_JCalls_free(void* this_arg) {
4066         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4067         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4068                 FREE(j_calls);
4069         }
4070 }
4071 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
4072         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4073         int64_t idx_conv = idx;
4074         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 2, idx_conv, 0, 0, 0, 0, 0);
4075         LDKPublicKey ret_ref;
4076         CHECK(ret->arr_len == 33);
4077         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
4078         return ret_ref;
4079 }
4080 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
4081         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4082         int64_t idx_conv = idx;
4083         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 3, idx_conv, 0, 0, 0, 0, 0);
4084         LDKThirtyTwoBytes ret_ref;
4085         CHECK(ret->arr_len == 32);
4086         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
4087         return ret_ref;
4088 }
4089 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
4090         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4091         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
4092         uint64_t holder_tx_ref = 0;
4093         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
4094         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
4095         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
4096         LDKCVec_PaymentPreimageZ preimages_var = preimages;
4097         ptrArray preimages_arr = NULL;
4098         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
4099         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
4100         for (size_t m = 0; m < preimages_var.datalen; m++) {
4101                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
4102                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
4103                 preimages_arr_ptr[m] = preimages_conv_12_arr;
4104         }
4105         
4106         FREE(preimages_var.data);
4107         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 4, holder_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
4108         void* ret_ptr = untag_ptr(ret);
4109         CHECK_ACCESS(ret_ptr);
4110         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4111         FREE(untag_ptr(ret));
4112         return ret_conv;
4113 }
4114 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
4115         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4116         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 5, 0, 0, 0, 0, 0, 0);
4117         LDKThirtyTwoBytes ret_ref;
4118         CHECK(ret->arr_len == 32);
4119         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
4120         return ret_ref;
4121 }
4122 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
4123         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4124         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
4125         uint64_t channel_parameters_ref = 0;
4126         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
4127         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
4128         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
4129         js_invoke_function_buuuuu(j_calls->instance_ptr, 6, channel_parameters_ref, 0, 0, 0, 0, 0);
4130 }
4131 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
4132         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
4133         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4134 }
4135 static inline LDKChannelSigner LDKChannelSigner_init (JSValue o, uint64_t pubkeys) {
4136         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
4137         atomic_init(&calls->refcnt, 1);
4138         calls->instance_ptr = o;
4139
4140         LDKChannelPublicKeys pubkeys_conv;
4141         pubkeys_conv.inner = untag_ptr(pubkeys);
4142         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4143         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4144
4145         LDKChannelSigner ret = {
4146                 .this_arg = (void*) calls,
4147                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
4148                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
4149                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
4150                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
4151                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
4152                 .free = LDKChannelSigner_JCalls_free,
4153                 .pubkeys = pubkeys_conv,
4154                 .set_pubkeys = NULL,
4155         };
4156         return ret;
4157 }
4158 uint64_t  __attribute__((export_name("TS_LDKChannelSigner_new"))) TS_LDKChannelSigner_new(JSValue o, uint64_t pubkeys) {
4159         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
4160         *res_ptr = LDKChannelSigner_init(o, pubkeys);
4161         return tag_ptr(res_ptr, true);
4162 }
4163 int8_tArray  __attribute__((export_name("TS_ChannelSigner_get_per_commitment_point"))) TS_ChannelSigner_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
4164         void* this_arg_ptr = untag_ptr(this_arg);
4165         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4166         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4167         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
4168         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
4169         return ret_arr;
4170 }
4171
4172 int8_tArray  __attribute__((export_name("TS_ChannelSigner_release_commitment_secret"))) TS_ChannelSigner_release_commitment_secret(uint64_t this_arg, int64_t idx) {
4173         void* this_arg_ptr = untag_ptr(this_arg);
4174         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4175         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4176         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4177         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
4178         return ret_arr;
4179 }
4180
4181 uint64_t  __attribute__((export_name("TS_ChannelSigner_validate_holder_commitment"))) TS_ChannelSigner_validate_holder_commitment(uint64_t this_arg, uint64_t holder_tx, ptrArray preimages) {
4182         void* this_arg_ptr = untag_ptr(this_arg);
4183         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4184         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4185         LDKHolderCommitmentTransaction holder_tx_conv;
4186         holder_tx_conv.inner = untag_ptr(holder_tx);
4187         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
4188         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
4189         holder_tx_conv.is_owned = false;
4190         LDKCVec_PaymentPreimageZ preimages_constr;
4191         preimages_constr.datalen = preimages->arr_len;
4192         if (preimages_constr.datalen > 0)
4193                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4194         else
4195                 preimages_constr.data = NULL;
4196         int8_tArray* preimages_vals = (void*) preimages->elems;
4197         for (size_t m = 0; m < preimages_constr.datalen; m++) {
4198                 int8_tArray preimages_conv_12 = preimages_vals[m];
4199                 LDKThirtyTwoBytes preimages_conv_12_ref;
4200                 CHECK(preimages_conv_12->arr_len == 32);
4201                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4202                 preimages_constr.data[m] = preimages_conv_12_ref;
4203         }
4204         FREE(preimages);
4205         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4206         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4207         return tag_ptr(ret_conv, true);
4208 }
4209
4210 int8_tArray  __attribute__((export_name("TS_ChannelSigner_channel_keys_id"))) TS_ChannelSigner_channel_keys_id(uint64_t this_arg) {
4211         void* this_arg_ptr = untag_ptr(this_arg);
4212         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4213         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4214         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4215         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
4216         return ret_arr;
4217 }
4218
4219 void  __attribute__((export_name("TS_ChannelSigner_provide_channel_parameters"))) TS_ChannelSigner_provide_channel_parameters(uint64_t this_arg, uint64_t channel_parameters) {
4220         void* this_arg_ptr = untag_ptr(this_arg);
4221         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4222         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4223         LDKChannelTransactionParameters channel_parameters_conv;
4224         channel_parameters_conv.inner = untag_ptr(channel_parameters);
4225         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
4226         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4227         channel_parameters_conv.is_owned = false;
4228         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
4229 }
4230
4231 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
4232         if (this_arg->set_pubkeys != NULL)
4233                 this_arg->set_pubkeys(this_arg);
4234         return this_arg->pubkeys;
4235 }
4236 uint64_t  __attribute__((export_name("TS_ChannelSigner_get_pubkeys"))) TS_ChannelSigner_get_pubkeys(uint64_t this_arg) {
4237         void* this_arg_ptr = untag_ptr(this_arg);
4238         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4239         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4240         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
4241         uint64_t ret_ref = 0;
4242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4244         return ret_ref;
4245 }
4246
4247 typedef struct LDKEcdsaChannelSigner_JCalls {
4248         atomic_size_t refcnt;
4249         uint32_t instance_ptr;
4250         LDKChannelSigner_JCalls* ChannelSigner;
4251 } LDKEcdsaChannelSigner_JCalls;
4252 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
4253         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4254         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4255                 FREE(j_calls);
4256         }
4257 }
4258 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
4259         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4260         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
4261         uint64_t commitment_tx_ref = 0;
4262         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
4263         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4264         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
4265         LDKCVec_PaymentPreimageZ preimages_var = preimages;
4266         ptrArray preimages_arr = NULL;
4267         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
4268         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
4269         for (size_t m = 0; m < preimages_var.datalen; m++) {
4270                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
4271                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
4272                 preimages_arr_ptr[m] = preimages_conv_12_arr;
4273         }
4274         
4275         FREE(preimages_var.data);
4276         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
4277         void* ret_ptr = untag_ptr(ret);
4278         CHECK_ACCESS(ret_ptr);
4279         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4280         FREE(untag_ptr(ret));
4281         return ret_conv;
4282 }
4283 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
4284         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4285         int64_t idx_conv = idx;
4286         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
4287         memcpy(secret_arr->elems, *secret, 32);
4288         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 8, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
4289         void* ret_ptr = untag_ptr(ret);
4290         CHECK_ACCESS(ret_ptr);
4291         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4292         FREE(untag_ptr(ret));
4293         return ret_conv;
4294 }
4295 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
4296         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4297         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
4298         uint64_t commitment_tx_ref = 0;
4299         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
4300         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4301         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
4302         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 9, commitment_tx_ref, 0, 0, 0, 0, 0);
4303         void* ret_ptr = untag_ptr(ret);
4304         CHECK_ACCESS(ret_ptr);
4305         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4306         FREE(untag_ptr(ret));
4307         return ret_conv;
4308 }
4309 LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) {
4310         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4311         LDKTransaction justice_tx_var = justice_tx;
4312         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
4313         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
4314         Transaction_free(justice_tx_var);
4315         uint32_t input_conv = input;
4316         int64_t amount_conv = amount;
4317         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
4318         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
4319         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 10, (uint32_t)justice_tx_arr, input_conv, amount_conv, (uint32_t)per_commitment_key_arr, 0, 0);
4320         void* ret_ptr = untag_ptr(ret);
4321         CHECK_ACCESS(ret_ptr);
4322         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4323         FREE(untag_ptr(ret));
4324         return ret_conv;
4325 }
4326 LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
4327         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4328         LDKTransaction justice_tx_var = justice_tx;
4329         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
4330         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
4331         Transaction_free(justice_tx_var);
4332         uint32_t input_conv = input;
4333         int64_t amount_conv = amount;
4334         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
4335         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
4336         LDKHTLCOutputInCommitment htlc_var = *htlc;
4337         uint64_t htlc_ref = 0;
4338         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4339         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4340         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
4341         uint64_t ret = js_invoke_function_uububu(j_calls->instance_ptr, 11, (uint32_t)justice_tx_arr, input_conv, amount_conv, (uint32_t)per_commitment_key_arr, htlc_ref, 0);
4342         void* ret_ptr = untag_ptr(ret);
4343         CHECK_ACCESS(ret_ptr);
4344         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4345         FREE(untag_ptr(ret));
4346         return ret_conv;
4347 }
4348 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
4349         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4350         LDKTransaction htlc_tx_var = htlc_tx;
4351         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
4352         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
4353         Transaction_free(htlc_tx_var);
4354         uint32_t input_conv = input;
4355         int64_t amount_conv = amount;
4356         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
4357         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
4358         LDKHTLCOutputInCommitment htlc_var = *htlc;
4359         uint64_t htlc_ref = 0;
4360         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4361         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4362         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
4363         uint64_t ret = js_invoke_function_uububu(j_calls->instance_ptr, 12, (uint32_t)htlc_tx_arr, input_conv, amount_conv, (uint32_t)per_commitment_point_arr, htlc_ref, 0);
4364         void* ret_ptr = untag_ptr(ret);
4365         CHECK_ACCESS(ret_ptr);
4366         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4367         FREE(untag_ptr(ret));
4368         return ret_conv;
4369 }
4370 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
4371         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4372         LDKClosingTransaction closing_tx_var = *closing_tx;
4373         uint64_t closing_tx_ref = 0;
4374         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
4375         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
4376         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
4377         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 13, closing_tx_ref, 0, 0, 0, 0, 0);
4378         void* ret_ptr = untag_ptr(ret);
4379         CHECK_ACCESS(ret_ptr);
4380         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4381         FREE(untag_ptr(ret));
4382         return ret_conv;
4383 }
4384 LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
4385         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4386         LDKTransaction anchor_tx_var = anchor_tx;
4387         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
4388         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
4389         Transaction_free(anchor_tx_var);
4390         uint32_t input_conv = input;
4391         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 14, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
4392         void* ret_ptr = untag_ptr(ret);
4393         CHECK_ACCESS(ret_ptr);
4394         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4395         FREE(untag_ptr(ret));
4396         return ret_conv;
4397 }
4398 LDKCResult_SignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
4399         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4400         LDKUnsignedChannelAnnouncement msg_var = *msg;
4401         uint64_t msg_ref = 0;
4402         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
4403         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4404         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
4405         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 15, msg_ref, 0, 0, 0, 0, 0);
4406         void* ret_ptr = untag_ptr(ret);
4407         CHECK_ACCESS(ret_ptr);
4408         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4409         FREE(untag_ptr(ret));
4410         return ret_conv;
4411 }
4412 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
4413         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
4414         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4415         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
4416 }
4417 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
4418         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
4419         atomic_init(&calls->refcnt, 1);
4420         calls->instance_ptr = o;
4421
4422         LDKChannelPublicKeys pubkeys_conv;
4423         pubkeys_conv.inner = untag_ptr(pubkeys);
4424         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4425         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4426
4427         LDKEcdsaChannelSigner ret = {
4428                 .this_arg = (void*) calls,
4429                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
4430                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall,
4431                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall,
4432                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
4433                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
4434                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
4435                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
4436                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
4437                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
4438                 .free = LDKEcdsaChannelSigner_JCalls_free,
4439                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
4440         };
4441         calls->ChannelSigner = ret.ChannelSigner.this_arg;
4442         return ret;
4443 }
4444 uint64_t  __attribute__((export_name("TS_LDKEcdsaChannelSigner_new"))) TS_LDKEcdsaChannelSigner_new(JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
4445         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
4446         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
4447         return tag_ptr(res_ptr, true);
4448 }
4449 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_counterparty_commitment"))) TS_EcdsaChannelSigner_sign_counterparty_commitment(uint64_t this_arg, uint64_t commitment_tx, ptrArray preimages) {
4450         void* this_arg_ptr = untag_ptr(this_arg);
4451         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4452         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4453         LDKCommitmentTransaction commitment_tx_conv;
4454         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4455         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4456         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4457         commitment_tx_conv.is_owned = false;
4458         LDKCVec_PaymentPreimageZ preimages_constr;
4459         preimages_constr.datalen = preimages->arr_len;
4460         if (preimages_constr.datalen > 0)
4461                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4462         else
4463                 preimages_constr.data = NULL;
4464         int8_tArray* preimages_vals = (void*) preimages->elems;
4465         for (size_t m = 0; m < preimages_constr.datalen; m++) {
4466                 int8_tArray preimages_conv_12 = preimages_vals[m];
4467                 LDKThirtyTwoBytes preimages_conv_12_ref;
4468                 CHECK(preimages_conv_12->arr_len == 32);
4469                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4470                 preimages_constr.data[m] = preimages_conv_12_ref;
4471         }
4472         FREE(preimages);
4473         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4474         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4475         return tag_ptr(ret_conv, true);
4476 }
4477
4478 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_validate_counterparty_revocation"))) TS_EcdsaChannelSigner_validate_counterparty_revocation(uint64_t this_arg, int64_t idx, int8_tArray secret) {
4479         void* this_arg_ptr = untag_ptr(this_arg);
4480         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4481         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4482         uint8_t secret_arr[32];
4483         CHECK(secret->arr_len == 32);
4484         memcpy(secret_arr, secret->elems, 32); FREE(secret);
4485         uint8_t (*secret_ref)[32] = &secret_arr;
4486         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4487         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
4488         return tag_ptr(ret_conv, true);
4489 }
4490
4491 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_holder_commitment_and_htlcs"))) TS_EcdsaChannelSigner_sign_holder_commitment_and_htlcs(uint64_t this_arg, uint64_t commitment_tx) {
4492         void* this_arg_ptr = untag_ptr(this_arg);
4493         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4494         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4495         LDKHolderCommitmentTransaction commitment_tx_conv;
4496         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4497         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4498         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4499         commitment_tx_conv.is_owned = false;
4500         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4501         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
4502         return tag_ptr(ret_conv, true);
4503 }
4504
4505 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_justice_revoked_output"))) TS_EcdsaChannelSigner_sign_justice_revoked_output(uint64_t this_arg, int8_tArray justice_tx, uint32_t input, int64_t amount, int8_tArray per_commitment_key) {
4506         void* this_arg_ptr = untag_ptr(this_arg);
4507         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4508         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4509         LDKTransaction justice_tx_ref;
4510         justice_tx_ref.datalen = justice_tx->arr_len;
4511         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4512         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4513         justice_tx_ref.data_is_owned = true;
4514         uint8_t per_commitment_key_arr[32];
4515         CHECK(per_commitment_key->arr_len == 32);
4516         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4517         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4518         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4519         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
4520         return tag_ptr(ret_conv, true);
4521 }
4522
4523 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_justice_revoked_htlc"))) TS_EcdsaChannelSigner_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) {
4524         void* this_arg_ptr = untag_ptr(this_arg);
4525         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4526         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4527         LDKTransaction justice_tx_ref;
4528         justice_tx_ref.datalen = justice_tx->arr_len;
4529         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4530         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4531         justice_tx_ref.data_is_owned = true;
4532         uint8_t per_commitment_key_arr[32];
4533         CHECK(per_commitment_key->arr_len == 32);
4534         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4535         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4536         LDKHTLCOutputInCommitment htlc_conv;
4537         htlc_conv.inner = untag_ptr(htlc);
4538         htlc_conv.is_owned = ptr_is_owned(htlc);
4539         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4540         htlc_conv.is_owned = false;
4541         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4542         *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);
4543         return tag_ptr(ret_conv, true);
4544 }
4545
4546 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_counterparty_htlc_transaction"))) TS_EcdsaChannelSigner_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) {
4547         void* this_arg_ptr = untag_ptr(this_arg);
4548         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4549         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4550         LDKTransaction htlc_tx_ref;
4551         htlc_tx_ref.datalen = htlc_tx->arr_len;
4552         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4553         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
4554         htlc_tx_ref.data_is_owned = true;
4555         LDKPublicKey per_commitment_point_ref;
4556         CHECK(per_commitment_point->arr_len == 33);
4557         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
4558         LDKHTLCOutputInCommitment htlc_conv;
4559         htlc_conv.inner = untag_ptr(htlc);
4560         htlc_conv.is_owned = ptr_is_owned(htlc);
4561         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4562         htlc_conv.is_owned = false;
4563         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4564         *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);
4565         return tag_ptr(ret_conv, true);
4566 }
4567
4568 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_closing_transaction"))) TS_EcdsaChannelSigner_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
4569         void* this_arg_ptr = untag_ptr(this_arg);
4570         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4571         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4572         LDKClosingTransaction closing_tx_conv;
4573         closing_tx_conv.inner = untag_ptr(closing_tx);
4574         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
4575         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4576         closing_tx_conv.is_owned = false;
4577         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4578         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4579         return tag_ptr(ret_conv, true);
4580 }
4581
4582 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_holder_anchor_input"))) TS_EcdsaChannelSigner_sign_holder_anchor_input(uint64_t this_arg, int8_tArray anchor_tx, uint32_t input) {
4583         void* this_arg_ptr = untag_ptr(this_arg);
4584         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4585         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4586         LDKTransaction anchor_tx_ref;
4587         anchor_tx_ref.datalen = anchor_tx->arr_len;
4588         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
4589         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
4590         anchor_tx_ref.data_is_owned = true;
4591         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4592         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
4593         return tag_ptr(ret_conv, true);
4594 }
4595
4596 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_channel_announcement_with_funding_key"))) TS_EcdsaChannelSigner_sign_channel_announcement_with_funding_key(uint64_t this_arg, uint64_t msg) {
4597         void* this_arg_ptr = untag_ptr(this_arg);
4598         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4599         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4600         LDKUnsignedChannelAnnouncement msg_conv;
4601         msg_conv.inner = untag_ptr(msg);
4602         msg_conv.is_owned = ptr_is_owned(msg);
4603         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4604         msg_conv.is_owned = false;
4605         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4606         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
4607         return tag_ptr(ret_conv, true);
4608 }
4609
4610 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
4611         atomic_size_t refcnt;
4612         uint32_t instance_ptr;
4613         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
4614         LDKChannelSigner_JCalls* ChannelSigner;
4615 } LDKWriteableEcdsaChannelSigner_JCalls;
4616 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
4617         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
4618         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4619                 FREE(j_calls);
4620         }
4621 }
4622 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
4623         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
4624         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 16, 0, 0, 0, 0, 0, 0);
4625         LDKCVec_u8Z ret_ref;
4626         ret_ref.datalen = ret->arr_len;
4627         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4628         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4629         return ret_ref;
4630 }
4631 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
4632         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
4633         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4634         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
4635         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
4636 }
4637 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
4638         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
4639         atomic_init(&calls->refcnt, 1);
4640         calls->instance_ptr = o;
4641
4642         LDKChannelPublicKeys pubkeys_conv;
4643         pubkeys_conv.inner = untag_ptr(pubkeys);
4644         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4645         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4646
4647         LDKWriteableEcdsaChannelSigner ret = {
4648                 .this_arg = (void*) calls,
4649                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
4650                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
4651                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
4652                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
4653         };
4654         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
4655         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
4656         return ret;
4657 }
4658 uint64_t  __attribute__((export_name("TS_LDKWriteableEcdsaChannelSigner_new"))) TS_LDKWriteableEcdsaChannelSigner_new(JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
4659         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
4660         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
4661         return tag_ptr(res_ptr, true);
4662 }
4663 int8_tArray  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_write"))) TS_WriteableEcdsaChannelSigner_write(uint64_t this_arg) {
4664         void* this_arg_ptr = untag_ptr(this_arg);
4665         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4666         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
4667         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4668         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4669         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4670         CVec_u8Z_free(ret_var);
4671         return ret_arr;
4672 }
4673
4674 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
4675 CHECK(owner->result_ok);
4676         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
4677 }
4678 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(uint64_t owner) {
4679         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
4680         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
4681         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
4682         return tag_ptr(ret_ret, true);
4683 }
4684
4685 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
4686 CHECK(!owner->result_ok);
4687         return DecodeError_clone(&*owner->contents.err);
4688 }
4689 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(uint64_t owner) {
4690         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
4691         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4692         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
4693         uint64_t ret_ref = tag_ptr(ret_copy, true);
4694         return ret_ref;
4695 }
4696
4697 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4698         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4699         for (size_t i = 0; i < ret.datalen; i++) {
4700                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4701         }
4702         return ret;
4703 }
4704 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4705 CHECK(owner->result_ok);
4706         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4707 }
4708 ptrArray  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint64_t owner) {
4709         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4710         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4711         ptrArray ret_arr = NULL;
4712         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
4713         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
4714         for (size_t m = 0; m < ret_var.datalen; m++) {
4715                 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
4716                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
4717                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
4718                 CVec_u8Z_free(ret_conv_12_var);
4719                 ret_arr_ptr[m] = ret_conv_12_arr;
4720         }
4721         
4722         FREE(ret_var.data);
4723         return ret_arr;
4724 }
4725
4726 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4727 CHECK(!owner->result_ok);
4728         return *owner->contents.err;
4729 }
4730 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint64_t owner) {
4731         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4732         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4733 }
4734
4735 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4736         LDKInMemorySigner ret = *owner->contents.result;
4737         ret.is_owned = false;
4738         return ret;
4739 }
4740 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
4741         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4742         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4743         uint64_t ret_ref = 0;
4744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4746         return ret_ref;
4747 }
4748
4749 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4750 CHECK(!owner->result_ok);
4751         return DecodeError_clone(&*owner->contents.err);
4752 }
4753 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
4754         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4755         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4756         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4757         uint64_t ret_ref = tag_ptr(ret_copy, true);
4758         return ret_ref;
4759 }
4760
4761 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4762         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4763         for (size_t i = 0; i < ret.datalen; i++) {
4764                 ret.data[i] = TxOut_clone(&orig->data[i]);
4765         }
4766         return ret;
4767 }
4768 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4769 CHECK(owner->result_ok);
4770         return *owner->contents.result;
4771 }
4772 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
4773         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4774         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4775         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4776         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4777         return ret_arr;
4778 }
4779
4780 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4781 CHECK(!owner->result_ok);
4782         return *owner->contents.err;
4783 }
4784 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
4785         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4786         CResult_TransactionNoneZ_get_err(owner_conv);
4787 }
4788
4789 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
4790         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4791         switch(obj->tag) {
4792                 case LDKCOption_u16Z_Some: return 0;
4793                 case LDKCOption_u16Z_None: return 1;
4794                 default: abort();
4795         }
4796 }
4797 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
4798         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4799         assert(obj->tag == LDKCOption_u16Z_Some);
4800                         int16_t some_conv = obj->some;
4801         return some_conv;
4802 }
4803 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4804 CHECK(owner->result_ok);
4805         return ThirtyTwoBytes_clone(&*owner->contents.result);
4806 }
4807 int8_tArray  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint64_t owner) {
4808         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4809         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4810         memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
4811         return ret_arr;
4812 }
4813
4814 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4815 CHECK(!owner->result_ok);
4816         return APIError_clone(&*owner->contents.err);
4817 }
4818 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint64_t owner) {
4819         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4820         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4821         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
4822         uint64_t ret_ref = tag_ptr(ret_copy, true);
4823         return ret_ref;
4824 }
4825
4826 uint32_t __attribute__((export_name("TS_LDKRecentPaymentDetails_ty_from_ptr"))) TS_LDKRecentPaymentDetails_ty_from_ptr(uint64_t ptr) {
4827         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4828         switch(obj->tag) {
4829                 case LDKRecentPaymentDetails_Pending: return 0;
4830                 case LDKRecentPaymentDetails_Fulfilled: return 1;
4831                 case LDKRecentPaymentDetails_Abandoned: return 2;
4832                 default: abort();
4833         }
4834 }
4835 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_hash"))) TS_LDKRecentPaymentDetails_Pending_get_payment_hash(uint64_t ptr) {
4836         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4837         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4838                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4839                         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
4840         return payment_hash_arr;
4841 }
4842 int64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_total_msat"))) TS_LDKRecentPaymentDetails_Pending_get_total_msat(uint64_t ptr) {
4843         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4844         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4845                         int64_t total_msat_conv = obj->pending.total_msat;
4846         return total_msat_conv;
4847 }
4848 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(uint64_t ptr) {
4849         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4850         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
4851                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4852                         memcpy(payment_hash_arr->elems, obj->fulfilled.payment_hash.data, 32);
4853         return payment_hash_arr;
4854 }
4855 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash(uint64_t ptr) {
4856         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4857         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
4858                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4859                         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
4860         return payment_hash_arr;
4861 }
4862 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
4863         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
4864         for (size_t i = 0; i < ret.datalen; i++) {
4865                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
4866         }
4867         return ret;
4868 }
4869 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
4870         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4871         switch(obj->tag) {
4872                 case LDKPaymentSendFailure_ParameterError: return 0;
4873                 case LDKPaymentSendFailure_PathParameterError: return 1;
4874                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
4875                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
4876                 case LDKPaymentSendFailure_PartialFailure: return 4;
4877                 default: abort();
4878         }
4879 }
4880 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
4881         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4882         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4883                         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
4884         return parameter_error_ref;
4885 }
4886 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
4887         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4888         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4889                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4890                         uint64_tArray path_parameter_error_arr = NULL;
4891                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
4892                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
4893                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4894                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4895                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4896                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4897                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
4898                         }
4899                         
4900         return path_parameter_error_arr;
4901 }
4902 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe"))) TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(uint64_t ptr) {
4903         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4904         assert(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
4905                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
4906                         uint64_tArray all_failed_resend_safe_arr = NULL;
4907                         all_failed_resend_safe_arr = init_uint64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
4908                         uint64_t *all_failed_resend_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
4909                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
4910                                 uint64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
4911                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
4912                         }
4913                         
4914         return all_failed_resend_safe_arr;
4915 }
4916 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
4917         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4918         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4919                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4920                         uint64_tArray results_arr = NULL;
4921                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
4922                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
4923                         for (size_t w = 0; w < results_var.datalen; w++) {
4924                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4925                                 *results_conv_22_conv = results_var.data[w];
4926                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4927                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
4928                         }
4929                         
4930         return results_arr;
4931 }
4932 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
4933         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4934         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4935                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4936                         uint64_t failed_paths_retry_ref = 0;
4937                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4938                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
4939         return failed_paths_retry_ref;
4940 }
4941 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
4942         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4943         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4944                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4945                         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4946         return payment_id_arr;
4947 }
4948 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4949 CHECK(owner->result_ok);
4950         return *owner->contents.result;
4951 }
4952 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
4953         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4954         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4955 }
4956
4957 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4958 CHECK(!owner->result_ok);
4959         return PaymentSendFailure_clone(&*owner->contents.err);
4960 }
4961 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
4962         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4963         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4964         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4965         uint64_t ret_ref = tag_ptr(ret_copy, true);
4966         return ret_ref;
4967 }
4968
4969 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
4970 CHECK(owner->result_ok);
4971         return *owner->contents.result;
4972 }
4973 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_ok"))) TS_CResult_NoneRetryableSendFailureZ_get_ok(uint64_t owner) {
4974         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
4975         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
4976 }
4977
4978 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
4979 CHECK(!owner->result_ok);
4980         return RetryableSendFailure_clone(&*owner->contents.err);
4981 }
4982 uint32_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_err"))) TS_CResult_NoneRetryableSendFailureZ_get_err(uint64_t owner) {
4983         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
4984         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
4985         return ret_conv;
4986 }
4987
4988 static inline struct LDKThirtyTwoBytes CResult_PaymentHashPaymentSendFailureZ_get_ok(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
4989 CHECK(owner->result_ok);
4990         return ThirtyTwoBytes_clone(&*owner->contents.result);
4991 }
4992 int8_tArray  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_get_ok(uint64_t owner) {
4993         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
4994         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4995         memcpy(ret_arr->elems, CResult_PaymentHashPaymentSendFailureZ_get_ok(owner_conv).data, 32);
4996         return ret_arr;
4997 }
4998
4999 static inline struct LDKPaymentSendFailure CResult_PaymentHashPaymentSendFailureZ_get_err(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
5000 CHECK(!owner->result_ok);
5001         return PaymentSendFailure_clone(&*owner->contents.err);
5002 }
5003 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_get_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_get_err(uint64_t owner) {
5004         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
5005         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5006         *ret_copy = CResult_PaymentHashPaymentSendFailureZ_get_err(owner_conv);
5007         uint64_t ret_ref = tag_ptr(ret_copy, true);
5008         return ret_ref;
5009 }
5010
5011 static inline struct LDKThirtyTwoBytes CResult_PaymentHashRetryableSendFailureZ_get_ok(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){
5012 CHECK(owner->result_ok);
5013         return ThirtyTwoBytes_clone(&*owner->contents.result);
5014 }
5015 int8_tArray  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_get_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_get_ok(uint64_t owner) {
5016         LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner);
5017         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5018         memcpy(ret_arr->elems, CResult_PaymentHashRetryableSendFailureZ_get_ok(owner_conv).data, 32);
5019         return ret_arr;
5020 }
5021
5022 static inline enum LDKRetryableSendFailure CResult_PaymentHashRetryableSendFailureZ_get_err(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){
5023 CHECK(!owner->result_ok);
5024         return RetryableSendFailure_clone(&*owner->contents.err);
5025 }
5026 uint32_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_get_err"))) TS_CResult_PaymentHashRetryableSendFailureZ_get_err(uint64_t owner) {
5027         LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner);
5028         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_PaymentHashRetryableSendFailureZ_get_err(owner_conv));
5029         return ret_conv;
5030 }
5031
5032 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5033         return ThirtyTwoBytes_clone(&owner->a);
5034 }
5035 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint64_t owner) {
5036         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
5037         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5038         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
5039         return ret_arr;
5040 }
5041
5042 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5043         return ThirtyTwoBytes_clone(&owner->b);
5044 }
5045 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint64_t owner) {
5046         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
5047         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5048         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
5049         return ret_arr;
5050 }
5051
5052 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5053 CHECK(owner->result_ok);
5054         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
5055 }
5056 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint64_t owner) {
5057         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
5058         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
5059         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
5060         return tag_ptr(ret_conv, true);
5061 }
5062
5063 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5064 CHECK(!owner->result_ok);
5065         return PaymentSendFailure_clone(&*owner->contents.err);
5066 }
5067 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint64_t owner) {
5068         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
5069         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5070         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
5071         uint64_t ret_ref = tag_ptr(ret_copy, true);
5072         return ret_ref;
5073 }
5074
5075 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
5076         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
5077         for (size_t i = 0; i < ret.datalen; i++) {
5078                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
5079         }
5080         return ret;
5081 }
5082 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5083         return ThirtyTwoBytes_clone(&owner->a);
5084 }
5085 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint64_t owner) {
5086         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
5087         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5088         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
5089         return ret_arr;
5090 }
5091
5092 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5093         return ThirtyTwoBytes_clone(&owner->b);
5094 }
5095 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint64_t owner) {
5096         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
5097         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5098         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
5099         return ret_arr;
5100 }
5101
5102 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5103 CHECK(owner->result_ok);
5104         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5105 }
5106 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint64_t owner) {
5107         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
5108         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5109         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
5110         return tag_ptr(ret_conv, true);
5111 }
5112
5113 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5114 CHECK(!owner->result_ok);
5115         return *owner->contents.err;
5116 }
5117 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint64_t owner) {
5118         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
5119         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
5120 }
5121
5122 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5123 CHECK(owner->result_ok);
5124         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5125 }
5126 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint64_t owner) {
5127         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
5128         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5129         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
5130         return tag_ptr(ret_conv, true);
5131 }
5132
5133 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5134 CHECK(!owner->result_ok);
5135         return APIError_clone(&*owner->contents.err);
5136 }
5137 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint64_t owner) {
5138         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
5139         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5140         *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
5141         uint64_t ret_ref = tag_ptr(ret_copy, true);
5142         return ret_ref;
5143 }
5144
5145 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5146 CHECK(owner->result_ok);
5147         return ThirtyTwoBytes_clone(&*owner->contents.result);
5148 }
5149 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint64_t owner) {
5150         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
5151         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5152         memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
5153         return ret_arr;
5154 }
5155
5156 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5157 CHECK(!owner->result_ok);
5158         return *owner->contents.err;
5159 }
5160 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint64_t owner) {
5161         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
5162         CResult_PaymentSecretNoneZ_get_err(owner_conv);
5163 }
5164
5165 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5166 CHECK(owner->result_ok);
5167         return ThirtyTwoBytes_clone(&*owner->contents.result);
5168 }
5169 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint64_t owner) {
5170         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
5171         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5172         memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
5173         return ret_arr;
5174 }
5175
5176 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5177 CHECK(!owner->result_ok);
5178         return APIError_clone(&*owner->contents.err);
5179 }
5180 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint64_t owner) {
5181         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
5182         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5183         *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
5184         uint64_t ret_ref = tag_ptr(ret_copy, true);
5185         return ret_ref;
5186 }
5187
5188 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5189 CHECK(owner->result_ok);
5190         return ThirtyTwoBytes_clone(&*owner->contents.result);
5191 }
5192 int8_tArray  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint64_t owner) {
5193         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
5194         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5195         memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
5196         return ret_arr;
5197 }
5198
5199 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5200 CHECK(!owner->result_ok);
5201         return APIError_clone(&*owner->contents.err);
5202 }
5203 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint64_t owner) {
5204         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
5205         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5206         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
5207         uint64_t ret_ref = tag_ptr(ret_copy, true);
5208         return ret_ref;
5209 }
5210
5211 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5212         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
5213         ret.is_owned = false;
5214         return ret;
5215 }
5216 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
5217         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5218         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5219         uint64_t ret_ref = 0;
5220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5222         return ret_ref;
5223 }
5224
5225 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5226 CHECK(!owner->result_ok);
5227         return DecodeError_clone(&*owner->contents.err);
5228 }
5229 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
5230         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5231         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5232         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5233         uint64_t ret_ref = tag_ptr(ret_copy, true);
5234         return ret_ref;
5235 }
5236
5237 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5238         LDKChannelCounterparty ret = *owner->contents.result;
5239         ret.is_owned = false;
5240         return ret;
5241 }
5242 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
5243         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5244         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5245         uint64_t ret_ref = 0;
5246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5248         return ret_ref;
5249 }
5250
5251 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5252 CHECK(!owner->result_ok);
5253         return DecodeError_clone(&*owner->contents.err);
5254 }
5255 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
5256         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5257         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5258         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5259         uint64_t ret_ref = tag_ptr(ret_copy, true);
5260         return ret_ref;
5261 }
5262
5263 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5264         LDKChannelDetails ret = *owner->contents.result;
5265         ret.is_owned = false;
5266         return ret;
5267 }
5268 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
5269         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5270         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5271         uint64_t ret_ref = 0;
5272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5274         return ret_ref;
5275 }
5276
5277 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5278 CHECK(!owner->result_ok);
5279         return DecodeError_clone(&*owner->contents.err);
5280 }
5281 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
5282         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5283         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5284         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5285         uint64_t ret_ref = tag_ptr(ret_copy, true);
5286         return ret_ref;
5287 }
5288
5289 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5290         LDKPhantomRouteHints ret = *owner->contents.result;
5291         ret.is_owned = false;
5292         return ret;
5293 }
5294 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
5295         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5296         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5297         uint64_t ret_ref = 0;
5298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5300         return ret_ref;
5301 }
5302
5303 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5304 CHECK(!owner->result_ok);
5305         return DecodeError_clone(&*owner->contents.err);
5306 }
5307 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
5308         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5309         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5310         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5311         uint64_t ret_ref = tag_ptr(ret_copy, true);
5312         return ret_ref;
5313 }
5314
5315 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5316         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5317         for (size_t i = 0; i < ret.datalen; i++) {
5318                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5319         }
5320         return ret;
5321 }
5322 typedef struct LDKWatch_JCalls {
5323         atomic_size_t refcnt;
5324         uint32_t instance_ptr;
5325 } LDKWatch_JCalls;
5326 static void LDKWatch_JCalls_free(void* this_arg) {
5327         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5328         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5329                 FREE(j_calls);
5330         }
5331 }
5332 LDKChannelMonitorUpdateStatus watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5333         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5334         LDKOutPoint funding_txo_var = funding_txo;
5335         uint64_t funding_txo_ref = 0;
5336         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5337         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5338         LDKChannelMonitor monitor_var = monitor;
5339         uint64_t monitor_ref = 0;
5340         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5341         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
5342         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 17, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
5343         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
5344         return ret_conv;
5345 }
5346 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
5347         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5348         LDKOutPoint funding_txo_var = funding_txo;
5349         uint64_t funding_txo_ref = 0;
5350         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5351         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5352         LDKChannelMonitorUpdate update_var = *update;
5353         uint64_t update_ref = 0;
5354         update_var = ChannelMonitorUpdate_clone(&update_var);
5355         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5356         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
5357         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, update_ref, 0, 0, 0, 0);
5358         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
5359         return ret_conv;
5360 }
5361 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5362         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5363         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 19, 0, 0, 0, 0, 0, 0);
5364         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
5365         ret_constr.datalen = ret->arr_len;
5366         if (ret_constr.datalen > 0)
5367                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
5368         else
5369                 ret_constr.data = NULL;
5370         uint64_t* ret_vals = ret->elems;
5371         for (size_t x = 0; x < ret_constr.datalen; x++) {
5372                 uint64_t ret_conv_49 = ret_vals[x];
5373                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
5374                 CHECK_ACCESS(ret_conv_49_ptr);
5375                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
5376                 FREE(untag_ptr(ret_conv_49));
5377                 ret_constr.data[x] = ret_conv_49_conv;
5378         }
5379         FREE(ret);
5380         return ret_constr;
5381 }
5382 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5383         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5384         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5385 }
5386 static inline LDKWatch LDKWatch_init (JSValue o) {
5387         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5388         atomic_init(&calls->refcnt, 1);
5389         calls->instance_ptr = o;
5390
5391         LDKWatch ret = {
5392                 .this_arg = (void*) calls,
5393                 .watch_channel = watch_channel_LDKWatch_jcall,
5394                 .update_channel = update_channel_LDKWatch_jcall,
5395                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5396                 .free = LDKWatch_JCalls_free,
5397         };
5398         return ret;
5399 }
5400 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5401         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5402         *res_ptr = LDKWatch_init(o);
5403         return tag_ptr(res_ptr, true);
5404 }
5405 uint32_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
5406         void* this_arg_ptr = untag_ptr(this_arg);
5407         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5408         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5409         LDKOutPoint funding_txo_conv;
5410         funding_txo_conv.inner = untag_ptr(funding_txo);
5411         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5412         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5413         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5414         LDKChannelMonitor monitor_conv;
5415         monitor_conv.inner = untag_ptr(monitor);
5416         monitor_conv.is_owned = ptr_is_owned(monitor);
5417         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5418         monitor_conv = ChannelMonitor_clone(&monitor_conv);
5419         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv));
5420         return ret_conv;
5421 }
5422
5423 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
5424         void* this_arg_ptr = untag_ptr(this_arg);
5425         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5426         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5427         LDKOutPoint funding_txo_conv;
5428         funding_txo_conv.inner = untag_ptr(funding_txo);
5429         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5430         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5431         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5432         LDKChannelMonitorUpdate update_conv;
5433         update_conv.inner = untag_ptr(update);
5434         update_conv.is_owned = ptr_is_owned(update);
5435         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5436         update_conv.is_owned = false;
5437         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
5438         return ret_conv;
5439 }
5440
5441 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
5442         void* this_arg_ptr = untag_ptr(this_arg);
5443         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5444         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5445         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5446         uint64_tArray ret_arr = NULL;
5447         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5448         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5449         for (size_t x = 0; x < ret_var.datalen; x++) {
5450                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
5451                 *ret_conv_49_conv = ret_var.data[x];
5452                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
5453         }
5454         
5455         FREE(ret_var.data);
5456         return ret_arr;
5457 }
5458
5459 typedef struct LDKBroadcasterInterface_JCalls {
5460         atomic_size_t refcnt;
5461         uint32_t instance_ptr;
5462 } LDKBroadcasterInterface_JCalls;
5463 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5464         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5465         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5466                 FREE(j_calls);
5467         }
5468 }
5469 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5470         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5471         LDKTransaction tx_var = tx;
5472         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
5473         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
5474         Transaction_free(tx_var);
5475         js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
5476 }
5477 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5478         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5479         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5480 }
5481 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5482         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5483         atomic_init(&calls->refcnt, 1);
5484         calls->instance_ptr = o;
5485
5486         LDKBroadcasterInterface ret = {
5487                 .this_arg = (void*) calls,
5488                 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5489                 .free = LDKBroadcasterInterface_JCalls_free,
5490         };
5491         return ret;
5492 }
5493 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5494         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5495         *res_ptr = LDKBroadcasterInterface_init(o);
5496         return tag_ptr(res_ptr, true);
5497 }
5498 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint64_t this_arg, int8_tArray tx) {
5499         void* this_arg_ptr = untag_ptr(this_arg);
5500         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5501         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5502         LDKTransaction tx_ref;
5503         tx_ref.datalen = tx->arr_len;
5504         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5505         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
5506         tx_ref.data_is_owned = true;
5507         (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5508 }
5509
5510 typedef struct LDKEntropySource_JCalls {
5511         atomic_size_t refcnt;
5512         uint32_t instance_ptr;
5513 } LDKEntropySource_JCalls;
5514 static void LDKEntropySource_JCalls_free(void* this_arg) {
5515         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5516         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5517                 FREE(j_calls);
5518         }
5519 }
5520 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
5521         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5522         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, 0, 0, 0, 0, 0, 0);
5523         LDKThirtyTwoBytes ret_ref;
5524         CHECK(ret->arr_len == 32);
5525         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5526         return ret_ref;
5527 }
5528 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
5529         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
5530         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5531 }
5532 static inline LDKEntropySource LDKEntropySource_init (JSValue o) {
5533         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
5534         atomic_init(&calls->refcnt, 1);
5535         calls->instance_ptr = o;
5536
5537         LDKEntropySource ret = {
5538                 .this_arg = (void*) calls,
5539                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
5540                 .free = LDKEntropySource_JCalls_free,
5541         };
5542         return ret;
5543 }
5544 uint64_t  __attribute__((export_name("TS_LDKEntropySource_new"))) TS_LDKEntropySource_new(JSValue o) {
5545         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
5546         *res_ptr = LDKEntropySource_init(o);
5547         return tag_ptr(res_ptr, true);
5548 }
5549 int8_tArray  __attribute__((export_name("TS_EntropySource_get_secure_random_bytes"))) TS_EntropySource_get_secure_random_bytes(uint64_t this_arg) {
5550         void* this_arg_ptr = untag_ptr(this_arg);
5551         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5552         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
5553         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5554         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5555         return ret_arr;
5556 }
5557
5558 uint32_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ty_from_ptr"))) TS_LDKUnsignedGossipMessage_ty_from_ptr(uint64_t ptr) {
5559         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5560         switch(obj->tag) {
5561                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
5562                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
5563                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
5564                 default: abort();
5565         }
5566 }
5567 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement"))) TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(uint64_t ptr) {
5568         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5569         assert(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
5570                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
5571                         uint64_t channel_announcement_ref = 0;
5572                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
5573                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
5574         return channel_announcement_ref;
5575 }
5576 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update"))) TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(uint64_t ptr) {
5577         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5578         assert(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
5579                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
5580                         uint64_t channel_update_ref = 0;
5581                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
5582                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
5583         return channel_update_ref;
5584 }
5585 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement"))) TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(uint64_t ptr) {
5586         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5587         assert(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
5588                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
5589                         uint64_t node_announcement_ref = 0;
5590                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
5591                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
5592         return node_announcement_ref;
5593 }
5594 typedef struct LDKNodeSigner_JCalls {
5595         atomic_size_t refcnt;
5596         uint32_t instance_ptr;
5597 } LDKNodeSigner_JCalls;
5598 static void LDKNodeSigner_JCalls_free(void* this_arg) {
5599         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5600         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5601                 FREE(j_calls);
5602         }
5603 }
5604 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
5605         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5606         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
5607         LDKThirtyTwoBytes ret_ref;
5608         CHECK(ret->arr_len == 32);
5609         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5610         return ret_ref;
5611 }
5612 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
5613         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5614         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5615         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 23, recipient_conv, 0, 0, 0, 0, 0);
5616         void* ret_ptr = untag_ptr(ret);
5617         CHECK_ACCESS(ret_ptr);
5618         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
5619         FREE(untag_ptr(ret));
5620         return ret_conv;
5621 }
5622 LDKCResult_SharedSecretNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) {
5623         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5624         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5625         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
5626         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
5627         LDKCOption_ScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
5628         *tweak_copy = tweak;
5629         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
5630         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 24, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
5631         void* ret_ptr = untag_ptr(ret);
5632         CHECK_ACCESS(ret_ptr);
5633         LDKCResult_SharedSecretNoneZ ret_conv = *(LDKCResult_SharedSecretNoneZ*)(ret_ptr);
5634         FREE(untag_ptr(ret));
5635         return ret_conv;
5636 }
5637 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
5638         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5639         LDKu8slice hrp_bytes_var = hrp_bytes;
5640         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5641         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5642         LDKCVec_U5Z invoice_data_var = invoice_data;
5643         ptrArray invoice_data_arr = NULL;
5644         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5645         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
5646         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5647                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5648                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5649         }
5650         
5651         FREE(invoice_data_var.data);
5652         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5653         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 25, (uint32_t)hrp_bytes_arr, (uint32_t)invoice_data_arr, recipient_conv, 0, 0, 0);
5654         void* ret_ptr = untag_ptr(ret);
5655         CHECK_ACCESS(ret_ptr);
5656         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5657         FREE(untag_ptr(ret));
5658         return ret_conv;
5659 }
5660 LDKCResult_SignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
5661         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5662         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
5663         *msg_copy = msg;
5664         uint64_t msg_ref = tag_ptr(msg_copy, true);
5665         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 26, msg_ref, 0, 0, 0, 0, 0);
5666         void* ret_ptr = untag_ptr(ret);
5667         CHECK_ACCESS(ret_ptr);
5668         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
5669         FREE(untag_ptr(ret));
5670         return ret_conv;
5671 }
5672 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
5673         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
5674         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5675 }
5676 static inline LDKNodeSigner LDKNodeSigner_init (JSValue o) {
5677         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
5678         atomic_init(&calls->refcnt, 1);
5679         calls->instance_ptr = o;
5680
5681         LDKNodeSigner ret = {
5682                 .this_arg = (void*) calls,
5683                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
5684                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
5685                 .ecdh = ecdh_LDKNodeSigner_jcall,
5686                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
5687                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
5688                 .free = LDKNodeSigner_JCalls_free,
5689         };
5690         return ret;
5691 }
5692 uint64_t  __attribute__((export_name("TS_LDKNodeSigner_new"))) TS_LDKNodeSigner_new(JSValue o) {
5693         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
5694         *res_ptr = LDKNodeSigner_init(o);
5695         return tag_ptr(res_ptr, true);
5696 }
5697 int8_tArray  __attribute__((export_name("TS_NodeSigner_get_inbound_payment_key_material"))) TS_NodeSigner_get_inbound_payment_key_material(uint64_t this_arg) {
5698         void* this_arg_ptr = untag_ptr(this_arg);
5699         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5700         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5701         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5702         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5703         return ret_arr;
5704 }
5705
5706 uint64_t  __attribute__((export_name("TS_NodeSigner_get_node_id"))) TS_NodeSigner_get_node_id(uint64_t this_arg, uint32_t recipient) {
5707         void* this_arg_ptr = untag_ptr(this_arg);
5708         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5709         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5710         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5711         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
5712         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
5713         return tag_ptr(ret_conv, true);
5714 }
5715
5716 uint64_t  __attribute__((export_name("TS_NodeSigner_ecdh"))) TS_NodeSigner_ecdh(uint64_t this_arg, uint32_t recipient, int8_tArray other_key, uint64_t tweak) {
5717         void* this_arg_ptr = untag_ptr(this_arg);
5718         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5719         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5720         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5721         LDKPublicKey other_key_ref;
5722         CHECK(other_key->arr_len == 33);
5723         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
5724         void* tweak_ptr = untag_ptr(tweak);
5725         CHECK_ACCESS(tweak_ptr);
5726         LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr);
5727         // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ
5728         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
5729         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
5730         return tag_ptr(ret_conv, true);
5731 }
5732
5733 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_invoice"))) TS_NodeSigner_sign_invoice(uint64_t this_arg, int8_tArray hrp_bytes, ptrArray invoice_data, uint32_t recipient) {
5734         void* this_arg_ptr = untag_ptr(this_arg);
5735         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5736         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5737         LDKu8slice hrp_bytes_ref;
5738         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5739         hrp_bytes_ref.data = hrp_bytes->elems;
5740         LDKCVec_U5Z invoice_data_constr;
5741         invoice_data_constr.datalen = invoice_data->arr_len;
5742         if (invoice_data_constr.datalen > 0)
5743                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
5744         else
5745                 invoice_data_constr.data = NULL;
5746         int8_t* invoice_data_vals = (void*) invoice_data->elems;
5747         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5748                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5749                 
5750                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
5751         }
5752         FREE(invoice_data);
5753         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5754         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5755         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
5756         FREE(hrp_bytes);
5757         return tag_ptr(ret_conv, true);
5758 }
5759
5760 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_gossip_message"))) TS_NodeSigner_sign_gossip_message(uint64_t this_arg, uint64_t msg) {
5761         void* this_arg_ptr = untag_ptr(this_arg);
5762         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5763         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5764         void* msg_ptr = untag_ptr(msg);
5765         CHECK_ACCESS(msg_ptr);
5766         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
5767         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
5768         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5769         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
5770         return tag_ptr(ret_conv, true);
5771 }
5772
5773 typedef struct LDKSignerProvider_JCalls {
5774         atomic_size_t refcnt;
5775         uint32_t instance_ptr;
5776 } LDKSignerProvider_JCalls;
5777 static void LDKSignerProvider_JCalls_free(void* this_arg) {
5778         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5779         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5780                 FREE(j_calls);
5781         }
5782 }
5783 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
5784         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5785         jboolean inbound_conv = inbound;
5786         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5787         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
5788         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
5789         int8_tArray ret = (int8_tArray)js_invoke_function_ubuuuu(j_calls->instance_ptr, 27, inbound_conv, channel_value_satoshis_conv, (uint32_t)user_channel_id_arr, 0, 0, 0);
5790         LDKThirtyTwoBytes ret_ref;
5791         CHECK(ret->arr_len == 32);
5792         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5793         return ret_ref;
5794 }
5795 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
5796         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5797         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5798         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
5799         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
5800         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 28, channel_value_satoshis_conv, (uint32_t)channel_keys_id_arr, 0, 0, 0, 0);
5801         void* ret_ptr = untag_ptr(ret);
5802         CHECK_ACCESS(ret_ptr);
5803         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
5804         FREE(untag_ptr(ret));
5805         return ret_conv;
5806 }
5807 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
5808         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5809         LDKu8slice reader_var = reader;
5810         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
5811         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
5812         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 29, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
5813         void* ret_ptr = untag_ptr(ret);
5814         CHECK_ACCESS(ret_ptr);
5815         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
5816         FREE(untag_ptr(ret));
5817         return ret_conv;
5818 }
5819 LDKCVec_u8Z get_destination_script_LDKSignerProvider_jcall(const void* this_arg) {
5820         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5821         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 30, 0, 0, 0, 0, 0, 0);
5822         LDKCVec_u8Z ret_ref;
5823         ret_ref.datalen = ret->arr_len;
5824         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5825         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5826         return ret_ref;
5827 }
5828 LDKShutdownScript get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
5829         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5830         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 31, 0, 0, 0, 0, 0, 0);
5831         LDKShutdownScript ret_conv;
5832         ret_conv.inner = untag_ptr(ret);
5833         ret_conv.is_owned = ptr_is_owned(ret);
5834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
5835         return ret_conv;
5836 }
5837 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
5838         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
5839         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5840 }
5841 static inline LDKSignerProvider LDKSignerProvider_init (JSValue o) {
5842         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
5843         atomic_init(&calls->refcnt, 1);
5844         calls->instance_ptr = o;
5845
5846         LDKSignerProvider ret = {
5847                 .this_arg = (void*) calls,
5848                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
5849                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
5850                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
5851                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
5852                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
5853                 .free = LDKSignerProvider_JCalls_free,
5854         };
5855         return ret;
5856 }
5857 uint64_t  __attribute__((export_name("TS_LDKSignerProvider_new"))) TS_LDKSignerProvider_new(JSValue o) {
5858         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
5859         *res_ptr = LDKSignerProvider_init(o);
5860         return tag_ptr(res_ptr, true);
5861 }
5862 int8_tArray  __attribute__((export_name("TS_SignerProvider_generate_channel_keys_id"))) TS_SignerProvider_generate_channel_keys_id(uint64_t this_arg, jboolean inbound, int64_t channel_value_satoshis, int8_tArray user_channel_id) {
5863         void* this_arg_ptr = untag_ptr(this_arg);
5864         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5865         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5866         LDKU128 user_channel_id_ref;
5867         CHECK(user_channel_id->arr_len == 16);
5868         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
5869         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5870         memcpy(ret_arr->elems, (this_arg_conv->generate_channel_keys_id)(this_arg_conv->this_arg, inbound, channel_value_satoshis, user_channel_id_ref).data, 32);
5871         return ret_arr;
5872 }
5873
5874 uint64_t  __attribute__((export_name("TS_SignerProvider_derive_channel_signer"))) TS_SignerProvider_derive_channel_signer(uint64_t this_arg, int64_t channel_value_satoshis, int8_tArray channel_keys_id) {
5875         void* this_arg_ptr = untag_ptr(this_arg);
5876         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5877         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5878         LDKThirtyTwoBytes channel_keys_id_ref;
5879         CHECK(channel_keys_id->arr_len == 32);
5880         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
5881         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
5882         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
5883         return tag_ptr(ret_ret, true);
5884 }
5885
5886 uint64_t  __attribute__((export_name("TS_SignerProvider_read_chan_signer"))) TS_SignerProvider_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
5887         void* this_arg_ptr = untag_ptr(this_arg);
5888         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5889         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5890         LDKu8slice reader_ref;
5891         reader_ref.datalen = reader->arr_len;
5892         reader_ref.data = reader->elems;
5893         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
5894         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5895         FREE(reader);
5896         return tag_ptr(ret_conv, true);
5897 }
5898
5899 int8_tArray  __attribute__((export_name("TS_SignerProvider_get_destination_script"))) TS_SignerProvider_get_destination_script(uint64_t this_arg) {
5900         void* this_arg_ptr = untag_ptr(this_arg);
5901         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5902         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5903         LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5904         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5905         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5906         CVec_u8Z_free(ret_var);
5907         return ret_arr;
5908 }
5909
5910 uint64_t  __attribute__((export_name("TS_SignerProvider_get_shutdown_scriptpubkey"))) TS_SignerProvider_get_shutdown_scriptpubkey(uint64_t this_arg) {
5911         void* this_arg_ptr = untag_ptr(this_arg);
5912         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5913         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5914         LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5915         uint64_t ret_ref = 0;
5916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5918         return ret_ref;
5919 }
5920
5921 typedef struct LDKFeeEstimator_JCalls {
5922         atomic_size_t refcnt;
5923         uint32_t instance_ptr;
5924 } LDKFeeEstimator_JCalls;
5925 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5926         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5927         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5928                 FREE(j_calls);
5929         }
5930 }
5931 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
5932         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5933         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
5934         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, confirmation_target_conv, 0, 0, 0, 0, 0);
5935 }
5936 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
5937         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
5938         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5939 }
5940 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
5941         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
5942         atomic_init(&calls->refcnt, 1);
5943         calls->instance_ptr = o;
5944
5945         LDKFeeEstimator ret = {
5946                 .this_arg = (void*) calls,
5947                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
5948                 .free = LDKFeeEstimator_JCalls_free,
5949         };
5950         return ret;
5951 }
5952 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
5953         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
5954         *res_ptr = LDKFeeEstimator_init(o);
5955         return tag_ptr(res_ptr, true);
5956 }
5957 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) {
5958         void* this_arg_ptr = untag_ptr(this_arg);
5959         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5960         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
5961         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
5962         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
5963         return ret_conv;
5964 }
5965
5966 typedef struct LDKRouter_JCalls {
5967         atomic_size_t refcnt;
5968         uint32_t instance_ptr;
5969 } LDKRouter_JCalls;
5970 static void LDKRouter_JCalls_free(void* this_arg) {
5971         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
5972         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5973                 FREE(j_calls);
5974         }
5975 }
5976 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, const LDKInFlightHtlcs * inflight_htlcs) {
5977         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
5978         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
5979         memcpy(payer_arr->elems, payer.compressed_form, 33);
5980         LDKRouteParameters route_params_var = *route_params;
5981         uint64_t route_params_ref = 0;
5982         route_params_var = RouteParameters_clone(&route_params_var);
5983         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
5984         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
5985         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
5986         uint64_tArray first_hops_arr = NULL;
5987         if (first_hops != NULL) {
5988                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
5989                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
5990                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
5991                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
5992                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
5993                         uint64_t first_hops_conv_16_ref = 0;
5994                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
5995                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
5996                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
5997                 }
5998         
5999         }
6000         LDKInFlightHtlcs inflight_htlcs_var = *inflight_htlcs;
6001         uint64_t inflight_htlcs_ref = 0;
6002         inflight_htlcs_var = InFlightHtlcs_clone(&inflight_htlcs_var);
6003         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
6004         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
6005         uint64_t ret = js_invoke_function_ububuu(j_calls->instance_ptr, 33, (uint32_t)payer_arr, route_params_ref, (uint32_t)first_hops_arr, inflight_htlcs_ref, 0, 0);
6006         void* ret_ptr = untag_ptr(ret);
6007         CHECK_ACCESS(ret_ptr);
6008         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
6009         FREE(untag_ptr(ret));
6010         return ret_conv;
6011 }
6012 LDKCResult_RouteLightningErrorZ find_route_with_id_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, const LDKInFlightHtlcs * inflight_htlcs, LDKThirtyTwoBytes _payment_hash, LDKThirtyTwoBytes _payment_id) {
6013         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6014         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
6015         memcpy(payer_arr->elems, payer.compressed_form, 33);
6016         LDKRouteParameters route_params_var = *route_params;
6017         uint64_t route_params_ref = 0;
6018         route_params_var = RouteParameters_clone(&route_params_var);
6019         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
6020         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
6021         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
6022         uint64_tArray first_hops_arr = NULL;
6023         if (first_hops != NULL) {
6024                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
6025                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
6026                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
6027                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
6028                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
6029                         uint64_t first_hops_conv_16_ref = 0;
6030                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
6031                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
6032                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
6033                 }
6034         
6035         }
6036         LDKInFlightHtlcs inflight_htlcs_var = *inflight_htlcs;
6037         uint64_t inflight_htlcs_ref = 0;
6038         inflight_htlcs_var = InFlightHtlcs_clone(&inflight_htlcs_var);
6039         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
6040         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
6041         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
6042         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
6043         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
6044         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
6045         uint64_t ret = js_invoke_function_ububuu(j_calls->instance_ptr, 34, (uint32_t)payer_arr, route_params_ref, (uint32_t)first_hops_arr, inflight_htlcs_ref, (uint32_t)_payment_hash_arr, (uint32_t)_payment_id_arr);
6046         void* ret_ptr = untag_ptr(ret);
6047         CHECK_ACCESS(ret_ptr);
6048         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
6049         FREE(untag_ptr(ret));
6050         return ret_conv;
6051 }
6052 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
6053         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
6054         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6055 }
6056 static inline LDKRouter LDKRouter_init (JSValue o) {
6057         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
6058         atomic_init(&calls->refcnt, 1);
6059         calls->instance_ptr = o;
6060
6061         LDKRouter ret = {
6062                 .this_arg = (void*) calls,
6063                 .find_route = find_route_LDKRouter_jcall,
6064                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
6065                 .free = LDKRouter_JCalls_free,
6066         };
6067         return ret;
6068 }
6069 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
6070         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
6071         *res_ptr = LDKRouter_init(o);
6072         return tag_ptr(res_ptr, true);
6073 }
6074 uint64_t  __attribute__((export_name("TS_Router_find_route"))) TS_Router_find_route(uint64_t this_arg, int8_tArray payer, uint64_t route_params, uint64_tArray first_hops, uint64_t inflight_htlcs) {
6075         void* this_arg_ptr = untag_ptr(this_arg);
6076         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6077         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6078         LDKPublicKey payer_ref;
6079         CHECK(payer->arr_len == 33);
6080         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
6081         LDKRouteParameters route_params_conv;
6082         route_params_conv.inner = untag_ptr(route_params);
6083         route_params_conv.is_owned = ptr_is_owned(route_params);
6084         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
6085         route_params_conv.is_owned = false;
6086         LDKCVec_ChannelDetailsZ first_hops_constr;
6087         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
6088         if (first_hops != 0) {
6089                 first_hops_constr.datalen = first_hops->arr_len;
6090                 if (first_hops_constr.datalen > 0)
6091                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6092                 else
6093                         first_hops_constr.data = NULL;
6094                 uint64_t* first_hops_vals = first_hops->elems;
6095                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6096                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6097                         LDKChannelDetails first_hops_conv_16_conv;
6098                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6099                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6100                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6101                         first_hops_conv_16_conv.is_owned = false;
6102                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6103                 }
6104                 FREE(first_hops);
6105                 first_hops_ptr = &first_hops_constr;
6106         }
6107         LDKInFlightHtlcs inflight_htlcs_conv;
6108         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6109         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6110         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6111         inflight_htlcs_conv.is_owned = false;
6112         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6113         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, &inflight_htlcs_conv);
6114         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6115         return tag_ptr(ret_conv, true);
6116 }
6117
6118 uint64_t  __attribute__((export_name("TS_Router_find_route_with_id"))) TS_Router_find_route_with_id(uint64_t this_arg, int8_tArray payer, uint64_t route_params, uint64_tArray first_hops, uint64_t inflight_htlcs, int8_tArray _payment_hash, int8_tArray _payment_id) {
6119         void* this_arg_ptr = untag_ptr(this_arg);
6120         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6121         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6122         LDKPublicKey payer_ref;
6123         CHECK(payer->arr_len == 33);
6124         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
6125         LDKRouteParameters route_params_conv;
6126         route_params_conv.inner = untag_ptr(route_params);
6127         route_params_conv.is_owned = ptr_is_owned(route_params);
6128         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
6129         route_params_conv.is_owned = false;
6130         LDKCVec_ChannelDetailsZ first_hops_constr;
6131         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
6132         if (first_hops != 0) {
6133                 first_hops_constr.datalen = first_hops->arr_len;
6134                 if (first_hops_constr.datalen > 0)
6135                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6136                 else
6137                         first_hops_constr.data = NULL;
6138                 uint64_t* first_hops_vals = first_hops->elems;
6139                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6140                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6141                         LDKChannelDetails first_hops_conv_16_conv;
6142                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6143                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6144                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6145                         first_hops_conv_16_conv.is_owned = false;
6146                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6147                 }
6148                 FREE(first_hops);
6149                 first_hops_ptr = &first_hops_constr;
6150         }
6151         LDKInFlightHtlcs inflight_htlcs_conv;
6152         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6153         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6154         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6155         inflight_htlcs_conv.is_owned = false;
6156         LDKThirtyTwoBytes _payment_hash_ref;
6157         CHECK(_payment_hash->arr_len == 32);
6158         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
6159         LDKThirtyTwoBytes _payment_id_ref;
6160         CHECK(_payment_id->arr_len == 32);
6161         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
6162         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6163         *ret_conv = (this_arg_conv->find_route_with_id)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, &inflight_htlcs_conv, _payment_hash_ref, _payment_id_ref);
6164         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6165         return tag_ptr(ret_conv, true);
6166 }
6167
6168 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6169         return ThirtyTwoBytes_clone(&owner->a);
6170 }
6171 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint64_t owner) {
6172         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
6173         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6174         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
6175         return ret_arr;
6176 }
6177
6178 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6179         LDKChannelManager ret = owner->b;
6180         ret.is_owned = false;
6181         return ret;
6182 }
6183 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint64_t owner) {
6184         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
6185         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
6186         uint64_t ret_ref = 0;
6187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6189         return ret_ref;
6190 }
6191
6192 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6193 CHECK(owner->result_ok);
6194         return &*owner->contents.result;
6195 }
6196 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
6197         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6198         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
6199         return ret_ret;
6200 }
6201
6202 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6203 CHECK(!owner->result_ok);
6204         return DecodeError_clone(&*owner->contents.err);
6205 }
6206 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
6207         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6208         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6209         *ret_copy = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
6210         uint64_t ret_ref = tag_ptr(ret_copy, true);
6211         return ret_ref;
6212 }
6213
6214 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6215         LDKChannelConfig ret = *owner->contents.result;
6216         ret.is_owned = false;
6217         return ret;
6218 }
6219 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
6220         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6221         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
6222         uint64_t ret_ref = 0;
6223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6225         return ret_ref;
6226 }
6227
6228 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6229 CHECK(!owner->result_ok);
6230         return DecodeError_clone(&*owner->contents.err);
6231 }
6232 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
6233         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6234         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6235         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
6236         uint64_t ret_ref = tag_ptr(ret_copy, true);
6237         return ret_ref;
6238 }
6239
6240 uint32_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_ty_from_ptr"))) TS_LDKCOption_APIErrorZ_ty_from_ptr(uint64_t ptr) {
6241         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6242         switch(obj->tag) {
6243                 case LDKCOption_APIErrorZ_Some: return 0;
6244                 case LDKCOption_APIErrorZ_None: return 1;
6245                 default: abort();
6246         }
6247 }
6248 uint64_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_Some_get_some"))) TS_LDKCOption_APIErrorZ_Some_get_some(uint64_t ptr) {
6249         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6250         assert(obj->tag == LDKCOption_APIErrorZ_Some);
6251                         uint64_t some_ref = tag_ptr(&obj->some, false);
6252         return some_ref;
6253 }
6254 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6255 CHECK(owner->result_ok);
6256         return COption_APIErrorZ_clone(&*owner->contents.result);
6257 }
6258 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok(uint64_t owner) {
6259         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6260         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
6261         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
6262         uint64_t ret_ref = tag_ptr(ret_copy, true);
6263         return ret_ref;
6264 }
6265
6266 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6267 CHECK(!owner->result_ok);
6268         return DecodeError_clone(&*owner->contents.err);
6269 }
6270 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_err(uint64_t owner) {
6271         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6272         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6273         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
6274         uint64_t ret_ref = tag_ptr(ret_copy, true);
6275         return ret_ref;
6276 }
6277
6278 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6279         LDKOutPoint ret = *owner->contents.result;
6280         ret.is_owned = false;
6281         return ret;
6282 }
6283 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
6284         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
6285         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
6286         uint64_t ret_ref = 0;
6287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6289         return ret_ref;
6290 }
6291
6292 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6293 CHECK(!owner->result_ok);
6294         return DecodeError_clone(&*owner->contents.err);
6295 }
6296 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
6297         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
6298         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6299         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
6300         uint64_t ret_ref = tag_ptr(ret_copy, true);
6301         return ret_ref;
6302 }
6303
6304 typedef struct LDKType_JCalls {
6305         atomic_size_t refcnt;
6306         uint32_t instance_ptr;
6307 } LDKType_JCalls;
6308 static void LDKType_JCalls_free(void* this_arg) {
6309         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6310         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6311                 FREE(j_calls);
6312         }
6313 }
6314 uint16_t type_id_LDKType_jcall(const void* this_arg) {
6315         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6316         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, 0, 0, 0, 0, 0, 0);
6317 }
6318 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
6319         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6320         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 36, 0, 0, 0, 0, 0, 0);
6321         LDKStr ret_conv = str_ref_to_owned_c(ret);
6322         return ret_conv;
6323 }
6324 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
6325         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6326         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 37, 0, 0, 0, 0, 0, 0);
6327         LDKCVec_u8Z ret_ref;
6328         ret_ref.datalen = ret->arr_len;
6329         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6330         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6331         return ret_ref;
6332 }
6333 static void LDKType_JCalls_cloned(LDKType* new_obj) {
6334         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
6335         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6336 }
6337 static inline LDKType LDKType_init (JSValue o) {
6338         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
6339         atomic_init(&calls->refcnt, 1);
6340         calls->instance_ptr = o;
6341
6342         LDKType ret = {
6343                 .this_arg = (void*) calls,
6344                 .type_id = type_id_LDKType_jcall,
6345                 .debug_str = debug_str_LDKType_jcall,
6346                 .write = write_LDKType_jcall,
6347                 .cloned = LDKType_JCalls_cloned,
6348                 .free = LDKType_JCalls_free,
6349         };
6350         return ret;
6351 }
6352 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
6353         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
6354         *res_ptr = LDKType_init(o);
6355         return tag_ptr(res_ptr, true);
6356 }
6357 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
6358         void* this_arg_ptr = untag_ptr(this_arg);
6359         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6360         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6361         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
6362         return ret_conv;
6363 }
6364
6365 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
6366         void* this_arg_ptr = untag_ptr(this_arg);
6367         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6368         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6369         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
6370         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6371         Str_free(ret_str);
6372         return ret_conv;
6373 }
6374
6375 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
6376         void* this_arg_ptr = untag_ptr(this_arg);
6377         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6378         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6379         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6380         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6381         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6382         CVec_u8Z_free(ret_var);
6383         return ret_arr;
6384 }
6385
6386 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
6387         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
6388         switch(obj->tag) {
6389                 case LDKCOption_TypeZ_Some: return 0;
6390                 case LDKCOption_TypeZ_None: return 1;
6391                 default: abort();
6392         }
6393 }
6394 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
6395         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
6396         assert(obj->tag == LDKCOption_TypeZ_Some);
6397                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
6398                         *some_ret = Type_clone(&obj->some);
6399         return tag_ptr(some_ret, true);
6400 }
6401 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6402 CHECK(owner->result_ok);
6403         return COption_TypeZ_clone(&*owner->contents.result);
6404 }
6405 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
6406         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
6407         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
6408         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
6409         uint64_t ret_ref = tag_ptr(ret_copy, true);
6410         return ret_ref;
6411 }
6412
6413 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6414 CHECK(!owner->result_ok);
6415         return DecodeError_clone(&*owner->contents.err);
6416 }
6417 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
6418         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
6419         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6420         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
6421         uint64_t ret_ref = tag_ptr(ret_copy, true);
6422         return ret_ref;
6423 }
6424
6425 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint64_t ptr) {
6426         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
6427         switch(obj->tag) {
6428                 case LDKPaymentError_Invoice: return 0;
6429                 case LDKPaymentError_Sending: return 1;
6430                 default: abort();
6431         }
6432 }
6433 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint64_t ptr) {
6434         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
6435         assert(obj->tag == LDKPaymentError_Invoice);
6436                         LDKStr invoice_str = obj->invoice;
6437                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
6438         return invoice_conv;
6439 }
6440 uint32_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) {
6441         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
6442         assert(obj->tag == LDKPaymentError_Sending);
6443                         uint32_t sending_conv = LDKRetryableSendFailure_to_js(obj->sending);
6444         return sending_conv;
6445 }
6446 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6447 CHECK(owner->result_ok);
6448         return ThirtyTwoBytes_clone(&*owner->contents.result);
6449 }
6450 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint64_t owner) {
6451         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
6452         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6453         memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
6454         return ret_arr;
6455 }
6456
6457 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6458 CHECK(!owner->result_ok);
6459         return PaymentError_clone(&*owner->contents.err);
6460 }
6461 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint64_t owner) {
6462         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
6463         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
6464         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
6465         uint64_t ret_ref = tag_ptr(ret_copy, true);
6466         return ret_ref;
6467 }
6468
6469 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
6470 CHECK(owner->result_ok);
6471         return *owner->contents.result;
6472 }
6473 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_ok"))) TS_CResult_NonePaymentErrorZ_get_ok(uint64_t owner) {
6474         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
6475         CResult_NonePaymentErrorZ_get_ok(owner_conv);
6476 }
6477
6478 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
6479 CHECK(!owner->result_ok);
6480         return PaymentError_clone(&*owner->contents.err);
6481 }
6482 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_err"))) TS_CResult_NonePaymentErrorZ_get_err(uint64_t owner) {
6483         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
6484         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
6485         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
6486         uint64_t ret_ref = tag_ptr(ret_copy, true);
6487         return ret_ref;
6488 }
6489
6490 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6491 CHECK(owner->result_ok);
6492         return *owner->contents.result;
6493 }
6494 jstring  __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint64_t owner) {
6495         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
6496         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
6497         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6498         return ret_conv;
6499 }
6500
6501 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6502 CHECK(!owner->result_ok);
6503         return *owner->contents.err;
6504 }
6505 uint32_t  __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint64_t owner) {
6506         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
6507         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
6508         return ret_conv;
6509 }
6510
6511 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
6512 CHECK(owner->result_ok);
6513         return *owner->contents.result;
6514 }
6515 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint64_t owner) {
6516         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
6517         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6518         memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
6519         return ret_arr;
6520 }
6521
6522 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
6523 CHECK(!owner->result_ok);
6524         return *owner->contents.err;
6525 }
6526 uint32_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint64_t owner) {
6527         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
6528         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
6529         return ret_conv;
6530 }
6531
6532 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6533         LDKChannelMonitorUpdate ret = *owner->contents.result;
6534         ret.is_owned = false;
6535         return ret;
6536 }
6537 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6538         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6539         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
6540         uint64_t ret_ref = 0;
6541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6543         return ret_ref;
6544 }
6545
6546 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6547 CHECK(!owner->result_ok);
6548         return DecodeError_clone(&*owner->contents.err);
6549 }
6550 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
6551         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6552         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6553         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6554         uint64_t ret_ref = tag_ptr(ret_copy, true);
6555         return ret_ref;
6556 }
6557
6558 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
6559         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6560         switch(obj->tag) {
6561                 case LDKCOption_MonitorEventZ_Some: return 0;
6562                 case LDKCOption_MonitorEventZ_None: return 1;
6563                 default: abort();
6564         }
6565 }
6566 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
6567         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6568         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
6569                         uint64_t some_ref = tag_ptr(&obj->some, false);
6570         return some_ref;
6571 }
6572 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6573 CHECK(owner->result_ok);
6574         return COption_MonitorEventZ_clone(&*owner->contents.result);
6575 }
6576 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
6577         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6578         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6579         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6580         uint64_t ret_ref = tag_ptr(ret_copy, true);
6581         return ret_ref;
6582 }
6583
6584 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6585 CHECK(!owner->result_ok);
6586         return DecodeError_clone(&*owner->contents.err);
6587 }
6588 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
6589         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6590         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6591         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6592         uint64_t ret_ref = tag_ptr(ret_copy, true);
6593         return ret_ref;
6594 }
6595
6596 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6597         LDKHTLCUpdate ret = *owner->contents.result;
6598         ret.is_owned = false;
6599         return ret;
6600 }
6601 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6602         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6603         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6604         uint64_t ret_ref = 0;
6605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6607         return ret_ref;
6608 }
6609
6610 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6611 CHECK(!owner->result_ok);
6612         return DecodeError_clone(&*owner->contents.err);
6613 }
6614 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
6615         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6616         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6617         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6618         uint64_t ret_ref = tag_ptr(ret_copy, true);
6619         return ret_ref;
6620 }
6621
6622 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6623         LDKOutPoint ret = owner->a;
6624         ret.is_owned = false;
6625         return ret;
6626 }
6627 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint64_t owner) {
6628         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6629         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
6630         uint64_t ret_ref = 0;
6631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6633         return ret_ref;
6634 }
6635
6636 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6637         return CVec_u8Z_clone(&owner->b);
6638 }
6639 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint64_t owner) {
6640         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6641         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
6642         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6643         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6644         CVec_u8Z_free(ret_var);
6645         return ret_arr;
6646 }
6647
6648 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6649         return owner->a;
6650 }
6651 int32_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint64_t owner) {
6652         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6653         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
6654         return ret_conv;
6655 }
6656
6657 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6658         return CVec_u8Z_clone(&owner->b);
6659 }
6660 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint64_t owner) {
6661         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6662         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
6663         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6664         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6665         CVec_u8Z_free(ret_var);
6666         return ret_arr;
6667 }
6668
6669 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
6670         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
6671         for (size_t i = 0; i < ret.datalen; i++) {
6672                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
6673         }
6674         return ret;
6675 }
6676 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6677         return ThirtyTwoBytes_clone(&owner->a);
6678 }
6679 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint64_t owner) {
6680         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6681         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6682         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
6683         return ret_arr;
6684 }
6685
6686 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6687         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
6688 }
6689 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint64_t owner) {
6690         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6691         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
6692         uint64_tArray ret_arr = NULL;
6693         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6694         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6695         for (size_t v = 0; v < ret_var.datalen; v++) {
6696                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6697                 *ret_conv_21_conv = ret_var.data[v];
6698                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
6699         }
6700         
6701         FREE(ret_var.data);
6702         return ret_arr;
6703 }
6704
6705 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
6706         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 };
6707         for (size_t i = 0; i < ret.datalen; i++) {
6708                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
6709         }
6710         return ret;
6711 }
6712 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
6713         LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
6714         for (size_t i = 0; i < ret.datalen; i++) {
6715                 ret.data[i] = Event_clone(&orig->data[i]);
6716         }
6717         return ret;
6718 }
6719 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6720         return owner->a;
6721 }
6722 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
6723         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6724         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6725         return ret_conv;
6726 }
6727
6728 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6729         return TxOut_clone(&owner->b);
6730 }
6731 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
6732         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6733         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6734         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6735         return tag_ptr(ret_ref, true);
6736 }
6737
6738 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6739         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6740         for (size_t i = 0; i < ret.datalen; i++) {
6741                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6742         }
6743         return ret;
6744 }
6745 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6746         return ThirtyTwoBytes_clone(&owner->a);
6747 }
6748 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
6749         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6750         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6751         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6752         return ret_arr;
6753 }
6754
6755 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6756         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6757 }
6758 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
6759         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6760         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6761         uint64_tArray ret_arr = NULL;
6762         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6763         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6764         for (size_t u = 0; u < ret_var.datalen; u++) {
6765                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6766                 *ret_conv_20_conv = ret_var.data[u];
6767                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
6768         }
6769         
6770         FREE(ret_var.data);
6771         return ret_arr;
6772 }
6773
6774 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
6775         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 };
6776         for (size_t i = 0; i < ret.datalen; i++) {
6777                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6778         }
6779         return ret;
6780 }
6781 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
6782         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6783         switch(obj->tag) {
6784                 case LDKBalance_ClaimableOnChannelClose: return 0;
6785                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6786                 case LDKBalance_ContentiousClaimable: return 2;
6787                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
6788                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
6789                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
6790                 default: abort();
6791         }
6792 }
6793 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint64_t ptr) {
6794         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6795         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6796                         int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
6797         return claimable_amount_satoshis_conv;
6798 }
6799 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint64_t ptr) {
6800         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6801         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6802                         int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
6803         return claimable_amount_satoshis_conv;
6804 }
6805 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
6806         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6807         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6808                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
6809         return confirmation_height_conv;
6810 }
6811 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
6812         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6813         assert(obj->tag == LDKBalance_ContentiousClaimable);
6814                         int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
6815         return claimable_amount_satoshis_conv;
6816 }
6817 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
6818         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6819         assert(obj->tag == LDKBalance_ContentiousClaimable);
6820                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
6821         return timeout_height_conv;
6822 }
6823 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
6824         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6825         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6826                         int64_t claimable_amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.claimable_amount_satoshis;
6827         return claimable_amount_satoshis_conv;
6828 }
6829 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
6830         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6831         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6832                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
6833         return claimable_height_conv;
6834 }
6835 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
6836         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6837         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6838                         int64_t claimable_amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.claimable_amount_satoshis;
6839         return claimable_amount_satoshis_conv;
6840 }
6841 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
6842         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6843         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6844                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
6845         return expiry_height_conv;
6846 }
6847 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
6848         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6849         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
6850                         int64_t claimable_amount_satoshis_conv = obj->counterparty_revoked_output_claimable.claimable_amount_satoshis;
6851         return claimable_amount_satoshis_conv;
6852 }
6853 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6854         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6855         for (size_t i = 0; i < ret.datalen; i++) {
6856                 ret.data[i] = Balance_clone(&orig->data[i]);
6857         }
6858         return ret;
6859 }
6860 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6861         return ThirtyTwoBytes_clone(&owner->a);
6862 }
6863 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint64_t owner) {
6864         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6865         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6866         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
6867         return ret_arr;
6868 }
6869
6870 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6871         LDKChannelMonitor ret = owner->b;
6872         ret.is_owned = false;
6873         return ret;
6874 }
6875 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint64_t owner) {
6876         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6877         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
6878         uint64_t ret_ref = 0;
6879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6881         return ret_ref;
6882 }
6883
6884 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6885 CHECK(owner->result_ok);
6886         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
6887 }
6888 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
6889         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6890         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6891         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6892         return tag_ptr(ret_conv, true);
6893 }
6894
6895 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6896 CHECK(!owner->result_ok);
6897         return DecodeError_clone(&*owner->contents.err);
6898 }
6899 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
6900         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6901         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6902         *ret_copy = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6903         uint64_t ret_ref = tag_ptr(ret_copy, true);
6904         return ret_ref;
6905 }
6906
6907 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6908         return owner->a;
6909 }
6910 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
6911         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6912         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6913         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
6914         return ret_arr;
6915 }
6916
6917 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6918         return Type_clone(&owner->b);
6919 }
6920 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
6921         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6922         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6923         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6924         return tag_ptr(ret_ret, true);
6925 }
6926
6927 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6928         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6929         for (size_t i = 0; i < ret.datalen; i++) {
6930                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6931         }
6932         return ret;
6933 }
6934 typedef struct LDKCustomOnionMessageContents_JCalls {
6935         atomic_size_t refcnt;
6936         uint32_t instance_ptr;
6937 } LDKCustomOnionMessageContents_JCalls;
6938 static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) {
6939         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6940         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6941                 FREE(j_calls);
6942         }
6943 }
6944 uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
6945         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6946         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 38, 0, 0, 0, 0, 0, 0);
6947 }
6948 LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
6949         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6950         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 39, 0, 0, 0, 0, 0, 0);
6951         LDKCVec_u8Z ret_ref;
6952         ret_ref.datalen = ret->arr_len;
6953         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6954         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6955         return ret_ref;
6956 }
6957 static void LDKCustomOnionMessageContents_JCalls_cloned(LDKCustomOnionMessageContents* new_obj) {
6958         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) new_obj->this_arg;
6959         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6960 }
6961 static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init (JSValue o) {
6962         LDKCustomOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageContents_JCalls), "LDKCustomOnionMessageContents_JCalls");
6963         atomic_init(&calls->refcnt, 1);
6964         calls->instance_ptr = o;
6965
6966         LDKCustomOnionMessageContents ret = {
6967                 .this_arg = (void*) calls,
6968                 .tlv_type = tlv_type_LDKCustomOnionMessageContents_jcall,
6969                 .write = write_LDKCustomOnionMessageContents_jcall,
6970                 .cloned = LDKCustomOnionMessageContents_JCalls_cloned,
6971                 .free = LDKCustomOnionMessageContents_JCalls_free,
6972         };
6973         return ret;
6974 }
6975 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageContents_new"))) TS_LDKCustomOnionMessageContents_new(JSValue o) {
6976         LDKCustomOnionMessageContents *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
6977         *res_ptr = LDKCustomOnionMessageContents_init(o);
6978         return tag_ptr(res_ptr, true);
6979 }
6980 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_tlv_type"))) TS_CustomOnionMessageContents_tlv_type(uint64_t this_arg) {
6981         void* this_arg_ptr = untag_ptr(this_arg);
6982         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6983         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
6984         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
6985         return ret_conv;
6986 }
6987
6988 int8_tArray  __attribute__((export_name("TS_CustomOnionMessageContents_write"))) TS_CustomOnionMessageContents_write(uint64_t this_arg) {
6989         void* this_arg_ptr = untag_ptr(this_arg);
6990         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6991         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
6992         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6993         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6994         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6995         CVec_u8Z_free(ret_var);
6996         return ret_arr;
6997 }
6998
6999 uint32_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
7000         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
7001         switch(obj->tag) {
7002                 case LDKCOption_CustomOnionMessageContentsZ_Some: return 0;
7003                 case LDKCOption_CustomOnionMessageContentsZ_None: return 1;
7004                 default: abort();
7005         }
7006 }
7007 uint64_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some(uint64_t ptr) {
7008         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
7009         assert(obj->tag == LDKCOption_CustomOnionMessageContentsZ_Some);
7010                         LDKCustomOnionMessageContents* some_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
7011                         *some_ret = CustomOnionMessageContents_clone(&obj->some);
7012         return tag_ptr(some_ret, true);
7013 }
7014 static inline struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
7015 CHECK(owner->result_ok);
7016         return COption_CustomOnionMessageContentsZ_clone(&*owner->contents.result);
7017 }
7018 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
7019         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
7020         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
7021         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
7022         uint64_t ret_ref = tag_ptr(ret_copy, true);
7023         return ret_ref;
7024 }
7025
7026 static inline struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
7027 CHECK(!owner->result_ok);
7028         return DecodeError_clone(&*owner->contents.err);
7029 }
7030 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
7031         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
7032         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7033         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
7034         uint64_t ret_ref = tag_ptr(ret_copy, true);
7035         return ret_ref;
7036 }
7037
7038 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_ty_from_ptr"))) TS_LDKCOption_NetAddressZ_ty_from_ptr(uint64_t ptr) {
7039         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
7040         switch(obj->tag) {
7041                 case LDKCOption_NetAddressZ_Some: return 0;
7042                 case LDKCOption_NetAddressZ_None: return 1;
7043                 default: abort();
7044         }
7045 }
7046 uint64_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) TS_LDKCOption_NetAddressZ_Some_get_some(uint64_t ptr) {
7047         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
7048         assert(obj->tag == LDKCOption_NetAddressZ_Some);
7049                         uint64_t some_ref = tag_ptr(&obj->some, false);
7050         return some_ref;
7051 }
7052 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){
7053         return owner->a;
7054 }
7055 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_a"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(uint64_t owner) {
7056         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner);
7057         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
7058         memcpy(ret_arr->elems, C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(owner_conv).compressed_form, 33);
7059         return ret_arr;
7060 }
7061
7062 static inline struct LDKCOption_NetAddressZ C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){
7063         return COption_NetAddressZ_clone(&owner->b);
7064 }
7065 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_b"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(uint64_t owner) {
7066         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner);
7067         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
7068         *ret_copy = C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(owner_conv);
7069         uint64_t ret_ref = tag_ptr(ret_copy, true);
7070         return ret_ref;
7071 }
7072
7073 static inline LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ *orig) {
7074         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ clone bytes"), .datalen = orig->datalen };
7075         for (size_t i = 0; i < ret.datalen; i++) {
7076                 ret.data[i] = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(&orig->data[i]);
7077         }
7078         return ret;
7079 }
7080 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7081 CHECK(owner->result_ok);
7082         return CVec_u8Z_clone(&*owner->contents.result);
7083 }
7084 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
7085         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7086         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
7087         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7088         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7089         CVec_u8Z_free(ret_var);
7090         return ret_arr;
7091 }
7092
7093 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7094         LDKPeerHandleError ret = *owner->contents.err;
7095         ret.is_owned = false;
7096         return ret;
7097 }
7098 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
7099         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7100         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
7101         uint64_t ret_ref = 0;
7102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7104         return ret_ref;
7105 }
7106
7107 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7108 CHECK(owner->result_ok);
7109         return *owner->contents.result;
7110 }
7111 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
7112         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7113         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
7114 }
7115
7116 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7117         LDKPeerHandleError ret = *owner->contents.err;
7118         ret.is_owned = false;
7119         return ret;
7120 }
7121 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
7122         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7123         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
7124         uint64_t ret_ref = 0;
7125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7127         return ret_ref;
7128 }
7129
7130 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7131 CHECK(owner->result_ok);
7132         return *owner->contents.result;
7133 }
7134 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
7135         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7136         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
7137         return ret_conv;
7138 }
7139
7140 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7141         LDKPeerHandleError ret = *owner->contents.err;
7142         ret.is_owned = false;
7143         return ret;
7144 }
7145 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
7146         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7147         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
7148         uint64_t ret_ref = 0;
7149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7151         return ret_ref;
7152 }
7153
7154 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
7155         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
7156         switch(obj->tag) {
7157                 case LDKSendError_Secp256k1: return 0;
7158                 case LDKSendError_TooBigPacket: return 1;
7159                 case LDKSendError_TooFewBlindedHops: return 2;
7160                 case LDKSendError_InvalidFirstHop: return 3;
7161                 case LDKSendError_InvalidMessage: return 4;
7162                 case LDKSendError_BufferFull: return 5;
7163                 case LDKSendError_GetNodeIdFailed: return 6;
7164                 case LDKSendError_BlindedPathAdvanceFailed: return 7;
7165                 default: abort();
7166         }
7167 }
7168 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
7169         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
7170         assert(obj->tag == LDKSendError_Secp256k1);
7171                         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
7172         return secp256k1_conv;
7173 }
7174 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
7175 CHECK(owner->result_ok);
7176         return *owner->contents.result;
7177 }
7178 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_ok"))) TS_CResult_NoneSendErrorZ_get_ok(uint64_t owner) {
7179         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
7180         CResult_NoneSendErrorZ_get_ok(owner_conv);
7181 }
7182
7183 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
7184 CHECK(!owner->result_ok);
7185         return SendError_clone(&*owner->contents.err);
7186 }
7187 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_err"))) TS_CResult_NoneSendErrorZ_get_err(uint64_t owner) {
7188         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
7189         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
7190         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
7191         uint64_t ret_ref = tag_ptr(ret_copy, true);
7192         return ret_ref;
7193 }
7194
7195 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
7196         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7197         switch(obj->tag) {
7198                 case LDKGraphSyncError_DecodeError: return 0;
7199                 case LDKGraphSyncError_LightningError: return 1;
7200                 default: abort();
7201         }
7202 }
7203 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
7204         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7205         assert(obj->tag == LDKGraphSyncError_DecodeError);
7206                         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
7207         return decode_error_ref;
7208 }
7209 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
7210         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7211         assert(obj->tag == LDKGraphSyncError_LightningError);
7212                         LDKLightningError lightning_error_var = obj->lightning_error;
7213                         uint64_t lightning_error_ref = 0;
7214                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
7215                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
7216         return lightning_error_ref;
7217 }
7218 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7219 CHECK(owner->result_ok);
7220         return *owner->contents.result;
7221 }
7222 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
7223         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7224         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
7225         return ret_conv;
7226 }
7227
7228 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7229 CHECK(!owner->result_ok);
7230         return GraphSyncError_clone(&*owner->contents.err);
7231 }
7232 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
7233         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7234         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
7235         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
7236         uint64_t ret_ref = tag_ptr(ret_copy, true);
7237         return ret_ref;
7238 }
7239
7240 uint32_t __attribute__((export_name("TS_LDKParseError_ty_from_ptr"))) TS_LDKParseError_ty_from_ptr(uint64_t ptr) {
7241         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
7242         switch(obj->tag) {
7243                 case LDKParseError_Bech32Error: return 0;
7244                 case LDKParseError_ParseAmountError: return 1;
7245                 case LDKParseError_MalformedSignature: return 2;
7246                 case LDKParseError_BadPrefix: return 3;
7247                 case LDKParseError_UnknownCurrency: return 4;
7248                 case LDKParseError_UnknownSiPrefix: return 5;
7249                 case LDKParseError_MalformedHRP: return 6;
7250                 case LDKParseError_TooShortDataPart: return 7;
7251                 case LDKParseError_UnexpectedEndOfTaggedFields: return 8;
7252                 case LDKParseError_DescriptionDecodeError: return 9;
7253                 case LDKParseError_PaddingError: return 10;
7254                 case LDKParseError_IntegerOverflowError: return 11;
7255                 case LDKParseError_InvalidSegWitProgramLength: return 12;
7256                 case LDKParseError_InvalidPubKeyHashLength: return 13;
7257                 case LDKParseError_InvalidScriptHashLength: return 14;
7258                 case LDKParseError_InvalidRecoveryId: return 15;
7259                 case LDKParseError_InvalidSliceLength: return 16;
7260                 case LDKParseError_Skip: return 17;
7261                 default: abort();
7262         }
7263 }
7264 uint64_t __attribute__((export_name("TS_LDKParseError_Bech32Error_get_bech32_error"))) TS_LDKParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
7265         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
7266         assert(obj->tag == LDKParseError_Bech32Error);
7267                         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
7268         return bech32_error_ref;
7269 }
7270 int32_t __attribute__((export_name("TS_LDKParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
7271         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
7272         assert(obj->tag == LDKParseError_ParseAmountError);
7273                         /*obj->parse_amount_error*/
7274         return 0;
7275 }
7276 uint32_t __attribute__((export_name("TS_LDKParseError_MalformedSignature_get_malformed_signature"))) TS_LDKParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
7277         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
7278         assert(obj->tag == LDKParseError_MalformedSignature);
7279                         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
7280         return malformed_signature_conv;
7281 }
7282 int32_t __attribute__((export_name("TS_LDKParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
7283         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
7284         assert(obj->tag == LDKParseError_DescriptionDecodeError);
7285                         /*obj->description_decode_error*/
7286         return 0;
7287 }
7288 jstring __attribute__((export_name("TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
7289         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
7290         assert(obj->tag == LDKParseError_InvalidSliceLength);
7291                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
7292                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
7293         return invalid_slice_length_conv;
7294 }
7295 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
7296 CHECK(owner->result_ok);
7297         return SiPrefix_clone(&*owner->contents.result);
7298 }
7299 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_ok"))) TS_CResult_SiPrefixParseErrorZ_get_ok(uint64_t owner) {
7300         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
7301         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
7302         return ret_conv;
7303 }
7304
7305 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
7306 CHECK(!owner->result_ok);
7307         return ParseError_clone(&*owner->contents.err);
7308 }
7309 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_err"))) TS_CResult_SiPrefixParseErrorZ_get_err(uint64_t owner) {
7310         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
7311         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7312         *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
7313         uint64_t ret_ref = tag_ptr(ret_copy, true);
7314         return ret_ref;
7315 }
7316
7317 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
7318         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
7319         switch(obj->tag) {
7320                 case LDKParseOrSemanticError_ParseError: return 0;
7321                 case LDKParseOrSemanticError_SemanticError: return 1;
7322                 default: abort();
7323         }
7324 }
7325 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
7326         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
7327         assert(obj->tag == LDKParseOrSemanticError_ParseError);
7328                         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
7329         return parse_error_ref;
7330 }
7331 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
7332         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
7333         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
7334                         uint32_t semantic_error_conv = LDKSemanticError_to_js(obj->semantic_error);
7335         return semantic_error_conv;
7336 }
7337 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7338         LDKInvoice ret = *owner->contents.result;
7339         ret.is_owned = false;
7340         return ret;
7341 }
7342 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
7343         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
7344         LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
7345         uint64_t ret_ref = 0;
7346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7348         return ret_ref;
7349 }
7350
7351 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7352 CHECK(!owner->result_ok);
7353         return ParseOrSemanticError_clone(&*owner->contents.err);
7354 }
7355 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
7356         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
7357         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
7358         *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
7359         uint64_t ret_ref = tag_ptr(ret_copy, true);
7360         return ret_ref;
7361 }
7362
7363 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7364         LDKSignedRawInvoice ret = *owner->contents.result;
7365         ret.is_owned = false;
7366         return ret;
7367 }
7368 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_ok(uint64_t owner) {
7369         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
7370         LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
7371         uint64_t ret_ref = 0;
7372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7374         return ret_ref;
7375 }
7376
7377 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7378 CHECK(!owner->result_ok);
7379         return ParseError_clone(&*owner->contents.err);
7380 }
7381 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_err(uint64_t owner) {
7382         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
7383         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7384         *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
7385         uint64_t ret_ref = tag_ptr(ret_copy, true);
7386         return ret_ref;
7387 }
7388
7389 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7390         LDKRawInvoice ret = owner->a;
7391         ret.is_owned = false;
7392         return ret;
7393 }
7394 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint64_t owner) {
7395         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
7396         LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
7397         uint64_t ret_ref = 0;
7398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7400         return ret_ref;
7401 }
7402
7403 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7404         return ThirtyTwoBytes_clone(&owner->b);
7405 }
7406 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint64_t owner) {
7407         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
7408         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7409         memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32);
7410         return ret_arr;
7411 }
7412
7413 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7414         LDKInvoiceSignature ret = owner->c;
7415         ret.is_owned = false;
7416         return ret;
7417 }
7418 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint64_t owner) {
7419         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
7420         LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
7421         uint64_t ret_ref = 0;
7422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7424         return ret_ref;
7425 }
7426
7427 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
7428         LDKPayeePubKey ret = *owner->contents.result;
7429         ret.is_owned = false;
7430         return ret;
7431 }
7432 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint64_t owner) {
7433         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
7434         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
7435         uint64_t ret_ref = 0;
7436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7438         return ret_ref;
7439 }
7440
7441 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
7442 CHECK(!owner->result_ok);
7443         return *owner->contents.err;
7444 }
7445 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint64_t owner) {
7446         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
7447         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
7448         return ret_conv;
7449 }
7450
7451 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
7452         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
7453         for (size_t i = 0; i < ret.datalen; i++) {
7454                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
7455         }
7456         return ret;
7457 }
7458 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
7459         LDKPositiveTimestamp ret = *owner->contents.result;
7460         ret.is_owned = false;
7461         return ret;
7462 }
7463 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
7464         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
7465         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
7466         uint64_t ret_ref = 0;
7467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7469         return ret_ref;
7470 }
7471
7472 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
7473 CHECK(!owner->result_ok);
7474         return CreationError_clone(&*owner->contents.err);
7475 }
7476 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
7477         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
7478         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
7479         return ret_conv;
7480 }
7481
7482 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
7483 CHECK(owner->result_ok);
7484         return *owner->contents.result;
7485 }
7486 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint64_t owner) {
7487         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
7488         CResult_NoneSemanticErrorZ_get_ok(owner_conv);
7489 }
7490
7491 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
7492 CHECK(!owner->result_ok);
7493         return SemanticError_clone(&*owner->contents.err);
7494 }
7495 uint32_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint64_t owner) {
7496         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
7497         uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv));
7498         return ret_conv;
7499 }
7500
7501 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
7502         LDKInvoice ret = *owner->contents.result;
7503         ret.is_owned = false;
7504         return ret;
7505 }
7506 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint64_t owner) {
7507         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
7508         LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
7509         uint64_t ret_ref = 0;
7510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7512         return ret_ref;
7513 }
7514
7515 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
7516 CHECK(!owner->result_ok);
7517         return SemanticError_clone(&*owner->contents.err);
7518 }
7519 uint32_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint64_t owner) {
7520         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
7521         uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
7522         return ret_conv;
7523 }
7524
7525 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
7526         LDKDescription ret = *owner->contents.result;
7527         ret.is_owned = false;
7528         return ret;
7529 }
7530 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
7531         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
7532         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
7533         uint64_t ret_ref = 0;
7534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7536         return ret_ref;
7537 }
7538
7539 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
7540 CHECK(!owner->result_ok);
7541         return CreationError_clone(&*owner->contents.err);
7542 }
7543 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
7544         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
7545         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
7546         return ret_conv;
7547 }
7548
7549 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
7550         LDKPrivateRoute ret = *owner->contents.result;
7551         ret.is_owned = false;
7552         return ret;
7553 }
7554 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
7555         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
7556         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
7557         uint64_t ret_ref = 0;
7558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7560         return ret_ref;
7561 }
7562
7563 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
7564 CHECK(!owner->result_ok);
7565         return CreationError_clone(&*owner->contents.err);
7566 }
7567 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
7568         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
7569         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
7570         return ret_conv;
7571 }
7572
7573 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
7574 CHECK(owner->result_ok);
7575         return *owner->contents.result;
7576 }
7577 void  __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint64_t owner) {
7578         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
7579         CResult_NoneErrorZ_get_ok(owner_conv);
7580 }
7581
7582 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
7583 CHECK(!owner->result_ok);
7584         return *owner->contents.err;
7585 }
7586 uint32_t  __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint64_t owner) {
7587         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
7588         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv));
7589         return ret_conv;
7590 }
7591
7592 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
7593 CHECK(owner->result_ok);
7594         return NetAddress_clone(&*owner->contents.result);
7595 }
7596 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint64_t owner) {
7597         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
7598         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
7599         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
7600         uint64_t ret_ref = tag_ptr(ret_copy, true);
7601         return ret_ref;
7602 }
7603
7604 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
7605 CHECK(!owner->result_ok);
7606         return DecodeError_clone(&*owner->contents.err);
7607 }
7608 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint64_t owner) {
7609         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
7610         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7611         *ret_copy = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
7612         uint64_t ret_ref = tag_ptr(ret_copy, true);
7613         return ret_ref;
7614 }
7615
7616 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
7617         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
7618         for (size_t i = 0; i < ret.datalen; i++) {
7619                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
7620         }
7621         return ret;
7622 }
7623 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
7624         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
7625         for (size_t i = 0; i < ret.datalen; i++) {
7626                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
7627         }
7628         return ret;
7629 }
7630 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
7631         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
7632         for (size_t i = 0; i < ret.datalen; i++) {
7633                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
7634         }
7635         return ret;
7636 }
7637 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
7638         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
7639         for (size_t i = 0; i < ret.datalen; i++) {
7640                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
7641         }
7642         return ret;
7643 }
7644 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7645         LDKAcceptChannel ret = *owner->contents.result;
7646         ret.is_owned = false;
7647         return ret;
7648 }
7649 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
7650         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7651         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
7652         uint64_t ret_ref = 0;
7653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7655         return ret_ref;
7656 }
7657
7658 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7659 CHECK(!owner->result_ok);
7660         return DecodeError_clone(&*owner->contents.err);
7661 }
7662 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
7663         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7664         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7665         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
7666         uint64_t ret_ref = tag_ptr(ret_copy, true);
7667         return ret_ref;
7668 }
7669
7670 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7671         LDKAnnouncementSignatures ret = *owner->contents.result;
7672         ret.is_owned = false;
7673         return ret;
7674 }
7675 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
7676         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7677         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
7678         uint64_t ret_ref = 0;
7679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7681         return ret_ref;
7682 }
7683
7684 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7685 CHECK(!owner->result_ok);
7686         return DecodeError_clone(&*owner->contents.err);
7687 }
7688 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
7689         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7690         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7691         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
7692         uint64_t ret_ref = tag_ptr(ret_copy, true);
7693         return ret_ref;
7694 }
7695
7696 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7697         LDKChannelReestablish ret = *owner->contents.result;
7698         ret.is_owned = false;
7699         return ret;
7700 }
7701 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
7702         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7703         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
7704         uint64_t ret_ref = 0;
7705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7707         return ret_ref;
7708 }
7709
7710 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7711 CHECK(!owner->result_ok);
7712         return DecodeError_clone(&*owner->contents.err);
7713 }
7714 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
7715         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7716         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7717         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
7718         uint64_t ret_ref = tag_ptr(ret_copy, true);
7719         return ret_ref;
7720 }
7721
7722 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7723         LDKClosingSigned ret = *owner->contents.result;
7724         ret.is_owned = false;
7725         return ret;
7726 }
7727 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7728         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7729         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
7730         uint64_t ret_ref = 0;
7731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7733         return ret_ref;
7734 }
7735
7736 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7737 CHECK(!owner->result_ok);
7738         return DecodeError_clone(&*owner->contents.err);
7739 }
7740 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
7741         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7742         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7743         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
7744         uint64_t ret_ref = tag_ptr(ret_copy, true);
7745         return ret_ref;
7746 }
7747
7748 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7749         LDKClosingSignedFeeRange ret = *owner->contents.result;
7750         ret.is_owned = false;
7751         return ret;
7752 }
7753 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
7754         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7755         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
7756         uint64_t ret_ref = 0;
7757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7759         return ret_ref;
7760 }
7761
7762 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7763 CHECK(!owner->result_ok);
7764         return DecodeError_clone(&*owner->contents.err);
7765 }
7766 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
7767         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7768         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7769         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
7770         uint64_t ret_ref = tag_ptr(ret_copy, true);
7771         return ret_ref;
7772 }
7773
7774 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7775         LDKCommitmentSigned ret = *owner->contents.result;
7776         ret.is_owned = false;
7777         return ret;
7778 }
7779 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
7780         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7781         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
7782         uint64_t ret_ref = 0;
7783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7785         return ret_ref;
7786 }
7787
7788 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7789 CHECK(!owner->result_ok);
7790         return DecodeError_clone(&*owner->contents.err);
7791 }
7792 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
7793         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7794         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7795         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
7796         uint64_t ret_ref = tag_ptr(ret_copy, true);
7797         return ret_ref;
7798 }
7799
7800 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7801         LDKFundingCreated ret = *owner->contents.result;
7802         ret.is_owned = false;
7803         return ret;
7804 }
7805 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
7806         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7807         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
7808         uint64_t ret_ref = 0;
7809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7811         return ret_ref;
7812 }
7813
7814 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7815 CHECK(!owner->result_ok);
7816         return DecodeError_clone(&*owner->contents.err);
7817 }
7818 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
7819         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7820         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7821         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
7822         uint64_t ret_ref = tag_ptr(ret_copy, true);
7823         return ret_ref;
7824 }
7825
7826 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7827         LDKFundingSigned ret = *owner->contents.result;
7828         ret.is_owned = false;
7829         return ret;
7830 }
7831 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7832         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7833         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
7834         uint64_t ret_ref = 0;
7835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7837         return ret_ref;
7838 }
7839
7840 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7841 CHECK(!owner->result_ok);
7842         return DecodeError_clone(&*owner->contents.err);
7843 }
7844 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
7845         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7846         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7847         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7848         uint64_t ret_ref = tag_ptr(ret_copy, true);
7849         return ret_ref;
7850 }
7851
7852 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7853         LDKChannelReady ret = *owner->contents.result;
7854         ret.is_owned = false;
7855         return ret;
7856 }
7857 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
7858         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7859         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
7860         uint64_t ret_ref = 0;
7861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7863         return ret_ref;
7864 }
7865
7866 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7867 CHECK(!owner->result_ok);
7868         return DecodeError_clone(&*owner->contents.err);
7869 }
7870 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
7871         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7872         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7873         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
7874         uint64_t ret_ref = tag_ptr(ret_copy, true);
7875         return ret_ref;
7876 }
7877
7878 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7879         LDKInit ret = *owner->contents.result;
7880         ret.is_owned = false;
7881         return ret;
7882 }
7883 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
7884         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7885         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
7886         uint64_t ret_ref = 0;
7887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7889         return ret_ref;
7890 }
7891
7892 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7893 CHECK(!owner->result_ok);
7894         return DecodeError_clone(&*owner->contents.err);
7895 }
7896 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
7897         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7898         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7899         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
7900         uint64_t ret_ref = tag_ptr(ret_copy, true);
7901         return ret_ref;
7902 }
7903
7904 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7905         LDKOpenChannel ret = *owner->contents.result;
7906         ret.is_owned = false;
7907         return ret;
7908 }
7909 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
7910         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7911         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
7912         uint64_t ret_ref = 0;
7913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7915         return ret_ref;
7916 }
7917
7918 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7919 CHECK(!owner->result_ok);
7920         return DecodeError_clone(&*owner->contents.err);
7921 }
7922 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
7923         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7924         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7925         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
7926         uint64_t ret_ref = tag_ptr(ret_copy, true);
7927         return ret_ref;
7928 }
7929
7930 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7931         LDKRevokeAndACK ret = *owner->contents.result;
7932         ret.is_owned = false;
7933         return ret;
7934 }
7935 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
7936         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7937         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
7938         uint64_t ret_ref = 0;
7939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7941         return ret_ref;
7942 }
7943
7944 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7945 CHECK(!owner->result_ok);
7946         return DecodeError_clone(&*owner->contents.err);
7947 }
7948 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
7949         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7950         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7951         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
7952         uint64_t ret_ref = tag_ptr(ret_copy, true);
7953         return ret_ref;
7954 }
7955
7956 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7957         LDKShutdown ret = *owner->contents.result;
7958         ret.is_owned = false;
7959         return ret;
7960 }
7961 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
7962         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7963         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
7964         uint64_t ret_ref = 0;
7965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7967         return ret_ref;
7968 }
7969
7970 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7971 CHECK(!owner->result_ok);
7972         return DecodeError_clone(&*owner->contents.err);
7973 }
7974 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
7975         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7976         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7977         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
7978         uint64_t ret_ref = tag_ptr(ret_copy, true);
7979         return ret_ref;
7980 }
7981
7982 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7983         LDKUpdateFailHTLC ret = *owner->contents.result;
7984         ret.is_owned = false;
7985         return ret;
7986 }
7987 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7988         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
7989         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
7990         uint64_t ret_ref = 0;
7991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7993         return ret_ref;
7994 }
7995
7996 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7997 CHECK(!owner->result_ok);
7998         return DecodeError_clone(&*owner->contents.err);
7999 }
8000 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
8001         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8002         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8003         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
8004         uint64_t ret_ref = tag_ptr(ret_copy, true);
8005         return ret_ref;
8006 }
8007
8008 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8009         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
8010         ret.is_owned = false;
8011         return ret;
8012 }
8013 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8014         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8015         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
8016         uint64_t ret_ref = 0;
8017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8019         return ret_ref;
8020 }
8021
8022 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8023 CHECK(!owner->result_ok);
8024         return DecodeError_clone(&*owner->contents.err);
8025 }
8026 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
8027         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8028         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8029         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
8030         uint64_t ret_ref = tag_ptr(ret_copy, true);
8031         return ret_ref;
8032 }
8033
8034 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8035         LDKUpdateFee ret = *owner->contents.result;
8036         ret.is_owned = false;
8037         return ret;
8038 }
8039 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
8040         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8041         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
8042         uint64_t ret_ref = 0;
8043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8045         return ret_ref;
8046 }
8047
8048 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8049 CHECK(!owner->result_ok);
8050         return DecodeError_clone(&*owner->contents.err);
8051 }
8052 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
8053         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8054         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8055         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
8056         uint64_t ret_ref = tag_ptr(ret_copy, true);
8057         return ret_ref;
8058 }
8059
8060 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8061         LDKUpdateFulfillHTLC ret = *owner->contents.result;
8062         ret.is_owned = false;
8063         return ret;
8064 }
8065 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8066         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8067         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
8068         uint64_t ret_ref = 0;
8069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8071         return ret_ref;
8072 }
8073
8074 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8075 CHECK(!owner->result_ok);
8076         return DecodeError_clone(&*owner->contents.err);
8077 }
8078 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
8079         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8080         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8081         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
8082         uint64_t ret_ref = tag_ptr(ret_copy, true);
8083         return ret_ref;
8084 }
8085
8086 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8087         LDKUpdateAddHTLC ret = *owner->contents.result;
8088         ret.is_owned = false;
8089         return ret;
8090 }
8091 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8092         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8093         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
8094         uint64_t ret_ref = 0;
8095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8097         return ret_ref;
8098 }
8099
8100 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8101 CHECK(!owner->result_ok);
8102         return DecodeError_clone(&*owner->contents.err);
8103 }
8104 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
8105         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8106         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8107         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
8108         uint64_t ret_ref = tag_ptr(ret_copy, true);
8109         return ret_ref;
8110 }
8111
8112 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
8113         LDKOnionMessage ret = *owner->contents.result;
8114         ret.is_owned = false;
8115         return ret;
8116 }
8117 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
8118         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
8119         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
8120         uint64_t ret_ref = 0;
8121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8123         return ret_ref;
8124 }
8125
8126 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
8127 CHECK(!owner->result_ok);
8128         return DecodeError_clone(&*owner->contents.err);
8129 }
8130 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
8131         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
8132         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8133         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
8134         uint64_t ret_ref = tag_ptr(ret_copy, true);
8135         return ret_ref;
8136 }
8137
8138 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8139         LDKPing ret = *owner->contents.result;
8140         ret.is_owned = false;
8141         return ret;
8142 }
8143 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
8144         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8145         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
8146         uint64_t ret_ref = 0;
8147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8149         return ret_ref;
8150 }
8151
8152 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8153 CHECK(!owner->result_ok);
8154         return DecodeError_clone(&*owner->contents.err);
8155 }
8156 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
8157         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8158         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8159         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
8160         uint64_t ret_ref = tag_ptr(ret_copy, true);
8161         return ret_ref;
8162 }
8163
8164 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8165         LDKPong ret = *owner->contents.result;
8166         ret.is_owned = false;
8167         return ret;
8168 }
8169 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
8170         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8171         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
8172         uint64_t ret_ref = 0;
8173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8175         return ret_ref;
8176 }
8177
8178 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8179 CHECK(!owner->result_ok);
8180         return DecodeError_clone(&*owner->contents.err);
8181 }
8182 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
8183         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8184         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8185         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
8186         uint64_t ret_ref = tag_ptr(ret_copy, true);
8187         return ret_ref;
8188 }
8189
8190 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8191         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
8192         ret.is_owned = false;
8193         return ret;
8194 }
8195 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8196         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8197         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8198         uint64_t ret_ref = 0;
8199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8201         return ret_ref;
8202 }
8203
8204 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8205 CHECK(!owner->result_ok);
8206         return DecodeError_clone(&*owner->contents.err);
8207 }
8208 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8209         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8210         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8211         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8212         uint64_t ret_ref = tag_ptr(ret_copy, true);
8213         return ret_ref;
8214 }
8215
8216 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8217         LDKChannelAnnouncement ret = *owner->contents.result;
8218         ret.is_owned = false;
8219         return ret;
8220 }
8221 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8222         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8223         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8224         uint64_t ret_ref = 0;
8225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8227         return ret_ref;
8228 }
8229
8230 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8231 CHECK(!owner->result_ok);
8232         return DecodeError_clone(&*owner->contents.err);
8233 }
8234 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8235         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8236         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8237         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8238         uint64_t ret_ref = tag_ptr(ret_copy, true);
8239         return ret_ref;
8240 }
8241
8242 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8243         LDKUnsignedChannelUpdate ret = *owner->contents.result;
8244         ret.is_owned = false;
8245         return ret;
8246 }
8247 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
8248         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8249         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8250         uint64_t ret_ref = 0;
8251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8253         return ret_ref;
8254 }
8255
8256 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8257 CHECK(!owner->result_ok);
8258         return DecodeError_clone(&*owner->contents.err);
8259 }
8260 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
8261         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8262         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8263         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
8264         uint64_t ret_ref = tag_ptr(ret_copy, true);
8265         return ret_ref;
8266 }
8267
8268 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8269         LDKChannelUpdate ret = *owner->contents.result;
8270         ret.is_owned = false;
8271         return ret;
8272 }
8273 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
8274         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8275         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8276         uint64_t ret_ref = 0;
8277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8279         return ret_ref;
8280 }
8281
8282 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8283 CHECK(!owner->result_ok);
8284         return DecodeError_clone(&*owner->contents.err);
8285 }
8286 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
8287         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8288         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8289         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
8290         uint64_t ret_ref = tag_ptr(ret_copy, true);
8291         return ret_ref;
8292 }
8293
8294 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8295         LDKErrorMessage ret = *owner->contents.result;
8296         ret.is_owned = false;
8297         return ret;
8298 }
8299 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
8300         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8301         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
8302         uint64_t ret_ref = 0;
8303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8305         return ret_ref;
8306 }
8307
8308 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8309 CHECK(!owner->result_ok);
8310         return DecodeError_clone(&*owner->contents.err);
8311 }
8312 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
8313         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8314         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8315         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
8316         uint64_t ret_ref = tag_ptr(ret_copy, true);
8317         return ret_ref;
8318 }
8319
8320 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8321         LDKWarningMessage ret = *owner->contents.result;
8322         ret.is_owned = false;
8323         return ret;
8324 }
8325 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
8326         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
8327         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
8328         uint64_t ret_ref = 0;
8329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8331         return ret_ref;
8332 }
8333
8334 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8335 CHECK(!owner->result_ok);
8336         return DecodeError_clone(&*owner->contents.err);
8337 }
8338 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
8339         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
8340         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8341         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
8342         uint64_t ret_ref = tag_ptr(ret_copy, true);
8343         return ret_ref;
8344 }
8345
8346 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8347         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
8348         ret.is_owned = false;
8349         return ret;
8350 }
8351 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8352         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8353         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8354         uint64_t ret_ref = 0;
8355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8357         return ret_ref;
8358 }
8359
8360 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8361 CHECK(!owner->result_ok);
8362         return DecodeError_clone(&*owner->contents.err);
8363 }
8364 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8365         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8366         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8367         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8368         uint64_t ret_ref = tag_ptr(ret_copy, true);
8369         return ret_ref;
8370 }
8371
8372 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8373         LDKNodeAnnouncement ret = *owner->contents.result;
8374         ret.is_owned = false;
8375         return ret;
8376 }
8377 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8378         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8379         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8380         uint64_t ret_ref = 0;
8381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8383         return ret_ref;
8384 }
8385
8386 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8387 CHECK(!owner->result_ok);
8388         return DecodeError_clone(&*owner->contents.err);
8389 }
8390 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8391         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8392         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8393         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8394         uint64_t ret_ref = tag_ptr(ret_copy, true);
8395         return ret_ref;
8396 }
8397
8398 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8399         LDKQueryShortChannelIds ret = *owner->contents.result;
8400         ret.is_owned = false;
8401         return ret;
8402 }
8403 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
8404         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
8405         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
8406         uint64_t ret_ref = 0;
8407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8409         return ret_ref;
8410 }
8411
8412 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8413 CHECK(!owner->result_ok);
8414         return DecodeError_clone(&*owner->contents.err);
8415 }
8416 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
8417         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
8418         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8419         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
8420         uint64_t ret_ref = tag_ptr(ret_copy, true);
8421         return ret_ref;
8422 }
8423
8424 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8425         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
8426         ret.is_owned = false;
8427         return ret;
8428 }
8429 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
8430         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
8431         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
8432         uint64_t ret_ref = 0;
8433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8435         return ret_ref;
8436 }
8437
8438 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8439 CHECK(!owner->result_ok);
8440         return DecodeError_clone(&*owner->contents.err);
8441 }
8442 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
8443         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
8444         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8445         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
8446         uint64_t ret_ref = tag_ptr(ret_copy, true);
8447         return ret_ref;
8448 }
8449
8450 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8451         LDKQueryChannelRange ret = *owner->contents.result;
8452         ret.is_owned = false;
8453         return ret;
8454 }
8455 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
8456         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
8457         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
8458         uint64_t ret_ref = 0;
8459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8461         return ret_ref;
8462 }
8463
8464 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8465 CHECK(!owner->result_ok);
8466         return DecodeError_clone(&*owner->contents.err);
8467 }
8468 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
8469         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
8470         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8471         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
8472         uint64_t ret_ref = tag_ptr(ret_copy, true);
8473         return ret_ref;
8474 }
8475
8476 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8477         LDKReplyChannelRange ret = *owner->contents.result;
8478         ret.is_owned = false;
8479         return ret;
8480 }
8481 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
8482         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
8483         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
8484         uint64_t ret_ref = 0;
8485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8487         return ret_ref;
8488 }
8489
8490 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8491 CHECK(!owner->result_ok);
8492         return DecodeError_clone(&*owner->contents.err);
8493 }
8494 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
8495         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
8496         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8497         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
8498         uint64_t ret_ref = tag_ptr(ret_copy, true);
8499         return ret_ref;
8500 }
8501
8502 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8503         LDKGossipTimestampFilter ret = *owner->contents.result;
8504         ret.is_owned = false;
8505         return ret;
8506 }
8507 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
8508         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
8509         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
8510         uint64_t ret_ref = 0;
8511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8513         return ret_ref;
8514 }
8515
8516 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8517 CHECK(!owner->result_ok);
8518         return DecodeError_clone(&*owner->contents.err);
8519 }
8520 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
8521         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
8522         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8523         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
8524         uint64_t ret_ref = tag_ptr(ret_copy, true);
8525         return ret_ref;
8526 }
8527
8528 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
8529         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
8530         for (size_t i = 0; i < ret.datalen; i++) {
8531                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
8532         }
8533         return ret;
8534 }
8535 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
8536         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
8537         switch(obj->tag) {
8538                 case LDKSignOrCreationError_SignError: return 0;
8539                 case LDKSignOrCreationError_CreationError: return 1;
8540                 default: abort();
8541         }
8542 }
8543 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
8544         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
8545         assert(obj->tag == LDKSignOrCreationError_CreationError);
8546                         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
8547         return creation_error_conv;
8548 }
8549 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8550         LDKInvoice ret = *owner->contents.result;
8551         ret.is_owned = false;
8552         return ret;
8553 }
8554 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
8555         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
8556         LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
8557         uint64_t ret_ref = 0;
8558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8560         return ret_ref;
8561 }
8562
8563 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8564 CHECK(!owner->result_ok);
8565         return SignOrCreationError_clone(&*owner->contents.err);
8566 }
8567 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
8568         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
8569         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
8570         *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
8571         uint64_t ret_ref = tag_ptr(ret_copy, true);
8572         return ret_ref;
8573 }
8574
8575 typedef struct LDKFilter_JCalls {
8576         atomic_size_t refcnt;
8577         uint32_t instance_ptr;
8578 } LDKFilter_JCalls;
8579 static void LDKFilter_JCalls_free(void* this_arg) {
8580         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8581         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8582                 FREE(j_calls);
8583         }
8584 }
8585 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
8586         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8587         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8588         memcpy(txid_arr->elems, *txid, 32);
8589         LDKu8slice script_pubkey_var = script_pubkey;
8590         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
8591         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
8592         js_invoke_function_uuuuuu(j_calls->instance_ptr, 40, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
8593 }
8594 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
8595         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8596         LDKWatchedOutput output_var = output;
8597         uint64_t output_ref = 0;
8598         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
8599         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
8600         js_invoke_function_buuuuu(j_calls->instance_ptr, 41, output_ref, 0, 0, 0, 0, 0);
8601 }
8602 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
8603         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
8604         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8605 }
8606 static inline LDKFilter LDKFilter_init (JSValue o) {
8607         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
8608         atomic_init(&calls->refcnt, 1);
8609         calls->instance_ptr = o;
8610
8611         LDKFilter ret = {
8612                 .this_arg = (void*) calls,
8613                 .register_tx = register_tx_LDKFilter_jcall,
8614                 .register_output = register_output_LDKFilter_jcall,
8615                 .free = LDKFilter_JCalls_free,
8616         };
8617         return ret;
8618 }
8619 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
8620         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
8621         *res_ptr = LDKFilter_init(o);
8622         return tag_ptr(res_ptr, true);
8623 }
8624 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
8625         void* this_arg_ptr = untag_ptr(this_arg);
8626         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8627         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8628         uint8_t txid_arr[32];
8629         CHECK(txid->arr_len == 32);
8630         memcpy(txid_arr, txid->elems, 32); FREE(txid);
8631         uint8_t (*txid_ref)[32] = &txid_arr;
8632         LDKu8slice script_pubkey_ref;
8633         script_pubkey_ref.datalen = script_pubkey->arr_len;
8634         script_pubkey_ref.data = script_pubkey->elems;
8635         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
8636         FREE(script_pubkey);
8637 }
8638
8639 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
8640         void* this_arg_ptr = untag_ptr(this_arg);
8641         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8642         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8643         LDKWatchedOutput output_conv;
8644         output_conv.inner = untag_ptr(output);
8645         output_conv.is_owned = ptr_is_owned(output);
8646         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
8647         output_conv = WatchedOutput_clone(&output_conv);
8648         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
8649 }
8650
8651 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
8652         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
8653         switch(obj->tag) {
8654                 case LDKCOption_FilterZ_Some: return 0;
8655                 case LDKCOption_FilterZ_None: return 1;
8656                 default: abort();
8657         }
8658 }
8659 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
8660         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
8661         assert(obj->tag == LDKCOption_FilterZ_Some);
8662                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
8663                         *some_ret = obj->some;
8664                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
8665                         if ((*some_ret).free == LDKFilter_JCalls_free) {
8666                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8667                                 LDKFilter_JCalls_cloned(&(*some_ret));
8668                         }
8669         return tag_ptr(some_ret, true);
8670 }
8671 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8672         LDKLockedChannelMonitor ret = *owner->contents.result;
8673         ret.is_owned = false;
8674         return ret;
8675 }
8676 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
8677         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
8678         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
8679         uint64_t ret_ref = 0;
8680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8682         return ret_ref;
8683 }
8684
8685 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8686 CHECK(!owner->result_ok);
8687         return *owner->contents.err;
8688 }
8689 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
8690         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
8691         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
8692 }
8693
8694 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
8695         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
8696         for (size_t i = 0; i < ret.datalen; i++) {
8697                 ret.data[i] = OutPoint_clone(&orig->data[i]);
8698         }
8699         return ret;
8700 }
8701 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
8702         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
8703         for (size_t i = 0; i < ret.datalen; i++) {
8704                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
8705         }
8706         return ret;
8707 }
8708 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
8709         LDKOutPoint ret = owner->a;
8710         ret.is_owned = false;
8711         return ret;
8712 }
8713 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(uint64_t owner) {
8714         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
8715         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
8716         uint64_t ret_ref = 0;
8717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8719         return ret_ref;
8720 }
8721
8722 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
8723         return CVec_MonitorUpdateIdZ_clone(&owner->b);
8724 }
8725 uint64_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(uint64_t owner) {
8726         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
8727         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
8728         uint64_tArray ret_arr = NULL;
8729         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8730         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8731         for (size_t r = 0; r < ret_var.datalen; r++) {
8732                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
8733                 uint64_t ret_conv_17_ref = 0;
8734                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
8735                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
8736                 ret_arr_ptr[r] = ret_conv_17_ref;
8737         }
8738         
8739         FREE(ret_var.data);
8740         return ret_arr;
8741 }
8742
8743 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
8744         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
8745         for (size_t i = 0; i < ret.datalen; i++) {
8746                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
8747         }
8748         return ret;
8749 }
8750 typedef struct LDKMessageSendEventsProvider_JCalls {
8751         atomic_size_t refcnt;
8752         uint32_t instance_ptr;
8753 } LDKMessageSendEventsProvider_JCalls;
8754 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
8755         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
8756         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8757                 FREE(j_calls);
8758         }
8759 }
8760 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
8761         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
8762         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 42, 0, 0, 0, 0, 0, 0);
8763         LDKCVec_MessageSendEventZ ret_constr;
8764         ret_constr.datalen = ret->arr_len;
8765         if (ret_constr.datalen > 0)
8766                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
8767         else
8768                 ret_constr.data = NULL;
8769         uint64_t* ret_vals = ret->elems;
8770         for (size_t s = 0; s < ret_constr.datalen; s++) {
8771                 uint64_t ret_conv_18 = ret_vals[s];
8772                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
8773                 CHECK_ACCESS(ret_conv_18_ptr);
8774                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
8775                 FREE(untag_ptr(ret_conv_18));
8776                 ret_constr.data[s] = ret_conv_18_conv;
8777         }
8778         FREE(ret);
8779         return ret_constr;
8780 }
8781 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
8782         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
8783         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8784 }
8785 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
8786         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
8787         atomic_init(&calls->refcnt, 1);
8788         calls->instance_ptr = o;
8789
8790         LDKMessageSendEventsProvider ret = {
8791                 .this_arg = (void*) calls,
8792                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
8793                 .free = LDKMessageSendEventsProvider_JCalls_free,
8794         };
8795         return ret;
8796 }
8797 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
8798         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
8799         *res_ptr = LDKMessageSendEventsProvider_init(o);
8800         return tag_ptr(res_ptr, true);
8801 }
8802 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) {
8803         void* this_arg_ptr = untag_ptr(this_arg);
8804         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8805         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
8806         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
8807         uint64_tArray ret_arr = NULL;
8808         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8809         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8810         for (size_t s = 0; s < ret_var.datalen; s++) {
8811                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
8812                 *ret_conv_18_copy = ret_var.data[s];
8813                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
8814                 ret_arr_ptr[s] = ret_conv_18_ref;
8815         }
8816         
8817         FREE(ret_var.data);
8818         return ret_arr;
8819 }
8820
8821 typedef struct LDKOnionMessageProvider_JCalls {
8822         atomic_size_t refcnt;
8823         uint32_t instance_ptr;
8824 } LDKOnionMessageProvider_JCalls;
8825 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
8826         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
8827         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8828                 FREE(j_calls);
8829         }
8830 }
8831 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
8832         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
8833         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
8834         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
8835         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 43, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
8836         LDKOnionMessage ret_conv;
8837         ret_conv.inner = untag_ptr(ret);
8838         ret_conv.is_owned = ptr_is_owned(ret);
8839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
8840         return ret_conv;
8841 }
8842 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
8843         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
8844         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8845 }
8846 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JSValue o) {
8847         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
8848         atomic_init(&calls->refcnt, 1);
8849         calls->instance_ptr = o;
8850
8851         LDKOnionMessageProvider ret = {
8852                 .this_arg = (void*) calls,
8853                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
8854                 .free = LDKOnionMessageProvider_JCalls_free,
8855         };
8856         return ret;
8857 }
8858 uint64_t  __attribute__((export_name("TS_LDKOnionMessageProvider_new"))) TS_LDKOnionMessageProvider_new(JSValue o) {
8859         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
8860         *res_ptr = LDKOnionMessageProvider_init(o);
8861         return tag_ptr(res_ptr, true);
8862 }
8863 uint64_t  __attribute__((export_name("TS_OnionMessageProvider_next_onion_message_for_peer"))) TS_OnionMessageProvider_next_onion_message_for_peer(uint64_t this_arg, int8_tArray peer_node_id) {
8864         void* this_arg_ptr = untag_ptr(this_arg);
8865         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8866         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
8867         LDKPublicKey peer_node_id_ref;
8868         CHECK(peer_node_id->arr_len == 33);
8869         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
8870         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
8871         uint64_t ret_ref = 0;
8872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8874         return ret_ref;
8875 }
8876
8877 typedef struct LDKEventHandler_JCalls {
8878         atomic_size_t refcnt;
8879         uint32_t instance_ptr;
8880 } LDKEventHandler_JCalls;
8881 static void LDKEventHandler_JCalls_free(void* this_arg) {
8882         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8883         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8884                 FREE(j_calls);
8885         }
8886 }
8887 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
8888         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8889         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
8890         *event_copy = event;
8891         uint64_t event_ref = tag_ptr(event_copy, true);
8892         js_invoke_function_buuuuu(j_calls->instance_ptr, 44, event_ref, 0, 0, 0, 0, 0);
8893 }
8894 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
8895         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
8896         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8897 }
8898 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
8899         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
8900         atomic_init(&calls->refcnt, 1);
8901         calls->instance_ptr = o;
8902
8903         LDKEventHandler ret = {
8904                 .this_arg = (void*) calls,
8905                 .handle_event = handle_event_LDKEventHandler_jcall,
8906                 .free = LDKEventHandler_JCalls_free,
8907         };
8908         return ret;
8909 }
8910 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
8911         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8912         *res_ptr = LDKEventHandler_init(o);
8913         return tag_ptr(res_ptr, true);
8914 }
8915 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
8916         void* this_arg_ptr = untag_ptr(this_arg);
8917         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8918         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
8919         void* event_ptr = untag_ptr(event);
8920         CHECK_ACCESS(event_ptr);
8921         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
8922         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
8923         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
8924 }
8925
8926 typedef struct LDKEventsProvider_JCalls {
8927         atomic_size_t refcnt;
8928         uint32_t instance_ptr;
8929 } LDKEventsProvider_JCalls;
8930 static void LDKEventsProvider_JCalls_free(void* this_arg) {
8931         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8932         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8933                 FREE(j_calls);
8934         }
8935 }
8936 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
8937         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8938         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8939         *handler_ret = handler;
8940         js_invoke_function_buuuuu(j_calls->instance_ptr, 45, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
8941 }
8942 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
8943         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
8944         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8945 }
8946 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
8947         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
8948         atomic_init(&calls->refcnt, 1);
8949         calls->instance_ptr = o;
8950
8951         LDKEventsProvider ret = {
8952                 .this_arg = (void*) calls,
8953                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
8954                 .free = LDKEventsProvider_JCalls_free,
8955         };
8956         return ret;
8957 }
8958 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
8959         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8960         *res_ptr = LDKEventsProvider_init(o);
8961         return tag_ptr(res_ptr, true);
8962 }
8963 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
8964         void* this_arg_ptr = untag_ptr(this_arg);
8965         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8966         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
8967         void* handler_ptr = untag_ptr(handler);
8968         CHECK_ACCESS(handler_ptr);
8969         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
8970         if (handler_conv.free == LDKEventHandler_JCalls_free) {
8971                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8972                 LDKEventHandler_JCalls_cloned(&handler_conv);
8973         }
8974         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
8975 }
8976
8977 typedef struct LDKScore_JCalls {
8978         atomic_size_t refcnt;
8979         uint32_t instance_ptr;
8980 } LDKScore_JCalls;
8981 static void LDKScore_JCalls_free(void* this_arg) {
8982         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8983         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8984                 FREE(j_calls);
8985         }
8986 }
8987 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
8988         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8989         int64_t short_channel_id_conv = short_channel_id;
8990         LDKNodeId source_var = *source;
8991         uint64_t source_ref = 0;
8992         source_var = NodeId_clone(&source_var);
8993         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
8994         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
8995         LDKNodeId target_var = *target;
8996         uint64_t target_ref = 0;
8997         target_var = NodeId_clone(&target_var);
8998         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
8999         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
9000         LDKChannelUsage usage_var = usage;
9001         uint64_t usage_ref = 0;
9002         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
9003         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
9004         return js_invoke_function_bbbbuu(j_calls->instance_ptr, 46, short_channel_id_conv, source_ref, target_ref, usage_ref, 0, 0);
9005 }
9006 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
9007         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9008         LDKCVec_RouteHopZ path_var = path;
9009         uint64_tArray path_arr = NULL;
9010         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
9011         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
9012         for (size_t k = 0; k < path_var.datalen; k++) {
9013                 LDKRouteHop path_conv_10_var = path_var.data[k];
9014                 uint64_t path_conv_10_ref = 0;
9015                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9016                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9017                 path_arr_ptr[k] = path_conv_10_ref;
9018         }
9019         
9020         FREE(path_var.data);
9021         int64_t short_channel_id_conv = short_channel_id;
9022         js_invoke_function_ubuuuu(j_calls->instance_ptr, 47, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
9023 }
9024 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
9025         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9026         LDKCVec_RouteHopZ path_var = path;
9027         uint64_tArray path_arr = NULL;
9028         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
9029         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
9030         for (size_t k = 0; k < path_var.datalen; k++) {
9031                 LDKRouteHop path_conv_10_var = path_var.data[k];
9032                 uint64_t path_conv_10_ref = 0;
9033                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9034                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9035                 path_arr_ptr[k] = path_conv_10_ref;
9036         }
9037         
9038         FREE(path_var.data);
9039         js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, (uint32_t)path_arr, 0, 0, 0, 0, 0);
9040 }
9041 void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
9042         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9043         LDKCVec_RouteHopZ path_var = path;
9044         uint64_tArray path_arr = NULL;
9045         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
9046         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
9047         for (size_t k = 0; k < path_var.datalen; k++) {
9048                 LDKRouteHop path_conv_10_var = path_var.data[k];
9049                 uint64_t path_conv_10_ref = 0;
9050                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9051                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9052                 path_arr_ptr[k] = path_conv_10_ref;
9053         }
9054         
9055         FREE(path_var.data);
9056         int64_t short_channel_id_conv = short_channel_id;
9057         js_invoke_function_ubuuuu(j_calls->instance_ptr, 49, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
9058 }
9059 void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
9060         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9061         LDKCVec_RouteHopZ path_var = path;
9062         uint64_tArray path_arr = NULL;
9063         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
9064         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
9065         for (size_t k = 0; k < path_var.datalen; k++) {
9066                 LDKRouteHop path_conv_10_var = path_var.data[k];
9067                 uint64_t path_conv_10_ref = 0;
9068                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9069                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9070                 path_arr_ptr[k] = path_conv_10_ref;
9071         }
9072         
9073         FREE(path_var.data);
9074         js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, (uint32_t)path_arr, 0, 0, 0, 0, 0);
9075 }
9076 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
9077         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9078         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 51, 0, 0, 0, 0, 0, 0);
9079         LDKCVec_u8Z ret_ref;
9080         ret_ref.datalen = ret->arr_len;
9081         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9082         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
9083         return ret_ref;
9084 }
9085 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
9086         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
9087         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9088 }
9089 static inline LDKScore LDKScore_init (JSValue o) {
9090         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
9091         atomic_init(&calls->refcnt, 1);
9092         calls->instance_ptr = o;
9093
9094         LDKScore ret = {
9095                 .this_arg = (void*) calls,
9096                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
9097                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
9098                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
9099                 .probe_failed = probe_failed_LDKScore_jcall,
9100                 .probe_successful = probe_successful_LDKScore_jcall,
9101                 .write = write_LDKScore_jcall,
9102                 .free = LDKScore_JCalls_free,
9103         };
9104         return ret;
9105 }
9106 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
9107         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
9108         *res_ptr = LDKScore_init(o);
9109         return tag_ptr(res_ptr, true);
9110 }
9111 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) {
9112         void* this_arg_ptr = untag_ptr(this_arg);
9113         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9114         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9115         LDKNodeId source_conv;
9116         source_conv.inner = untag_ptr(source);
9117         source_conv.is_owned = ptr_is_owned(source);
9118         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
9119         source_conv.is_owned = false;
9120         LDKNodeId target_conv;
9121         target_conv.inner = untag_ptr(target);
9122         target_conv.is_owned = ptr_is_owned(target);
9123         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
9124         target_conv.is_owned = false;
9125         LDKChannelUsage usage_conv;
9126         usage_conv.inner = untag_ptr(usage);
9127         usage_conv.is_owned = ptr_is_owned(usage);
9128         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
9129         usage_conv = ChannelUsage_clone(&usage_conv);
9130         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
9131         return ret_conv;
9132 }
9133
9134 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) {
9135         void* this_arg_ptr = untag_ptr(this_arg);
9136         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9137         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9138         LDKCVec_RouteHopZ path_constr;
9139         path_constr.datalen = path->arr_len;
9140         if (path_constr.datalen > 0)
9141                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9142         else
9143                 path_constr.data = NULL;
9144         uint64_t* path_vals = path->elems;
9145         for (size_t k = 0; k < path_constr.datalen; k++) {
9146                 uint64_t path_conv_10 = path_vals[k];
9147                 LDKRouteHop path_conv_10_conv;
9148                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
9149                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
9150                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
9151                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
9152                 path_constr.data[k] = path_conv_10_conv;
9153         }
9154         FREE(path);
9155         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
9156 }
9157
9158 void  __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint64_t this_arg, uint64_tArray path) {
9159         void* this_arg_ptr = untag_ptr(this_arg);
9160         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9161         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9162         LDKCVec_RouteHopZ path_constr;
9163         path_constr.datalen = path->arr_len;
9164         if (path_constr.datalen > 0)
9165                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9166         else
9167                 path_constr.data = NULL;
9168         uint64_t* path_vals = path->elems;
9169         for (size_t k = 0; k < path_constr.datalen; k++) {
9170                 uint64_t path_conv_10 = path_vals[k];
9171                 LDKRouteHop path_conv_10_conv;
9172                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
9173                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
9174                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
9175                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
9176                 path_constr.data[k] = path_conv_10_conv;
9177         }
9178         FREE(path);
9179         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
9180 }
9181
9182 void  __attribute__((export_name("TS_Score_probe_failed"))) TS_Score_probe_failed(uint64_t this_arg, uint64_tArray path, int64_t short_channel_id) {
9183         void* this_arg_ptr = untag_ptr(this_arg);
9184         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9185         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9186         LDKCVec_RouteHopZ path_constr;
9187         path_constr.datalen = path->arr_len;
9188         if (path_constr.datalen > 0)
9189                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9190         else
9191                 path_constr.data = NULL;
9192         uint64_t* path_vals = path->elems;
9193         for (size_t k = 0; k < path_constr.datalen; k++) {
9194                 uint64_t path_conv_10 = path_vals[k];
9195                 LDKRouteHop path_conv_10_conv;
9196                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
9197                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
9198                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
9199                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
9200                 path_constr.data[k] = path_conv_10_conv;
9201         }
9202         FREE(path);
9203         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
9204 }
9205
9206 void  __attribute__((export_name("TS_Score_probe_successful"))) TS_Score_probe_successful(uint64_t this_arg, uint64_tArray path) {
9207         void* this_arg_ptr = untag_ptr(this_arg);
9208         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9209         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9210         LDKCVec_RouteHopZ path_constr;
9211         path_constr.datalen = path->arr_len;
9212         if (path_constr.datalen > 0)
9213                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9214         else
9215                 path_constr.data = NULL;
9216         uint64_t* path_vals = path->elems;
9217         for (size_t k = 0; k < path_constr.datalen; k++) {
9218                 uint64_t path_conv_10 = path_vals[k];
9219                 LDKRouteHop path_conv_10_conv;
9220                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
9221                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
9222                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
9223                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
9224                 path_constr.data[k] = path_conv_10_conv;
9225         }
9226         FREE(path);
9227         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr);
9228 }
9229
9230 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
9231         void* this_arg_ptr = untag_ptr(this_arg);
9232         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9233         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9234         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9235         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
9236         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
9237         CVec_u8Z_free(ret_var);
9238         return ret_arr;
9239 }
9240
9241 typedef struct LDKLockableScore_JCalls {
9242         atomic_size_t refcnt;
9243         uint32_t instance_ptr;
9244 } LDKLockableScore_JCalls;
9245 static void LDKLockableScore_JCalls_free(void* this_arg) {
9246         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
9247         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9248                 FREE(j_calls);
9249         }
9250 }
9251 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
9252         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
9253         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 52, 0, 0, 0, 0, 0, 0);
9254         void* ret_ptr = untag_ptr(ret);
9255         CHECK_ACCESS(ret_ptr);
9256         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
9257         if (ret_conv.free == LDKScore_JCalls_free) {
9258                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9259                 LDKScore_JCalls_cloned(&ret_conv);
9260         }// WARNING: we may need a move here but no clone is available for LDKScore
9261         
9262         return ret_conv;
9263 }
9264 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
9265         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
9266         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9267 }
9268 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
9269         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
9270         atomic_init(&calls->refcnt, 1);
9271         calls->instance_ptr = o;
9272
9273         LDKLockableScore ret = {
9274                 .this_arg = (void*) calls,
9275                 .lock = lock_LDKLockableScore_jcall,
9276                 .free = LDKLockableScore_JCalls_free,
9277         };
9278         return ret;
9279 }
9280 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
9281         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
9282         *res_ptr = LDKLockableScore_init(o);
9283         return tag_ptr(res_ptr, true);
9284 }
9285 uint64_t  __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint64_t this_arg) {
9286         void* this_arg_ptr = untag_ptr(this_arg);
9287         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9288         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
9289         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
9290         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
9291         return tag_ptr(ret_ret, true);
9292 }
9293
9294 typedef struct LDKWriteableScore_JCalls {
9295         atomic_size_t refcnt;
9296         uint32_t instance_ptr;
9297         LDKLockableScore_JCalls* LockableScore;
9298 } LDKWriteableScore_JCalls;
9299 static void LDKWriteableScore_JCalls_free(void* this_arg) {
9300         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
9301         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9302                 FREE(j_calls);
9303         }
9304 }
9305 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
9306         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
9307         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 53, 0, 0, 0, 0, 0, 0);
9308         LDKCVec_u8Z ret_ref;
9309         ret_ref.datalen = ret->arr_len;
9310         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9311         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
9312         return ret_ref;
9313 }
9314 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
9315         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
9316         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9317         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
9318 }
9319 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
9320         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
9321         atomic_init(&calls->refcnt, 1);
9322         calls->instance_ptr = o;
9323
9324         LDKWriteableScore ret = {
9325                 .this_arg = (void*) calls,
9326                 .write = write_LDKWriteableScore_jcall,
9327                 .free = LDKWriteableScore_JCalls_free,
9328                 .LockableScore = LDKLockableScore_init(LockableScore),
9329         };
9330         calls->LockableScore = ret.LockableScore.this_arg;
9331         return ret;
9332 }
9333 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
9334         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
9335         *res_ptr = LDKWriteableScore_init(o, LockableScore);
9336         return tag_ptr(res_ptr, true);
9337 }
9338 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
9339         void* this_arg_ptr = untag_ptr(this_arg);
9340         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9341         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
9342         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9343         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
9344         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
9345         CVec_u8Z_free(ret_var);
9346         return ret_arr;
9347 }
9348
9349 typedef struct LDKPersister_JCalls {
9350         atomic_size_t refcnt;
9351         uint32_t instance_ptr;
9352 } LDKPersister_JCalls;
9353 static void LDKPersister_JCalls_free(void* this_arg) {
9354         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
9355         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9356                 FREE(j_calls);
9357         }
9358 }
9359 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
9360         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
9361         LDKChannelManager channel_manager_var = *channel_manager;
9362         uint64_t channel_manager_ref = 0;
9363         // WARNING: we may need a move here but no clone is available for LDKChannelManager
9364         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
9365         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
9366         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 54, channel_manager_ref, 0, 0, 0, 0, 0);
9367         void* ret_ptr = untag_ptr(ret);
9368         CHECK_ACCESS(ret_ptr);
9369         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
9370         FREE(untag_ptr(ret));
9371         return ret_conv;
9372 }
9373 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
9374         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
9375         LDKNetworkGraph network_graph_var = *network_graph;
9376         uint64_t network_graph_ref = 0;
9377         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
9378         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
9379         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
9380         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 55, network_graph_ref, 0, 0, 0, 0, 0);
9381         void* ret_ptr = untag_ptr(ret);
9382         CHECK_ACCESS(ret_ptr);
9383         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
9384         FREE(untag_ptr(ret));
9385         return ret_conv;
9386 }
9387 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
9388         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
9389         // WARNING: This object doesn't live past this scope, needs clone!
9390         uint64_t ret_scorer = tag_ptr(scorer, false);
9391         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 56, ret_scorer, 0, 0, 0, 0, 0);
9392         void* ret_ptr = untag_ptr(ret);
9393         CHECK_ACCESS(ret_ptr);
9394         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
9395         FREE(untag_ptr(ret));
9396         return ret_conv;
9397 }
9398 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
9399         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
9400         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9401 }
9402 static inline LDKPersister LDKPersister_init (JSValue o) {
9403         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
9404         atomic_init(&calls->refcnt, 1);
9405         calls->instance_ptr = o;
9406
9407         LDKPersister ret = {
9408                 .this_arg = (void*) calls,
9409                 .persist_manager = persist_manager_LDKPersister_jcall,
9410                 .persist_graph = persist_graph_LDKPersister_jcall,
9411                 .persist_scorer = persist_scorer_LDKPersister_jcall,
9412                 .free = LDKPersister_JCalls_free,
9413         };
9414         return ret;
9415 }
9416 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
9417         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
9418         *res_ptr = LDKPersister_init(o);
9419         return tag_ptr(res_ptr, true);
9420 }
9421 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
9422         void* this_arg_ptr = untag_ptr(this_arg);
9423         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9424         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
9425         LDKChannelManager channel_manager_conv;
9426         channel_manager_conv.inner = untag_ptr(channel_manager);
9427         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
9428         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
9429         channel_manager_conv.is_owned = false;
9430         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9431         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
9432         return tag_ptr(ret_conv, true);
9433 }
9434
9435 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
9436         void* this_arg_ptr = untag_ptr(this_arg);
9437         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9438         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
9439         LDKNetworkGraph network_graph_conv;
9440         network_graph_conv.inner = untag_ptr(network_graph);
9441         network_graph_conv.is_owned = ptr_is_owned(network_graph);
9442         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
9443         network_graph_conv.is_owned = false;
9444         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9445         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
9446         return tag_ptr(ret_conv, true);
9447 }
9448
9449 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
9450         void* this_arg_ptr = untag_ptr(this_arg);
9451         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9452         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
9453         void* scorer_ptr = untag_ptr(scorer);
9454         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
9455         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
9456         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9457         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
9458         return tag_ptr(ret_conv, true);
9459 }
9460
9461 typedef struct LDKFutureCallback_JCalls {
9462         atomic_size_t refcnt;
9463         uint32_t instance_ptr;
9464 } LDKFutureCallback_JCalls;
9465 static void LDKFutureCallback_JCalls_free(void* this_arg) {
9466         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
9467         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9468                 FREE(j_calls);
9469         }
9470 }
9471 void call_LDKFutureCallback_jcall(const void* this_arg) {
9472         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
9473         js_invoke_function_uuuuuu(j_calls->instance_ptr, 57, 0, 0, 0, 0, 0, 0);
9474 }
9475 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
9476         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
9477         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9478 }
9479 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
9480         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
9481         atomic_init(&calls->refcnt, 1);
9482         calls->instance_ptr = o;
9483
9484         LDKFutureCallback ret = {
9485                 .this_arg = (void*) calls,
9486                 .call = call_LDKFutureCallback_jcall,
9487                 .free = LDKFutureCallback_JCalls_free,
9488         };
9489         return ret;
9490 }
9491 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
9492         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
9493         *res_ptr = LDKFutureCallback_init(o);
9494         return tag_ptr(res_ptr, true);
9495 }
9496 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
9497         void* this_arg_ptr = untag_ptr(this_arg);
9498         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9499         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
9500         (this_arg_conv->call)(this_arg_conv->this_arg);
9501 }
9502
9503 typedef struct LDKListen_JCalls {
9504         atomic_size_t refcnt;
9505         uint32_t instance_ptr;
9506 } LDKListen_JCalls;
9507 static void LDKListen_JCalls_free(void* this_arg) {
9508         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9509         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9510                 FREE(j_calls);
9511         }
9512 }
9513 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
9514         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9515         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9516         memcpy(header_arr->elems, *header, 80);
9517         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
9518         uint64_tArray txdata_arr = NULL;
9519         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
9520         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
9521         for (size_t c = 0; c < txdata_var.datalen; c++) {
9522                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9523                 *txdata_conv_28_conv = txdata_var.data[c];
9524                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
9525         }
9526         
9527         FREE(txdata_var.data);
9528         int32_t height_conv = height;
9529         js_invoke_function_uuuuuu(j_calls->instance_ptr, 58, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
9530 }
9531 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
9532         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9533         LDKu8slice block_var = block;
9534         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
9535         memcpy(block_arr->elems, block_var.data, block_var.datalen);
9536         int32_t height_conv = height;
9537         js_invoke_function_uuuuuu(j_calls->instance_ptr, 59, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
9538 }
9539 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
9540         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9541         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9542         memcpy(header_arr->elems, *header, 80);
9543         int32_t height_conv = height;
9544         js_invoke_function_uuuuuu(j_calls->instance_ptr, 60, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
9545 }
9546 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
9547         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
9548         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9549 }
9550 static inline LDKListen LDKListen_init (JSValue o) {
9551         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
9552         atomic_init(&calls->refcnt, 1);
9553         calls->instance_ptr = o;
9554
9555         LDKListen ret = {
9556                 .this_arg = (void*) calls,
9557                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
9558                 .block_connected = block_connected_LDKListen_jcall,
9559                 .block_disconnected = block_disconnected_LDKListen_jcall,
9560                 .free = LDKListen_JCalls_free,
9561         };
9562         return ret;
9563 }
9564 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
9565         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
9566         *res_ptr = LDKListen_init(o);
9567         return tag_ptr(res_ptr, true);
9568 }
9569 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) {
9570         void* this_arg_ptr = untag_ptr(this_arg);
9571         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9572         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9573         uint8_t header_arr[80];
9574         CHECK(header->arr_len == 80);
9575         memcpy(header_arr, header->elems, 80); FREE(header);
9576         uint8_t (*header_ref)[80] = &header_arr;
9577         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9578         txdata_constr.datalen = txdata->arr_len;
9579         if (txdata_constr.datalen > 0)
9580                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9581         else
9582                 txdata_constr.data = NULL;
9583         uint64_t* txdata_vals = txdata->elems;
9584         for (size_t c = 0; c < txdata_constr.datalen; c++) {
9585                 uint64_t txdata_conv_28 = txdata_vals[c];
9586                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
9587                 CHECK_ACCESS(txdata_conv_28_ptr);
9588                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
9589                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
9590                 txdata_constr.data[c] = txdata_conv_28_conv;
9591         }
9592         FREE(txdata);
9593         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
9594 }
9595
9596 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
9597         void* this_arg_ptr = untag_ptr(this_arg);
9598         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9599         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9600         LDKu8slice block_ref;
9601         block_ref.datalen = block->arr_len;
9602         block_ref.data = block->elems;
9603         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
9604         FREE(block);
9605 }
9606
9607 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
9608         void* this_arg_ptr = untag_ptr(this_arg);
9609         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9610         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9611         uint8_t header_arr[80];
9612         CHECK(header->arr_len == 80);
9613         memcpy(header_arr, header->elems, 80); FREE(header);
9614         uint8_t (*header_ref)[80] = &header_arr;
9615         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
9616 }
9617
9618 typedef struct LDKConfirm_JCalls {
9619         atomic_size_t refcnt;
9620         uint32_t instance_ptr;
9621 } LDKConfirm_JCalls;
9622 static void LDKConfirm_JCalls_free(void* this_arg) {
9623         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9624         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9625                 FREE(j_calls);
9626         }
9627 }
9628 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
9629         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9630         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9631         memcpy(header_arr->elems, *header, 80);
9632         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
9633         uint64_tArray txdata_arr = NULL;
9634         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
9635         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
9636         for (size_t c = 0; c < txdata_var.datalen; c++) {
9637                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9638                 *txdata_conv_28_conv = txdata_var.data[c];
9639                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
9640         }
9641         
9642         FREE(txdata_var.data);
9643         int32_t height_conv = height;
9644         js_invoke_function_uuuuuu(j_calls->instance_ptr, 61, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
9645 }
9646 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
9647         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9648         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
9649         memcpy(txid_arr->elems, *txid, 32);
9650         js_invoke_function_uuuuuu(j_calls->instance_ptr, 62, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
9651 }
9652 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
9653         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9654         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9655         memcpy(header_arr->elems, *header, 80);
9656         int32_t height_conv = height;
9657         js_invoke_function_uuuuuu(j_calls->instance_ptr, 63, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
9658 }
9659 LDKCVec_C2Tuple_TxidBlockHashZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
9660         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9661         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 64, 0, 0, 0, 0, 0, 0);
9662         LDKCVec_C2Tuple_TxidBlockHashZZ ret_constr;
9663         ret_constr.datalen = ret->arr_len;
9664         if (ret_constr.datalen > 0)
9665                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKCVec_C2Tuple_TxidBlockHashZZ Elements");
9666         else
9667                 ret_constr.data = NULL;
9668         uint64_t* ret_vals = ret->elems;
9669         for (size_t z = 0; z < ret_constr.datalen; z++) {
9670                 uint64_t ret_conv_25 = ret_vals[z];
9671                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
9672                 CHECK_ACCESS(ret_conv_25_ptr);
9673                 LDKC2Tuple_TxidBlockHashZ ret_conv_25_conv = *(LDKC2Tuple_TxidBlockHashZ*)(ret_conv_25_ptr);
9674                 FREE(untag_ptr(ret_conv_25));
9675                 ret_constr.data[z] = ret_conv_25_conv;
9676         }
9677         FREE(ret);
9678         return ret_constr;
9679 }
9680 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
9681         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
9682         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9683 }
9684 static inline LDKConfirm LDKConfirm_init (JSValue o) {
9685         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
9686         atomic_init(&calls->refcnt, 1);
9687         calls->instance_ptr = o;
9688
9689         LDKConfirm ret = {
9690                 .this_arg = (void*) calls,
9691                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
9692                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
9693                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
9694                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
9695                 .free = LDKConfirm_JCalls_free,
9696         };
9697         return ret;
9698 }
9699 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
9700         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
9701         *res_ptr = LDKConfirm_init(o);
9702         return tag_ptr(res_ptr, true);
9703 }
9704 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) {
9705         void* this_arg_ptr = untag_ptr(this_arg);
9706         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9707         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9708         uint8_t header_arr[80];
9709         CHECK(header->arr_len == 80);
9710         memcpy(header_arr, header->elems, 80); FREE(header);
9711         uint8_t (*header_ref)[80] = &header_arr;
9712         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9713         txdata_constr.datalen = txdata->arr_len;
9714         if (txdata_constr.datalen > 0)
9715                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9716         else
9717                 txdata_constr.data = NULL;
9718         uint64_t* txdata_vals = txdata->elems;
9719         for (size_t c = 0; c < txdata_constr.datalen; c++) {
9720                 uint64_t txdata_conv_28 = txdata_vals[c];
9721                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
9722                 CHECK_ACCESS(txdata_conv_28_ptr);
9723                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
9724                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
9725                 txdata_constr.data[c] = txdata_conv_28_conv;
9726         }
9727         FREE(txdata);
9728         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
9729 }
9730
9731 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
9732         void* this_arg_ptr = untag_ptr(this_arg);
9733         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9734         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9735         uint8_t txid_arr[32];
9736         CHECK(txid->arr_len == 32);
9737         memcpy(txid_arr, txid->elems, 32); FREE(txid);
9738         uint8_t (*txid_ref)[32] = &txid_arr;
9739         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
9740 }
9741
9742 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
9743         void* this_arg_ptr = untag_ptr(this_arg);
9744         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9745         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9746         uint8_t header_arr[80];
9747         CHECK(header->arr_len == 80);
9748         memcpy(header_arr, header->elems, 80); FREE(header);
9749         uint8_t (*header_ref)[80] = &header_arr;
9750         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
9751 }
9752
9753 uint64_tArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
9754         void* this_arg_ptr = untag_ptr(this_arg);
9755         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9756         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9757         LDKCVec_C2Tuple_TxidBlockHashZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
9758         uint64_tArray ret_arr = NULL;
9759         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
9760         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
9761         for (size_t z = 0; z < ret_var.datalen; z++) {
9762                 LDKC2Tuple_TxidBlockHashZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
9763                 *ret_conv_25_conv = ret_var.data[z];
9764                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
9765         }
9766         
9767         FREE(ret_var.data);
9768         return ret_arr;
9769 }
9770
9771 typedef struct LDKPersist_JCalls {
9772         atomic_size_t refcnt;
9773         uint32_t instance_ptr;
9774 } LDKPersist_JCalls;
9775 static void LDKPersist_JCalls_free(void* this_arg) {
9776         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9777         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9778                 FREE(j_calls);
9779         }
9780 }
9781 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
9782         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9783         LDKOutPoint channel_id_var = channel_id;
9784         uint64_t channel_id_ref = 0;
9785         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
9786         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
9787         LDKChannelMonitor data_var = *data;
9788         uint64_t data_ref = 0;
9789         data_var = ChannelMonitor_clone(&data_var);
9790         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
9791         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
9792         LDKMonitorUpdateId update_id_var = update_id;
9793         uint64_t update_id_ref = 0;
9794         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
9795         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
9796         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 65, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
9797         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
9798         return ret_conv;
9799 }
9800 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
9801         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9802         LDKOutPoint channel_id_var = channel_id;
9803         uint64_t channel_id_ref = 0;
9804         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
9805         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
9806         LDKChannelMonitorUpdate update_var = update;
9807         uint64_t update_ref = 0;
9808         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
9809         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
9810         LDKChannelMonitor data_var = *data;
9811         uint64_t data_ref = 0;
9812         data_var = ChannelMonitor_clone(&data_var);
9813         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
9814         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
9815         LDKMonitorUpdateId update_id_var = update_id;
9816         uint64_t update_id_ref = 0;
9817         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
9818         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
9819         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 66, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
9820         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
9821         return ret_conv;
9822 }
9823 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
9824         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
9825         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9826 }
9827 static inline LDKPersist LDKPersist_init (JSValue o) {
9828         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
9829         atomic_init(&calls->refcnt, 1);
9830         calls->instance_ptr = o;
9831
9832         LDKPersist ret = {
9833                 .this_arg = (void*) calls,
9834                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
9835                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
9836                 .free = LDKPersist_JCalls_free,
9837         };
9838         return ret;
9839 }
9840 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
9841         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
9842         *res_ptr = LDKPersist_init(o);
9843         return tag_ptr(res_ptr, true);
9844 }
9845 uint32_t  __attribute__((export_name("TS_Persist_persist_new_channel"))) TS_Persist_persist_new_channel(uint64_t this_arg, uint64_t channel_id, uint64_t data, uint64_t update_id) {
9846         void* this_arg_ptr = untag_ptr(this_arg);
9847         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9848         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9849         LDKOutPoint channel_id_conv;
9850         channel_id_conv.inner = untag_ptr(channel_id);
9851         channel_id_conv.is_owned = ptr_is_owned(channel_id);
9852         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9853         channel_id_conv = OutPoint_clone(&channel_id_conv);
9854         LDKChannelMonitor data_conv;
9855         data_conv.inner = untag_ptr(data);
9856         data_conv.is_owned = ptr_is_owned(data);
9857         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9858         data_conv.is_owned = false;
9859         LDKMonitorUpdateId update_id_conv;
9860         update_id_conv.inner = untag_ptr(update_id);
9861         update_id_conv.is_owned = ptr_is_owned(update_id);
9862         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9863         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9864         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv));
9865         return ret_conv;
9866 }
9867
9868 uint32_t  __attribute__((export_name("TS_Persist_update_persisted_channel"))) TS_Persist_update_persisted_channel(uint64_t this_arg, uint64_t channel_id, uint64_t update, uint64_t data, uint64_t update_id) {
9869         void* this_arg_ptr = untag_ptr(this_arg);
9870         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9871         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9872         LDKOutPoint channel_id_conv;
9873         channel_id_conv.inner = untag_ptr(channel_id);
9874         channel_id_conv.is_owned = ptr_is_owned(channel_id);
9875         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9876         channel_id_conv = OutPoint_clone(&channel_id_conv);
9877         LDKChannelMonitorUpdate update_conv;
9878         update_conv.inner = untag_ptr(update);
9879         update_conv.is_owned = ptr_is_owned(update);
9880         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
9881         update_conv = ChannelMonitorUpdate_clone(&update_conv);
9882         LDKChannelMonitor data_conv;
9883         data_conv.inner = untag_ptr(data);
9884         data_conv.is_owned = ptr_is_owned(data);
9885         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9886         data_conv.is_owned = false;
9887         LDKMonitorUpdateId update_id_conv;
9888         update_id_conv.inner = untag_ptr(update_id);
9889         update_id_conv.is_owned = ptr_is_owned(update_id);
9890         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9891         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9892         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, update_conv, &data_conv, update_id_conv));
9893         return ret_conv;
9894 }
9895
9896 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
9897         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
9898         switch(obj->tag) {
9899                 case LDKRetry_Attempts: return 0;
9900                 default: abort();
9901         }
9902 }
9903 uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
9904         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
9905         assert(obj->tag == LDKRetry_Attempts);
9906                         uint32_t attempts_conv = obj->attempts;
9907         return attempts_conv;
9908 }
9909 typedef struct LDKChannelMessageHandler_JCalls {
9910         atomic_size_t refcnt;
9911         uint32_t instance_ptr;
9912         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9913 } LDKChannelMessageHandler_JCalls;
9914 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
9915         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9916         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9917                 FREE(j_calls);
9918         }
9919 }
9920 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
9921         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9922         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9923         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9924         LDKOpenChannel msg_var = *msg;
9925         uint64_t msg_ref = 0;
9926         msg_var = OpenChannel_clone(&msg_var);
9927         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9928         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9929         js_invoke_function_ubuuuu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9930 }
9931 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
9932         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9933         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9934         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9935         LDKAcceptChannel msg_var = *msg;
9936         uint64_t msg_ref = 0;
9937         msg_var = AcceptChannel_clone(&msg_var);
9938         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9939         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9940         js_invoke_function_ubuuuu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9941 }
9942 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
9943         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9944         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9945         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9946         LDKFundingCreated msg_var = *msg;
9947         uint64_t msg_ref = 0;
9948         msg_var = FundingCreated_clone(&msg_var);
9949         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9950         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9951         js_invoke_function_ubuuuu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9952 }
9953 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
9954         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9955         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9956         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9957         LDKFundingSigned msg_var = *msg;
9958         uint64_t msg_ref = 0;
9959         msg_var = FundingSigned_clone(&msg_var);
9960         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9961         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9962         js_invoke_function_ubuuuu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9963 }
9964 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
9965         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9966         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9967         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9968         LDKChannelReady msg_var = *msg;
9969         uint64_t msg_ref = 0;
9970         msg_var = ChannelReady_clone(&msg_var);
9971         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9972         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9973         js_invoke_function_ubuuuu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9974 }
9975 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
9976         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9977         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9978         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9979         LDKShutdown msg_var = *msg;
9980         uint64_t msg_ref = 0;
9981         msg_var = Shutdown_clone(&msg_var);
9982         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9983         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9984         js_invoke_function_ubuuuu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9985 }
9986 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
9987         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9988         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9989         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9990         LDKClosingSigned msg_var = *msg;
9991         uint64_t msg_ref = 0;
9992         msg_var = ClosingSigned_clone(&msg_var);
9993         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9994         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9995         js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9996 }
9997 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
9998         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9999         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10000         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10001         LDKUpdateAddHTLC msg_var = *msg;
10002         uint64_t msg_ref = 0;
10003         msg_var = UpdateAddHTLC_clone(&msg_var);
10004         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10005         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10006         js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10007 }
10008 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
10009         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10010         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10011         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10012         LDKUpdateFulfillHTLC msg_var = *msg;
10013         uint64_t msg_ref = 0;
10014         msg_var = UpdateFulfillHTLC_clone(&msg_var);
10015         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10016         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10017         js_invoke_function_ubuuuu(j_calls->instance_ptr, 75, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10018 }
10019 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
10020         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10021         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10022         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10023         LDKUpdateFailHTLC msg_var = *msg;
10024         uint64_t msg_ref = 0;
10025         msg_var = UpdateFailHTLC_clone(&msg_var);
10026         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10027         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10028         js_invoke_function_ubuuuu(j_calls->instance_ptr, 76, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10029 }
10030 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
10031         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10032         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10033         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10034         LDKUpdateFailMalformedHTLC msg_var = *msg;
10035         uint64_t msg_ref = 0;
10036         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
10037         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10038         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10039         js_invoke_function_ubuuuu(j_calls->instance_ptr, 77, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10040 }
10041 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
10042         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10043         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10044         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10045         LDKCommitmentSigned msg_var = *msg;
10046         uint64_t msg_ref = 0;
10047         msg_var = CommitmentSigned_clone(&msg_var);
10048         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10049         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10050         js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10051 }
10052 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
10053         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10054         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10055         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10056         LDKRevokeAndACK msg_var = *msg;
10057         uint64_t msg_ref = 0;
10058         msg_var = RevokeAndACK_clone(&msg_var);
10059         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10060         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10061         js_invoke_function_ubuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10062 }
10063 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
10064         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10065         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10066         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10067         LDKUpdateFee msg_var = *msg;
10068         uint64_t msg_ref = 0;
10069         msg_var = UpdateFee_clone(&msg_var);
10070         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10071         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10072         js_invoke_function_ubuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10073 }
10074 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
10075         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10076         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10077         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10078         LDKAnnouncementSignatures msg_var = *msg;
10079         uint64_t msg_ref = 0;
10080         msg_var = AnnouncementSignatures_clone(&msg_var);
10081         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10082         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10083         js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10084 }
10085 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10086         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10087         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10088         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10089         js_invoke_function_uuuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10090 }
10091 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
10092         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10093         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10094         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10095         LDKInit msg_var = *msg;
10096         uint64_t msg_ref = 0;
10097         msg_var = Init_clone(&msg_var);
10098         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10099         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10100         jboolean inbound_conv = inbound;
10101         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, inbound_conv, 0, 0, 0);
10102         void* ret_ptr = untag_ptr(ret);
10103         CHECK_ACCESS(ret_ptr);
10104         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
10105         FREE(untag_ptr(ret));
10106         return ret_conv;
10107 }
10108 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
10109         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10110         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10111         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10112         LDKChannelReestablish msg_var = *msg;
10113         uint64_t msg_ref = 0;
10114         msg_var = ChannelReestablish_clone(&msg_var);
10115         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10116         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10117         js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10118 }
10119 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
10120         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10121         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10122         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10123         LDKChannelUpdate msg_var = *msg;
10124         uint64_t msg_ref = 0;
10125         msg_var = ChannelUpdate_clone(&msg_var);
10126         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10127         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10128         js_invoke_function_ubuuuu(j_calls->instance_ptr, 85, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10129 }
10130 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
10131         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10132         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10133         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10134         LDKErrorMessage msg_var = *msg;
10135         uint64_t msg_ref = 0;
10136         msg_var = ErrorMessage_clone(&msg_var);
10137         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10138         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10139         js_invoke_function_ubuuuu(j_calls->instance_ptr, 86, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10140 }
10141 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
10142         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10143         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 87, 0, 0, 0, 0, 0, 0);
10144         LDKNodeFeatures ret_conv;
10145         ret_conv.inner = untag_ptr(ret);
10146         ret_conv.is_owned = ptr_is_owned(ret);
10147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10148         return ret_conv;
10149 }
10150 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10151         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10152         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10153         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10154         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 88, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10155         LDKInitFeatures ret_conv;
10156         ret_conv.inner = untag_ptr(ret);
10157         ret_conv.is_owned = ptr_is_owned(ret);
10158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10159         return ret_conv;
10160 }
10161 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
10162         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
10163         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10164         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
10165 }
10166 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
10167         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
10168         atomic_init(&calls->refcnt, 1);
10169         calls->instance_ptr = o;
10170
10171         LDKChannelMessageHandler ret = {
10172                 .this_arg = (void*) calls,
10173                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
10174                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
10175                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
10176                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
10177                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
10178                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
10179                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
10180                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
10181                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
10182                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
10183                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
10184                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
10185                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
10186                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
10187                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
10188                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
10189                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
10190                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
10191                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
10192                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
10193                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
10194                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
10195                 .free = LDKChannelMessageHandler_JCalls_free,
10196                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
10197         };
10198         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
10199         return ret;
10200 }
10201 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
10202         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
10203         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
10204         return tag_ptr(res_ptr, true);
10205 }
10206 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 msg) {
10207         void* this_arg_ptr = untag_ptr(this_arg);
10208         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10209         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10210         LDKPublicKey their_node_id_ref;
10211         CHECK(their_node_id->arr_len == 33);
10212         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10213         LDKOpenChannel msg_conv;
10214         msg_conv.inner = untag_ptr(msg);
10215         msg_conv.is_owned = ptr_is_owned(msg);
10216         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10217         msg_conv.is_owned = false;
10218         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10219 }
10220
10221 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 msg) {
10222         void* this_arg_ptr = untag_ptr(this_arg);
10223         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10224         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10225         LDKPublicKey their_node_id_ref;
10226         CHECK(their_node_id->arr_len == 33);
10227         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10228         LDKAcceptChannel msg_conv;
10229         msg_conv.inner = untag_ptr(msg);
10230         msg_conv.is_owned = ptr_is_owned(msg);
10231         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10232         msg_conv.is_owned = false;
10233         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10234 }
10235
10236 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) {
10237         void* this_arg_ptr = untag_ptr(this_arg);
10238         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10239         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10240         LDKPublicKey their_node_id_ref;
10241         CHECK(their_node_id->arr_len == 33);
10242         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10243         LDKFundingCreated msg_conv;
10244         msg_conv.inner = untag_ptr(msg);
10245         msg_conv.is_owned = ptr_is_owned(msg);
10246         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10247         msg_conv.is_owned = false;
10248         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10249 }
10250
10251 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) {
10252         void* this_arg_ptr = untag_ptr(this_arg);
10253         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10254         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10255         LDKPublicKey their_node_id_ref;
10256         CHECK(their_node_id->arr_len == 33);
10257         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10258         LDKFundingSigned msg_conv;
10259         msg_conv.inner = untag_ptr(msg);
10260         msg_conv.is_owned = ptr_is_owned(msg);
10261         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10262         msg_conv.is_owned = false;
10263         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10264 }
10265
10266 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) {
10267         void* this_arg_ptr = untag_ptr(this_arg);
10268         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10269         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10270         LDKPublicKey their_node_id_ref;
10271         CHECK(their_node_id->arr_len == 33);
10272         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10273         LDKChannelReady msg_conv;
10274         msg_conv.inner = untag_ptr(msg);
10275         msg_conv.is_owned = ptr_is_owned(msg);
10276         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10277         msg_conv.is_owned = false;
10278         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10279 }
10280
10281 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
10282         void* this_arg_ptr = untag_ptr(this_arg);
10283         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10284         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10285         LDKPublicKey their_node_id_ref;
10286         CHECK(their_node_id->arr_len == 33);
10287         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10288         LDKShutdown msg_conv;
10289         msg_conv.inner = untag_ptr(msg);
10290         msg_conv.is_owned = ptr_is_owned(msg);
10291         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10292         msg_conv.is_owned = false;
10293         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10294 }
10295
10296 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) {
10297         void* this_arg_ptr = untag_ptr(this_arg);
10298         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10299         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10300         LDKPublicKey their_node_id_ref;
10301         CHECK(their_node_id->arr_len == 33);
10302         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10303         LDKClosingSigned msg_conv;
10304         msg_conv.inner = untag_ptr(msg);
10305         msg_conv.is_owned = ptr_is_owned(msg);
10306         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10307         msg_conv.is_owned = false;
10308         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10309 }
10310
10311 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) {
10312         void* this_arg_ptr = untag_ptr(this_arg);
10313         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10314         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10315         LDKPublicKey their_node_id_ref;
10316         CHECK(their_node_id->arr_len == 33);
10317         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10318         LDKUpdateAddHTLC msg_conv;
10319         msg_conv.inner = untag_ptr(msg);
10320         msg_conv.is_owned = ptr_is_owned(msg);
10321         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10322         msg_conv.is_owned = false;
10323         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10324 }
10325
10326 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) {
10327         void* this_arg_ptr = untag_ptr(this_arg);
10328         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10329         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10330         LDKPublicKey their_node_id_ref;
10331         CHECK(their_node_id->arr_len == 33);
10332         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10333         LDKUpdateFulfillHTLC msg_conv;
10334         msg_conv.inner = untag_ptr(msg);
10335         msg_conv.is_owned = ptr_is_owned(msg);
10336         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10337         msg_conv.is_owned = false;
10338         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10339 }
10340
10341 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) {
10342         void* this_arg_ptr = untag_ptr(this_arg);
10343         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10344         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10345         LDKPublicKey their_node_id_ref;
10346         CHECK(their_node_id->arr_len == 33);
10347         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10348         LDKUpdateFailHTLC msg_conv;
10349         msg_conv.inner = untag_ptr(msg);
10350         msg_conv.is_owned = ptr_is_owned(msg);
10351         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10352         msg_conv.is_owned = false;
10353         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10354 }
10355
10356 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) {
10357         void* this_arg_ptr = untag_ptr(this_arg);
10358         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10359         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10360         LDKPublicKey their_node_id_ref;
10361         CHECK(their_node_id->arr_len == 33);
10362         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10363         LDKUpdateFailMalformedHTLC msg_conv;
10364         msg_conv.inner = untag_ptr(msg);
10365         msg_conv.is_owned = ptr_is_owned(msg);
10366         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10367         msg_conv.is_owned = false;
10368         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10369 }
10370
10371 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) {
10372         void* this_arg_ptr = untag_ptr(this_arg);
10373         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10374         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10375         LDKPublicKey their_node_id_ref;
10376         CHECK(their_node_id->arr_len == 33);
10377         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10378         LDKCommitmentSigned msg_conv;
10379         msg_conv.inner = untag_ptr(msg);
10380         msg_conv.is_owned = ptr_is_owned(msg);
10381         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10382         msg_conv.is_owned = false;
10383         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10384 }
10385
10386 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) {
10387         void* this_arg_ptr = untag_ptr(this_arg);
10388         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10389         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10390         LDKPublicKey their_node_id_ref;
10391         CHECK(their_node_id->arr_len == 33);
10392         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10393         LDKRevokeAndACK msg_conv;
10394         msg_conv.inner = untag_ptr(msg);
10395         msg_conv.is_owned = ptr_is_owned(msg);
10396         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10397         msg_conv.is_owned = false;
10398         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10399 }
10400
10401 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) {
10402         void* this_arg_ptr = untag_ptr(this_arg);
10403         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10404         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10405         LDKPublicKey their_node_id_ref;
10406         CHECK(their_node_id->arr_len == 33);
10407         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10408         LDKUpdateFee msg_conv;
10409         msg_conv.inner = untag_ptr(msg);
10410         msg_conv.is_owned = ptr_is_owned(msg);
10411         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10412         msg_conv.is_owned = false;
10413         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10414 }
10415
10416 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) {
10417         void* this_arg_ptr = untag_ptr(this_arg);
10418         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10419         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10420         LDKPublicKey their_node_id_ref;
10421         CHECK(their_node_id->arr_len == 33);
10422         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10423         LDKAnnouncementSignatures msg_conv;
10424         msg_conv.inner = untag_ptr(msg);
10425         msg_conv.is_owned = ptr_is_owned(msg);
10426         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10427         msg_conv.is_owned = false;
10428         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10429 }
10430
10431 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
10432         void* this_arg_ptr = untag_ptr(this_arg);
10433         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10434         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10435         LDKPublicKey their_node_id_ref;
10436         CHECK(their_node_id->arr_len == 33);
10437         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10438         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
10439 }
10440
10441 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_peer_connected"))) TS_ChannelMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg, jboolean inbound) {
10442         void* this_arg_ptr = untag_ptr(this_arg);
10443         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10444         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10445         LDKPublicKey their_node_id_ref;
10446         CHECK(their_node_id->arr_len == 33);
10447         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10448         LDKInit msg_conv;
10449         msg_conv.inner = untag_ptr(msg);
10450         msg_conv.is_owned = ptr_is_owned(msg);
10451         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10452         msg_conv.is_owned = false;
10453         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10454         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
10455         return tag_ptr(ret_conv, true);
10456 }
10457
10458 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) {
10459         void* this_arg_ptr = untag_ptr(this_arg);
10460         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10461         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10462         LDKPublicKey their_node_id_ref;
10463         CHECK(their_node_id->arr_len == 33);
10464         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10465         LDKChannelReestablish msg_conv;
10466         msg_conv.inner = untag_ptr(msg);
10467         msg_conv.is_owned = ptr_is_owned(msg);
10468         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10469         msg_conv.is_owned = false;
10470         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10471 }
10472
10473 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) {
10474         void* this_arg_ptr = untag_ptr(this_arg);
10475         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10476         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10477         LDKPublicKey their_node_id_ref;
10478         CHECK(their_node_id->arr_len == 33);
10479         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10480         LDKChannelUpdate msg_conv;
10481         msg_conv.inner = untag_ptr(msg);
10482         msg_conv.is_owned = ptr_is_owned(msg);
10483         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10484         msg_conv.is_owned = false;
10485         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10486 }
10487
10488 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
10489         void* this_arg_ptr = untag_ptr(this_arg);
10490         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10491         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10492         LDKPublicKey their_node_id_ref;
10493         CHECK(their_node_id->arr_len == 33);
10494         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10495         LDKErrorMessage msg_conv;
10496         msg_conv.inner = untag_ptr(msg);
10497         msg_conv.is_owned = ptr_is_owned(msg);
10498         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10499         msg_conv.is_owned = false;
10500         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10501 }
10502
10503 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
10504         void* this_arg_ptr = untag_ptr(this_arg);
10505         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10506         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10507         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
10508         uint64_t ret_ref = 0;
10509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10511         return ret_ref;
10512 }
10513
10514 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
10515         void* this_arg_ptr = untag_ptr(this_arg);
10516         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10517         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10518         LDKPublicKey their_node_id_ref;
10519         CHECK(their_node_id->arr_len == 33);
10520         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10521         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
10522         uint64_t ret_ref = 0;
10523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10525         return ret_ref;
10526 }
10527
10528 typedef struct LDKRoutingMessageHandler_JCalls {
10529         atomic_size_t refcnt;
10530         uint32_t instance_ptr;
10531         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
10532 } LDKRoutingMessageHandler_JCalls;
10533 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
10534         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10535         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10536                 FREE(j_calls);
10537         }
10538 }
10539 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
10540         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10541         LDKNodeAnnouncement msg_var = *msg;
10542         uint64_t msg_ref = 0;
10543         msg_var = NodeAnnouncement_clone(&msg_var);
10544         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10545         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10546         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 89, msg_ref, 0, 0, 0, 0, 0);
10547         void* ret_ptr = untag_ptr(ret);
10548         CHECK_ACCESS(ret_ptr);
10549         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
10550         FREE(untag_ptr(ret));
10551         return ret_conv;
10552 }
10553 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
10554         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10555         LDKChannelAnnouncement msg_var = *msg;
10556         uint64_t msg_ref = 0;
10557         msg_var = ChannelAnnouncement_clone(&msg_var);
10558         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10559         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10560         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 90, msg_ref, 0, 0, 0, 0, 0);
10561         void* ret_ptr = untag_ptr(ret);
10562         CHECK_ACCESS(ret_ptr);
10563         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
10564         FREE(untag_ptr(ret));
10565         return ret_conv;
10566 }
10567 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
10568         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10569         LDKChannelUpdate msg_var = *msg;
10570         uint64_t msg_ref = 0;
10571         msg_var = ChannelUpdate_clone(&msg_var);
10572         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10573         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10574         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 91, msg_ref, 0, 0, 0, 0, 0);
10575         void* ret_ptr = untag_ptr(ret);
10576         CHECK_ACCESS(ret_ptr);
10577         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
10578         FREE(untag_ptr(ret));
10579         return ret_conv;
10580 }
10581 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
10582         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10583         int64_t starting_point_conv = starting_point;
10584         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 92, starting_point_conv, 0, 0, 0, 0, 0);
10585         void* ret_ptr = untag_ptr(ret);
10586         CHECK_ACCESS(ret_ptr);
10587         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
10588         FREE(untag_ptr(ret));
10589         return ret_conv;
10590 }
10591 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
10592         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10593         LDKNodeId starting_point_var = starting_point;
10594         uint64_t starting_point_ref = 0;
10595         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
10596         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
10597         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 93, starting_point_ref, 0, 0, 0, 0, 0);
10598         LDKNodeAnnouncement ret_conv;
10599         ret_conv.inner = untag_ptr(ret);
10600         ret_conv.is_owned = ptr_is_owned(ret);
10601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10602         return ret_conv;
10603 }
10604 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
10605         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10606         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10607         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10608         LDKInit init_var = *init;
10609         uint64_t init_ref = 0;
10610         init_var = Init_clone(&init_var);
10611         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
10612         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
10613         jboolean inbound_conv = inbound;
10614         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0);
10615         void* ret_ptr = untag_ptr(ret);
10616         CHECK_ACCESS(ret_ptr);
10617         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
10618         FREE(untag_ptr(ret));
10619         return ret_conv;
10620 }
10621 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
10622         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10623         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10624         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10625         LDKReplyChannelRange msg_var = msg;
10626         uint64_t msg_ref = 0;
10627         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10628         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10629         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10630         void* ret_ptr = untag_ptr(ret);
10631         CHECK_ACCESS(ret_ptr);
10632         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10633         FREE(untag_ptr(ret));
10634         return ret_conv;
10635 }
10636 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
10637         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10638         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10639         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10640         LDKReplyShortChannelIdsEnd msg_var = msg;
10641         uint64_t msg_ref = 0;
10642         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10643         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10644         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10645         void* ret_ptr = untag_ptr(ret);
10646         CHECK_ACCESS(ret_ptr);
10647         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10648         FREE(untag_ptr(ret));
10649         return ret_conv;
10650 }
10651 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
10652         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10653         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10654         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10655         LDKQueryChannelRange msg_var = msg;
10656         uint64_t msg_ref = 0;
10657         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10658         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10659         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 97, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10660         void* ret_ptr = untag_ptr(ret);
10661         CHECK_ACCESS(ret_ptr);
10662         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10663         FREE(untag_ptr(ret));
10664         return ret_conv;
10665 }
10666 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
10667         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10668         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10669         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10670         LDKQueryShortChannelIds msg_var = msg;
10671         uint64_t msg_ref = 0;
10672         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10673         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10674         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 98, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10675         void* ret_ptr = untag_ptr(ret);
10676         CHECK_ACCESS(ret_ptr);
10677         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10678         FREE(untag_ptr(ret));
10679         return ret_conv;
10680 }
10681 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
10682         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10683         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 99, 0, 0, 0, 0, 0, 0);
10684 }
10685 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
10686         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10687         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 100, 0, 0, 0, 0, 0, 0);
10688         LDKNodeFeatures ret_conv;
10689         ret_conv.inner = untag_ptr(ret);
10690         ret_conv.is_owned = ptr_is_owned(ret);
10691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10692         return ret_conv;
10693 }
10694 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10695         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10696         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10697         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10698         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 101, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10699         LDKInitFeatures ret_conv;
10700         ret_conv.inner = untag_ptr(ret);
10701         ret_conv.is_owned = ptr_is_owned(ret);
10702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10703         return ret_conv;
10704 }
10705 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
10706         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
10707         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10708         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
10709 }
10710 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
10711         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
10712         atomic_init(&calls->refcnt, 1);
10713         calls->instance_ptr = o;
10714
10715         LDKRoutingMessageHandler ret = {
10716                 .this_arg = (void*) calls,
10717                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
10718                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
10719                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
10720                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
10721                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
10722                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
10723                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
10724                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
10725                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
10726                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
10727                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
10728                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
10729                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
10730                 .free = LDKRoutingMessageHandler_JCalls_free,
10731                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
10732         };
10733         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
10734         return ret;
10735 }
10736 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
10737         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
10738         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
10739         return tag_ptr(res_ptr, true);
10740 }
10741 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
10742         void* this_arg_ptr = untag_ptr(this_arg);
10743         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10744         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10745         LDKNodeAnnouncement msg_conv;
10746         msg_conv.inner = untag_ptr(msg);
10747         msg_conv.is_owned = ptr_is_owned(msg);
10748         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10749         msg_conv.is_owned = false;
10750         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10751         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
10752         return tag_ptr(ret_conv, true);
10753 }
10754
10755 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
10756         void* this_arg_ptr = untag_ptr(this_arg);
10757         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10758         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10759         LDKChannelAnnouncement msg_conv;
10760         msg_conv.inner = untag_ptr(msg);
10761         msg_conv.is_owned = ptr_is_owned(msg);
10762         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10763         msg_conv.is_owned = false;
10764         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10765         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
10766         return tag_ptr(ret_conv, true);
10767 }
10768
10769 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
10770         void* this_arg_ptr = untag_ptr(this_arg);
10771         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10772         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10773         LDKChannelUpdate msg_conv;
10774         msg_conv.inner = untag_ptr(msg);
10775         msg_conv.is_owned = ptr_is_owned(msg);
10776         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10777         msg_conv.is_owned = false;
10778         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10779         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
10780         return tag_ptr(ret_conv, true);
10781 }
10782
10783 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_get_next_channel_announcement"))) TS_RoutingMessageHandler_get_next_channel_announcement(uint64_t this_arg, int64_t starting_point) {
10784         void* this_arg_ptr = untag_ptr(this_arg);
10785         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10786         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10787         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
10788         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
10789         uint64_t ret_ref = tag_ptr(ret_copy, true);
10790         return ret_ref;
10791 }
10792
10793 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_get_next_node_announcement"))) TS_RoutingMessageHandler_get_next_node_announcement(uint64_t this_arg, uint64_t starting_point) {
10794         void* this_arg_ptr = untag_ptr(this_arg);
10795         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10796         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10797         LDKNodeId starting_point_conv;
10798         starting_point_conv.inner = untag_ptr(starting_point);
10799         starting_point_conv.is_owned = ptr_is_owned(starting_point);
10800         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
10801         starting_point_conv = NodeId_clone(&starting_point_conv);
10802         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
10803         uint64_t ret_ref = 0;
10804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10806         return ret_ref;
10807 }
10808
10809 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_peer_connected"))) TS_RoutingMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t init, jboolean inbound) {
10810         void* this_arg_ptr = untag_ptr(this_arg);
10811         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10812         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10813         LDKPublicKey their_node_id_ref;
10814         CHECK(their_node_id->arr_len == 33);
10815         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10816         LDKInit init_conv;
10817         init_conv.inner = untag_ptr(init);
10818         init_conv.is_owned = ptr_is_owned(init);
10819         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
10820         init_conv.is_owned = false;
10821         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10822         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
10823         return tag_ptr(ret_conv, true);
10824 }
10825
10826 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) {
10827         void* this_arg_ptr = untag_ptr(this_arg);
10828         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10829         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10830         LDKPublicKey their_node_id_ref;
10831         CHECK(their_node_id->arr_len == 33);
10832         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10833         LDKReplyChannelRange msg_conv;
10834         msg_conv.inner = untag_ptr(msg);
10835         msg_conv.is_owned = ptr_is_owned(msg);
10836         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10837         msg_conv = ReplyChannelRange_clone(&msg_conv);
10838         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10839         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10840         return tag_ptr(ret_conv, true);
10841 }
10842
10843 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) {
10844         void* this_arg_ptr = untag_ptr(this_arg);
10845         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10846         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10847         LDKPublicKey their_node_id_ref;
10848         CHECK(their_node_id->arr_len == 33);
10849         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10850         LDKReplyShortChannelIdsEnd msg_conv;
10851         msg_conv.inner = untag_ptr(msg);
10852         msg_conv.is_owned = ptr_is_owned(msg);
10853         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10854         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
10855         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10856         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10857         return tag_ptr(ret_conv, true);
10858 }
10859
10860 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) {
10861         void* this_arg_ptr = untag_ptr(this_arg);
10862         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10863         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10864         LDKPublicKey their_node_id_ref;
10865         CHECK(their_node_id->arr_len == 33);
10866         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10867         LDKQueryChannelRange msg_conv;
10868         msg_conv.inner = untag_ptr(msg);
10869         msg_conv.is_owned = ptr_is_owned(msg);
10870         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10871         msg_conv = QueryChannelRange_clone(&msg_conv);
10872         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10873         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10874         return tag_ptr(ret_conv, true);
10875 }
10876
10877 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) {
10878         void* this_arg_ptr = untag_ptr(this_arg);
10879         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10880         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10881         LDKPublicKey their_node_id_ref;
10882         CHECK(their_node_id->arr_len == 33);
10883         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10884         LDKQueryShortChannelIds msg_conv;
10885         msg_conv.inner = untag_ptr(msg);
10886         msg_conv.is_owned = ptr_is_owned(msg);
10887         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10888         msg_conv = QueryShortChannelIds_clone(&msg_conv);
10889         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10890         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10891         return tag_ptr(ret_conv, true);
10892 }
10893
10894 jboolean  __attribute__((export_name("TS_RoutingMessageHandler_processing_queue_high"))) TS_RoutingMessageHandler_processing_queue_high(uint64_t this_arg) {
10895         void* this_arg_ptr = untag_ptr(this_arg);
10896         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10897         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10898         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
10899         return ret_conv;
10900 }
10901
10902 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
10903         void* this_arg_ptr = untag_ptr(this_arg);
10904         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10905         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10906         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
10907         uint64_t ret_ref = 0;
10908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10910         return ret_ref;
10911 }
10912
10913 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
10914         void* this_arg_ptr = untag_ptr(this_arg);
10915         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10916         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10917         LDKPublicKey their_node_id_ref;
10918         CHECK(their_node_id->arr_len == 33);
10919         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10920         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
10921         uint64_t ret_ref = 0;
10922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10924         return ret_ref;
10925 }
10926
10927 typedef struct LDKOnionMessageHandler_JCalls {
10928         atomic_size_t refcnt;
10929         uint32_t instance_ptr;
10930         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
10931 } LDKOnionMessageHandler_JCalls;
10932 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
10933         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10934         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10935                 FREE(j_calls);
10936         }
10937 }
10938 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
10939         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10940         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
10941         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
10942         LDKOnionMessage msg_var = *msg;
10943         uint64_t msg_ref = 0;
10944         msg_var = OnionMessage_clone(&msg_var);
10945         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10946         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10947         js_invoke_function_ubuuuu(j_calls->instance_ptr, 102, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
10948 }
10949 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
10950         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10951         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10952         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10953         LDKInit init_var = *init;
10954         uint64_t init_ref = 0;
10955         init_var = Init_clone(&init_var);
10956         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
10957         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
10958         jboolean inbound_conv = inbound;
10959         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 103, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0);
10960         void* ret_ptr = untag_ptr(ret);
10961         CHECK_ACCESS(ret_ptr);
10962         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
10963         FREE(untag_ptr(ret));
10964         return ret_conv;
10965 }
10966 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10967         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10968         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10969         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10970         js_invoke_function_uuuuuu(j_calls->instance_ptr, 104, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10971 }
10972 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
10973         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10974         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 105, 0, 0, 0, 0, 0, 0);
10975         LDKNodeFeatures ret_conv;
10976         ret_conv.inner = untag_ptr(ret);
10977         ret_conv.is_owned = ptr_is_owned(ret);
10978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10979         return ret_conv;
10980 }
10981 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10982         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10983         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10984         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10985         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 106, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10986         LDKInitFeatures ret_conv;
10987         ret_conv.inner = untag_ptr(ret);
10988         ret_conv.is_owned = ptr_is_owned(ret);
10989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10990         return ret_conv;
10991 }
10992 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
10993         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
10994         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10995         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
10996 }
10997 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o, JSValue OnionMessageProvider) {
10998         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
10999         atomic_init(&calls->refcnt, 1);
11000         calls->instance_ptr = o;
11001
11002         LDKOnionMessageHandler ret = {
11003                 .this_arg = (void*) calls,
11004                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
11005                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
11006                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
11007                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
11008                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
11009                 .free = LDKOnionMessageHandler_JCalls_free,
11010                 .OnionMessageProvider = LDKOnionMessageProvider_init(OnionMessageProvider),
11011         };
11012         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
11013         return ret;
11014 }
11015 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o, JSValue OnionMessageProvider) {
11016         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
11017         *res_ptr = LDKOnionMessageHandler_init(o, OnionMessageProvider);
11018         return tag_ptr(res_ptr, true);
11019 }
11020 void  __attribute__((export_name("TS_OnionMessageHandler_handle_onion_message"))) TS_OnionMessageHandler_handle_onion_message(uint64_t this_arg, int8_tArray peer_node_id, uint64_t msg) {
11021         void* this_arg_ptr = untag_ptr(this_arg);
11022         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11023         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11024         LDKPublicKey peer_node_id_ref;
11025         CHECK(peer_node_id->arr_len == 33);
11026         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
11027         LDKOnionMessage msg_conv;
11028         msg_conv.inner = untag_ptr(msg);
11029         msg_conv.is_owned = ptr_is_owned(msg);
11030         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11031         msg_conv.is_owned = false;
11032         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
11033 }
11034
11035 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_peer_connected"))) TS_OnionMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t init, jboolean inbound) {
11036         void* this_arg_ptr = untag_ptr(this_arg);
11037         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11038         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11039         LDKPublicKey their_node_id_ref;
11040         CHECK(their_node_id->arr_len == 33);
11041         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
11042         LDKInit init_conv;
11043         init_conv.inner = untag_ptr(init);
11044         init_conv.is_owned = ptr_is_owned(init);
11045         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
11046         init_conv.is_owned = false;
11047         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11048         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
11049         return tag_ptr(ret_conv, true);
11050 }
11051
11052 void  __attribute__((export_name("TS_OnionMessageHandler_peer_disconnected"))) TS_OnionMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
11053         void* this_arg_ptr = untag_ptr(this_arg);
11054         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11055         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11056         LDKPublicKey their_node_id_ref;
11057         CHECK(their_node_id->arr_len == 33);
11058         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
11059         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
11060 }
11061
11062 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
11063         void* this_arg_ptr = untag_ptr(this_arg);
11064         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11065         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11066         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
11067         uint64_t ret_ref = 0;
11068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11070         return ret_ref;
11071 }
11072
11073 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
11074         void* this_arg_ptr = untag_ptr(this_arg);
11075         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11076         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11077         LDKPublicKey their_node_id_ref;
11078         CHECK(their_node_id->arr_len == 33);
11079         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
11080         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
11081         uint64_t ret_ref = 0;
11082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11084         return ret_ref;
11085 }
11086
11087 typedef struct LDKCustomMessageReader_JCalls {
11088         atomic_size_t refcnt;
11089         uint32_t instance_ptr;
11090 } LDKCustomMessageReader_JCalls;
11091 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
11092         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
11093         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11094                 FREE(j_calls);
11095         }
11096 }
11097 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
11098         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
11099         int16_t message_type_conv = message_type;
11100         LDKu8slice buffer_var = buffer;
11101         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
11102         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
11103         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 107, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
11104         void* ret_ptr = untag_ptr(ret);
11105         CHECK_ACCESS(ret_ptr);
11106         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
11107         FREE(untag_ptr(ret));
11108         return ret_conv;
11109 }
11110 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
11111         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
11112         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11113 }
11114 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
11115         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
11116         atomic_init(&calls->refcnt, 1);
11117         calls->instance_ptr = o;
11118
11119         LDKCustomMessageReader ret = {
11120                 .this_arg = (void*) calls,
11121                 .read = read_LDKCustomMessageReader_jcall,
11122                 .free = LDKCustomMessageReader_JCalls_free,
11123         };
11124         return ret;
11125 }
11126 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
11127         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
11128         *res_ptr = LDKCustomMessageReader_init(o);
11129         return tag_ptr(res_ptr, true);
11130 }
11131 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
11132         void* this_arg_ptr = untag_ptr(this_arg);
11133         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11134         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
11135         LDKu8slice buffer_ref;
11136         buffer_ref.datalen = buffer->arr_len;
11137         buffer_ref.data = buffer->elems;
11138         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
11139         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
11140         FREE(buffer);
11141         return tag_ptr(ret_conv, true);
11142 }
11143
11144 typedef struct LDKCustomMessageHandler_JCalls {
11145         atomic_size_t refcnt;
11146         uint32_t instance_ptr;
11147         LDKCustomMessageReader_JCalls* CustomMessageReader;
11148 } LDKCustomMessageHandler_JCalls;
11149 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
11150         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
11151         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11152                 FREE(j_calls);
11153         }
11154 }
11155 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
11156         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
11157         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
11158         *msg_ret = msg;
11159         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
11160         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
11161         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 108, tag_ptr(msg_ret, true), (uint32_t)sender_node_id_arr, 0, 0, 0, 0);
11162         void* ret_ptr = untag_ptr(ret);
11163         CHECK_ACCESS(ret_ptr);
11164         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
11165         FREE(untag_ptr(ret));
11166         return ret_conv;
11167 }
11168 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
11169         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
11170         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 109, 0, 0, 0, 0, 0, 0);
11171         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
11172         ret_constr.datalen = ret->arr_len;
11173         if (ret_constr.datalen > 0)
11174                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
11175         else
11176                 ret_constr.data = NULL;
11177         uint64_t* ret_vals = ret->elems;
11178         for (size_t z = 0; z < ret_constr.datalen; z++) {
11179                 uint64_t ret_conv_25 = ret_vals[z];
11180                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
11181                 CHECK_ACCESS(ret_conv_25_ptr);
11182                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
11183                 FREE(untag_ptr(ret_conv_25));
11184                 ret_constr.data[z] = ret_conv_25_conv;
11185         }
11186         FREE(ret);
11187         return ret_constr;
11188 }
11189 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
11190         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
11191         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11192         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
11193 }
11194 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
11195         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
11196         atomic_init(&calls->refcnt, 1);
11197         calls->instance_ptr = o;
11198
11199         LDKCustomMessageHandler ret = {
11200                 .this_arg = (void*) calls,
11201                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
11202                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
11203                 .free = LDKCustomMessageHandler_JCalls_free,
11204                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
11205         };
11206         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
11207         return ret;
11208 }
11209 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
11210         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
11211         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
11212         return tag_ptr(res_ptr, true);
11213 }
11214 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) {
11215         void* this_arg_ptr = untag_ptr(this_arg);
11216         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11217         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
11218         void* msg_ptr = untag_ptr(msg);
11219         CHECK_ACCESS(msg_ptr);
11220         LDKType msg_conv = *(LDKType*)(msg_ptr);
11221         if (msg_conv.free == LDKType_JCalls_free) {
11222                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11223                 LDKType_JCalls_cloned(&msg_conv);
11224         }
11225         LDKPublicKey sender_node_id_ref;
11226         CHECK(sender_node_id->arr_len == 33);
11227         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
11228         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11229         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
11230         return tag_ptr(ret_conv, true);
11231 }
11232
11233 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
11234         void* this_arg_ptr = untag_ptr(this_arg);
11235         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11236         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
11237         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
11238         uint64_tArray ret_arr = NULL;
11239         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
11240         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
11241         for (size_t z = 0; z < ret_var.datalen; z++) {
11242                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11243                 *ret_conv_25_conv = ret_var.data[z];
11244                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
11245         }
11246         
11247         FREE(ret_var.data);
11248         return ret_arr;
11249 }
11250
11251 typedef struct LDKCustomOnionMessageHandler_JCalls {
11252         atomic_size_t refcnt;
11253         uint32_t instance_ptr;
11254 } LDKCustomOnionMessageHandler_JCalls;
11255 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
11256         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
11257         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11258                 FREE(j_calls);
11259         }
11260 }
11261 void handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKCustomOnionMessageContents msg) {
11262         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
11263         LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
11264         *msg_ret = msg;
11265         js_invoke_function_buuuuu(j_calls->instance_ptr, 110, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
11266 }
11267 LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
11268         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
11269         int64_t message_type_conv = message_type;
11270         LDKu8slice buffer_var = buffer;
11271         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
11272         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
11273         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 111, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
11274         void* ret_ptr = untag_ptr(ret);
11275         CHECK_ACCESS(ret_ptr);
11276         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr);
11277         FREE(untag_ptr(ret));
11278         return ret_conv;
11279 }
11280 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
11281         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
11282         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11283 }
11284 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
11285         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
11286         atomic_init(&calls->refcnt, 1);
11287         calls->instance_ptr = o;
11288
11289         LDKCustomOnionMessageHandler ret = {
11290                 .this_arg = (void*) calls,
11291                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
11292                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
11293                 .free = LDKCustomOnionMessageHandler_JCalls_free,
11294         };
11295         return ret;
11296 }
11297 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
11298         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
11299         *res_ptr = LDKCustomOnionMessageHandler_init(o);
11300         return tag_ptr(res_ptr, true);
11301 }
11302 void  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
11303         void* this_arg_ptr = untag_ptr(this_arg);
11304         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11305         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
11306         void* msg_ptr = untag_ptr(msg);
11307         CHECK_ACCESS(msg_ptr);
11308         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
11309         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
11310                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11311                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
11312         }
11313         (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
11314 }
11315
11316 uint64_t  __attribute__((export_name("TS_CustomOnionMessageHandler_read_custom_message"))) TS_CustomOnionMessageHandler_read_custom_message(uint64_t this_arg, int64_t message_type, int8_tArray buffer) {
11317         void* this_arg_ptr = untag_ptr(this_arg);
11318         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11319         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
11320         LDKu8slice buffer_ref;
11321         buffer_ref.datalen = buffer->arr_len;
11322         buffer_ref.data = buffer->elems;
11323         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
11324         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
11325         FREE(buffer);
11326         return tag_ptr(ret_conv, true);
11327 }
11328
11329 typedef struct LDKSocketDescriptor_JCalls {
11330         atomic_size_t refcnt;
11331         uint32_t instance_ptr;
11332 } LDKSocketDescriptor_JCalls;
11333 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
11334         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11335         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11336                 FREE(j_calls);
11337         }
11338 }
11339 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
11340         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11341         LDKu8slice data_var = data;
11342         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
11343         memcpy(data_arr->elems, data_var.data, data_var.datalen);
11344         jboolean resume_read_conv = resume_read;
11345         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 112, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
11346 }
11347 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
11348         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11349         js_invoke_function_uuuuuu(j_calls->instance_ptr, 113, 0, 0, 0, 0, 0, 0);
11350 }
11351 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
11352         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11353         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
11354         *other_arg_clone = SocketDescriptor_clone(other_arg);
11355         return js_invoke_function_buuuuu(j_calls->instance_ptr, 114, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
11356 }
11357 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
11358         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11359         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 115, 0, 0, 0, 0, 0, 0);
11360 }
11361 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
11362         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
11363         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11364 }
11365 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
11366         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
11367         atomic_init(&calls->refcnt, 1);
11368         calls->instance_ptr = o;
11369
11370         LDKSocketDescriptor ret = {
11371                 .this_arg = (void*) calls,
11372                 .send_data = send_data_LDKSocketDescriptor_jcall,
11373                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
11374                 .eq = eq_LDKSocketDescriptor_jcall,
11375                 .hash = hash_LDKSocketDescriptor_jcall,
11376                 .cloned = LDKSocketDescriptor_JCalls_cloned,
11377                 .free = LDKSocketDescriptor_JCalls_free,
11378         };
11379         return ret;
11380 }
11381 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
11382         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
11383         *res_ptr = LDKSocketDescriptor_init(o);
11384         return tag_ptr(res_ptr, true);
11385 }
11386 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
11387         void* this_arg_ptr = untag_ptr(this_arg);
11388         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11389         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
11390         LDKu8slice data_ref;
11391         data_ref.datalen = data->arr_len;
11392         data_ref.data = data->elems;
11393         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
11394         FREE(data);
11395         return ret_conv;
11396 }
11397
11398 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
11399         void* this_arg_ptr = untag_ptr(this_arg);
11400         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11401         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
11402         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
11403 }
11404
11405 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
11406         void* this_arg_ptr = untag_ptr(this_arg);
11407         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11408         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
11409         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
11410         return ret_conv;
11411 }
11412
11413 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
11414         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11415         switch(obj->tag) {
11416                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
11417                 case LDKEffectiveCapacity_MaximumHTLC: return 1;
11418                 case LDKEffectiveCapacity_Total: return 2;
11419                 case LDKEffectiveCapacity_Infinite: return 3;
11420                 case LDKEffectiveCapacity_Unknown: return 4;
11421                 default: abort();
11422         }
11423 }
11424 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
11425         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11426         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
11427                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
11428         return liquidity_msat_conv;
11429 }
11430 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat(uint64_t ptr) {
11431         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11432         assert(obj->tag == LDKEffectiveCapacity_MaximumHTLC);
11433                         int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
11434         return amount_msat_conv;
11435 }
11436 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
11437         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11438         assert(obj->tag == LDKEffectiveCapacity_Total);
11439                         int64_t capacity_msat_conv = obj->total.capacity_msat;
11440         return capacity_msat_conv;
11441 }
11442 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
11443         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11444         assert(obj->tag == LDKEffectiveCapacity_Total);
11445                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
11446         return htlc_maximum_msat_conv;
11447 }
11448 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
11449         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
11450         switch(obj->tag) {
11451                 case LDKDestination_Node: return 0;
11452                 case LDKDestination_BlindedPath: return 1;
11453                 default: abort();
11454         }
11455 }
11456 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
11457         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
11458         assert(obj->tag == LDKDestination_Node);
11459                         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
11460                         memcpy(node_arr->elems, obj->node.compressed_form, 33);
11461         return node_arr;
11462 }
11463 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedPath_get_blinded_path"))) TS_LDKDestination_BlindedPath_get_blinded_path(uint64_t ptr) {
11464         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
11465         assert(obj->tag == LDKDestination_BlindedPath);
11466                         LDKBlindedPath blinded_path_var = obj->blinded_path;
11467                         uint64_t blinded_path_ref = 0;
11468                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
11469                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
11470         return blinded_path_ref;
11471 }
11472 uint32_t __attribute__((export_name("TS_LDKOnionMessageContents_ty_from_ptr"))) TS_LDKOnionMessageContents_ty_from_ptr(uint64_t ptr) {
11473         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
11474         switch(obj->tag) {
11475                 case LDKOnionMessageContents_Custom: return 0;
11476                 default: abort();
11477         }
11478 }
11479 uint64_t __attribute__((export_name("TS_LDKOnionMessageContents_Custom_get_custom"))) TS_LDKOnionMessageContents_Custom_get_custom(uint64_t ptr) {
11480         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
11481         assert(obj->tag == LDKOnionMessageContents_Custom);
11482                         LDKCustomOnionMessageContents* custom_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
11483                         *custom_ret = CustomOnionMessageContents_clone(&obj->custom);
11484         return tag_ptr(custom_ret, true);
11485 }
11486 uint32_t __attribute__((export_name("TS_LDKGossipSync_ty_from_ptr"))) TS_LDKGossipSync_ty_from_ptr(uint64_t ptr) {
11487         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
11488         switch(obj->tag) {
11489                 case LDKGossipSync_P2P: return 0;
11490                 case LDKGossipSync_Rapid: return 1;
11491                 case LDKGossipSync_None: return 2;
11492                 default: abort();
11493         }
11494 }
11495 uint64_t __attribute__((export_name("TS_LDKGossipSync_P2P_get_p2p"))) TS_LDKGossipSync_P2P_get_p2p(uint64_t ptr) {
11496         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
11497         assert(obj->tag == LDKGossipSync_P2P);
11498                         LDKP2PGossipSync p2p_var = obj->p2p;
11499                         uint64_t p2p_ref = 0;
11500                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
11501                         p2p_ref = tag_ptr(p2p_var.inner, false);
11502         return p2p_ref;
11503 }
11504 uint64_t __attribute__((export_name("TS_LDKGossipSync_Rapid_get_rapid"))) TS_LDKGossipSync_Rapid_get_rapid(uint64_t ptr) {
11505         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
11506         assert(obj->tag == LDKGossipSync_Rapid);
11507                         LDKRapidGossipSync rapid_var = obj->rapid;
11508                         uint64_t rapid_ref = 0;
11509                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
11510                         rapid_ref = tag_ptr(rapid_var.inner, false);
11511         return rapid_ref;
11512 }
11513 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
11514         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11515         switch(obj->tag) {
11516                 case LDKFallback_SegWitProgram: return 0;
11517                 case LDKFallback_PubKeyHash: return 1;
11518                 case LDKFallback_ScriptHash: return 2;
11519                 default: abort();
11520         }
11521 }
11522 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
11523         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11524         assert(obj->tag == LDKFallback_SegWitProgram);
11525                         uint8_t version_val = obj->seg_wit_program.version._0;
11526         return version_val;
11527 }
11528 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
11529         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11530         assert(obj->tag == LDKFallback_SegWitProgram);
11531                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
11532                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
11533                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
11534         return program_arr;
11535 }
11536 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
11537         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11538         assert(obj->tag == LDKFallback_PubKeyHash);
11539                         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
11540                         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
11541         return pub_key_hash_arr;
11542 }
11543 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
11544         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11545         assert(obj->tag == LDKFallback_ScriptHash);
11546                         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
11547                         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
11548         return script_hash_arr;
11549 }
11550 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
11551         LDKStr ret_str = _ldk_get_compiled_version();
11552         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11553         Str_free(ret_str);
11554         return ret_conv;
11555 }
11556
11557 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
11558         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
11559         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11560         Str_free(ret_str);
11561         return ret_conv;
11562 }
11563
11564 int8_tArray  __attribute__((export_name("TS_U128_le_bytes"))) TS_U128_le_bytes(int8_tArray val) {
11565         LDKU128 val_ref;
11566         CHECK(val->arr_len == 16);
11567         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
11568         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
11569         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
11570         return ret_arr;
11571 }
11572
11573 int8_tArray  __attribute__((export_name("TS_U128_new"))) TS_U128_new(int8_tArray le_bytes) {
11574         LDKSixteenBytes le_bytes_ref;
11575         CHECK(le_bytes->arr_len == 16);
11576         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
11577         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
11578         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
11579         return ret_arr;
11580 }
11581
11582 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
11583         LDKThirtyTwoBytes big_endian_bytes_ref;
11584         CHECK(big_endian_bytes->arr_len == 32);
11585         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
11586         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
11587         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
11588         return tag_ptr(ret_ref, true);
11589 }
11590
11591 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
11592         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11593         *ret_copy = Bech32Error_clone(arg);
11594         uint64_t ret_ref = tag_ptr(ret_copy, true);
11595         return ret_ref;
11596 }
11597 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
11598         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
11599         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
11600         return ret_conv;
11601 }
11602
11603 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
11604         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
11605         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11606         *ret_copy = Bech32Error_clone(orig_conv);
11607         uint64_t ret_ref = tag_ptr(ret_copy, true);
11608         return ret_ref;
11609 }
11610
11611 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
11612         if (!ptr_is_owned(o)) return;
11613         void* o_ptr = untag_ptr(o);
11614         CHECK_ACCESS(o_ptr);
11615         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
11616         FREE(untag_ptr(o));
11617         Bech32Error_free(o_conv);
11618 }
11619
11620 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
11621         LDKTransaction _res_ref;
11622         _res_ref.datalen = _res->arr_len;
11623         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
11624         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
11625         _res_ref.data_is_owned = true;
11626         Transaction_free(_res_ref);
11627 }
11628
11629 void  __attribute__((export_name("TS_Witness_free"))) TS_Witness_free(int8_tArray _res) {
11630         LDKWitness _res_ref;
11631         _res_ref.datalen = _res->arr_len;
11632         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
11633         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
11634         _res_ref.data_is_owned = true;
11635         Witness_free(_res_ref);
11636 }
11637
11638 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
11639         LDKCVec_u8Z script_pubkey_ref;
11640         script_pubkey_ref.datalen = script_pubkey->arr_len;
11641         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
11642         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
11643         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11644         *ret_ref = TxOut_new(script_pubkey_ref, value);
11645         return tag_ptr(ret_ref, true);
11646 }
11647
11648 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
11649         if (!ptr_is_owned(_res)) return;
11650         void* _res_ptr = untag_ptr(_res);
11651         CHECK_ACCESS(_res_ptr);
11652         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
11653         FREE(untag_ptr(_res));
11654         TxOut_free(_res_conv);
11655 }
11656
11657 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
11658         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11659         *ret_ref = TxOut_clone(arg);
11660         return tag_ptr(ret_ref, true);
11661 }
11662 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
11663         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
11664         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
11665         return ret_conv;
11666 }
11667
11668 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
11669         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
11670         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11671         *ret_ref = TxOut_clone(orig_conv);
11672         return tag_ptr(ret_ref, true);
11673 }
11674
11675 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
11676         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
11677         Str_free(dummy);
11678 }
11679
11680 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
11681         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11682         *ret_conv = CResult_NoneAPIErrorZ_ok();
11683         return tag_ptr(ret_conv, true);
11684 }
11685
11686 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
11687         void* e_ptr = untag_ptr(e);
11688         CHECK_ACCESS(e_ptr);
11689         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
11690         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
11691         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11692         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
11693         return tag_ptr(ret_conv, true);
11694 }
11695
11696 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
11697         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
11698         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
11699         return ret_conv;
11700 }
11701
11702 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_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_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
11707         FREE(untag_ptr(_res));
11708         CResult_NoneAPIErrorZ_free(_res_conv);
11709 }
11710
11711 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
11712         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11713         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
11714         return tag_ptr(ret_conv, true);
11715 }
11716 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
11717         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
11718         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
11719         return ret_conv;
11720 }
11721
11722 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
11723         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
11724         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11725         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
11726         return tag_ptr(ret_conv, true);
11727 }
11728
11729 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
11730         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
11731         _res_constr.datalen = _res->arr_len;
11732         if (_res_constr.datalen > 0)
11733                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
11734         else
11735                 _res_constr.data = NULL;
11736         uint64_t* _res_vals = _res->elems;
11737         for (size_t w = 0; w < _res_constr.datalen; w++) {
11738                 uint64_t _res_conv_22 = _res_vals[w];
11739                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
11740                 CHECK_ACCESS(_res_conv_22_ptr);
11741                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
11742                 FREE(untag_ptr(_res_conv_22));
11743                 _res_constr.data[w] = _res_conv_22_conv;
11744         }
11745         FREE(_res);
11746         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
11747 }
11748
11749 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
11750         LDKCVec_APIErrorZ _res_constr;
11751         _res_constr.datalen = _res->arr_len;
11752         if (_res_constr.datalen > 0)
11753                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
11754         else
11755                 _res_constr.data = NULL;
11756         uint64_t* _res_vals = _res->elems;
11757         for (size_t k = 0; k < _res_constr.datalen; k++) {
11758                 uint64_t _res_conv_10 = _res_vals[k];
11759                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
11760                 CHECK_ACCESS(_res_conv_10_ptr);
11761                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
11762                 FREE(untag_ptr(_res_conv_10));
11763                 _res_constr.data[k] = _res_conv_10_conv;
11764         }
11765         FREE(_res);
11766         CVec_APIErrorZ_free(_res_constr);
11767 }
11768
11769 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_some"))) TS_COption_HTLCClaimZ_some(uint32_t o) {
11770         LDKHTLCClaim o_conv = LDKHTLCClaim_from_js(o);
11771         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
11772         *ret_copy = COption_HTLCClaimZ_some(o_conv);
11773         uint64_t ret_ref = tag_ptr(ret_copy, true);
11774         return ret_ref;
11775 }
11776
11777 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_none"))) TS_COption_HTLCClaimZ_none() {
11778         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
11779         *ret_copy = COption_HTLCClaimZ_none();
11780         uint64_t ret_ref = tag_ptr(ret_copy, true);
11781         return ret_ref;
11782 }
11783
11784 void  __attribute__((export_name("TS_COption_HTLCClaimZ_free"))) TS_COption_HTLCClaimZ_free(uint64_t _res) {
11785         if (!ptr_is_owned(_res)) return;
11786         void* _res_ptr = untag_ptr(_res);
11787         CHECK_ACCESS(_res_ptr);
11788         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
11789         FREE(untag_ptr(_res));
11790         COption_HTLCClaimZ_free(_res_conv);
11791 }
11792
11793 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
11794         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11795         *ret_conv = CResult_NoneNoneZ_ok();
11796         return tag_ptr(ret_conv, true);
11797 }
11798
11799 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
11800         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11801         *ret_conv = CResult_NoneNoneZ_err();
11802         return tag_ptr(ret_conv, true);
11803 }
11804
11805 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
11806         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
11807         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
11808         return ret_conv;
11809 }
11810
11811 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
11812         if (!ptr_is_owned(_res)) return;
11813         void* _res_ptr = untag_ptr(_res);
11814         CHECK_ACCESS(_res_ptr);
11815         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
11816         FREE(untag_ptr(_res));
11817         CResult_NoneNoneZ_free(_res_conv);
11818 }
11819
11820 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
11821         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11822         *ret_conv = CResult_NoneNoneZ_clone(arg);
11823         return tag_ptr(ret_conv, true);
11824 }
11825 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
11826         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
11827         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
11828         return ret_conv;
11829 }
11830
11831 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
11832         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
11833         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11834         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
11835         return tag_ptr(ret_conv, true);
11836 }
11837
11838 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
11839         LDKCounterpartyCommitmentSecrets o_conv;
11840         o_conv.inner = untag_ptr(o);
11841         o_conv.is_owned = ptr_is_owned(o);
11842         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11843         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
11844         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11845         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
11846         return tag_ptr(ret_conv, true);
11847 }
11848
11849 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
11850         void* e_ptr = untag_ptr(e);
11851         CHECK_ACCESS(e_ptr);
11852         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11853         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11854         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11855         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
11856         return tag_ptr(ret_conv, true);
11857 }
11858
11859 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
11860         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
11861         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
11862         return ret_conv;
11863 }
11864
11865 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
11866         if (!ptr_is_owned(_res)) return;
11867         void* _res_ptr = untag_ptr(_res);
11868         CHECK_ACCESS(_res_ptr);
11869         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
11870         FREE(untag_ptr(_res));
11871         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
11872 }
11873
11874 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
11875         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11876         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
11877         return tag_ptr(ret_conv, true);
11878 }
11879 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
11880         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
11881         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
11882         return ret_conv;
11883 }
11884
11885 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
11886         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
11887         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11888         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
11889         return tag_ptr(ret_conv, true);
11890 }
11891
11892 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
11893         LDKTxCreationKeys o_conv;
11894         o_conv.inner = untag_ptr(o);
11895         o_conv.is_owned = ptr_is_owned(o);
11896         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11897         o_conv = TxCreationKeys_clone(&o_conv);
11898         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11899         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
11900         return tag_ptr(ret_conv, true);
11901 }
11902
11903 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
11904         void* e_ptr = untag_ptr(e);
11905         CHECK_ACCESS(e_ptr);
11906         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11907         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11908         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11909         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
11910         return tag_ptr(ret_conv, true);
11911 }
11912
11913 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
11914         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
11915         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
11916         return ret_conv;
11917 }
11918
11919 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
11920         if (!ptr_is_owned(_res)) return;
11921         void* _res_ptr = untag_ptr(_res);
11922         CHECK_ACCESS(_res_ptr);
11923         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
11924         FREE(untag_ptr(_res));
11925         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
11926 }
11927
11928 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
11929         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11930         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
11931         return tag_ptr(ret_conv, true);
11932 }
11933 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
11934         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
11935         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
11936         return ret_conv;
11937 }
11938
11939 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
11940         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
11941         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11942         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
11943         return tag_ptr(ret_conv, true);
11944 }
11945
11946 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
11947         LDKChannelPublicKeys o_conv;
11948         o_conv.inner = untag_ptr(o);
11949         o_conv.is_owned = ptr_is_owned(o);
11950         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11951         o_conv = ChannelPublicKeys_clone(&o_conv);
11952         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11953         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
11954         return tag_ptr(ret_conv, true);
11955 }
11956
11957 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
11958         void* e_ptr = untag_ptr(e);
11959         CHECK_ACCESS(e_ptr);
11960         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11961         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11962         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11963         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
11964         return tag_ptr(ret_conv, true);
11965 }
11966
11967 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
11968         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
11969         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
11970         return ret_conv;
11971 }
11972
11973 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
11974         if (!ptr_is_owned(_res)) return;
11975         void* _res_ptr = untag_ptr(_res);
11976         CHECK_ACCESS(_res_ptr);
11977         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
11978         FREE(untag_ptr(_res));
11979         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
11980 }
11981
11982 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
11983         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11984         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
11985         return tag_ptr(ret_conv, true);
11986 }
11987 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
11988         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
11989         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
11990         return ret_conv;
11991 }
11992
11993 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
11994         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
11995         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11996         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
11997         return tag_ptr(ret_conv, true);
11998 }
11999
12000 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
12001         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
12002         *ret_copy = COption_u32Z_some(o);
12003         uint64_t ret_ref = tag_ptr(ret_copy, true);
12004         return ret_ref;
12005 }
12006
12007 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
12008         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
12009         *ret_copy = COption_u32Z_none();
12010         uint64_t ret_ref = tag_ptr(ret_copy, true);
12011         return ret_ref;
12012 }
12013
12014 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
12015         if (!ptr_is_owned(_res)) return;
12016         void* _res_ptr = untag_ptr(_res);
12017         CHECK_ACCESS(_res_ptr);
12018         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
12019         FREE(untag_ptr(_res));
12020         COption_u32Z_free(_res_conv);
12021 }
12022
12023 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
12024         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
12025         *ret_copy = COption_u32Z_clone(arg);
12026         uint64_t ret_ref = tag_ptr(ret_copy, true);
12027         return ret_ref;
12028 }
12029 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
12030         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
12031         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
12032         return ret_conv;
12033 }
12034
12035 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
12036         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
12037         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
12038         *ret_copy = COption_u32Z_clone(orig_conv);
12039         uint64_t ret_ref = tag_ptr(ret_copy, true);
12040         return ret_ref;
12041 }
12042
12043 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
12044         LDKHTLCOutputInCommitment o_conv;
12045         o_conv.inner = untag_ptr(o);
12046         o_conv.is_owned = ptr_is_owned(o);
12047         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12048         o_conv = HTLCOutputInCommitment_clone(&o_conv);
12049         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12050         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
12051         return tag_ptr(ret_conv, true);
12052 }
12053
12054 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
12055         void* e_ptr = untag_ptr(e);
12056         CHECK_ACCESS(e_ptr);
12057         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12058         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12059         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12060         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
12061         return tag_ptr(ret_conv, true);
12062 }
12063
12064 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
12065         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
12066         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
12067         return ret_conv;
12068 }
12069
12070 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
12071         if (!ptr_is_owned(_res)) return;
12072         void* _res_ptr = untag_ptr(_res);
12073         CHECK_ACCESS(_res_ptr);
12074         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
12075         FREE(untag_ptr(_res));
12076         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
12077 }
12078
12079 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
12080         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12081         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
12082         return tag_ptr(ret_conv, true);
12083 }
12084 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
12085         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
12086         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
12087         return ret_conv;
12088 }
12089
12090 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
12091         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
12092         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12093         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
12094         return tag_ptr(ret_conv, true);
12095 }
12096
12097 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
12098         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
12099         return ret_conv;
12100 }
12101
12102 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
12103         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
12104         return ret_conv;
12105 }
12106
12107 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
12108         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
12109         COption_NoneZ_free(_res_conv);
12110 }
12111
12112 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
12113         LDKCounterpartyChannelTransactionParameters o_conv;
12114         o_conv.inner = untag_ptr(o);
12115         o_conv.is_owned = ptr_is_owned(o);
12116         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12117         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
12118         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12119         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
12120         return tag_ptr(ret_conv, true);
12121 }
12122
12123 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
12124         void* e_ptr = untag_ptr(e);
12125         CHECK_ACCESS(e_ptr);
12126         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12127         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12128         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12129         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
12130         return tag_ptr(ret_conv, true);
12131 }
12132
12133 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
12134         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
12135         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
12136         return ret_conv;
12137 }
12138
12139 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
12140         if (!ptr_is_owned(_res)) return;
12141         void* _res_ptr = untag_ptr(_res);
12142         CHECK_ACCESS(_res_ptr);
12143         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
12144         FREE(untag_ptr(_res));
12145         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
12146 }
12147
12148 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
12149         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12150         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
12151         return tag_ptr(ret_conv, true);
12152 }
12153 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12154         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
12155         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
12156         return ret_conv;
12157 }
12158
12159 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
12160         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
12161         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12162         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
12163         return tag_ptr(ret_conv, true);
12164 }
12165
12166 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
12167         LDKChannelTransactionParameters o_conv;
12168         o_conv.inner = untag_ptr(o);
12169         o_conv.is_owned = ptr_is_owned(o);
12170         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12171         o_conv = ChannelTransactionParameters_clone(&o_conv);
12172         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12173         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
12174         return tag_ptr(ret_conv, true);
12175 }
12176
12177 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
12178         void* e_ptr = untag_ptr(e);
12179         CHECK_ACCESS(e_ptr);
12180         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12181         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12182         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12183         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
12184         return tag_ptr(ret_conv, true);
12185 }
12186
12187 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
12188         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
12189         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
12190         return ret_conv;
12191 }
12192
12193 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
12194         if (!ptr_is_owned(_res)) return;
12195         void* _res_ptr = untag_ptr(_res);
12196         CHECK_ACCESS(_res_ptr);
12197         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
12198         FREE(untag_ptr(_res));
12199         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
12200 }
12201
12202 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
12203         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12204         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
12205         return tag_ptr(ret_conv, true);
12206 }
12207 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12208         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
12209         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
12210         return ret_conv;
12211 }
12212
12213 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
12214         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
12215         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12216         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
12217         return tag_ptr(ret_conv, true);
12218 }
12219
12220 void  __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
12221         LDKCVec_SignatureZ _res_constr;
12222         _res_constr.datalen = _res->arr_len;
12223         if (_res_constr.datalen > 0)
12224                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12225         else
12226                 _res_constr.data = NULL;
12227         int8_tArray* _res_vals = (void*) _res->elems;
12228         for (size_t m = 0; m < _res_constr.datalen; m++) {
12229                 int8_tArray _res_conv_12 = _res_vals[m];
12230                 LDKSignature _res_conv_12_ref;
12231                 CHECK(_res_conv_12->arr_len == 64);
12232                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
12233                 _res_constr.data[m] = _res_conv_12_ref;
12234         }
12235         FREE(_res);
12236         CVec_SignatureZ_free(_res_constr);
12237 }
12238
12239 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12240         LDKHolderCommitmentTransaction o_conv;
12241         o_conv.inner = untag_ptr(o);
12242         o_conv.is_owned = ptr_is_owned(o);
12243         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12244         o_conv = HolderCommitmentTransaction_clone(&o_conv);
12245         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12246         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
12247         return tag_ptr(ret_conv, true);
12248 }
12249
12250 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12251         void* e_ptr = untag_ptr(e);
12252         CHECK_ACCESS(e_ptr);
12253         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12254         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12255         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12256         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
12257         return tag_ptr(ret_conv, true);
12258 }
12259
12260 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12261         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12262         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12263         return ret_conv;
12264 }
12265
12266 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12267         if (!ptr_is_owned(_res)) return;
12268         void* _res_ptr = untag_ptr(_res);
12269         CHECK_ACCESS(_res_ptr);
12270         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12271         FREE(untag_ptr(_res));
12272         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
12273 }
12274
12275 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12276         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12277         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
12278         return tag_ptr(ret_conv, true);
12279 }
12280 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12281         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12282         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12283         return ret_conv;
12284 }
12285
12286 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12287         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12288         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12289         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12290         return tag_ptr(ret_conv, true);
12291 }
12292
12293 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12294         LDKBuiltCommitmentTransaction o_conv;
12295         o_conv.inner = untag_ptr(o);
12296         o_conv.is_owned = ptr_is_owned(o);
12297         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12298         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
12299         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12300         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
12301         return tag_ptr(ret_conv, true);
12302 }
12303
12304 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12305         void* e_ptr = untag_ptr(e);
12306         CHECK_ACCESS(e_ptr);
12307         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12308         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12309         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12310         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
12311         return tag_ptr(ret_conv, true);
12312 }
12313
12314 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12315         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12316         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12317         return ret_conv;
12318 }
12319
12320 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12321         if (!ptr_is_owned(_res)) return;
12322         void* _res_ptr = untag_ptr(_res);
12323         CHECK_ACCESS(_res_ptr);
12324         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12325         FREE(untag_ptr(_res));
12326         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
12327 }
12328
12329 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12330         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12331         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
12332         return tag_ptr(ret_conv, true);
12333 }
12334 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12335         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12336         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12337         return ret_conv;
12338 }
12339
12340 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12341         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12342         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12343         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12344         return tag_ptr(ret_conv, true);
12345 }
12346
12347 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
12348         LDKTrustedClosingTransaction o_conv;
12349         o_conv.inner = untag_ptr(o);
12350         o_conv.is_owned = ptr_is_owned(o);
12351         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12352         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
12353         
12354         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12355         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
12356         return tag_ptr(ret_conv, true);
12357 }
12358
12359 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
12360         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12361         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
12362         return tag_ptr(ret_conv, true);
12363 }
12364
12365 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
12366         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
12367         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
12368         return ret_conv;
12369 }
12370
12371 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
12372         if (!ptr_is_owned(_res)) return;
12373         void* _res_ptr = untag_ptr(_res);
12374         CHECK_ACCESS(_res_ptr);
12375         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
12376         FREE(untag_ptr(_res));
12377         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
12378 }
12379
12380 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12381         LDKCommitmentTransaction o_conv;
12382         o_conv.inner = untag_ptr(o);
12383         o_conv.is_owned = ptr_is_owned(o);
12384         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12385         o_conv = CommitmentTransaction_clone(&o_conv);
12386         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12387         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
12388         return tag_ptr(ret_conv, true);
12389 }
12390
12391 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12392         void* e_ptr = untag_ptr(e);
12393         CHECK_ACCESS(e_ptr);
12394         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12395         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12396         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12397         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
12398         return tag_ptr(ret_conv, true);
12399 }
12400
12401 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12402         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12403         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12404         return ret_conv;
12405 }
12406
12407 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12408         if (!ptr_is_owned(_res)) return;
12409         void* _res_ptr = untag_ptr(_res);
12410         CHECK_ACCESS(_res_ptr);
12411         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
12412         FREE(untag_ptr(_res));
12413         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
12414 }
12415
12416 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12417         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12418         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
12419         return tag_ptr(ret_conv, true);
12420 }
12421 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12422         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12423         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12424         return ret_conv;
12425 }
12426
12427 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12428         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12429         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12430         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
12431         return tag_ptr(ret_conv, true);
12432 }
12433
12434 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
12435         LDKTrustedCommitmentTransaction o_conv;
12436         o_conv.inner = untag_ptr(o);
12437         o_conv.is_owned = ptr_is_owned(o);
12438         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12439         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
12440         
12441         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12442         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
12443         return tag_ptr(ret_conv, true);
12444 }
12445
12446 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
12447         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12448         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
12449         return tag_ptr(ret_conv, true);
12450 }
12451
12452 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
12453         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
12454         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
12455         return ret_conv;
12456 }
12457
12458 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
12459         if (!ptr_is_owned(_res)) return;
12460         void* _res_ptr = untag_ptr(_res);
12461         CHECK_ACCESS(_res_ptr);
12462         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
12463         FREE(untag_ptr(_res));
12464         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
12465 }
12466
12467 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
12468         LDKCVec_SignatureZ o_constr;
12469         o_constr.datalen = o->arr_len;
12470         if (o_constr.datalen > 0)
12471                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12472         else
12473                 o_constr.data = NULL;
12474         int8_tArray* o_vals = (void*) o->elems;
12475         for (size_t m = 0; m < o_constr.datalen; m++) {
12476                 int8_tArray o_conv_12 = o_vals[m];
12477                 LDKSignature o_conv_12_ref;
12478                 CHECK(o_conv_12->arr_len == 64);
12479                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
12480                 o_constr.data[m] = o_conv_12_ref;
12481         }
12482         FREE(o);
12483         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12484         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
12485         return tag_ptr(ret_conv, true);
12486 }
12487
12488 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
12489         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12490         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
12491         return tag_ptr(ret_conv, true);
12492 }
12493
12494 jboolean  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint64_t o) {
12495         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
12496         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
12497         return ret_conv;
12498 }
12499
12500 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint64_t _res) {
12501         if (!ptr_is_owned(_res)) return;
12502         void* _res_ptr = untag_ptr(_res);
12503         CHECK_ACCESS(_res_ptr);
12504         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
12505         FREE(untag_ptr(_res));
12506         CResult_CVec_SignatureZNoneZ_free(_res_conv);
12507 }
12508
12509 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
12510         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12511         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
12512         return tag_ptr(ret_conv, true);
12513 }
12514 int64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint64_t arg) {
12515         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
12516         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
12517         return ret_conv;
12518 }
12519
12520 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint64_t orig) {
12521         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
12522         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12523         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
12524         return tag_ptr(ret_conv, true);
12525 }
12526
12527 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
12528         LDKShutdownScript o_conv;
12529         o_conv.inner = untag_ptr(o);
12530         o_conv.is_owned = ptr_is_owned(o);
12531         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12532         o_conv = ShutdownScript_clone(&o_conv);
12533         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12534         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
12535         return tag_ptr(ret_conv, true);
12536 }
12537
12538 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
12539         void* e_ptr = untag_ptr(e);
12540         CHECK_ACCESS(e_ptr);
12541         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12542         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12543         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12544         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
12545         return tag_ptr(ret_conv, true);
12546 }
12547
12548 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
12549         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
12550         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
12551         return ret_conv;
12552 }
12553
12554 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
12555         if (!ptr_is_owned(_res)) return;
12556         void* _res_ptr = untag_ptr(_res);
12557         CHECK_ACCESS(_res_ptr);
12558         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
12559         FREE(untag_ptr(_res));
12560         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
12561 }
12562
12563 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
12564         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12565         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
12566         return tag_ptr(ret_conv, true);
12567 }
12568 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
12569         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
12570         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
12571         return ret_conv;
12572 }
12573
12574 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
12575         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
12576         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12577         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
12578         return tag_ptr(ret_conv, true);
12579 }
12580
12581 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
12582         LDKShutdownScript o_conv;
12583         o_conv.inner = untag_ptr(o);
12584         o_conv.is_owned = ptr_is_owned(o);
12585         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12586         o_conv = ShutdownScript_clone(&o_conv);
12587         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12588         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
12589         return tag_ptr(ret_conv, true);
12590 }
12591
12592 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
12593         LDKInvalidShutdownScript e_conv;
12594         e_conv.inner = untag_ptr(e);
12595         e_conv.is_owned = ptr_is_owned(e);
12596         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12597         e_conv = InvalidShutdownScript_clone(&e_conv);
12598         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12599         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
12600         return tag_ptr(ret_conv, true);
12601 }
12602
12603 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
12604         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
12605         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
12606         return ret_conv;
12607 }
12608
12609 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
12610         if (!ptr_is_owned(_res)) return;
12611         void* _res_ptr = untag_ptr(_res);
12612         CHECK_ACCESS(_res_ptr);
12613         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
12614         FREE(untag_ptr(_res));
12615         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
12616 }
12617
12618 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
12619         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12620         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
12621         return tag_ptr(ret_conv, true);
12622 }
12623 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
12624         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
12625         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
12626         return ret_conv;
12627 }
12628
12629 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
12630         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
12631         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12632         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
12633         return tag_ptr(ret_conv, true);
12634 }
12635
12636 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
12637         LDKCVec_PublicKeyZ _res_constr;
12638         _res_constr.datalen = _res->arr_len;
12639         if (_res_constr.datalen > 0)
12640                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
12641         else
12642                 _res_constr.data = NULL;
12643         int8_tArray* _res_vals = (void*) _res->elems;
12644         for (size_t m = 0; m < _res_constr.datalen; m++) {
12645                 int8_tArray _res_conv_12 = _res_vals[m];
12646                 LDKPublicKey _res_conv_12_ref;
12647                 CHECK(_res_conv_12->arr_len == 33);
12648                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
12649                 _res_constr.data[m] = _res_conv_12_ref;
12650         }
12651         FREE(_res);
12652         CVec_PublicKeyZ_free(_res_constr);
12653 }
12654
12655 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
12656         LDKBlindedPath o_conv;
12657         o_conv.inner = untag_ptr(o);
12658         o_conv.is_owned = ptr_is_owned(o);
12659         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12660         o_conv = BlindedPath_clone(&o_conv);
12661         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
12662         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
12663         return tag_ptr(ret_conv, true);
12664 }
12665
12666 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
12667         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
12668         *ret_conv = CResult_BlindedPathNoneZ_err();
12669         return tag_ptr(ret_conv, true);
12670 }
12671
12672 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
12673         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
12674         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
12675         return ret_conv;
12676 }
12677
12678 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
12679         if (!ptr_is_owned(_res)) return;
12680         void* _res_ptr = untag_ptr(_res);
12681         CHECK_ACCESS(_res_ptr);
12682         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
12683         FREE(untag_ptr(_res));
12684         CResult_BlindedPathNoneZ_free(_res_conv);
12685 }
12686
12687 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
12688         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
12689         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
12690         return tag_ptr(ret_conv, true);
12691 }
12692 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
12693         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
12694         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
12695         return ret_conv;
12696 }
12697
12698 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
12699         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
12700         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
12701         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
12702         return tag_ptr(ret_conv, true);
12703 }
12704
12705 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
12706         LDKBlindedPath o_conv;
12707         o_conv.inner = untag_ptr(o);
12708         o_conv.is_owned = ptr_is_owned(o);
12709         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12710         o_conv = BlindedPath_clone(&o_conv);
12711         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
12712         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
12713         return tag_ptr(ret_conv, true);
12714 }
12715
12716 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
12717         void* e_ptr = untag_ptr(e);
12718         CHECK_ACCESS(e_ptr);
12719         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12720         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12721         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
12722         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
12723         return tag_ptr(ret_conv, true);
12724 }
12725
12726 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
12727         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
12728         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
12729         return ret_conv;
12730 }
12731
12732 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
12733         if (!ptr_is_owned(_res)) return;
12734         void* _res_ptr = untag_ptr(_res);
12735         CHECK_ACCESS(_res_ptr);
12736         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
12737         FREE(untag_ptr(_res));
12738         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
12739 }
12740
12741 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
12742         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
12743         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
12744         return tag_ptr(ret_conv, true);
12745 }
12746 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
12747         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
12748         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
12749         return ret_conv;
12750 }
12751
12752 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
12753         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
12754         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
12755         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
12756         return tag_ptr(ret_conv, true);
12757 }
12758
12759 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
12760         LDKBlindedHop o_conv;
12761         o_conv.inner = untag_ptr(o);
12762         o_conv.is_owned = ptr_is_owned(o);
12763         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12764         o_conv = BlindedHop_clone(&o_conv);
12765         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
12766         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
12767         return tag_ptr(ret_conv, true);
12768 }
12769
12770 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
12771         void* e_ptr = untag_ptr(e);
12772         CHECK_ACCESS(e_ptr);
12773         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12774         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12775         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
12776         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
12777         return tag_ptr(ret_conv, true);
12778 }
12779
12780 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
12781         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
12782         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
12783         return ret_conv;
12784 }
12785
12786 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
12787         if (!ptr_is_owned(_res)) return;
12788         void* _res_ptr = untag_ptr(_res);
12789         CHECK_ACCESS(_res_ptr);
12790         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
12791         FREE(untag_ptr(_res));
12792         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
12793 }
12794
12795 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
12796         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
12797         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
12798         return tag_ptr(ret_conv, true);
12799 }
12800 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
12801         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
12802         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
12803         return ret_conv;
12804 }
12805
12806 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
12807         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
12808         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
12809         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
12810         return tag_ptr(ret_conv, true);
12811 }
12812
12813 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
12814         LDKCVec_ChannelDetailsZ _res_constr;
12815         _res_constr.datalen = _res->arr_len;
12816         if (_res_constr.datalen > 0)
12817                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12818         else
12819                 _res_constr.data = NULL;
12820         uint64_t* _res_vals = _res->elems;
12821         for (size_t q = 0; q < _res_constr.datalen; q++) {
12822                 uint64_t _res_conv_16 = _res_vals[q];
12823                 LDKChannelDetails _res_conv_16_conv;
12824                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
12825                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
12826                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
12827                 _res_constr.data[q] = _res_conv_16_conv;
12828         }
12829         FREE(_res);
12830         CVec_ChannelDetailsZ_free(_res_constr);
12831 }
12832
12833 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
12834         LDKRoute o_conv;
12835         o_conv.inner = untag_ptr(o);
12836         o_conv.is_owned = ptr_is_owned(o);
12837         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12838         o_conv = Route_clone(&o_conv);
12839         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12840         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
12841         return tag_ptr(ret_conv, true);
12842 }
12843
12844 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
12845         LDKLightningError e_conv;
12846         e_conv.inner = untag_ptr(e);
12847         e_conv.is_owned = ptr_is_owned(e);
12848         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12849         e_conv = LightningError_clone(&e_conv);
12850         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12851         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
12852         return tag_ptr(ret_conv, true);
12853 }
12854
12855 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
12856         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
12857         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
12858         return ret_conv;
12859 }
12860
12861 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
12862         if (!ptr_is_owned(_res)) return;
12863         void* _res_ptr = untag_ptr(_res);
12864         CHECK_ACCESS(_res_ptr);
12865         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
12866         FREE(untag_ptr(_res));
12867         CResult_RouteLightningErrorZ_free(_res_conv);
12868 }
12869
12870 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
12871         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12872         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
12873         return tag_ptr(ret_conv, true);
12874 }
12875 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
12876         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
12877         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
12878         return ret_conv;
12879 }
12880
12881 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
12882         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
12883         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12884         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
12885         return tag_ptr(ret_conv, true);
12886 }
12887
12888 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
12889         LDKCVec_RouteHopZ _res_constr;
12890         _res_constr.datalen = _res->arr_len;
12891         if (_res_constr.datalen > 0)
12892                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12893         else
12894                 _res_constr.data = NULL;
12895         uint64_t* _res_vals = _res->elems;
12896         for (size_t k = 0; k < _res_constr.datalen; k++) {
12897                 uint64_t _res_conv_10 = _res_vals[k];
12898                 LDKRouteHop _res_conv_10_conv;
12899                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
12900                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
12901                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
12902                 _res_constr.data[k] = _res_conv_10_conv;
12903         }
12904         FREE(_res);
12905         CVec_RouteHopZ_free(_res_constr);
12906 }
12907
12908 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
12909         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12910         *ret_copy = COption_u64Z_some(o);
12911         uint64_t ret_ref = tag_ptr(ret_copy, true);
12912         return ret_ref;
12913 }
12914
12915 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
12916         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12917         *ret_copy = COption_u64Z_none();
12918         uint64_t ret_ref = tag_ptr(ret_copy, true);
12919         return ret_ref;
12920 }
12921
12922 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
12923         if (!ptr_is_owned(_res)) return;
12924         void* _res_ptr = untag_ptr(_res);
12925         CHECK_ACCESS(_res_ptr);
12926         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
12927         FREE(untag_ptr(_res));
12928         COption_u64Z_free(_res_conv);
12929 }
12930
12931 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
12932         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12933         *ret_copy = COption_u64Z_clone(arg);
12934         uint64_t ret_ref = tag_ptr(ret_copy, true);
12935         return ret_ref;
12936 }
12937 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
12938         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
12939         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
12940         return ret_conv;
12941 }
12942
12943 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
12944         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
12945         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12946         *ret_copy = COption_u64Z_clone(orig_conv);
12947         uint64_t ret_ref = tag_ptr(ret_copy, true);
12948         return ret_ref;
12949 }
12950
12951 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
12952         LDKInFlightHtlcs o_conv;
12953         o_conv.inner = untag_ptr(o);
12954         o_conv.is_owned = ptr_is_owned(o);
12955         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12956         o_conv = InFlightHtlcs_clone(&o_conv);
12957         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
12958         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
12959         return tag_ptr(ret_conv, true);
12960 }
12961
12962 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
12963         void* e_ptr = untag_ptr(e);
12964         CHECK_ACCESS(e_ptr);
12965         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12966         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12967         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
12968         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
12969         return tag_ptr(ret_conv, true);
12970 }
12971
12972 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
12973         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
12974         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
12975         return ret_conv;
12976 }
12977
12978 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
12979         if (!ptr_is_owned(_res)) return;
12980         void* _res_ptr = untag_ptr(_res);
12981         CHECK_ACCESS(_res_ptr);
12982         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
12983         FREE(untag_ptr(_res));
12984         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
12985 }
12986
12987 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
12988         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
12989         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
12990         return tag_ptr(ret_conv, true);
12991 }
12992 int64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(uint64_t arg) {
12993         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
12994         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
12995         return ret_conv;
12996 }
12997
12998 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone(uint64_t orig) {
12999         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
13000         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
13001         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
13002         return tag_ptr(ret_conv, true);
13003 }
13004
13005 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
13006         LDKRouteHop o_conv;
13007         o_conv.inner = untag_ptr(o);
13008         o_conv.is_owned = ptr_is_owned(o);
13009         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13010         o_conv = RouteHop_clone(&o_conv);
13011         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
13012         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
13013         return tag_ptr(ret_conv, true);
13014 }
13015
13016 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
13017         void* e_ptr = untag_ptr(e);
13018         CHECK_ACCESS(e_ptr);
13019         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13020         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13021         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
13022         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
13023         return tag_ptr(ret_conv, true);
13024 }
13025
13026 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
13027         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
13028         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
13029         return ret_conv;
13030 }
13031
13032 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
13033         if (!ptr_is_owned(_res)) return;
13034         void* _res_ptr = untag_ptr(_res);
13035         CHECK_ACCESS(_res_ptr);
13036         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
13037         FREE(untag_ptr(_res));
13038         CResult_RouteHopDecodeErrorZ_free(_res_conv);
13039 }
13040
13041 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
13042         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
13043         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
13044         return tag_ptr(ret_conv, true);
13045 }
13046 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
13047         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
13048         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
13049         return ret_conv;
13050 }
13051
13052 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
13053         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
13054         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
13055         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
13056         return tag_ptr(ret_conv, true);
13057 }
13058
13059 void  __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
13060         LDKCVec_CVec_RouteHopZZ _res_constr;
13061         _res_constr.datalen = _res->arr_len;
13062         if (_res_constr.datalen > 0)
13063                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13064         else
13065                 _res_constr.data = NULL;
13066         uint64_tArray* _res_vals = (void*) _res->elems;
13067         for (size_t m = 0; m < _res_constr.datalen; m++) {
13068                 uint64_tArray _res_conv_12 = _res_vals[m];
13069                 LDKCVec_RouteHopZ _res_conv_12_constr;
13070                 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
13071                 if (_res_conv_12_constr.datalen > 0)
13072                         _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13073                 else
13074                         _res_conv_12_constr.data = NULL;
13075                 uint64_t* _res_conv_12_vals = _res_conv_12->elems;
13076                 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
13077                         uint64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
13078                         LDKRouteHop _res_conv_12_conv_10_conv;
13079                         _res_conv_12_conv_10_conv.inner = untag_ptr(_res_conv_12_conv_10);
13080                         _res_conv_12_conv_10_conv.is_owned = ptr_is_owned(_res_conv_12_conv_10);
13081                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
13082                         _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
13083                 }
13084                 FREE(_res_conv_12);
13085                 _res_constr.data[m] = _res_conv_12_constr;
13086         }
13087         FREE(_res);
13088         CVec_CVec_RouteHopZZ_free(_res_constr);
13089 }
13090
13091 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
13092         LDKRoute o_conv;
13093         o_conv.inner = untag_ptr(o);
13094         o_conv.is_owned = ptr_is_owned(o);
13095         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13096         o_conv = Route_clone(&o_conv);
13097         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13098         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
13099         return tag_ptr(ret_conv, true);
13100 }
13101
13102 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
13103         void* e_ptr = untag_ptr(e);
13104         CHECK_ACCESS(e_ptr);
13105         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13106         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13107         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13108         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
13109         return tag_ptr(ret_conv, true);
13110 }
13111
13112 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
13113         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
13114         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
13115         return ret_conv;
13116 }
13117
13118 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
13119         if (!ptr_is_owned(_res)) return;
13120         void* _res_ptr = untag_ptr(_res);
13121         CHECK_ACCESS(_res_ptr);
13122         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
13123         FREE(untag_ptr(_res));
13124         CResult_RouteDecodeErrorZ_free(_res_conv);
13125 }
13126
13127 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
13128         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13129         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
13130         return tag_ptr(ret_conv, true);
13131 }
13132 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
13133         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
13134         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
13135         return ret_conv;
13136 }
13137
13138 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
13139         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
13140         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13141         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
13142         return tag_ptr(ret_conv, true);
13143 }
13144
13145 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
13146         LDKRouteParameters o_conv;
13147         o_conv.inner = untag_ptr(o);
13148         o_conv.is_owned = ptr_is_owned(o);
13149         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13150         o_conv = RouteParameters_clone(&o_conv);
13151         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13152         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
13153         return tag_ptr(ret_conv, true);
13154 }
13155
13156 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
13157         void* e_ptr = untag_ptr(e);
13158         CHECK_ACCESS(e_ptr);
13159         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13160         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13161         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13162         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
13163         return tag_ptr(ret_conv, true);
13164 }
13165
13166 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
13167         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
13168         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
13169         return ret_conv;
13170 }
13171
13172 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
13173         if (!ptr_is_owned(_res)) return;
13174         void* _res_ptr = untag_ptr(_res);
13175         CHECK_ACCESS(_res_ptr);
13176         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
13177         FREE(untag_ptr(_res));
13178         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
13179 }
13180
13181 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
13182         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13183         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
13184         return tag_ptr(ret_conv, true);
13185 }
13186 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
13187         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
13188         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
13189         return ret_conv;
13190 }
13191
13192 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
13193         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
13194         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13195         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
13196         return tag_ptr(ret_conv, true);
13197 }
13198
13199 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
13200         LDKCVec_RouteHintZ _res_constr;
13201         _res_constr.datalen = _res->arr_len;
13202         if (_res_constr.datalen > 0)
13203                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
13204         else
13205                 _res_constr.data = NULL;
13206         uint64_t* _res_vals = _res->elems;
13207         for (size_t l = 0; l < _res_constr.datalen; l++) {
13208                 uint64_t _res_conv_11 = _res_vals[l];
13209                 LDKRouteHint _res_conv_11_conv;
13210                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
13211                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
13212                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
13213                 _res_constr.data[l] = _res_conv_11_conv;
13214         }
13215         FREE(_res);
13216         CVec_RouteHintZ_free(_res_constr);
13217 }
13218
13219 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
13220         LDKCVec_u64Z _res_constr;
13221         _res_constr.datalen = _res->arr_len;
13222         if (_res_constr.datalen > 0)
13223                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
13224         else
13225                 _res_constr.data = NULL;
13226         int64_t* _res_vals = _res->elems;
13227         for (size_t i = 0; i < _res_constr.datalen; i++) {
13228                 int64_t _res_conv_8 = _res_vals[i];
13229                 _res_constr.data[i] = _res_conv_8;
13230         }
13231         FREE(_res);
13232         CVec_u64Z_free(_res_constr);
13233 }
13234
13235 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
13236         LDKPaymentParameters o_conv;
13237         o_conv.inner = untag_ptr(o);
13238         o_conv.is_owned = ptr_is_owned(o);
13239         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13240         o_conv = PaymentParameters_clone(&o_conv);
13241         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13242         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
13243         return tag_ptr(ret_conv, true);
13244 }
13245
13246 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
13247         void* e_ptr = untag_ptr(e);
13248         CHECK_ACCESS(e_ptr);
13249         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13250         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13251         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13252         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
13253         return tag_ptr(ret_conv, true);
13254 }
13255
13256 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
13257         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
13258         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
13259         return ret_conv;
13260 }
13261
13262 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
13263         if (!ptr_is_owned(_res)) return;
13264         void* _res_ptr = untag_ptr(_res);
13265         CHECK_ACCESS(_res_ptr);
13266         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
13267         FREE(untag_ptr(_res));
13268         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
13269 }
13270
13271 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
13272         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13273         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
13274         return tag_ptr(ret_conv, true);
13275 }
13276 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
13277         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
13278         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
13279         return ret_conv;
13280 }
13281
13282 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
13283         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
13284         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13285         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
13286         return tag_ptr(ret_conv, true);
13287 }
13288
13289 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
13290         LDKCVec_RouteHintHopZ _res_constr;
13291         _res_constr.datalen = _res->arr_len;
13292         if (_res_constr.datalen > 0)
13293                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
13294         else
13295                 _res_constr.data = NULL;
13296         uint64_t* _res_vals = _res->elems;
13297         for (size_t o = 0; o < _res_constr.datalen; o++) {
13298                 uint64_t _res_conv_14 = _res_vals[o];
13299                 LDKRouteHintHop _res_conv_14_conv;
13300                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
13301                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
13302                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
13303                 _res_constr.data[o] = _res_conv_14_conv;
13304         }
13305         FREE(_res);
13306         CVec_RouteHintHopZ_free(_res_constr);
13307 }
13308
13309 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
13310         LDKRouteHint o_conv;
13311         o_conv.inner = untag_ptr(o);
13312         o_conv.is_owned = ptr_is_owned(o);
13313         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13314         o_conv = RouteHint_clone(&o_conv);
13315         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13316         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
13317         return tag_ptr(ret_conv, true);
13318 }
13319
13320 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
13321         void* e_ptr = untag_ptr(e);
13322         CHECK_ACCESS(e_ptr);
13323         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13324         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13325         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13326         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
13327         return tag_ptr(ret_conv, true);
13328 }
13329
13330 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
13331         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
13332         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
13333         return ret_conv;
13334 }
13335
13336 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
13337         if (!ptr_is_owned(_res)) return;
13338         void* _res_ptr = untag_ptr(_res);
13339         CHECK_ACCESS(_res_ptr);
13340         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
13341         FREE(untag_ptr(_res));
13342         CResult_RouteHintDecodeErrorZ_free(_res_conv);
13343 }
13344
13345 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
13346         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13347         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
13348         return tag_ptr(ret_conv, true);
13349 }
13350 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
13351         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
13352         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
13353         return ret_conv;
13354 }
13355
13356 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
13357         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
13358         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13359         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
13360         return tag_ptr(ret_conv, true);
13361 }
13362
13363 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
13364         LDKRouteHintHop o_conv;
13365         o_conv.inner = untag_ptr(o);
13366         o_conv.is_owned = ptr_is_owned(o);
13367         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13368         o_conv = RouteHintHop_clone(&o_conv);
13369         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13370         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
13371         return tag_ptr(ret_conv, true);
13372 }
13373
13374 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
13375         void* e_ptr = untag_ptr(e);
13376         CHECK_ACCESS(e_ptr);
13377         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13378         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13379         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13380         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
13381         return tag_ptr(ret_conv, true);
13382 }
13383
13384 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
13385         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
13386         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
13387         return ret_conv;
13388 }
13389
13390 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
13391         if (!ptr_is_owned(_res)) return;
13392         void* _res_ptr = untag_ptr(_res);
13393         CHECK_ACCESS(_res_ptr);
13394         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
13395         FREE(untag_ptr(_res));
13396         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
13397 }
13398
13399 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
13400         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13401         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
13402         return tag_ptr(ret_conv, true);
13403 }
13404 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
13405         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
13406         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
13407         return ret_conv;
13408 }
13409
13410 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
13411         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
13412         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13413         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
13414         return tag_ptr(ret_conv, true);
13415 }
13416
13417 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
13418         void* o_ptr = untag_ptr(o);
13419         CHECK_ACCESS(o_ptr);
13420         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
13421         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
13422         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
13423         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
13424         return tag_ptr(ret_conv, true);
13425 }
13426
13427 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
13428         void* e_ptr = untag_ptr(e);
13429         CHECK_ACCESS(e_ptr);
13430         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13431         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13432         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
13433         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
13434         return tag_ptr(ret_conv, true);
13435 }
13436
13437 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
13438         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
13439         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
13440         return ret_conv;
13441 }
13442
13443 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
13444         if (!ptr_is_owned(_res)) return;
13445         void* _res_ptr = untag_ptr(_res);
13446         CHECK_ACCESS(_res_ptr);
13447         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
13448         FREE(untag_ptr(_res));
13449         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
13450 }
13451
13452 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
13453         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
13454         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
13455         return tag_ptr(ret_conv, true);
13456 }
13457 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
13458         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
13459         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
13460         return ret_conv;
13461 }
13462
13463 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
13464         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
13465         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
13466         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
13467         return tag_ptr(ret_conv, true);
13468 }
13469
13470 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
13471         void* o_ptr = untag_ptr(o);
13472         CHECK_ACCESS(o_ptr);
13473         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
13474         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
13475         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13476         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
13477         uint64_t ret_ref = tag_ptr(ret_copy, true);
13478         return ret_ref;
13479 }
13480
13481 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
13482         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13483         *ret_copy = COption_NetworkUpdateZ_none();
13484         uint64_t ret_ref = tag_ptr(ret_copy, true);
13485         return ret_ref;
13486 }
13487
13488 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
13489         if (!ptr_is_owned(_res)) return;
13490         void* _res_ptr = untag_ptr(_res);
13491         CHECK_ACCESS(_res_ptr);
13492         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
13493         FREE(untag_ptr(_res));
13494         COption_NetworkUpdateZ_free(_res_conv);
13495 }
13496
13497 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
13498         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13499         *ret_copy = COption_NetworkUpdateZ_clone(arg);
13500         uint64_t ret_ref = tag_ptr(ret_copy, true);
13501         return ret_ref;
13502 }
13503 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
13504         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
13505         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
13506         return ret_conv;
13507 }
13508
13509 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
13510         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
13511         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13512         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
13513         uint64_t ret_ref = tag_ptr(ret_copy, true);
13514         return ret_ref;
13515 }
13516
13517 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_some"))) TS_COption_PathFailureZ_some(uint64_t o) {
13518         void* o_ptr = untag_ptr(o);
13519         CHECK_ACCESS(o_ptr);
13520         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
13521         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
13522         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
13523         *ret_copy = COption_PathFailureZ_some(o_conv);
13524         uint64_t ret_ref = tag_ptr(ret_copy, true);
13525         return ret_ref;
13526 }
13527
13528 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_none"))) TS_COption_PathFailureZ_none() {
13529         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
13530         *ret_copy = COption_PathFailureZ_none();
13531         uint64_t ret_ref = tag_ptr(ret_copy, true);
13532         return ret_ref;
13533 }
13534
13535 void  __attribute__((export_name("TS_COption_PathFailureZ_free"))) TS_COption_PathFailureZ_free(uint64_t _res) {
13536         if (!ptr_is_owned(_res)) return;
13537         void* _res_ptr = untag_ptr(_res);
13538         CHECK_ACCESS(_res_ptr);
13539         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
13540         FREE(untag_ptr(_res));
13541         COption_PathFailureZ_free(_res_conv);
13542 }
13543
13544 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
13545         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
13546         *ret_copy = COption_PathFailureZ_clone(arg);
13547         uint64_t ret_ref = tag_ptr(ret_copy, true);
13548         return ret_ref;
13549 }
13550 int64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone_ptr"))) TS_COption_PathFailureZ_clone_ptr(uint64_t arg) {
13551         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
13552         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
13553         return ret_conv;
13554 }
13555
13556 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone"))) TS_COption_PathFailureZ_clone(uint64_t orig) {
13557         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
13558         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
13559         *ret_copy = COption_PathFailureZ_clone(orig_conv);
13560         uint64_t ret_ref = tag_ptr(ret_copy, true);
13561         return ret_ref;
13562 }
13563
13564 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_ok(uint64_t o) {
13565         void* o_ptr = untag_ptr(o);
13566         CHECK_ACCESS(o_ptr);
13567         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
13568         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
13569         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
13570         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
13571         return tag_ptr(ret_conv, true);
13572 }
13573
13574 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_err(uint64_t e) {
13575         void* e_ptr = untag_ptr(e);
13576         CHECK_ACCESS(e_ptr);
13577         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13578         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13579         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
13580         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
13581         return tag_ptr(ret_conv, true);
13582 }
13583
13584 jboolean  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok(uint64_t o) {
13585         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
13586         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
13587         return ret_conv;
13588 }
13589
13590 void  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_free"))) TS_CResult_COption_PathFailureZDecodeErrorZ_free(uint64_t _res) {
13591         if (!ptr_is_owned(_res)) return;
13592         void* _res_ptr = untag_ptr(_res);
13593         CHECK_ACCESS(_res_ptr);
13594         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
13595         FREE(untag_ptr(_res));
13596         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
13597 }
13598
13599 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
13600         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
13601         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
13602         return tag_ptr(ret_conv, true);
13603 }
13604 int64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(uint64_t arg) {
13605         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
13606         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
13607         return ret_conv;
13608 }
13609
13610 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone(uint64_t orig) {
13611         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
13612         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
13613         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
13614         return tag_ptr(ret_conv, true);
13615 }
13616
13617 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
13618         void* o_ptr = untag_ptr(o);
13619         CHECK_ACCESS(o_ptr);
13620         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
13621         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
13622         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13623         *ret_copy = COption_ClosureReasonZ_some(o_conv);
13624         uint64_t ret_ref = tag_ptr(ret_copy, true);
13625         return ret_ref;
13626 }
13627
13628 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
13629         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13630         *ret_copy = COption_ClosureReasonZ_none();
13631         uint64_t ret_ref = tag_ptr(ret_copy, true);
13632         return ret_ref;
13633 }
13634
13635 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
13636         if (!ptr_is_owned(_res)) return;
13637         void* _res_ptr = untag_ptr(_res);
13638         CHECK_ACCESS(_res_ptr);
13639         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
13640         FREE(untag_ptr(_res));
13641         COption_ClosureReasonZ_free(_res_conv);
13642 }
13643
13644 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
13645         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13646         *ret_copy = COption_ClosureReasonZ_clone(arg);
13647         uint64_t ret_ref = tag_ptr(ret_copy, true);
13648         return ret_ref;
13649 }
13650 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
13651         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
13652         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
13653         return ret_conv;
13654 }
13655
13656 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
13657         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
13658         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13659         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
13660         uint64_t ret_ref = tag_ptr(ret_copy, true);
13661         return ret_ref;
13662 }
13663
13664 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
13665         void* o_ptr = untag_ptr(o);
13666         CHECK_ACCESS(o_ptr);
13667         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
13668         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
13669         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13670         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
13671         return tag_ptr(ret_conv, true);
13672 }
13673
13674 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
13675         void* e_ptr = untag_ptr(e);
13676         CHECK_ACCESS(e_ptr);
13677         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13678         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13679         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13680         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
13681         return tag_ptr(ret_conv, true);
13682 }
13683
13684 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
13685         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
13686         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
13687         return ret_conv;
13688 }
13689
13690 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
13691         if (!ptr_is_owned(_res)) return;
13692         void* _res_ptr = untag_ptr(_res);
13693         CHECK_ACCESS(_res_ptr);
13694         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
13695         FREE(untag_ptr(_res));
13696         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
13697 }
13698
13699 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
13700         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13701         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
13702         return tag_ptr(ret_conv, true);
13703 }
13704 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
13705         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
13706         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
13707         return ret_conv;
13708 }
13709
13710 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
13711         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
13712         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13713         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
13714         return tag_ptr(ret_conv, true);
13715 }
13716
13717 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
13718         void* o_ptr = untag_ptr(o);
13719         CHECK_ACCESS(o_ptr);
13720         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
13721         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
13722         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13723         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
13724         uint64_t ret_ref = tag_ptr(ret_copy, true);
13725         return ret_ref;
13726 }
13727
13728 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
13729         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13730         *ret_copy = COption_HTLCDestinationZ_none();
13731         uint64_t ret_ref = tag_ptr(ret_copy, true);
13732         return ret_ref;
13733 }
13734
13735 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
13736         if (!ptr_is_owned(_res)) return;
13737         void* _res_ptr = untag_ptr(_res);
13738         CHECK_ACCESS(_res_ptr);
13739         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
13740         FREE(untag_ptr(_res));
13741         COption_HTLCDestinationZ_free(_res_conv);
13742 }
13743
13744 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
13745         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13746         *ret_copy = COption_HTLCDestinationZ_clone(arg);
13747         uint64_t ret_ref = tag_ptr(ret_copy, true);
13748         return ret_ref;
13749 }
13750 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
13751         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
13752         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
13753         return ret_conv;
13754 }
13755
13756 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
13757         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
13758         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13759         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
13760         uint64_t ret_ref = tag_ptr(ret_copy, true);
13761         return ret_ref;
13762 }
13763
13764 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
13765         void* o_ptr = untag_ptr(o);
13766         CHECK_ACCESS(o_ptr);
13767         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
13768         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
13769         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13770         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
13771         return tag_ptr(ret_conv, true);
13772 }
13773
13774 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
13775         void* e_ptr = untag_ptr(e);
13776         CHECK_ACCESS(e_ptr);
13777         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13778         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13779         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13780         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
13781         return tag_ptr(ret_conv, true);
13782 }
13783
13784 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
13785         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
13786         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
13787         return ret_conv;
13788 }
13789
13790 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
13791         if (!ptr_is_owned(_res)) return;
13792         void* _res_ptr = untag_ptr(_res);
13793         CHECK_ACCESS(_res_ptr);
13794         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
13795         FREE(untag_ptr(_res));
13796         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
13797 }
13798
13799 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
13800         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13801         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
13802         return tag_ptr(ret_conv, true);
13803 }
13804 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
13805         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
13806         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
13807         return ret_conv;
13808 }
13809
13810 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
13811         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
13812         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13813         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
13814         return tag_ptr(ret_conv, true);
13815 }
13816
13817 uint64_t  __attribute__((export_name("TS_COption_u128Z_some"))) TS_COption_u128Z_some(int8_tArray o) {
13818         LDKU128 o_ref;
13819         CHECK(o->arr_len == 16);
13820         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
13821         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
13822         *ret_copy = COption_u128Z_some(o_ref);
13823         uint64_t ret_ref = tag_ptr(ret_copy, true);
13824         return ret_ref;
13825 }
13826
13827 uint64_t  __attribute__((export_name("TS_COption_u128Z_none"))) TS_COption_u128Z_none() {
13828         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
13829         *ret_copy = COption_u128Z_none();
13830         uint64_t ret_ref = tag_ptr(ret_copy, true);
13831         return ret_ref;
13832 }
13833
13834 void  __attribute__((export_name("TS_COption_u128Z_free"))) TS_COption_u128Z_free(uint64_t _res) {
13835         if (!ptr_is_owned(_res)) return;
13836         void* _res_ptr = untag_ptr(_res);
13837         CHECK_ACCESS(_res_ptr);
13838         LDKCOption_u128Z _res_conv = *(LDKCOption_u128Z*)(_res_ptr);
13839         FREE(untag_ptr(_res));
13840         COption_u128Z_free(_res_conv);
13841 }
13842
13843 static inline uint64_t COption_u128Z_clone_ptr(LDKCOption_u128Z *NONNULL_PTR arg) {
13844         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
13845         *ret_copy = COption_u128Z_clone(arg);
13846         uint64_t ret_ref = tag_ptr(ret_copy, true);
13847         return ret_ref;
13848 }
13849 int64_t  __attribute__((export_name("TS_COption_u128Z_clone_ptr"))) TS_COption_u128Z_clone_ptr(uint64_t arg) {
13850         LDKCOption_u128Z* arg_conv = (LDKCOption_u128Z*)untag_ptr(arg);
13851         int64_t ret_conv = COption_u128Z_clone_ptr(arg_conv);
13852         return ret_conv;
13853 }
13854
13855 uint64_t  __attribute__((export_name("TS_COption_u128Z_clone"))) TS_COption_u128Z_clone(uint64_t orig) {
13856         LDKCOption_u128Z* orig_conv = (LDKCOption_u128Z*)untag_ptr(orig);
13857         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
13858         *ret_copy = COption_u128Z_clone(orig_conv);
13859         uint64_t ret_ref = tag_ptr(ret_copy, true);
13860         return ret_ref;
13861 }
13862
13863 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
13864         LDKCVec_SpendableOutputDescriptorZ _res_constr;
13865         _res_constr.datalen = _res->arr_len;
13866         if (_res_constr.datalen > 0)
13867                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13868         else
13869                 _res_constr.data = NULL;
13870         uint64_t* _res_vals = _res->elems;
13871         for (size_t b = 0; b < _res_constr.datalen; b++) {
13872                 uint64_t _res_conv_27 = _res_vals[b];
13873                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
13874                 CHECK_ACCESS(_res_conv_27_ptr);
13875                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
13876                 FREE(untag_ptr(_res_conv_27));
13877                 _res_constr.data[b] = _res_conv_27_conv;
13878         }
13879         FREE(_res);
13880         CVec_SpendableOutputDescriptorZ_free(_res_constr);
13881 }
13882
13883 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
13884         void* o_ptr = untag_ptr(o);
13885         CHECK_ACCESS(o_ptr);
13886         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
13887         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
13888         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13889         *ret_copy = COption_EventZ_some(o_conv);
13890         uint64_t ret_ref = tag_ptr(ret_copy, true);
13891         return ret_ref;
13892 }
13893
13894 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
13895         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13896         *ret_copy = COption_EventZ_none();
13897         uint64_t ret_ref = tag_ptr(ret_copy, true);
13898         return ret_ref;
13899 }
13900
13901 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
13902         if (!ptr_is_owned(_res)) return;
13903         void* _res_ptr = untag_ptr(_res);
13904         CHECK_ACCESS(_res_ptr);
13905         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
13906         FREE(untag_ptr(_res));
13907         COption_EventZ_free(_res_conv);
13908 }
13909
13910 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
13911         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13912         *ret_copy = COption_EventZ_clone(arg);
13913         uint64_t ret_ref = tag_ptr(ret_copy, true);
13914         return ret_ref;
13915 }
13916 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
13917         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
13918         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
13919         return ret_conv;
13920 }
13921
13922 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
13923         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
13924         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13925         *ret_copy = COption_EventZ_clone(orig_conv);
13926         uint64_t ret_ref = tag_ptr(ret_copy, true);
13927         return ret_ref;
13928 }
13929
13930 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
13931         void* o_ptr = untag_ptr(o);
13932         CHECK_ACCESS(o_ptr);
13933         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
13934         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
13935         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13936         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
13937         return tag_ptr(ret_conv, true);
13938 }
13939
13940 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
13941         void* e_ptr = untag_ptr(e);
13942         CHECK_ACCESS(e_ptr);
13943         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13944         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13945         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13946         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
13947         return tag_ptr(ret_conv, true);
13948 }
13949
13950 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
13951         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
13952         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
13953         return ret_conv;
13954 }
13955
13956 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
13957         if (!ptr_is_owned(_res)) return;
13958         void* _res_ptr = untag_ptr(_res);
13959         CHECK_ACCESS(_res_ptr);
13960         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
13961         FREE(untag_ptr(_res));
13962         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
13963 }
13964
13965 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
13966         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13967         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
13968         return tag_ptr(ret_conv, true);
13969 }
13970 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
13971         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
13972         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
13973         return ret_conv;
13974 }
13975
13976 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
13977         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
13978         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13979         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
13980         return tag_ptr(ret_conv, true);
13981 }
13982
13983 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
13984         LDKCVec_MessageSendEventZ _res_constr;
13985         _res_constr.datalen = _res->arr_len;
13986         if (_res_constr.datalen > 0)
13987                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
13988         else
13989                 _res_constr.data = NULL;
13990         uint64_t* _res_vals = _res->elems;
13991         for (size_t s = 0; s < _res_constr.datalen; s++) {
13992                 uint64_t _res_conv_18 = _res_vals[s];
13993                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
13994                 CHECK_ACCESS(_res_conv_18_ptr);
13995                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
13996                 FREE(untag_ptr(_res_conv_18));
13997                 _res_constr.data[s] = _res_conv_18_conv;
13998         }
13999         FREE(_res);
14000         CVec_MessageSendEventZ_free(_res_constr);
14001 }
14002
14003 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
14004         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14005         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
14006         return tag_ptr(ret_conv, true);
14007 }
14008 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
14009         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
14010         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
14011         return ret_conv;
14012 }
14013
14014 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
14015         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
14016         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14017         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
14018         return tag_ptr(ret_conv, true);
14019 }
14020
14021 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
14022         LDKTransaction b_ref;
14023         b_ref.datalen = b->arr_len;
14024         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
14025         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
14026         b_ref.data_is_owned = true;
14027         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14028         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
14029         return tag_ptr(ret_conv, true);
14030 }
14031
14032 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
14033         if (!ptr_is_owned(_res)) return;
14034         void* _res_ptr = untag_ptr(_res);
14035         CHECK_ACCESS(_res_ptr);
14036         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
14037         FREE(untag_ptr(_res));
14038         C2Tuple_usizeTransactionZ_free(_res_conv);
14039 }
14040
14041 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
14042         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
14043         _res_constr.datalen = _res->arr_len;
14044         if (_res_constr.datalen > 0)
14045                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14046         else
14047                 _res_constr.data = NULL;
14048         uint64_t* _res_vals = _res->elems;
14049         for (size_t c = 0; c < _res_constr.datalen; c++) {
14050                 uint64_t _res_conv_28 = _res_vals[c];
14051                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
14052                 CHECK_ACCESS(_res_conv_28_ptr);
14053                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
14054                 FREE(untag_ptr(_res_conv_28));
14055                 _res_constr.data[c] = _res_conv_28_conv;
14056         }
14057         FREE(_res);
14058         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
14059 }
14060
14061 static inline uint64_t C2Tuple_TxidBlockHashZ_clone_ptr(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR arg) {
14062         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
14063         *ret_conv = C2Tuple_TxidBlockHashZ_clone(arg);
14064         return tag_ptr(ret_conv, true);
14065 }
14066 int64_t  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_clone_ptr"))) TS_C2Tuple_TxidBlockHashZ_clone_ptr(uint64_t arg) {
14067         LDKC2Tuple_TxidBlockHashZ* arg_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(arg);
14068         int64_t ret_conv = C2Tuple_TxidBlockHashZ_clone_ptr(arg_conv);
14069         return ret_conv;
14070 }
14071
14072 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_clone"))) TS_C2Tuple_TxidBlockHashZ_clone(uint64_t orig) {
14073         LDKC2Tuple_TxidBlockHashZ* orig_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(orig);
14074         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
14075         *ret_conv = C2Tuple_TxidBlockHashZ_clone(orig_conv);
14076         return tag_ptr(ret_conv, true);
14077 }
14078
14079 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_new"))) TS_C2Tuple_TxidBlockHashZ_new(int8_tArray a, int8_tArray b) {
14080         LDKThirtyTwoBytes a_ref;
14081         CHECK(a->arr_len == 32);
14082         memcpy(a_ref.data, a->elems, 32); FREE(a);
14083         LDKThirtyTwoBytes b_ref;
14084         CHECK(b->arr_len == 32);
14085         memcpy(b_ref.data, b->elems, 32); FREE(b);
14086         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
14087         *ret_conv = C2Tuple_TxidBlockHashZ_new(a_ref, b_ref);
14088         return tag_ptr(ret_conv, true);
14089 }
14090
14091 void  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_free"))) TS_C2Tuple_TxidBlockHashZ_free(uint64_t _res) {
14092         if (!ptr_is_owned(_res)) return;
14093         void* _res_ptr = untag_ptr(_res);
14094         CHECK_ACCESS(_res_ptr);
14095         LDKC2Tuple_TxidBlockHashZ _res_conv = *(LDKC2Tuple_TxidBlockHashZ*)(_res_ptr);
14096         FREE(untag_ptr(_res));
14097         C2Tuple_TxidBlockHashZ_free(_res_conv);
14098 }
14099
14100 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidBlockHashZZ_free"))) TS_CVec_C2Tuple_TxidBlockHashZZ_free(uint64_tArray _res) {
14101         LDKCVec_C2Tuple_TxidBlockHashZZ _res_constr;
14102         _res_constr.datalen = _res->arr_len;
14103         if (_res_constr.datalen > 0)
14104                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKCVec_C2Tuple_TxidBlockHashZZ Elements");
14105         else
14106                 _res_constr.data = NULL;
14107         uint64_t* _res_vals = _res->elems;
14108         for (size_t z = 0; z < _res_constr.datalen; z++) {
14109                 uint64_t _res_conv_25 = _res_vals[z];
14110                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
14111                 CHECK_ACCESS(_res_conv_25_ptr);
14112                 LDKC2Tuple_TxidBlockHashZ _res_conv_25_conv = *(LDKC2Tuple_TxidBlockHashZ*)(_res_conv_25_ptr);
14113                 FREE(untag_ptr(_res_conv_25));
14114                 _res_constr.data[z] = _res_conv_25_conv;
14115         }
14116         FREE(_res);
14117         CVec_C2Tuple_TxidBlockHashZZ_free(_res_constr);
14118 }
14119
14120 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
14121         LDKCVec_MonitorEventZ _res_constr;
14122         _res_constr.datalen = _res->arr_len;
14123         if (_res_constr.datalen > 0)
14124                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
14125         else
14126                 _res_constr.data = NULL;
14127         uint64_t* _res_vals = _res->elems;
14128         for (size_t o = 0; o < _res_constr.datalen; o++) {
14129                 uint64_t _res_conv_14 = _res_vals[o];
14130                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
14131                 CHECK_ACCESS(_res_conv_14_ptr);
14132                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
14133                 FREE(untag_ptr(_res_conv_14));
14134                 _res_constr.data[o] = _res_conv_14_conv;
14135         }
14136         FREE(_res);
14137         CVec_MonitorEventZ_free(_res_constr);
14138 }
14139
14140 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
14141         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
14142         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
14143         return tag_ptr(ret_conv, true);
14144 }
14145 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
14146         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
14147         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
14148         return ret_conv;
14149 }
14150
14151 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
14152         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
14153         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
14154         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
14155         return tag_ptr(ret_conv, true);
14156 }
14157
14158 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
14159         LDKOutPoint a_conv;
14160         a_conv.inner = untag_ptr(a);
14161         a_conv.is_owned = ptr_is_owned(a);
14162         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
14163         a_conv = OutPoint_clone(&a_conv);
14164         LDKCVec_MonitorEventZ b_constr;
14165         b_constr.datalen = b->arr_len;
14166         if (b_constr.datalen > 0)
14167                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
14168         else
14169                 b_constr.data = NULL;
14170         uint64_t* b_vals = b->elems;
14171         for (size_t o = 0; o < b_constr.datalen; o++) {
14172                 uint64_t b_conv_14 = b_vals[o];
14173                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
14174                 CHECK_ACCESS(b_conv_14_ptr);
14175                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
14176                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
14177                 b_constr.data[o] = b_conv_14_conv;
14178         }
14179         FREE(b);
14180         LDKPublicKey c_ref;
14181         CHECK(c->arr_len == 33);
14182         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
14183         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
14184         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
14185         return tag_ptr(ret_conv, true);
14186 }
14187
14188 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
14189         if (!ptr_is_owned(_res)) return;
14190         void* _res_ptr = untag_ptr(_res);
14191         CHECK_ACCESS(_res_ptr);
14192         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
14193         FREE(untag_ptr(_res));
14194         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
14195 }
14196
14197 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
14198         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
14199         _res_constr.datalen = _res->arr_len;
14200         if (_res_constr.datalen > 0)
14201                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
14202         else
14203                 _res_constr.data = NULL;
14204         uint64_t* _res_vals = _res->elems;
14205         for (size_t x = 0; x < _res_constr.datalen; x++) {
14206                 uint64_t _res_conv_49 = _res_vals[x];
14207                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
14208                 CHECK_ACCESS(_res_conv_49_ptr);
14209                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
14210                 FREE(untag_ptr(_res_conv_49));
14211                 _res_constr.data[x] = _res_conv_49_conv;
14212         }
14213         FREE(_res);
14214         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
14215 }
14216
14217 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
14218         LDKFixedPenaltyScorer o_conv;
14219         o_conv.inner = untag_ptr(o);
14220         o_conv.is_owned = ptr_is_owned(o);
14221         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14222         o_conv = FixedPenaltyScorer_clone(&o_conv);
14223         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14224         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
14225         return tag_ptr(ret_conv, true);
14226 }
14227
14228 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
14229         void* e_ptr = untag_ptr(e);
14230         CHECK_ACCESS(e_ptr);
14231         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14232         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14233         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14234         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
14235         return tag_ptr(ret_conv, true);
14236 }
14237
14238 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
14239         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
14240         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
14241         return ret_conv;
14242 }
14243
14244 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
14245         if (!ptr_is_owned(_res)) return;
14246         void* _res_ptr = untag_ptr(_res);
14247         CHECK_ACCESS(_res_ptr);
14248         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
14249         FREE(untag_ptr(_res));
14250         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
14251 }
14252
14253 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
14254         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14255         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
14256         return tag_ptr(ret_conv, true);
14257 }
14258 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
14259         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
14260         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
14261         return ret_conv;
14262 }
14263
14264 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
14265         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
14266         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14267         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
14268         return tag_ptr(ret_conv, true);
14269 }
14270
14271 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
14272         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
14273         *ret_conv = C2Tuple_u64u64Z_clone(arg);
14274         return tag_ptr(ret_conv, true);
14275 }
14276 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
14277         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
14278         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
14279         return ret_conv;
14280 }
14281
14282 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
14283         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
14284         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
14285         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
14286         return tag_ptr(ret_conv, true);
14287 }
14288
14289 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
14290         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
14291         *ret_conv = C2Tuple_u64u64Z_new(a, b);
14292         return tag_ptr(ret_conv, true);
14293 }
14294
14295 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
14296         if (!ptr_is_owned(_res)) return;
14297         void* _res_ptr = untag_ptr(_res);
14298         CHECK_ACCESS(_res_ptr);
14299         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
14300         FREE(untag_ptr(_res));
14301         C2Tuple_u64u64Z_free(_res_conv);
14302 }
14303
14304 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
14305         void* o_ptr = untag_ptr(o);
14306         CHECK_ACCESS(o_ptr);
14307         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
14308         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
14309         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14310         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
14311         uint64_t ret_ref = tag_ptr(ret_copy, true);
14312         return ret_ref;
14313 }
14314
14315 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
14316         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14317         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
14318         uint64_t ret_ref = tag_ptr(ret_copy, true);
14319         return ret_ref;
14320 }
14321
14322 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
14323         if (!ptr_is_owned(_res)) return;
14324         void* _res_ptr = untag_ptr(_res);
14325         CHECK_ACCESS(_res_ptr);
14326         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
14327         FREE(untag_ptr(_res));
14328         COption_C2Tuple_u64u64ZZ_free(_res_conv);
14329 }
14330
14331 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
14332         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14333         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
14334         uint64_t ret_ref = tag_ptr(ret_copy, true);
14335         return ret_ref;
14336 }
14337 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
14338         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
14339         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
14340         return ret_conv;
14341 }
14342
14343 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
14344         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
14345         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14346         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
14347         uint64_t ret_ref = tag_ptr(ret_copy, true);
14348         return ret_ref;
14349 }
14350
14351 static inline uint64_t C2Tuple_Z_clone_ptr(LDKC2Tuple_Z *NONNULL_PTR arg) {
14352         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
14353         *ret_conv = C2Tuple_Z_clone(arg);
14354         return tag_ptr(ret_conv, true);
14355 }
14356 int64_t  __attribute__((export_name("TS_C2Tuple_Z_clone_ptr"))) TS_C2Tuple_Z_clone_ptr(uint64_t arg) {
14357         LDKC2Tuple_Z* arg_conv = (LDKC2Tuple_Z*)untag_ptr(arg);
14358         int64_t ret_conv = C2Tuple_Z_clone_ptr(arg_conv);
14359         return ret_conv;
14360 }
14361
14362 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_clone"))) TS_C2Tuple_Z_clone(uint64_t orig) {
14363         LDKC2Tuple_Z* orig_conv = (LDKC2Tuple_Z*)untag_ptr(orig);
14364         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
14365         *ret_conv = C2Tuple_Z_clone(orig_conv);
14366         return tag_ptr(ret_conv, true);
14367 }
14368
14369 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_new"))) TS_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
14370         LDKEightU16s a_ref;
14371         CHECK(a->arr_len == 8);
14372         memcpy(a_ref.data, a->elems, 8 * 2); FREE(a);
14373         LDKEightU16s b_ref;
14374         CHECK(b->arr_len == 8);
14375         memcpy(b_ref.data, b->elems, 8 * 2); FREE(b);
14376         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
14377         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
14378         return tag_ptr(ret_conv, true);
14379 }
14380
14381 void  __attribute__((export_name("TS_C2Tuple_Z_free"))) TS_C2Tuple_Z_free(uint64_t _res) {
14382         if (!ptr_is_owned(_res)) return;
14383         void* _res_ptr = untag_ptr(_res);
14384         CHECK_ACCESS(_res_ptr);
14385         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
14386         FREE(untag_ptr(_res));
14387         C2Tuple_Z_free(_res_conv);
14388 }
14389
14390 static inline uint64_t C2Tuple__u168_u168Z_clone_ptr(LDKC2Tuple__u168_u168Z *NONNULL_PTR arg) {
14391         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
14392         *ret_conv = C2Tuple__u168_u168Z_clone(arg);
14393         return tag_ptr(ret_conv, true);
14394 }
14395 int64_t  __attribute__((export_name("TS_C2Tuple__u168_u168Z_clone_ptr"))) TS_C2Tuple__u168_u168Z_clone_ptr(uint64_t arg) {
14396         LDKC2Tuple__u168_u168Z* arg_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(arg);
14397         int64_t ret_conv = C2Tuple__u168_u168Z_clone_ptr(arg_conv);
14398         return ret_conv;
14399 }
14400
14401 uint64_t  __attribute__((export_name("TS_C2Tuple__u168_u168Z_clone"))) TS_C2Tuple__u168_u168Z_clone(uint64_t orig) {
14402         LDKC2Tuple__u168_u168Z* orig_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(orig);
14403         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
14404         *ret_conv = C2Tuple__u168_u168Z_clone(orig_conv);
14405         return tag_ptr(ret_conv, true);
14406 }
14407
14408 uint64_t  __attribute__((export_name("TS_C2Tuple__u168_u168Z_new"))) TS_C2Tuple__u168_u168Z_new(int16_tArray a, int16_tArray b) {
14409         LDKEightU16s a_ref;
14410         CHECK(a->arr_len == 8);
14411         memcpy(a_ref.data, a->elems, 8 * 2); FREE(a);
14412         LDKEightU16s b_ref;
14413         CHECK(b->arr_len == 8);
14414         memcpy(b_ref.data, b->elems, 8 * 2); FREE(b);
14415         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
14416         *ret_conv = C2Tuple__u168_u168Z_new(a_ref, b_ref);
14417         return tag_ptr(ret_conv, true);
14418 }
14419
14420 void  __attribute__((export_name("TS_C2Tuple__u168_u168Z_free"))) TS_C2Tuple__u168_u168Z_free(uint64_t _res) {
14421         if (!ptr_is_owned(_res)) return;
14422         void* _res_ptr = untag_ptr(_res);
14423         CHECK_ACCESS(_res_ptr);
14424         LDKC2Tuple__u168_u168Z _res_conv = *(LDKC2Tuple__u168_u168Z*)(_res_ptr);
14425         FREE(untag_ptr(_res));
14426         C2Tuple__u168_u168Z_free(_res_conv);
14427 }
14428
14429 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_some"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_some(uint64_t o) {
14430         void* o_ptr = untag_ptr(o);
14431         CHECK_ACCESS(o_ptr);
14432         LDKC2Tuple__u168_u168Z o_conv = *(LDKC2Tuple__u168_u168Z*)(o_ptr);
14433         o_conv = C2Tuple__u168_u168Z_clone((LDKC2Tuple__u168_u168Z*)untag_ptr(o));
14434         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
14435         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_some(o_conv);
14436         uint64_t ret_ref = tag_ptr(ret_copy, true);
14437         return ret_ref;
14438 }
14439
14440 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_none"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_none() {
14441         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
14442         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_none();
14443         uint64_t ret_ref = tag_ptr(ret_copy, true);
14444         return ret_ref;
14445 }
14446
14447 void  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_free"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_free(uint64_t _res) {
14448         if (!ptr_is_owned(_res)) return;
14449         void* _res_ptr = untag_ptr(_res);
14450         CHECK_ACCESS(_res_ptr);
14451         LDKCOption_C2Tuple_EightU16sEightU16sZZ _res_conv = *(LDKCOption_C2Tuple_EightU16sEightU16sZZ*)(_res_ptr);
14452         FREE(untag_ptr(_res));
14453         COption_C2Tuple_EightU16sEightU16sZZ_free(_res_conv);
14454 }
14455
14456 static inline uint64_t COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR arg) {
14457         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
14458         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(arg);
14459         uint64_t ret_ref = tag_ptr(ret_copy, true);
14460         return ret_ref;
14461 }
14462 int64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(uint64_t arg) {
14463         LDKCOption_C2Tuple_EightU16sEightU16sZZ* arg_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(arg);
14464         int64_t ret_conv = COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(arg_conv);
14465         return ret_conv;
14466 }
14467
14468 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_clone"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_clone(uint64_t orig) {
14469         LDKCOption_C2Tuple_EightU16sEightU16sZZ* orig_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(orig);
14470         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
14471         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(orig_conv);
14472         uint64_t ret_ref = tag_ptr(ret_copy, true);
14473         return ret_ref;
14474 }
14475
14476 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
14477         LDKCVec_NodeIdZ _res_constr;
14478         _res_constr.datalen = _res->arr_len;
14479         if (_res_constr.datalen > 0)
14480                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
14481         else
14482                 _res_constr.data = NULL;
14483         uint64_t* _res_vals = _res->elems;
14484         for (size_t i = 0; i < _res_constr.datalen; i++) {
14485                 uint64_t _res_conv_8 = _res_vals[i];
14486                 LDKNodeId _res_conv_8_conv;
14487                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
14488                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
14489                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
14490                 _res_constr.data[i] = _res_conv_8_conv;
14491         }
14492         FREE(_res);
14493         CVec_NodeIdZ_free(_res_constr);
14494 }
14495
14496 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
14497         LDKProbabilisticScorer o_conv;
14498         o_conv.inner = untag_ptr(o);
14499         o_conv.is_owned = ptr_is_owned(o);
14500         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14501         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
14502         
14503         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
14504         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
14505         return tag_ptr(ret_conv, true);
14506 }
14507
14508 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
14509         void* e_ptr = untag_ptr(e);
14510         CHECK_ACCESS(e_ptr);
14511         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14512         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14513         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
14514         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
14515         return tag_ptr(ret_conv, true);
14516 }
14517
14518 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
14519         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
14520         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
14521         return ret_conv;
14522 }
14523
14524 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
14525         if (!ptr_is_owned(_res)) return;
14526         void* _res_ptr = untag_ptr(_res);
14527         CHECK_ACCESS(_res_ptr);
14528         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
14529         FREE(untag_ptr(_res));
14530         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
14531 }
14532
14533 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
14534         LDKInitFeatures o_conv;
14535         o_conv.inner = untag_ptr(o);
14536         o_conv.is_owned = ptr_is_owned(o);
14537         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14538         o_conv = InitFeatures_clone(&o_conv);
14539         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14540         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
14541         return tag_ptr(ret_conv, true);
14542 }
14543
14544 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
14545         void* e_ptr = untag_ptr(e);
14546         CHECK_ACCESS(e_ptr);
14547         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14548         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14549         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14550         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
14551         return tag_ptr(ret_conv, true);
14552 }
14553
14554 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14555         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
14556         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
14557         return ret_conv;
14558 }
14559
14560 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
14561         if (!ptr_is_owned(_res)) return;
14562         void* _res_ptr = untag_ptr(_res);
14563         CHECK_ACCESS(_res_ptr);
14564         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
14565         FREE(untag_ptr(_res));
14566         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
14567 }
14568
14569 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14570         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14571         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
14572         return tag_ptr(ret_conv, true);
14573 }
14574 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14575         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
14576         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14577         return ret_conv;
14578 }
14579
14580 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
14581         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
14582         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14583         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
14584         return tag_ptr(ret_conv, true);
14585 }
14586
14587 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
14588         LDKChannelFeatures o_conv;
14589         o_conv.inner = untag_ptr(o);
14590         o_conv.is_owned = ptr_is_owned(o);
14591         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14592         o_conv = ChannelFeatures_clone(&o_conv);
14593         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14594         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
14595         return tag_ptr(ret_conv, true);
14596 }
14597
14598 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
14599         void* e_ptr = untag_ptr(e);
14600         CHECK_ACCESS(e_ptr);
14601         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14602         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14603         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14604         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
14605         return tag_ptr(ret_conv, true);
14606 }
14607
14608 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14609         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
14610         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
14611         return ret_conv;
14612 }
14613
14614 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
14615         if (!ptr_is_owned(_res)) return;
14616         void* _res_ptr = untag_ptr(_res);
14617         CHECK_ACCESS(_res_ptr);
14618         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
14619         FREE(untag_ptr(_res));
14620         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
14621 }
14622
14623 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14624         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14625         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
14626         return tag_ptr(ret_conv, true);
14627 }
14628 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14629         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
14630         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14631         return ret_conv;
14632 }
14633
14634 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
14635         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
14636         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14637         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
14638         return tag_ptr(ret_conv, true);
14639 }
14640
14641 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
14642         LDKNodeFeatures o_conv;
14643         o_conv.inner = untag_ptr(o);
14644         o_conv.is_owned = ptr_is_owned(o);
14645         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14646         o_conv = NodeFeatures_clone(&o_conv);
14647         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14648         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
14649         return tag_ptr(ret_conv, true);
14650 }
14651
14652 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
14653         void* e_ptr = untag_ptr(e);
14654         CHECK_ACCESS(e_ptr);
14655         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14656         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14657         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14658         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
14659         return tag_ptr(ret_conv, true);
14660 }
14661
14662 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14663         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
14664         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
14665         return ret_conv;
14666 }
14667
14668 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
14669         if (!ptr_is_owned(_res)) return;
14670         void* _res_ptr = untag_ptr(_res);
14671         CHECK_ACCESS(_res_ptr);
14672         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
14673         FREE(untag_ptr(_res));
14674         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
14675 }
14676
14677 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14678         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14679         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
14680         return tag_ptr(ret_conv, true);
14681 }
14682 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14683         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
14684         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14685         return ret_conv;
14686 }
14687
14688 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
14689         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
14690         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14691         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
14692         return tag_ptr(ret_conv, true);
14693 }
14694
14695 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
14696         LDKInvoiceFeatures o_conv;
14697         o_conv.inner = untag_ptr(o);
14698         o_conv.is_owned = ptr_is_owned(o);
14699         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14700         o_conv = InvoiceFeatures_clone(&o_conv);
14701         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14702         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
14703         return tag_ptr(ret_conv, true);
14704 }
14705
14706 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
14707         void* e_ptr = untag_ptr(e);
14708         CHECK_ACCESS(e_ptr);
14709         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14710         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14711         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14712         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
14713         return tag_ptr(ret_conv, true);
14714 }
14715
14716 jboolean  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14717         LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
14718         jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
14719         return ret_conv;
14720 }
14721
14722 void  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
14723         if (!ptr_is_owned(_res)) return;
14724         void* _res_ptr = untag_ptr(_res);
14725         CHECK_ACCESS(_res_ptr);
14726         LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
14727         FREE(untag_ptr(_res));
14728         CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
14729 }
14730
14731 static inline uint64_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14732         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14733         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
14734         return tag_ptr(ret_conv, true);
14735 }
14736 int64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14737         LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
14738         int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14739         return ret_conv;
14740 }
14741
14742 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
14743         LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
14744         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14745         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
14746         return tag_ptr(ret_conv, true);
14747 }
14748
14749 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok(uint64_t o) {
14750         LDKBlindedHopFeatures o_conv;
14751         o_conv.inner = untag_ptr(o);
14752         o_conv.is_owned = ptr_is_owned(o);
14753         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14754         o_conv = BlindedHopFeatures_clone(&o_conv);
14755         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
14756         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
14757         return tag_ptr(ret_conv, true);
14758 }
14759
14760 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_err(uint64_t e) {
14761         void* e_ptr = untag_ptr(e);
14762         CHECK_ACCESS(e_ptr);
14763         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14764         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14765         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
14766         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
14767         return tag_ptr(ret_conv, true);
14768 }
14769
14770 jboolean  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14771         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
14772         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
14773         return ret_conv;
14774 }
14775
14776 void  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_free"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_free(uint64_t _res) {
14777         if (!ptr_is_owned(_res)) return;
14778         void* _res_ptr = untag_ptr(_res);
14779         CHECK_ACCESS(_res_ptr);
14780         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
14781         FREE(untag_ptr(_res));
14782         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
14783 }
14784
14785 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14786         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
14787         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
14788         return tag_ptr(ret_conv, true);
14789 }
14790 int64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14791         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
14792         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14793         return ret_conv;
14794 }
14795
14796 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone(uint64_t orig) {
14797         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
14798         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
14799         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
14800         return tag_ptr(ret_conv, true);
14801 }
14802
14803 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
14804         LDKChannelTypeFeatures o_conv;
14805         o_conv.inner = untag_ptr(o);
14806         o_conv.is_owned = ptr_is_owned(o);
14807         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14808         o_conv = ChannelTypeFeatures_clone(&o_conv);
14809         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14810         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
14811         return tag_ptr(ret_conv, true);
14812 }
14813
14814 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
14815         void* e_ptr = untag_ptr(e);
14816         CHECK_ACCESS(e_ptr);
14817         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14818         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14819         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14820         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
14821         return tag_ptr(ret_conv, true);
14822 }
14823
14824 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14825         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
14826         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
14827         return ret_conv;
14828 }
14829
14830 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
14831         if (!ptr_is_owned(_res)) return;
14832         void* _res_ptr = untag_ptr(_res);
14833         CHECK_ACCESS(_res_ptr);
14834         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
14835         FREE(untag_ptr(_res));
14836         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
14837 }
14838
14839 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14840         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14841         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
14842         return tag_ptr(ret_conv, true);
14843 }
14844 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14845         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
14846         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14847         return ret_conv;
14848 }
14849
14850 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
14851         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
14852         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14853         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
14854         return tag_ptr(ret_conv, true);
14855 }
14856
14857 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
14858         LDKNodeId o_conv;
14859         o_conv.inner = untag_ptr(o);
14860         o_conv.is_owned = ptr_is_owned(o);
14861         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14862         o_conv = NodeId_clone(&o_conv);
14863         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14864         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
14865         return tag_ptr(ret_conv, true);
14866 }
14867
14868 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
14869         void* e_ptr = untag_ptr(e);
14870         CHECK_ACCESS(e_ptr);
14871         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14872         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14873         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14874         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
14875         return tag_ptr(ret_conv, true);
14876 }
14877
14878 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
14879         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
14880         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
14881         return ret_conv;
14882 }
14883
14884 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
14885         if (!ptr_is_owned(_res)) return;
14886         void* _res_ptr = untag_ptr(_res);
14887         CHECK_ACCESS(_res_ptr);
14888         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
14889         FREE(untag_ptr(_res));
14890         CResult_NodeIdDecodeErrorZ_free(_res_conv);
14891 }
14892
14893 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
14894         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14895         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
14896         return tag_ptr(ret_conv, true);
14897 }
14898 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
14899         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
14900         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
14901         return ret_conv;
14902 }
14903
14904 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
14905         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
14906         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14907         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
14908         return tag_ptr(ret_conv, true);
14909 }
14910
14911 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
14912         void* o_ptr = untag_ptr(o);
14913         CHECK_ACCESS(o_ptr);
14914         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
14915         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
14916         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14917         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
14918         return tag_ptr(ret_conv, true);
14919 }
14920
14921 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
14922         void* e_ptr = untag_ptr(e);
14923         CHECK_ACCESS(e_ptr);
14924         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14925         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14926         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14927         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
14928         return tag_ptr(ret_conv, true);
14929 }
14930
14931 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
14932         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
14933         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
14934         return ret_conv;
14935 }
14936
14937 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
14938         if (!ptr_is_owned(_res)) return;
14939         void* _res_ptr = untag_ptr(_res);
14940         CHECK_ACCESS(_res_ptr);
14941         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
14942         FREE(untag_ptr(_res));
14943         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
14944 }
14945
14946 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
14947         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14948         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
14949         return tag_ptr(ret_conv, true);
14950 }
14951 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
14952         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
14953         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
14954         return ret_conv;
14955 }
14956
14957 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
14958         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
14959         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14960         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
14961         return tag_ptr(ret_conv, true);
14962 }
14963
14964 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_some"))) TS_COption_UtxoLookupZ_some(uint64_t o) {
14965         void* o_ptr = untag_ptr(o);
14966         CHECK_ACCESS(o_ptr);
14967         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
14968         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
14969                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14970                 LDKUtxoLookup_JCalls_cloned(&o_conv);
14971         }
14972         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
14973         *ret_copy = COption_UtxoLookupZ_some(o_conv);
14974         uint64_t ret_ref = tag_ptr(ret_copy, true);
14975         return ret_ref;
14976 }
14977
14978 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_none"))) TS_COption_UtxoLookupZ_none() {
14979         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
14980         *ret_copy = COption_UtxoLookupZ_none();
14981         uint64_t ret_ref = tag_ptr(ret_copy, true);
14982         return ret_ref;
14983 }
14984
14985 void  __attribute__((export_name("TS_COption_UtxoLookupZ_free"))) TS_COption_UtxoLookupZ_free(uint64_t _res) {
14986         if (!ptr_is_owned(_res)) return;
14987         void* _res_ptr = untag_ptr(_res);
14988         CHECK_ACCESS(_res_ptr);
14989         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
14990         FREE(untag_ptr(_res));
14991         COption_UtxoLookupZ_free(_res_conv);
14992 }
14993
14994 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
14995         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14996         *ret_conv = CResult_boolLightningErrorZ_ok(o);
14997         return tag_ptr(ret_conv, true);
14998 }
14999
15000 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
15001         LDKLightningError e_conv;
15002         e_conv.inner = untag_ptr(e);
15003         e_conv.is_owned = ptr_is_owned(e);
15004         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15005         e_conv = LightningError_clone(&e_conv);
15006         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15007         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
15008         return tag_ptr(ret_conv, true);
15009 }
15010
15011 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
15012         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
15013         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
15014         return ret_conv;
15015 }
15016
15017 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
15018         if (!ptr_is_owned(_res)) return;
15019         void* _res_ptr = untag_ptr(_res);
15020         CHECK_ACCESS(_res_ptr);
15021         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
15022         FREE(untag_ptr(_res));
15023         CResult_boolLightningErrorZ_free(_res_conv);
15024 }
15025
15026 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
15027         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15028         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
15029         return tag_ptr(ret_conv, true);
15030 }
15031 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
15032         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
15033         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
15034         return ret_conv;
15035 }
15036
15037 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
15038         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
15039         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15040         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
15041         return tag_ptr(ret_conv, true);
15042 }
15043
15044 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
15045         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
15046         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
15047         return tag_ptr(ret_conv, true);
15048 }
15049 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
15050         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
15051         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
15052         return ret_conv;
15053 }
15054
15055 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
15056         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
15057         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
15058         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
15059         return tag_ptr(ret_conv, true);
15060 }
15061
15062 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
15063         LDKChannelAnnouncement a_conv;
15064         a_conv.inner = untag_ptr(a);
15065         a_conv.is_owned = ptr_is_owned(a);
15066         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
15067         a_conv = ChannelAnnouncement_clone(&a_conv);
15068         LDKChannelUpdate b_conv;
15069         b_conv.inner = untag_ptr(b);
15070         b_conv.is_owned = ptr_is_owned(b);
15071         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
15072         b_conv = ChannelUpdate_clone(&b_conv);
15073         LDKChannelUpdate c_conv;
15074         c_conv.inner = untag_ptr(c);
15075         c_conv.is_owned = ptr_is_owned(c);
15076         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
15077         c_conv = ChannelUpdate_clone(&c_conv);
15078         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
15079         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
15080         return tag_ptr(ret_conv, true);
15081 }
15082
15083 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
15084         if (!ptr_is_owned(_res)) return;
15085         void* _res_ptr = untag_ptr(_res);
15086         CHECK_ACCESS(_res_ptr);
15087         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
15088         FREE(untag_ptr(_res));
15089         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
15090 }
15091
15092 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
15093         void* o_ptr = untag_ptr(o);
15094         CHECK_ACCESS(o_ptr);
15095         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
15096         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
15097         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15098         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
15099         uint64_t ret_ref = tag_ptr(ret_copy, true);
15100         return ret_ref;
15101 }
15102
15103 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
15104         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15105         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
15106         uint64_t ret_ref = tag_ptr(ret_copy, true);
15107         return ret_ref;
15108 }
15109
15110 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
15111         if (!ptr_is_owned(_res)) return;
15112         void* _res_ptr = untag_ptr(_res);
15113         CHECK_ACCESS(_res_ptr);
15114         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
15115         FREE(untag_ptr(_res));
15116         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
15117 }
15118
15119 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
15120         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15121         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
15122         uint64_t ret_ref = tag_ptr(ret_copy, true);
15123         return ret_ref;
15124 }
15125 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
15126         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
15127         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
15128         return ret_conv;
15129 }
15130
15131 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
15132         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
15133         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15134         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
15135         uint64_t ret_ref = tag_ptr(ret_copy, true);
15136         return ret_ref;
15137 }
15138
15139 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
15140         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15141         *ret_conv = CResult_NoneLightningErrorZ_ok();
15142         return tag_ptr(ret_conv, true);
15143 }
15144
15145 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
15146         LDKLightningError e_conv;
15147         e_conv.inner = untag_ptr(e);
15148         e_conv.is_owned = ptr_is_owned(e);
15149         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15150         e_conv = LightningError_clone(&e_conv);
15151         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15152         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
15153         return tag_ptr(ret_conv, true);
15154 }
15155
15156 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
15157         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
15158         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
15159         return ret_conv;
15160 }
15161
15162 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
15163         if (!ptr_is_owned(_res)) return;
15164         void* _res_ptr = untag_ptr(_res);
15165         CHECK_ACCESS(_res_ptr);
15166         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
15167         FREE(untag_ptr(_res));
15168         CResult_NoneLightningErrorZ_free(_res_conv);
15169 }
15170
15171 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
15172         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15173         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
15174         return tag_ptr(ret_conv, true);
15175 }
15176 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
15177         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
15178         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
15179         return ret_conv;
15180 }
15181
15182 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
15183         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
15184         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15185         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
15186         return tag_ptr(ret_conv, true);
15187 }
15188
15189 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
15190         LDKChannelUpdateInfo o_conv;
15191         o_conv.inner = untag_ptr(o);
15192         o_conv.is_owned = ptr_is_owned(o);
15193         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15194         o_conv = ChannelUpdateInfo_clone(&o_conv);
15195         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15196         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
15197         return tag_ptr(ret_conv, true);
15198 }
15199
15200 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
15201         void* e_ptr = untag_ptr(e);
15202         CHECK_ACCESS(e_ptr);
15203         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15204         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15205         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15206         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
15207         return tag_ptr(ret_conv, true);
15208 }
15209
15210 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
15211         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
15212         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
15213         return ret_conv;
15214 }
15215
15216 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
15217         if (!ptr_is_owned(_res)) return;
15218         void* _res_ptr = untag_ptr(_res);
15219         CHECK_ACCESS(_res_ptr);
15220         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
15221         FREE(untag_ptr(_res));
15222         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
15223 }
15224
15225 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
15226         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15227         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
15228         return tag_ptr(ret_conv, true);
15229 }
15230 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15231         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
15232         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
15233         return ret_conv;
15234 }
15235
15236 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
15237         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
15238         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15239         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
15240         return tag_ptr(ret_conv, true);
15241 }
15242
15243 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
15244         LDKChannelInfo o_conv;
15245         o_conv.inner = untag_ptr(o);
15246         o_conv.is_owned = ptr_is_owned(o);
15247         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15248         o_conv = ChannelInfo_clone(&o_conv);
15249         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15250         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
15251         return tag_ptr(ret_conv, true);
15252 }
15253
15254 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
15255         void* e_ptr = untag_ptr(e);
15256         CHECK_ACCESS(e_ptr);
15257         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15258         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15259         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15260         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
15261         return tag_ptr(ret_conv, true);
15262 }
15263
15264 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
15265         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
15266         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
15267         return ret_conv;
15268 }
15269
15270 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
15271         if (!ptr_is_owned(_res)) return;
15272         void* _res_ptr = untag_ptr(_res);
15273         CHECK_ACCESS(_res_ptr);
15274         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
15275         FREE(untag_ptr(_res));
15276         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
15277 }
15278
15279 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
15280         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15281         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
15282         return tag_ptr(ret_conv, true);
15283 }
15284 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15285         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
15286         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
15287         return ret_conv;
15288 }
15289
15290 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
15291         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
15292         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15293         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
15294         return tag_ptr(ret_conv, true);
15295 }
15296
15297 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
15298         LDKRoutingFees o_conv;
15299         o_conv.inner = untag_ptr(o);
15300         o_conv.is_owned = ptr_is_owned(o);
15301         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15302         o_conv = RoutingFees_clone(&o_conv);
15303         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15304         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
15305         return tag_ptr(ret_conv, true);
15306 }
15307
15308 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
15309         void* e_ptr = untag_ptr(e);
15310         CHECK_ACCESS(e_ptr);
15311         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15312         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15313         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15314         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
15315         return tag_ptr(ret_conv, true);
15316 }
15317
15318 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
15319         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
15320         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
15321         return ret_conv;
15322 }
15323
15324 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
15325         if (!ptr_is_owned(_res)) return;
15326         void* _res_ptr = untag_ptr(_res);
15327         CHECK_ACCESS(_res_ptr);
15328         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
15329         FREE(untag_ptr(_res));
15330         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
15331 }
15332
15333 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
15334         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15335         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
15336         return tag_ptr(ret_conv, true);
15337 }
15338 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
15339         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
15340         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
15341         return ret_conv;
15342 }
15343
15344 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
15345         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
15346         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15347         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
15348         return tag_ptr(ret_conv, true);
15349 }
15350
15351 void  __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint64_tArray _res) {
15352         LDKCVec_NetAddressZ _res_constr;
15353         _res_constr.datalen = _res->arr_len;
15354         if (_res_constr.datalen > 0)
15355                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15356         else
15357                 _res_constr.data = NULL;
15358         uint64_t* _res_vals = _res->elems;
15359         for (size_t m = 0; m < _res_constr.datalen; m++) {
15360                 uint64_t _res_conv_12 = _res_vals[m];
15361                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
15362                 CHECK_ACCESS(_res_conv_12_ptr);
15363                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
15364                 FREE(untag_ptr(_res_conv_12));
15365                 _res_constr.data[m] = _res_conv_12_conv;
15366         }
15367         FREE(_res);
15368         CVec_NetAddressZ_free(_res_constr);
15369 }
15370
15371 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
15372         LDKNodeAnnouncementInfo o_conv;
15373         o_conv.inner = untag_ptr(o);
15374         o_conv.is_owned = ptr_is_owned(o);
15375         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15376         o_conv = NodeAnnouncementInfo_clone(&o_conv);
15377         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15378         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
15379         return tag_ptr(ret_conv, true);
15380 }
15381
15382 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
15383         void* e_ptr = untag_ptr(e);
15384         CHECK_ACCESS(e_ptr);
15385         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15386         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15387         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15388         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
15389         return tag_ptr(ret_conv, true);
15390 }
15391
15392 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
15393         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
15394         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
15395         return ret_conv;
15396 }
15397
15398 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
15399         if (!ptr_is_owned(_res)) return;
15400         void* _res_ptr = untag_ptr(_res);
15401         CHECK_ACCESS(_res_ptr);
15402         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
15403         FREE(untag_ptr(_res));
15404         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
15405 }
15406
15407 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
15408         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15409         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
15410         return tag_ptr(ret_conv, true);
15411 }
15412 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15413         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
15414         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
15415         return ret_conv;
15416 }
15417
15418 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
15419         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
15420         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15421         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
15422         return tag_ptr(ret_conv, true);
15423 }
15424
15425 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
15426         LDKNodeAlias o_conv;
15427         o_conv.inner = untag_ptr(o);
15428         o_conv.is_owned = ptr_is_owned(o);
15429         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15430         o_conv = NodeAlias_clone(&o_conv);
15431         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
15432         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
15433         return tag_ptr(ret_conv, true);
15434 }
15435
15436 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
15437         void* e_ptr = untag_ptr(e);
15438         CHECK_ACCESS(e_ptr);
15439         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15440         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15441         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
15442         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
15443         return tag_ptr(ret_conv, true);
15444 }
15445
15446 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
15447         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
15448         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
15449         return ret_conv;
15450 }
15451
15452 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
15453         if (!ptr_is_owned(_res)) return;
15454         void* _res_ptr = untag_ptr(_res);
15455         CHECK_ACCESS(_res_ptr);
15456         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
15457         FREE(untag_ptr(_res));
15458         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
15459 }
15460
15461 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
15462         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
15463         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
15464         return tag_ptr(ret_conv, true);
15465 }
15466 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
15467         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
15468         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
15469         return ret_conv;
15470 }
15471
15472 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
15473         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
15474         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
15475         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
15476         return tag_ptr(ret_conv, true);
15477 }
15478
15479 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
15480         LDKNodeInfo o_conv;
15481         o_conv.inner = untag_ptr(o);
15482         o_conv.is_owned = ptr_is_owned(o);
15483         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15484         o_conv = NodeInfo_clone(&o_conv);
15485         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15486         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
15487         return tag_ptr(ret_conv, true);
15488 }
15489
15490 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
15491         void* e_ptr = untag_ptr(e);
15492         CHECK_ACCESS(e_ptr);
15493         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15494         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15495         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15496         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
15497         return tag_ptr(ret_conv, true);
15498 }
15499
15500 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
15501         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
15502         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
15503         return ret_conv;
15504 }
15505
15506 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
15507         if (!ptr_is_owned(_res)) return;
15508         void* _res_ptr = untag_ptr(_res);
15509         CHECK_ACCESS(_res_ptr);
15510         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
15511         FREE(untag_ptr(_res));
15512         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
15513 }
15514
15515 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
15516         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15517         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
15518         return tag_ptr(ret_conv, true);
15519 }
15520 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15521         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
15522         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
15523         return ret_conv;
15524 }
15525
15526 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
15527         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
15528         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15529         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
15530         return tag_ptr(ret_conv, true);
15531 }
15532
15533 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
15534         LDKNetworkGraph o_conv;
15535         o_conv.inner = untag_ptr(o);
15536         o_conv.is_owned = ptr_is_owned(o);
15537         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15538         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
15539         
15540         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
15541         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
15542         return tag_ptr(ret_conv, true);
15543 }
15544
15545 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
15546         void* e_ptr = untag_ptr(e);
15547         CHECK_ACCESS(e_ptr);
15548         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15549         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15550         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
15551         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
15552         return tag_ptr(ret_conv, true);
15553 }
15554
15555 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
15556         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
15557         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
15558         return ret_conv;
15559 }
15560
15561 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
15562         if (!ptr_is_owned(_res)) return;
15563         void* _res_ptr = untag_ptr(_res);
15564         CHECK_ACCESS(_res_ptr);
15565         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
15566         FREE(untag_ptr(_res));
15567         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
15568 }
15569
15570 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint64_tArray o) {
15571         LDKCVec_NetAddressZ o_constr;
15572         o_constr.datalen = o->arr_len;
15573         if (o_constr.datalen > 0)
15574                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15575         else
15576                 o_constr.data = NULL;
15577         uint64_t* o_vals = o->elems;
15578         for (size_t m = 0; m < o_constr.datalen; m++) {
15579                 uint64_t o_conv_12 = o_vals[m];
15580                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
15581                 CHECK_ACCESS(o_conv_12_ptr);
15582                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
15583                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
15584                 o_constr.data[m] = o_conv_12_conv;
15585         }
15586         FREE(o);
15587         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15588         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
15589         uint64_t ret_ref = tag_ptr(ret_copy, true);
15590         return ret_ref;
15591 }
15592
15593 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
15594         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15595         *ret_copy = COption_CVec_NetAddressZZ_none();
15596         uint64_t ret_ref = tag_ptr(ret_copy, true);
15597         return ret_ref;
15598 }
15599
15600 void  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint64_t _res) {
15601         if (!ptr_is_owned(_res)) return;
15602         void* _res_ptr = untag_ptr(_res);
15603         CHECK_ACCESS(_res_ptr);
15604         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
15605         FREE(untag_ptr(_res));
15606         COption_CVec_NetAddressZZ_free(_res_conv);
15607 }
15608
15609 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
15610         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15611         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
15612         uint64_t ret_ref = tag_ptr(ret_copy, true);
15613         return ret_ref;
15614 }
15615 int64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint64_t arg) {
15616         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
15617         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
15618         return ret_conv;
15619 }
15620
15621 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint64_t orig) {
15622         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
15623         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15624         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
15625         uint64_t ret_ref = tag_ptr(ret_copy, true);
15626         return ret_ref;
15627 }
15628
15629 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15630         LDKDelayedPaymentOutputDescriptor o_conv;
15631         o_conv.inner = untag_ptr(o);
15632         o_conv.is_owned = ptr_is_owned(o);
15633         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15634         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
15635         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15636         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15637         return tag_ptr(ret_conv, true);
15638 }
15639
15640 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15641         void* e_ptr = untag_ptr(e);
15642         CHECK_ACCESS(e_ptr);
15643         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15644         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15645         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15646         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15647         return tag_ptr(ret_conv, true);
15648 }
15649
15650 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15651         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15652         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15653         return ret_conv;
15654 }
15655
15656 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15657         if (!ptr_is_owned(_res)) return;
15658         void* _res_ptr = untag_ptr(_res);
15659         CHECK_ACCESS(_res_ptr);
15660         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15661         FREE(untag_ptr(_res));
15662         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15663 }
15664
15665 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15666         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15667         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15668         return tag_ptr(ret_conv, true);
15669 }
15670 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15671         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15672         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15673         return ret_conv;
15674 }
15675
15676 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15677         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15678         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15679         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15680         return tag_ptr(ret_conv, true);
15681 }
15682
15683 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15684         LDKStaticPaymentOutputDescriptor o_conv;
15685         o_conv.inner = untag_ptr(o);
15686         o_conv.is_owned = ptr_is_owned(o);
15687         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15688         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
15689         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15690         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15691         return tag_ptr(ret_conv, true);
15692 }
15693
15694 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15695         void* e_ptr = untag_ptr(e);
15696         CHECK_ACCESS(e_ptr);
15697         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15698         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15699         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15700         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15701         return tag_ptr(ret_conv, true);
15702 }
15703
15704 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15705         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15706         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15707         return ret_conv;
15708 }
15709
15710 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15711         if (!ptr_is_owned(_res)) return;
15712         void* _res_ptr = untag_ptr(_res);
15713         CHECK_ACCESS(_res_ptr);
15714         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15715         FREE(untag_ptr(_res));
15716         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15717 }
15718
15719 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15720         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15721         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15722         return tag_ptr(ret_conv, true);
15723 }
15724 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15725         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15726         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15727         return ret_conv;
15728 }
15729
15730 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15731         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15732         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15733         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15734         return tag_ptr(ret_conv, true);
15735 }
15736
15737 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15738         void* o_ptr = untag_ptr(o);
15739         CHECK_ACCESS(o_ptr);
15740         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
15741         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
15742         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15743         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
15744         return tag_ptr(ret_conv, true);
15745 }
15746
15747 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15748         void* e_ptr = untag_ptr(e);
15749         CHECK_ACCESS(e_ptr);
15750         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15751         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15752         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15753         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
15754         return tag_ptr(ret_conv, true);
15755 }
15756
15757 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15758         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15759         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15760         return ret_conv;
15761 }
15762
15763 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15764         if (!ptr_is_owned(_res)) return;
15765         void* _res_ptr = untag_ptr(_res);
15766         CHECK_ACCESS(_res_ptr);
15767         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
15768         FREE(untag_ptr(_res));
15769         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
15770 }
15771
15772 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15773         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15774         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
15775         return tag_ptr(ret_conv, true);
15776 }
15777 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15778         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15779         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15780         return ret_conv;
15781 }
15782
15783 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15784         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15785         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15786         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
15787         return tag_ptr(ret_conv, true);
15788 }
15789
15790 void  __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
15791         LDKCVec_PaymentPreimageZ _res_constr;
15792         _res_constr.datalen = _res->arr_len;
15793         if (_res_constr.datalen > 0)
15794                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
15795         else
15796                 _res_constr.data = NULL;
15797         int8_tArray* _res_vals = (void*) _res->elems;
15798         for (size_t m = 0; m < _res_constr.datalen; m++) {
15799                 int8_tArray _res_conv_12 = _res_vals[m];
15800                 LDKThirtyTwoBytes _res_conv_12_ref;
15801                 CHECK(_res_conv_12->arr_len == 32);
15802                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
15803                 _res_constr.data[m] = _res_conv_12_ref;
15804         }
15805         FREE(_res);
15806         CVec_PaymentPreimageZ_free(_res_constr);
15807 }
15808
15809 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
15810         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15811         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
15812         return tag_ptr(ret_conv, true);
15813 }
15814 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint64_t arg) {
15815         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
15816         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
15817         return ret_conv;
15818 }
15819
15820 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint64_t orig) {
15821         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
15822         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15823         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
15824         return tag_ptr(ret_conv, true);
15825 }
15826
15827 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
15828         LDKSignature a_ref;
15829         CHECK(a->arr_len == 64);
15830         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
15831         LDKCVec_SignatureZ b_constr;
15832         b_constr.datalen = b->arr_len;
15833         if (b_constr.datalen > 0)
15834                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15835         else
15836                 b_constr.data = NULL;
15837         int8_tArray* b_vals = (void*) b->elems;
15838         for (size_t m = 0; m < b_constr.datalen; m++) {
15839                 int8_tArray b_conv_12 = b_vals[m];
15840                 LDKSignature b_conv_12_ref;
15841                 CHECK(b_conv_12->arr_len == 64);
15842                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
15843                 b_constr.data[m] = b_conv_12_ref;
15844         }
15845         FREE(b);
15846         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15847         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
15848         return tag_ptr(ret_conv, true);
15849 }
15850
15851 void  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint64_t _res) {
15852         if (!ptr_is_owned(_res)) return;
15853         void* _res_ptr = untag_ptr(_res);
15854         CHECK_ACCESS(_res_ptr);
15855         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
15856         FREE(untag_ptr(_res));
15857         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
15858 }
15859
15860 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint64_t o) {
15861         void* o_ptr = untag_ptr(o);
15862         CHECK_ACCESS(o_ptr);
15863         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
15864         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
15865         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15866         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
15867         return tag_ptr(ret_conv, true);
15868 }
15869
15870 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
15871         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15872         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
15873         return tag_ptr(ret_conv, true);
15874 }
15875
15876 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint64_t o) {
15877         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
15878         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
15879         return ret_conv;
15880 }
15881
15882 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint64_t _res) {
15883         if (!ptr_is_owned(_res)) return;
15884         void* _res_ptr = untag_ptr(_res);
15885         CHECK_ACCESS(_res_ptr);
15886         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
15887         FREE(untag_ptr(_res));
15888         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
15889 }
15890
15891 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
15892         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15893         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
15894         return tag_ptr(ret_conv, true);
15895 }
15896 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint64_t arg) {
15897         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
15898         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
15899         return ret_conv;
15900 }
15901
15902 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint64_t orig) {
15903         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
15904         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15905         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
15906         return tag_ptr(ret_conv, true);
15907 }
15908
15909 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
15910         LDKSignature o_ref;
15911         CHECK(o->arr_len == 64);
15912         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
15913         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15914         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
15915         return tag_ptr(ret_conv, true);
15916 }
15917
15918 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
15919         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15920         *ret_conv = CResult_SignatureNoneZ_err();
15921         return tag_ptr(ret_conv, true);
15922 }
15923
15924 jboolean  __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint64_t o) {
15925         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
15926         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
15927         return ret_conv;
15928 }
15929
15930 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint64_t _res) {
15931         if (!ptr_is_owned(_res)) return;
15932         void* _res_ptr = untag_ptr(_res);
15933         CHECK_ACCESS(_res_ptr);
15934         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
15935         FREE(untag_ptr(_res));
15936         CResult_SignatureNoneZ_free(_res_conv);
15937 }
15938
15939 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
15940         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15941         *ret_conv = CResult_SignatureNoneZ_clone(arg);
15942         return tag_ptr(ret_conv, true);
15943 }
15944 int64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint64_t arg) {
15945         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
15946         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
15947         return ret_conv;
15948 }
15949
15950 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint64_t orig) {
15951         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
15952         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15953         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
15954         return tag_ptr(ret_conv, true);
15955 }
15956
15957 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
15958         LDKPublicKey o_ref;
15959         CHECK(o->arr_len == 33);
15960         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
15961         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15962         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
15963         return tag_ptr(ret_conv, true);
15964 }
15965
15966 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
15967         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15968         *ret_conv = CResult_PublicKeyNoneZ_err();
15969         return tag_ptr(ret_conv, true);
15970 }
15971
15972 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
15973         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
15974         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
15975         return ret_conv;
15976 }
15977
15978 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
15979         if (!ptr_is_owned(_res)) return;
15980         void* _res_ptr = untag_ptr(_res);
15981         CHECK_ACCESS(_res_ptr);
15982         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
15983         FREE(untag_ptr(_res));
15984         CResult_PublicKeyNoneZ_free(_res_conv);
15985 }
15986
15987 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
15988         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15989         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
15990         return tag_ptr(ret_conv, true);
15991 }
15992 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
15993         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
15994         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
15995         return ret_conv;
15996 }
15997
15998 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
15999         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
16000         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16001         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
16002         return tag_ptr(ret_conv, true);
16003 }
16004
16005 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_some"))) TS_COption_ScalarZ_some(uint64_t o) {
16006         void* o_ptr = untag_ptr(o);
16007         CHECK_ACCESS(o_ptr);
16008         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
16009         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
16010         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16011         *ret_copy = COption_ScalarZ_some(o_conv);
16012         uint64_t ret_ref = tag_ptr(ret_copy, true);
16013         return ret_ref;
16014 }
16015
16016 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_none"))) TS_COption_ScalarZ_none() {
16017         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16018         *ret_copy = COption_ScalarZ_none();
16019         uint64_t ret_ref = tag_ptr(ret_copy, true);
16020         return ret_ref;
16021 }
16022
16023 void  __attribute__((export_name("TS_COption_ScalarZ_free"))) TS_COption_ScalarZ_free(uint64_t _res) {
16024         if (!ptr_is_owned(_res)) return;
16025         void* _res_ptr = untag_ptr(_res);
16026         CHECK_ACCESS(_res_ptr);
16027         LDKCOption_ScalarZ _res_conv = *(LDKCOption_ScalarZ*)(_res_ptr);
16028         FREE(untag_ptr(_res));
16029         COption_ScalarZ_free(_res_conv);
16030 }
16031
16032 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_ok"))) TS_CResult_SharedSecretNoneZ_ok(int8_tArray o) {
16033         LDKThirtyTwoBytes o_ref;
16034         CHECK(o->arr_len == 32);
16035         memcpy(o_ref.data, o->elems, 32); FREE(o);
16036         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16037         *ret_conv = CResult_SharedSecretNoneZ_ok(o_ref);
16038         return tag_ptr(ret_conv, true);
16039 }
16040
16041 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_err"))) TS_CResult_SharedSecretNoneZ_err() {
16042         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16043         *ret_conv = CResult_SharedSecretNoneZ_err();
16044         return tag_ptr(ret_conv, true);
16045 }
16046
16047 jboolean  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_is_ok"))) TS_CResult_SharedSecretNoneZ_is_ok(uint64_t o) {
16048         LDKCResult_SharedSecretNoneZ* o_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(o);
16049         jboolean ret_conv = CResult_SharedSecretNoneZ_is_ok(o_conv);
16050         return ret_conv;
16051 }
16052
16053 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_free"))) TS_CResult_SharedSecretNoneZ_free(uint64_t _res) {
16054         if (!ptr_is_owned(_res)) return;
16055         void* _res_ptr = untag_ptr(_res);
16056         CHECK_ACCESS(_res_ptr);
16057         LDKCResult_SharedSecretNoneZ _res_conv = *(LDKCResult_SharedSecretNoneZ*)(_res_ptr);
16058         FREE(untag_ptr(_res));
16059         CResult_SharedSecretNoneZ_free(_res_conv);
16060 }
16061
16062 static inline uint64_t CResult_SharedSecretNoneZ_clone_ptr(LDKCResult_SharedSecretNoneZ *NONNULL_PTR arg) {
16063         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16064         *ret_conv = CResult_SharedSecretNoneZ_clone(arg);
16065         return tag_ptr(ret_conv, true);
16066 }
16067 int64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone_ptr"))) TS_CResult_SharedSecretNoneZ_clone_ptr(uint64_t arg) {
16068         LDKCResult_SharedSecretNoneZ* arg_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(arg);
16069         int64_t ret_conv = CResult_SharedSecretNoneZ_clone_ptr(arg_conv);
16070         return ret_conv;
16071 }
16072
16073 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone"))) TS_CResult_SharedSecretNoneZ_clone(uint64_t orig) {
16074         LDKCResult_SharedSecretNoneZ* orig_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(orig);
16075         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16076         *ret_conv = CResult_SharedSecretNoneZ_clone(orig_conv);
16077         return tag_ptr(ret_conv, true);
16078 }
16079
16080 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
16081         LDKCVec_U5Z _res_constr;
16082         _res_constr.datalen = _res->arr_len;
16083         if (_res_constr.datalen > 0)
16084                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
16085         else
16086                 _res_constr.data = NULL;
16087         int8_t* _res_vals = (void*) _res->elems;
16088         for (size_t h = 0; h < _res_constr.datalen; h++) {
16089                 int8_t _res_conv_7 = _res_vals[h];
16090                 
16091                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
16092         }
16093         FREE(_res);
16094         CVec_U5Z_free(_res_constr);
16095 }
16096
16097 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
16098         LDKRecoverableSignature o_ref;
16099         CHECK(o->arr_len == 68);
16100         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
16101         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16102         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
16103         return tag_ptr(ret_conv, true);
16104 }
16105
16106 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
16107         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16108         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
16109         return tag_ptr(ret_conv, true);
16110 }
16111
16112 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
16113         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
16114         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
16115         return ret_conv;
16116 }
16117
16118 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
16119         if (!ptr_is_owned(_res)) return;
16120         void* _res_ptr = untag_ptr(_res);
16121         CHECK_ACCESS(_res_ptr);
16122         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
16123         FREE(untag_ptr(_res));
16124         CResult_RecoverableSignatureNoneZ_free(_res_conv);
16125 }
16126
16127 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
16128         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16129         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
16130         return tag_ptr(ret_conv, true);
16131 }
16132 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
16133         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
16134         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
16135         return ret_conv;
16136 }
16137
16138 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
16139         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
16140         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16141         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
16142         return tag_ptr(ret_conv, true);
16143 }
16144
16145 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(uint64_t o) {
16146         void* o_ptr = untag_ptr(o);
16147         CHECK_ACCESS(o_ptr);
16148         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
16149         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
16150                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16151                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
16152         }
16153         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16154         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
16155         return tag_ptr(ret_conv, true);
16156 }
16157
16158 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(uint64_t e) {
16159         void* e_ptr = untag_ptr(e);
16160         CHECK_ACCESS(e_ptr);
16161         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16162         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16163         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16164         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
16165         return tag_ptr(ret_conv, true);
16166 }
16167
16168 jboolean  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(uint64_t o) {
16169         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
16170         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
16171         return ret_conv;
16172 }
16173
16174 void  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(uint64_t _res) {
16175         if (!ptr_is_owned(_res)) return;
16176         void* _res_ptr = untag_ptr(_res);
16177         CHECK_ACCESS(_res_ptr);
16178         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
16179         FREE(untag_ptr(_res));
16180         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
16181 }
16182
16183 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
16184         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16185         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
16186         return tag_ptr(ret_conv, true);
16187 }
16188 int64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16189         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
16190         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
16191         return ret_conv;
16192 }
16193
16194 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(uint64_t orig) {
16195         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
16196         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16197         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
16198         return tag_ptr(ret_conv, true);
16199 }
16200
16201 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
16202         LDKCVec_u8Z _res_ref;
16203         _res_ref.datalen = _res->arr_len;
16204         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
16205         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
16206         CVec_u8Z_free(_res_ref);
16207 }
16208
16209 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
16210         LDKCVec_CVec_u8ZZ _res_constr;
16211         _res_constr.datalen = _res->arr_len;
16212         if (_res_constr.datalen > 0)
16213                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16214         else
16215                 _res_constr.data = NULL;
16216         int8_tArray* _res_vals = (void*) _res->elems;
16217         for (size_t m = 0; m < _res_constr.datalen; m++) {
16218                 int8_tArray _res_conv_12 = _res_vals[m];
16219                 LDKCVec_u8Z _res_conv_12_ref;
16220                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
16221                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16222                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
16223                 _res_constr.data[m] = _res_conv_12_ref;
16224         }
16225         FREE(_res);
16226         CVec_CVec_u8ZZ_free(_res_constr);
16227 }
16228
16229 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
16230         LDKCVec_CVec_u8ZZ o_constr;
16231         o_constr.datalen = o->arr_len;
16232         if (o_constr.datalen > 0)
16233                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16234         else
16235                 o_constr.data = NULL;
16236         int8_tArray* o_vals = (void*) o->elems;
16237         for (size_t m = 0; m < o_constr.datalen; m++) {
16238                 int8_tArray o_conv_12 = o_vals[m];
16239                 LDKCVec_u8Z o_conv_12_ref;
16240                 o_conv_12_ref.datalen = o_conv_12->arr_len;
16241                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16242                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
16243                 o_constr.data[m] = o_conv_12_ref;
16244         }
16245         FREE(o);
16246         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16247         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
16248         return tag_ptr(ret_conv, true);
16249 }
16250
16251 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
16252         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16253         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
16254         return tag_ptr(ret_conv, true);
16255 }
16256
16257 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
16258         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
16259         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
16260         return ret_conv;
16261 }
16262
16263 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
16264         if (!ptr_is_owned(_res)) return;
16265         void* _res_ptr = untag_ptr(_res);
16266         CHECK_ACCESS(_res_ptr);
16267         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
16268         FREE(untag_ptr(_res));
16269         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
16270 }
16271
16272 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
16273         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16274         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
16275         return tag_ptr(ret_conv, true);
16276 }
16277 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
16278         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
16279         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
16280         return ret_conv;
16281 }
16282
16283 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
16284         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
16285         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16286         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
16287         return tag_ptr(ret_conv, true);
16288 }
16289
16290 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
16291         LDKInMemorySigner o_conv;
16292         o_conv.inner = untag_ptr(o);
16293         o_conv.is_owned = ptr_is_owned(o);
16294         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16295         o_conv = InMemorySigner_clone(&o_conv);
16296         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16297         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
16298         return tag_ptr(ret_conv, true);
16299 }
16300
16301 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
16302         void* e_ptr = untag_ptr(e);
16303         CHECK_ACCESS(e_ptr);
16304         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16305         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16306         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16307         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
16308         return tag_ptr(ret_conv, true);
16309 }
16310
16311 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
16312         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
16313         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
16314         return ret_conv;
16315 }
16316
16317 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
16318         if (!ptr_is_owned(_res)) return;
16319         void* _res_ptr = untag_ptr(_res);
16320         CHECK_ACCESS(_res_ptr);
16321         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
16322         FREE(untag_ptr(_res));
16323         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
16324 }
16325
16326 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
16327         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16328         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
16329         return tag_ptr(ret_conv, true);
16330 }
16331 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16332         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
16333         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
16334         return ret_conv;
16335 }
16336
16337 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
16338         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
16339         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16340         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
16341         return tag_ptr(ret_conv, true);
16342 }
16343
16344 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
16345         LDKCVec_TxOutZ _res_constr;
16346         _res_constr.datalen = _res->arr_len;
16347         if (_res_constr.datalen > 0)
16348                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16349         else
16350                 _res_constr.data = NULL;
16351         uint64_t* _res_vals = _res->elems;
16352         for (size_t h = 0; h < _res_constr.datalen; h++) {
16353                 uint64_t _res_conv_7 = _res_vals[h];
16354                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
16355                 CHECK_ACCESS(_res_conv_7_ptr);
16356                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
16357                 FREE(untag_ptr(_res_conv_7));
16358                 _res_constr.data[h] = _res_conv_7_conv;
16359         }
16360         FREE(_res);
16361         CVec_TxOutZ_free(_res_constr);
16362 }
16363
16364 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
16365         LDKTransaction o_ref;
16366         o_ref.datalen = o->arr_len;
16367         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
16368         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16369         o_ref.data_is_owned = true;
16370         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16371         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
16372         return tag_ptr(ret_conv, true);
16373 }
16374
16375 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
16376         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16377         *ret_conv = CResult_TransactionNoneZ_err();
16378         return tag_ptr(ret_conv, true);
16379 }
16380
16381 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
16382         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
16383         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
16384         return ret_conv;
16385 }
16386
16387 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
16388         if (!ptr_is_owned(_res)) return;
16389         void* _res_ptr = untag_ptr(_res);
16390         CHECK_ACCESS(_res_ptr);
16391         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
16392         FREE(untag_ptr(_res));
16393         CResult_TransactionNoneZ_free(_res_conv);
16394 }
16395
16396 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
16397         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16398         *ret_conv = CResult_TransactionNoneZ_clone(arg);
16399         return tag_ptr(ret_conv, true);
16400 }
16401 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
16402         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
16403         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
16404         return ret_conv;
16405 }
16406
16407 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
16408         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
16409         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16410         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
16411         return tag_ptr(ret_conv, true);
16412 }
16413
16414 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
16415         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16416         *ret_copy = COption_u16Z_some(o);
16417         uint64_t ret_ref = tag_ptr(ret_copy, true);
16418         return ret_ref;
16419 }
16420
16421 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
16422         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16423         *ret_copy = COption_u16Z_none();
16424         uint64_t ret_ref = tag_ptr(ret_copy, true);
16425         return ret_ref;
16426 }
16427
16428 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
16429         if (!ptr_is_owned(_res)) return;
16430         void* _res_ptr = untag_ptr(_res);
16431         CHECK_ACCESS(_res_ptr);
16432         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
16433         FREE(untag_ptr(_res));
16434         COption_u16Z_free(_res_conv);
16435 }
16436
16437 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
16438         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16439         *ret_copy = COption_u16Z_clone(arg);
16440         uint64_t ret_ref = tag_ptr(ret_copy, true);
16441         return ret_ref;
16442 }
16443 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
16444         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
16445         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
16446         return ret_conv;
16447 }
16448
16449 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
16450         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
16451         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16452         *ret_copy = COption_u16Z_clone(orig_conv);
16453         uint64_t ret_ref = tag_ptr(ret_copy, true);
16454         return ret_ref;
16455 }
16456
16457 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
16458         LDKThirtyTwoBytes o_ref;
16459         CHECK(o->arr_len == 32);
16460         memcpy(o_ref.data, o->elems, 32); FREE(o);
16461         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16462         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
16463         return tag_ptr(ret_conv, true);
16464 }
16465
16466 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint64_t e) {
16467         void* e_ptr = untag_ptr(e);
16468         CHECK_ACCESS(e_ptr);
16469         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16470         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16471         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16472         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
16473         return tag_ptr(ret_conv, true);
16474 }
16475
16476 jboolean  __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint64_t o) {
16477         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
16478         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
16479         return ret_conv;
16480 }
16481
16482 void  __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint64_t _res) {
16483         if (!ptr_is_owned(_res)) return;
16484         void* _res_ptr = untag_ptr(_res);
16485         CHECK_ACCESS(_res_ptr);
16486         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
16487         FREE(untag_ptr(_res));
16488         CResult__u832APIErrorZ_free(_res_conv);
16489 }
16490
16491 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
16492         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16493         *ret_conv = CResult__u832APIErrorZ_clone(arg);
16494         return tag_ptr(ret_conv, true);
16495 }
16496 int64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint64_t arg) {
16497         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
16498         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
16499         return ret_conv;
16500 }
16501
16502 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint64_t orig) {
16503         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
16504         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16505         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
16506         return tag_ptr(ret_conv, true);
16507 }
16508
16509 void  __attribute__((export_name("TS_CVec_RecentPaymentDetailsZ_free"))) TS_CVec_RecentPaymentDetailsZ_free(uint64_tArray _res) {
16510         LDKCVec_RecentPaymentDetailsZ _res_constr;
16511         _res_constr.datalen = _res->arr_len;
16512         if (_res_constr.datalen > 0)
16513                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
16514         else
16515                 _res_constr.data = NULL;
16516         uint64_t* _res_vals = _res->elems;
16517         for (size_t w = 0; w < _res_constr.datalen; w++) {
16518                 uint64_t _res_conv_22 = _res_vals[w];
16519                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
16520                 CHECK_ACCESS(_res_conv_22_ptr);
16521                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
16522                 FREE(untag_ptr(_res_conv_22));
16523                 _res_constr.data[w] = _res_conv_22_conv;
16524         }
16525         FREE(_res);
16526         CVec_RecentPaymentDetailsZ_free(_res_constr);
16527 }
16528
16529 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
16530         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16531         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
16532         return tag_ptr(ret_conv, true);
16533 }
16534
16535 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
16536         void* e_ptr = untag_ptr(e);
16537         CHECK_ACCESS(e_ptr);
16538         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16539         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
16540         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16541         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
16542         return tag_ptr(ret_conv, true);
16543 }
16544
16545 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
16546         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
16547         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
16548         return ret_conv;
16549 }
16550
16551 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
16552         if (!ptr_is_owned(_res)) return;
16553         void* _res_ptr = untag_ptr(_res);
16554         CHECK_ACCESS(_res_ptr);
16555         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
16556         FREE(untag_ptr(_res));
16557         CResult_NonePaymentSendFailureZ_free(_res_conv);
16558 }
16559
16560 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
16561         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16562         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
16563         return tag_ptr(ret_conv, true);
16564 }
16565 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
16566         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
16567         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
16568         return ret_conv;
16569 }
16570
16571 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
16572         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
16573         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16574         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
16575         return tag_ptr(ret_conv, true);
16576 }
16577
16578 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_ok"))) TS_CResult_NoneRetryableSendFailureZ_ok() {
16579         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
16580         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
16581         return tag_ptr(ret_conv, true);
16582 }
16583
16584 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_err"))) TS_CResult_NoneRetryableSendFailureZ_err(uint32_t e) {
16585         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
16586         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
16587         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
16588         return tag_ptr(ret_conv, true);
16589 }
16590
16591 jboolean  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_is_ok"))) TS_CResult_NoneRetryableSendFailureZ_is_ok(uint64_t o) {
16592         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
16593         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
16594         return ret_conv;
16595 }
16596
16597 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_free"))) TS_CResult_NoneRetryableSendFailureZ_free(uint64_t _res) {
16598         if (!ptr_is_owned(_res)) return;
16599         void* _res_ptr = untag_ptr(_res);
16600         CHECK_ACCESS(_res_ptr);
16601         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
16602         FREE(untag_ptr(_res));
16603         CResult_NoneRetryableSendFailureZ_free(_res_conv);
16604 }
16605
16606 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
16607         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
16608         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
16609         return tag_ptr(ret_conv, true);
16610 }
16611 int64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone_ptr"))) TS_CResult_NoneRetryableSendFailureZ_clone_ptr(uint64_t arg) {
16612         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
16613         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
16614         return ret_conv;
16615 }
16616
16617 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone"))) TS_CResult_NoneRetryableSendFailureZ_clone(uint64_t orig) {
16618         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
16619         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
16620         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
16621         return tag_ptr(ret_conv, true);
16622 }
16623
16624 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) {
16625         LDKThirtyTwoBytes o_ref;
16626         CHECK(o->arr_len == 32);
16627         memcpy(o_ref.data, o->elems, 32); FREE(o);
16628         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
16629         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
16630         return tag_ptr(ret_conv, true);
16631 }
16632
16633 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint64_t e) {
16634         void* e_ptr = untag_ptr(e);
16635         CHECK_ACCESS(e_ptr);
16636         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16637         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
16638         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
16639         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
16640         return tag_ptr(ret_conv, true);
16641 }
16642
16643 jboolean  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_is_ok(uint64_t o) {
16644         LDKCResult_PaymentHashPaymentSendFailureZ* o_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(o);
16645         jboolean ret_conv = CResult_PaymentHashPaymentSendFailureZ_is_ok(o_conv);
16646         return ret_conv;
16647 }
16648
16649 void  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_free"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint64_t _res) {
16650         if (!ptr_is_owned(_res)) return;
16651         void* _res_ptr = untag_ptr(_res);
16652         CHECK_ACCESS(_res_ptr);
16653         LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(_res_ptr);
16654         FREE(untag_ptr(_res));
16655         CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
16656 }
16657
16658 static inline uint64_t CResult_PaymentHashPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR arg) {
16659         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
16660         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(arg);
16661         return tag_ptr(ret_conv, true);
16662 }
16663 int64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr(uint64_t arg) {
16664         LDKCResult_PaymentHashPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(arg);
16665         int64_t ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone_ptr(arg_conv);
16666         return ret_conv;
16667 }
16668
16669 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint64_t orig) {
16670         LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(orig);
16671         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
16672         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
16673         return tag_ptr(ret_conv, true);
16674 }
16675
16676 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_ok(int8_tArray o) {
16677         LDKThirtyTwoBytes o_ref;
16678         CHECK(o->arr_len == 32);
16679         memcpy(o_ref.data, o->elems, 32); FREE(o);
16680         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
16681         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_ok(o_ref);
16682         return tag_ptr(ret_conv, true);
16683 }
16684
16685 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_err"))) TS_CResult_PaymentHashRetryableSendFailureZ_err(uint32_t e) {
16686         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
16687         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
16688         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_err(e_conv);
16689         return tag_ptr(ret_conv, true);
16690 }
16691
16692 jboolean  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_is_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_is_ok(uint64_t o) {
16693         LDKCResult_PaymentHashRetryableSendFailureZ* o_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(o);
16694         jboolean ret_conv = CResult_PaymentHashRetryableSendFailureZ_is_ok(o_conv);
16695         return ret_conv;
16696 }
16697
16698 void  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_free"))) TS_CResult_PaymentHashRetryableSendFailureZ_free(uint64_t _res) {
16699         if (!ptr_is_owned(_res)) return;
16700         void* _res_ptr = untag_ptr(_res);
16701         CHECK_ACCESS(_res_ptr);
16702         LDKCResult_PaymentHashRetryableSendFailureZ _res_conv = *(LDKCResult_PaymentHashRetryableSendFailureZ*)(_res_ptr);
16703         FREE(untag_ptr(_res));
16704         CResult_PaymentHashRetryableSendFailureZ_free(_res_conv);
16705 }
16706
16707 static inline uint64_t CResult_PaymentHashRetryableSendFailureZ_clone_ptr(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR arg) {
16708         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
16709         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(arg);
16710         return tag_ptr(ret_conv, true);
16711 }
16712 int64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashRetryableSendFailureZ_clone_ptr(uint64_t arg) {
16713         LDKCResult_PaymentHashRetryableSendFailureZ* arg_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(arg);
16714         int64_t ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone_ptr(arg_conv);
16715         return ret_conv;
16716 }
16717
16718 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_clone"))) TS_CResult_PaymentHashRetryableSendFailureZ_clone(uint64_t orig) {
16719         LDKCResult_PaymentHashRetryableSendFailureZ* orig_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(orig);
16720         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
16721         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(orig_conv);
16722         return tag_ptr(ret_conv, true);
16723 }
16724
16725 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
16726         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16727         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
16728         return tag_ptr(ret_conv, true);
16729 }
16730 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint64_t arg) {
16731         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
16732         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
16733         return ret_conv;
16734 }
16735
16736 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint64_t orig) {
16737         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
16738         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16739         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
16740         return tag_ptr(ret_conv, true);
16741 }
16742
16743 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
16744         LDKThirtyTwoBytes a_ref;
16745         CHECK(a->arr_len == 32);
16746         memcpy(a_ref.data, a->elems, 32); FREE(a);
16747         LDKThirtyTwoBytes b_ref;
16748         CHECK(b->arr_len == 32);
16749         memcpy(b_ref.data, b->elems, 32); FREE(b);
16750         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16751         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
16752         return tag_ptr(ret_conv, true);
16753 }
16754
16755 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint64_t _res) {
16756         if (!ptr_is_owned(_res)) return;
16757         void* _res_ptr = untag_ptr(_res);
16758         CHECK_ACCESS(_res_ptr);
16759         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
16760         FREE(untag_ptr(_res));
16761         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
16762 }
16763
16764 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint64_t o) {
16765         void* o_ptr = untag_ptr(o);
16766         CHECK_ACCESS(o_ptr);
16767         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
16768         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
16769         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16770         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
16771         return tag_ptr(ret_conv, true);
16772 }
16773
16774 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint64_t e) {
16775         void* e_ptr = untag_ptr(e);
16776         CHECK_ACCESS(e_ptr);
16777         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16778         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
16779         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16780         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
16781         return tag_ptr(ret_conv, true);
16782 }
16783
16784 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint64_t o) {
16785         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
16786         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
16787         return ret_conv;
16788 }
16789
16790 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint64_t _res) {
16791         if (!ptr_is_owned(_res)) return;
16792         void* _res_ptr = untag_ptr(_res);
16793         CHECK_ACCESS(_res_ptr);
16794         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
16795         FREE(untag_ptr(_res));
16796         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
16797 }
16798
16799 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
16800         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16801         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
16802         return tag_ptr(ret_conv, true);
16803 }
16804 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
16805         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
16806         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
16807         return ret_conv;
16808 }
16809
16810 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint64_t orig) {
16811         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
16812         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16813         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
16814         return tag_ptr(ret_conv, true);
16815 }
16816
16817 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
16818         LDKCVec_ThirtyTwoBytesZ _res_constr;
16819         _res_constr.datalen = _res->arr_len;
16820         if (_res_constr.datalen > 0)
16821                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
16822         else
16823                 _res_constr.data = NULL;
16824         int8_tArray* _res_vals = (void*) _res->elems;
16825         for (size_t m = 0; m < _res_constr.datalen; m++) {
16826                 int8_tArray _res_conv_12 = _res_vals[m];
16827                 LDKThirtyTwoBytes _res_conv_12_ref;
16828                 CHECK(_res_conv_12->arr_len == 32);
16829                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
16830                 _res_constr.data[m] = _res_conv_12_ref;
16831         }
16832         FREE(_res);
16833         CVec_ThirtyTwoBytesZ_free(_res_constr);
16834 }
16835
16836 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
16837         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16838         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
16839         return tag_ptr(ret_conv, true);
16840 }
16841 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint64_t arg) {
16842         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
16843         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
16844         return ret_conv;
16845 }
16846
16847 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint64_t orig) {
16848         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
16849         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16850         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
16851         return tag_ptr(ret_conv, true);
16852 }
16853
16854 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
16855         LDKThirtyTwoBytes a_ref;
16856         CHECK(a->arr_len == 32);
16857         memcpy(a_ref.data, a->elems, 32); FREE(a);
16858         LDKThirtyTwoBytes b_ref;
16859         CHECK(b->arr_len == 32);
16860         memcpy(b_ref.data, b->elems, 32); FREE(b);
16861         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16862         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
16863         return tag_ptr(ret_conv, true);
16864 }
16865
16866 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint64_t _res) {
16867         if (!ptr_is_owned(_res)) return;
16868         void* _res_ptr = untag_ptr(_res);
16869         CHECK_ACCESS(_res_ptr);
16870         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
16871         FREE(untag_ptr(_res));
16872         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
16873 }
16874
16875 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint64_t o) {
16876         void* o_ptr = untag_ptr(o);
16877         CHECK_ACCESS(o_ptr);
16878         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16879         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
16880         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16881         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
16882         return tag_ptr(ret_conv, true);
16883 }
16884
16885 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
16886         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16887         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
16888         return tag_ptr(ret_conv, true);
16889 }
16890
16891 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint64_t o) {
16892         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
16893         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
16894         return ret_conv;
16895 }
16896
16897 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint64_t _res) {
16898         if (!ptr_is_owned(_res)) return;
16899         void* _res_ptr = untag_ptr(_res);
16900         CHECK_ACCESS(_res_ptr);
16901         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
16902         FREE(untag_ptr(_res));
16903         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
16904 }
16905
16906 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
16907         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16908         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
16909         return tag_ptr(ret_conv, true);
16910 }
16911 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint64_t arg) {
16912         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
16913         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
16914         return ret_conv;
16915 }
16916
16917 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint64_t orig) {
16918         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
16919         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16920         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
16921         return tag_ptr(ret_conv, true);
16922 }
16923
16924 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint64_t o) {
16925         void* o_ptr = untag_ptr(o);
16926         CHECK_ACCESS(o_ptr);
16927         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16928         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
16929         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16930         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
16931         return tag_ptr(ret_conv, true);
16932 }
16933
16934 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint64_t e) {
16935         void* e_ptr = untag_ptr(e);
16936         CHECK_ACCESS(e_ptr);
16937         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16938         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16939         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16940         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
16941         return tag_ptr(ret_conv, true);
16942 }
16943
16944 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint64_t o) {
16945         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
16946         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
16947         return ret_conv;
16948 }
16949
16950 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint64_t _res) {
16951         if (!ptr_is_owned(_res)) return;
16952         void* _res_ptr = untag_ptr(_res);
16953         CHECK_ACCESS(_res_ptr);
16954         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
16955         FREE(untag_ptr(_res));
16956         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
16957 }
16958
16959 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
16960         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16961         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
16962         return tag_ptr(ret_conv, true);
16963 }
16964 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint64_t arg) {
16965         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
16966         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
16967         return ret_conv;
16968 }
16969
16970 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint64_t orig) {
16971         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
16972         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16973         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
16974         return tag_ptr(ret_conv, true);
16975 }
16976
16977 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
16978         LDKThirtyTwoBytes o_ref;
16979         CHECK(o->arr_len == 32);
16980         memcpy(o_ref.data, o->elems, 32); FREE(o);
16981         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16982         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
16983         return tag_ptr(ret_conv, true);
16984 }
16985
16986 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
16987         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16988         *ret_conv = CResult_PaymentSecretNoneZ_err();
16989         return tag_ptr(ret_conv, true);
16990 }
16991
16992 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint64_t o) {
16993         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
16994         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
16995         return ret_conv;
16996 }
16997
16998 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint64_t _res) {
16999         if (!ptr_is_owned(_res)) return;
17000         void* _res_ptr = untag_ptr(_res);
17001         CHECK_ACCESS(_res_ptr);
17002         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
17003         FREE(untag_ptr(_res));
17004         CResult_PaymentSecretNoneZ_free(_res_conv);
17005 }
17006
17007 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
17008         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17009         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
17010         return tag_ptr(ret_conv, true);
17011 }
17012 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint64_t arg) {
17013         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
17014         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
17015         return ret_conv;
17016 }
17017
17018 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint64_t orig) {
17019         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
17020         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17021         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
17022         return tag_ptr(ret_conv, true);
17023 }
17024
17025 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
17026         LDKThirtyTwoBytes o_ref;
17027         CHECK(o->arr_len == 32);
17028         memcpy(o_ref.data, o->elems, 32); FREE(o);
17029         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17030         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
17031         return tag_ptr(ret_conv, true);
17032 }
17033
17034 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint64_t e) {
17035         void* e_ptr = untag_ptr(e);
17036         CHECK_ACCESS(e_ptr);
17037         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17038         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17039         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17040         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
17041         return tag_ptr(ret_conv, true);
17042 }
17043
17044 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint64_t o) {
17045         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
17046         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
17047         return ret_conv;
17048 }
17049
17050 void  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint64_t _res) {
17051         if (!ptr_is_owned(_res)) return;
17052         void* _res_ptr = untag_ptr(_res);
17053         CHECK_ACCESS(_res_ptr);
17054         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
17055         FREE(untag_ptr(_res));
17056         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
17057 }
17058
17059 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
17060         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17061         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
17062         return tag_ptr(ret_conv, true);
17063 }
17064 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint64_t arg) {
17065         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
17066         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
17067         return ret_conv;
17068 }
17069
17070 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint64_t orig) {
17071         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
17072         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17073         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
17074         return tag_ptr(ret_conv, true);
17075 }
17076
17077 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
17078         LDKThirtyTwoBytes o_ref;
17079         CHECK(o->arr_len == 32);
17080         memcpy(o_ref.data, o->elems, 32); FREE(o);
17081         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17082         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
17083         return tag_ptr(ret_conv, true);
17084 }
17085
17086 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint64_t e) {
17087         void* e_ptr = untag_ptr(e);
17088         CHECK_ACCESS(e_ptr);
17089         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17090         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17091         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17092         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
17093         return tag_ptr(ret_conv, true);
17094 }
17095
17096 jboolean  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint64_t o) {
17097         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
17098         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
17099         return ret_conv;
17100 }
17101
17102 void  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint64_t _res) {
17103         if (!ptr_is_owned(_res)) return;
17104         void* _res_ptr = untag_ptr(_res);
17105         CHECK_ACCESS(_res_ptr);
17106         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
17107         FREE(untag_ptr(_res));
17108         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
17109 }
17110
17111 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
17112         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17113         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
17114         return tag_ptr(ret_conv, true);
17115 }
17116 int64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint64_t arg) {
17117         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
17118         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
17119         return ret_conv;
17120 }
17121
17122 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint64_t orig) {
17123         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
17124         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17125         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
17126         return tag_ptr(ret_conv, true);
17127 }
17128
17129 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
17130         LDKCounterpartyForwardingInfo o_conv;
17131         o_conv.inner = untag_ptr(o);
17132         o_conv.is_owned = ptr_is_owned(o);
17133         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17134         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
17135         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17136         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
17137         return tag_ptr(ret_conv, true);
17138 }
17139
17140 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
17141         void* e_ptr = untag_ptr(e);
17142         CHECK_ACCESS(e_ptr);
17143         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17144         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17145         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17146         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
17147         return tag_ptr(ret_conv, true);
17148 }
17149
17150 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
17151         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
17152         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
17153         return ret_conv;
17154 }
17155
17156 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
17157         if (!ptr_is_owned(_res)) return;
17158         void* _res_ptr = untag_ptr(_res);
17159         CHECK_ACCESS(_res_ptr);
17160         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
17161         FREE(untag_ptr(_res));
17162         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
17163 }
17164
17165 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
17166         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17167         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
17168         return tag_ptr(ret_conv, true);
17169 }
17170 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
17171         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
17172         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
17173         return ret_conv;
17174 }
17175
17176 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
17177         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
17178         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17179         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
17180         return tag_ptr(ret_conv, true);
17181 }
17182
17183 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
17184         LDKChannelCounterparty o_conv;
17185         o_conv.inner = untag_ptr(o);
17186         o_conv.is_owned = ptr_is_owned(o);
17187         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17188         o_conv = ChannelCounterparty_clone(&o_conv);
17189         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17190         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
17191         return tag_ptr(ret_conv, true);
17192 }
17193
17194 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
17195         void* e_ptr = untag_ptr(e);
17196         CHECK_ACCESS(e_ptr);
17197         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17198         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17199         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17200         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
17201         return tag_ptr(ret_conv, true);
17202 }
17203
17204 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
17205         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
17206         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
17207         return ret_conv;
17208 }
17209
17210 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
17211         if (!ptr_is_owned(_res)) return;
17212         void* _res_ptr = untag_ptr(_res);
17213         CHECK_ACCESS(_res_ptr);
17214         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
17215         FREE(untag_ptr(_res));
17216         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
17217 }
17218
17219 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
17220         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17221         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
17222         return tag_ptr(ret_conv, true);
17223 }
17224 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
17225         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
17226         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
17227         return ret_conv;
17228 }
17229
17230 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
17231         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
17232         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17233         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
17234         return tag_ptr(ret_conv, true);
17235 }
17236
17237 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
17238         LDKChannelDetails o_conv;
17239         o_conv.inner = untag_ptr(o);
17240         o_conv.is_owned = ptr_is_owned(o);
17241         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17242         o_conv = ChannelDetails_clone(&o_conv);
17243         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17244         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
17245         return tag_ptr(ret_conv, true);
17246 }
17247
17248 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
17249         void* e_ptr = untag_ptr(e);
17250         CHECK_ACCESS(e_ptr);
17251         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17252         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17253         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17254         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
17255         return tag_ptr(ret_conv, true);
17256 }
17257
17258 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
17259         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
17260         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
17261         return ret_conv;
17262 }
17263
17264 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
17265         if (!ptr_is_owned(_res)) return;
17266         void* _res_ptr = untag_ptr(_res);
17267         CHECK_ACCESS(_res_ptr);
17268         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
17269         FREE(untag_ptr(_res));
17270         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
17271 }
17272
17273 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
17274         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17275         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
17276         return tag_ptr(ret_conv, true);
17277 }
17278 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
17279         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
17280         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
17281         return ret_conv;
17282 }
17283
17284 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
17285         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
17286         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17287         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
17288         return tag_ptr(ret_conv, true);
17289 }
17290
17291 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
17292         LDKPhantomRouteHints o_conv;
17293         o_conv.inner = untag_ptr(o);
17294         o_conv.is_owned = ptr_is_owned(o);
17295         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17296         o_conv = PhantomRouteHints_clone(&o_conv);
17297         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17298         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
17299         return tag_ptr(ret_conv, true);
17300 }
17301
17302 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
17303         void* e_ptr = untag_ptr(e);
17304         CHECK_ACCESS(e_ptr);
17305         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17306         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17307         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17308         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
17309         return tag_ptr(ret_conv, true);
17310 }
17311
17312 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
17313         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
17314         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
17315         return ret_conv;
17316 }
17317
17318 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
17319         if (!ptr_is_owned(_res)) return;
17320         void* _res_ptr = untag_ptr(_res);
17321         CHECK_ACCESS(_res_ptr);
17322         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
17323         FREE(untag_ptr(_res));
17324         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
17325 }
17326
17327 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
17328         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17329         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
17330         return tag_ptr(ret_conv, true);
17331 }
17332 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
17333         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
17334         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
17335         return ret_conv;
17336 }
17337
17338 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
17339         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
17340         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17341         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
17342         return tag_ptr(ret_conv, true);
17343 }
17344
17345 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
17346         LDKCVec_ChannelMonitorZ _res_constr;
17347         _res_constr.datalen = _res->arr_len;
17348         if (_res_constr.datalen > 0)
17349                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
17350         else
17351                 _res_constr.data = NULL;
17352         uint64_t* _res_vals = _res->elems;
17353         for (size_t q = 0; q < _res_constr.datalen; q++) {
17354                 uint64_t _res_conv_16 = _res_vals[q];
17355                 LDKChannelMonitor _res_conv_16_conv;
17356                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
17357                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
17358                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17359                 _res_constr.data[q] = _res_conv_16_conv;
17360         }
17361         FREE(_res);
17362         CVec_ChannelMonitorZ_free(_res_constr);
17363 }
17364
17365 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint64_t b) {
17366         LDKThirtyTwoBytes a_ref;
17367         CHECK(a->arr_len == 32);
17368         memcpy(a_ref.data, a->elems, 32); FREE(a);
17369         LDKChannelManager b_conv;
17370         b_conv.inner = untag_ptr(b);
17371         b_conv.is_owned = ptr_is_owned(b);
17372         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17373         // WARNING: we need a move here but no clone is available for LDKChannelManager
17374         
17375         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
17376         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
17377         return tag_ptr(ret_conv, true);
17378 }
17379
17380 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint64_t _res) {
17381         if (!ptr_is_owned(_res)) return;
17382         void* _res_ptr = untag_ptr(_res);
17383         CHECK_ACCESS(_res_ptr);
17384         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
17385         FREE(untag_ptr(_res));
17386         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
17387 }
17388
17389 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint64_t o) {
17390         void* o_ptr = untag_ptr(o);
17391         CHECK_ACCESS(o_ptr);
17392         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
17393         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
17394         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
17395         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
17396         return tag_ptr(ret_conv, true);
17397 }
17398
17399 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint64_t e) {
17400         void* e_ptr = untag_ptr(e);
17401         CHECK_ACCESS(e_ptr);
17402         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17403         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17404         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
17405         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
17406         return tag_ptr(ret_conv, true);
17407 }
17408
17409 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
17410         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
17411         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
17412         return ret_conv;
17413 }
17414
17415 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint64_t _res) {
17416         if (!ptr_is_owned(_res)) return;
17417         void* _res_ptr = untag_ptr(_res);
17418         CHECK_ACCESS(_res_ptr);
17419         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
17420         FREE(untag_ptr(_res));
17421         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
17422 }
17423
17424 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
17425         LDKChannelConfig o_conv;
17426         o_conv.inner = untag_ptr(o);
17427         o_conv.is_owned = ptr_is_owned(o);
17428         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17429         o_conv = ChannelConfig_clone(&o_conv);
17430         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17431         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
17432         return tag_ptr(ret_conv, true);
17433 }
17434
17435 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
17436         void* e_ptr = untag_ptr(e);
17437         CHECK_ACCESS(e_ptr);
17438         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17439         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17440         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17441         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
17442         return tag_ptr(ret_conv, true);
17443 }
17444
17445 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
17446         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
17447         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
17448         return ret_conv;
17449 }
17450
17451 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
17452         if (!ptr_is_owned(_res)) return;
17453         void* _res_ptr = untag_ptr(_res);
17454         CHECK_ACCESS(_res_ptr);
17455         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
17456         FREE(untag_ptr(_res));
17457         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
17458 }
17459
17460 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
17461         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17462         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
17463         return tag_ptr(ret_conv, true);
17464 }
17465 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
17466         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
17467         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
17468         return ret_conv;
17469 }
17470
17471 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
17472         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
17473         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17474         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
17475         return tag_ptr(ret_conv, true);
17476 }
17477
17478 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_some"))) TS_COption_APIErrorZ_some(uint64_t o) {
17479         void* o_ptr = untag_ptr(o);
17480         CHECK_ACCESS(o_ptr);
17481         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
17482         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
17483         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
17484         *ret_copy = COption_APIErrorZ_some(o_conv);
17485         uint64_t ret_ref = tag_ptr(ret_copy, true);
17486         return ret_ref;
17487 }
17488
17489 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_none"))) TS_COption_APIErrorZ_none() {
17490         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
17491         *ret_copy = COption_APIErrorZ_none();
17492         uint64_t ret_ref = tag_ptr(ret_copy, true);
17493         return ret_ref;
17494 }
17495
17496 void  __attribute__((export_name("TS_COption_APIErrorZ_free"))) TS_COption_APIErrorZ_free(uint64_t _res) {
17497         if (!ptr_is_owned(_res)) return;
17498         void* _res_ptr = untag_ptr(_res);
17499         CHECK_ACCESS(_res_ptr);
17500         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
17501         FREE(untag_ptr(_res));
17502         COption_APIErrorZ_free(_res_conv);
17503 }
17504
17505 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
17506         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
17507         *ret_copy = COption_APIErrorZ_clone(arg);
17508         uint64_t ret_ref = tag_ptr(ret_copy, true);
17509         return ret_ref;
17510 }
17511 int64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone_ptr"))) TS_COption_APIErrorZ_clone_ptr(uint64_t arg) {
17512         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
17513         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
17514         return ret_conv;
17515 }
17516
17517 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone"))) TS_COption_APIErrorZ_clone(uint64_t orig) {
17518         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
17519         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
17520         *ret_copy = COption_APIErrorZ_clone(orig_conv);
17521         uint64_t ret_ref = tag_ptr(ret_copy, true);
17522         return ret_ref;
17523 }
17524
17525 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_ok(uint64_t o) {
17526         void* o_ptr = untag_ptr(o);
17527         CHECK_ACCESS(o_ptr);
17528         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
17529         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
17530         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
17531         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
17532         return tag_ptr(ret_conv, true);
17533 }
17534
17535 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_err(uint64_t e) {
17536         void* e_ptr = untag_ptr(e);
17537         CHECK_ACCESS(e_ptr);
17538         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17539         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17540         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
17541         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
17542         return tag_ptr(ret_conv, true);
17543 }
17544
17545 jboolean  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok(uint64_t o) {
17546         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
17547         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
17548         return ret_conv;
17549 }
17550
17551 void  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_free"))) TS_CResult_COption_APIErrorZDecodeErrorZ_free(uint64_t _res) {
17552         if (!ptr_is_owned(_res)) return;
17553         void* _res_ptr = untag_ptr(_res);
17554         CHECK_ACCESS(_res_ptr);
17555         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
17556         FREE(untag_ptr(_res));
17557         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
17558 }
17559
17560 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
17561         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
17562         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
17563         return tag_ptr(ret_conv, true);
17564 }
17565 int64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(uint64_t arg) {
17566         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
17567         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
17568         return ret_conv;
17569 }
17570
17571 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone(uint64_t orig) {
17572         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
17573         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
17574         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
17575         return tag_ptr(ret_conv, true);
17576 }
17577
17578 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
17579         LDKOutPoint o_conv;
17580         o_conv.inner = untag_ptr(o);
17581         o_conv.is_owned = ptr_is_owned(o);
17582         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17583         o_conv = OutPoint_clone(&o_conv);
17584         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17585         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
17586         return tag_ptr(ret_conv, true);
17587 }
17588
17589 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
17590         void* e_ptr = untag_ptr(e);
17591         CHECK_ACCESS(e_ptr);
17592         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17593         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17594         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17595         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
17596         return tag_ptr(ret_conv, true);
17597 }
17598
17599 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
17600         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
17601         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
17602         return ret_conv;
17603 }
17604
17605 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
17606         if (!ptr_is_owned(_res)) return;
17607         void* _res_ptr = untag_ptr(_res);
17608         CHECK_ACCESS(_res_ptr);
17609         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
17610         FREE(untag_ptr(_res));
17611         CResult_OutPointDecodeErrorZ_free(_res_conv);
17612 }
17613
17614 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
17615         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17616         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
17617         return tag_ptr(ret_conv, true);
17618 }
17619 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
17620         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
17621         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
17622         return ret_conv;
17623 }
17624
17625 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
17626         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
17627         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17628         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
17629         return tag_ptr(ret_conv, true);
17630 }
17631
17632 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
17633         void* o_ptr = untag_ptr(o);
17634         CHECK_ACCESS(o_ptr);
17635         LDKType o_conv = *(LDKType*)(o_ptr);
17636         if (o_conv.free == LDKType_JCalls_free) {
17637                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17638                 LDKType_JCalls_cloned(&o_conv);
17639         }
17640         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17641         *ret_copy = COption_TypeZ_some(o_conv);
17642         uint64_t ret_ref = tag_ptr(ret_copy, true);
17643         return ret_ref;
17644 }
17645
17646 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
17647         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17648         *ret_copy = COption_TypeZ_none();
17649         uint64_t ret_ref = tag_ptr(ret_copy, true);
17650         return ret_ref;
17651 }
17652
17653 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
17654         if (!ptr_is_owned(_res)) return;
17655         void* _res_ptr = untag_ptr(_res);
17656         CHECK_ACCESS(_res_ptr);
17657         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
17658         FREE(untag_ptr(_res));
17659         COption_TypeZ_free(_res_conv);
17660 }
17661
17662 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
17663         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17664         *ret_copy = COption_TypeZ_clone(arg);
17665         uint64_t ret_ref = tag_ptr(ret_copy, true);
17666         return ret_ref;
17667 }
17668 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
17669         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
17670         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
17671         return ret_conv;
17672 }
17673
17674 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
17675         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
17676         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17677         *ret_copy = COption_TypeZ_clone(orig_conv);
17678         uint64_t ret_ref = tag_ptr(ret_copy, true);
17679         return ret_ref;
17680 }
17681
17682 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
17683         void* o_ptr = untag_ptr(o);
17684         CHECK_ACCESS(o_ptr);
17685         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
17686         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
17687         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17688         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
17689         return tag_ptr(ret_conv, true);
17690 }
17691
17692 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
17693         void* e_ptr = untag_ptr(e);
17694         CHECK_ACCESS(e_ptr);
17695         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17696         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17697         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17698         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
17699         return tag_ptr(ret_conv, true);
17700 }
17701
17702 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
17703         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
17704         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
17705         return ret_conv;
17706 }
17707
17708 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
17709         if (!ptr_is_owned(_res)) return;
17710         void* _res_ptr = untag_ptr(_res);
17711         CHECK_ACCESS(_res_ptr);
17712         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
17713         FREE(untag_ptr(_res));
17714         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
17715 }
17716
17717 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
17718         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17719         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
17720         return tag_ptr(ret_conv, true);
17721 }
17722 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
17723         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
17724         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
17725         return ret_conv;
17726 }
17727
17728 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
17729         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
17730         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17731         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
17732         return tag_ptr(ret_conv, true);
17733 }
17734
17735 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
17736         LDKThirtyTwoBytes o_ref;
17737         CHECK(o->arr_len == 32);
17738         memcpy(o_ref.data, o->elems, 32); FREE(o);
17739         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17740         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
17741         return tag_ptr(ret_conv, true);
17742 }
17743
17744 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint64_t e) {
17745         void* e_ptr = untag_ptr(e);
17746         CHECK_ACCESS(e_ptr);
17747         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
17748         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
17749         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17750         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
17751         return tag_ptr(ret_conv, true);
17752 }
17753
17754 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint64_t o) {
17755         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
17756         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
17757         return ret_conv;
17758 }
17759
17760 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint64_t _res) {
17761         if (!ptr_is_owned(_res)) return;
17762         void* _res_ptr = untag_ptr(_res);
17763         CHECK_ACCESS(_res_ptr);
17764         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
17765         FREE(untag_ptr(_res));
17766         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
17767 }
17768
17769 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
17770         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17771         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
17772         return tag_ptr(ret_conv, true);
17773 }
17774 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint64_t arg) {
17775         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
17776         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
17777         return ret_conv;
17778 }
17779
17780 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint64_t orig) {
17781         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
17782         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17783         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
17784         return tag_ptr(ret_conv, true);
17785 }
17786
17787 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_ok"))) TS_CResult_NonePaymentErrorZ_ok() {
17788         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
17789         *ret_conv = CResult_NonePaymentErrorZ_ok();
17790         return tag_ptr(ret_conv, true);
17791 }
17792
17793 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_err"))) TS_CResult_NonePaymentErrorZ_err(uint64_t e) {
17794         void* e_ptr = untag_ptr(e);
17795         CHECK_ACCESS(e_ptr);
17796         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
17797         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
17798         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
17799         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
17800         return tag_ptr(ret_conv, true);
17801 }
17802
17803 jboolean  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_is_ok"))) TS_CResult_NonePaymentErrorZ_is_ok(uint64_t o) {
17804         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
17805         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
17806         return ret_conv;
17807 }
17808
17809 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_free"))) TS_CResult_NonePaymentErrorZ_free(uint64_t _res) {
17810         if (!ptr_is_owned(_res)) return;
17811         void* _res_ptr = untag_ptr(_res);
17812         CHECK_ACCESS(_res_ptr);
17813         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
17814         FREE(untag_ptr(_res));
17815         CResult_NonePaymentErrorZ_free(_res_conv);
17816 }
17817
17818 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
17819         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
17820         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
17821         return tag_ptr(ret_conv, true);
17822 }
17823 int64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone_ptr"))) TS_CResult_NonePaymentErrorZ_clone_ptr(uint64_t arg) {
17824         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
17825         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
17826         return ret_conv;
17827 }
17828
17829 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone"))) TS_CResult_NonePaymentErrorZ_clone(uint64_t orig) {
17830         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
17831         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
17832         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
17833         return tag_ptr(ret_conv, true);
17834 }
17835
17836 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
17837         LDKStr o_conv = str_ref_to_owned_c(o);
17838         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17839         *ret_conv = CResult_StringErrorZ_ok(o_conv);
17840         return tag_ptr(ret_conv, true);
17841 }
17842
17843 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
17844         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
17845         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17846         *ret_conv = CResult_StringErrorZ_err(e_conv);
17847         return tag_ptr(ret_conv, true);
17848 }
17849
17850 jboolean  __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint64_t o) {
17851         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
17852         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
17853         return ret_conv;
17854 }
17855
17856 void  __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint64_t _res) {
17857         if (!ptr_is_owned(_res)) return;
17858         void* _res_ptr = untag_ptr(_res);
17859         CHECK_ACCESS(_res_ptr);
17860         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
17861         FREE(untag_ptr(_res));
17862         CResult_StringErrorZ_free(_res_conv);
17863 }
17864
17865 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
17866         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17867         *ret_conv = CResult_StringErrorZ_clone(arg);
17868         return tag_ptr(ret_conv, true);
17869 }
17870 int64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint64_t arg) {
17871         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
17872         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
17873         return ret_conv;
17874 }
17875
17876 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint64_t orig) {
17877         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
17878         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17879         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
17880         return tag_ptr(ret_conv, true);
17881 }
17882
17883 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
17884         LDKPublicKey o_ref;
17885         CHECK(o->arr_len == 33);
17886         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
17887         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17888         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
17889         return tag_ptr(ret_conv, true);
17890 }
17891
17892 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
17893         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
17894         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17895         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
17896         return tag_ptr(ret_conv, true);
17897 }
17898
17899 jboolean  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint64_t o) {
17900         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
17901         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
17902         return ret_conv;
17903 }
17904
17905 void  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint64_t _res) {
17906         if (!ptr_is_owned(_res)) return;
17907         void* _res_ptr = untag_ptr(_res);
17908         CHECK_ACCESS(_res_ptr);
17909         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
17910         FREE(untag_ptr(_res));
17911         CResult_PublicKeyErrorZ_free(_res_conv);
17912 }
17913
17914 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
17915         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17916         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
17917         return tag_ptr(ret_conv, true);
17918 }
17919 int64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint64_t arg) {
17920         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
17921         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
17922         return ret_conv;
17923 }
17924
17925 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint64_t orig) {
17926         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
17927         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17928         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
17929         return tag_ptr(ret_conv, true);
17930 }
17931
17932 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
17933         LDKChannelMonitorUpdate o_conv;
17934         o_conv.inner = untag_ptr(o);
17935         o_conv.is_owned = ptr_is_owned(o);
17936         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17937         o_conv = ChannelMonitorUpdate_clone(&o_conv);
17938         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17939         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
17940         return tag_ptr(ret_conv, true);
17941 }
17942
17943 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
17944         void* e_ptr = untag_ptr(e);
17945         CHECK_ACCESS(e_ptr);
17946         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17947         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17948         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17949         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
17950         return tag_ptr(ret_conv, true);
17951 }
17952
17953 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
17954         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
17955         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
17956         return ret_conv;
17957 }
17958
17959 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
17960         if (!ptr_is_owned(_res)) return;
17961         void* _res_ptr = untag_ptr(_res);
17962         CHECK_ACCESS(_res_ptr);
17963         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
17964         FREE(untag_ptr(_res));
17965         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
17966 }
17967
17968 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
17969         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17970         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
17971         return tag_ptr(ret_conv, true);
17972 }
17973 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
17974         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
17975         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
17976         return ret_conv;
17977 }
17978
17979 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
17980         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
17981         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17982         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
17983         return tag_ptr(ret_conv, true);
17984 }
17985
17986 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
17987         void* o_ptr = untag_ptr(o);
17988         CHECK_ACCESS(o_ptr);
17989         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
17990         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
17991         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17992         *ret_copy = COption_MonitorEventZ_some(o_conv);
17993         uint64_t ret_ref = tag_ptr(ret_copy, true);
17994         return ret_ref;
17995 }
17996
17997 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
17998         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17999         *ret_copy = COption_MonitorEventZ_none();
18000         uint64_t ret_ref = tag_ptr(ret_copy, true);
18001         return ret_ref;
18002 }
18003
18004 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
18005         if (!ptr_is_owned(_res)) return;
18006         void* _res_ptr = untag_ptr(_res);
18007         CHECK_ACCESS(_res_ptr);
18008         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
18009         FREE(untag_ptr(_res));
18010         COption_MonitorEventZ_free(_res_conv);
18011 }
18012
18013 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
18014         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18015         *ret_copy = COption_MonitorEventZ_clone(arg);
18016         uint64_t ret_ref = tag_ptr(ret_copy, true);
18017         return ret_ref;
18018 }
18019 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
18020         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
18021         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
18022         return ret_conv;
18023 }
18024
18025 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
18026         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
18027         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18028         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
18029         uint64_t ret_ref = tag_ptr(ret_copy, true);
18030         return ret_ref;
18031 }
18032
18033 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
18034         void* o_ptr = untag_ptr(o);
18035         CHECK_ACCESS(o_ptr);
18036         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
18037         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
18038         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18039         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
18040         return tag_ptr(ret_conv, true);
18041 }
18042
18043 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
18044         void* e_ptr = untag_ptr(e);
18045         CHECK_ACCESS(e_ptr);
18046         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18047         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18048         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18049         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
18050         return tag_ptr(ret_conv, true);
18051 }
18052
18053 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
18054         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
18055         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
18056         return ret_conv;
18057 }
18058
18059 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
18060         if (!ptr_is_owned(_res)) return;
18061         void* _res_ptr = untag_ptr(_res);
18062         CHECK_ACCESS(_res_ptr);
18063         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
18064         FREE(untag_ptr(_res));
18065         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
18066 }
18067
18068 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
18069         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18070         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
18071         return tag_ptr(ret_conv, true);
18072 }
18073 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
18074         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
18075         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
18076         return ret_conv;
18077 }
18078
18079 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
18080         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
18081         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18082         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
18083         return tag_ptr(ret_conv, true);
18084 }
18085
18086 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
18087         LDKHTLCUpdate o_conv;
18088         o_conv.inner = untag_ptr(o);
18089         o_conv.is_owned = ptr_is_owned(o);
18090         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18091         o_conv = HTLCUpdate_clone(&o_conv);
18092         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18093         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
18094         return tag_ptr(ret_conv, true);
18095 }
18096
18097 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
18098         void* e_ptr = untag_ptr(e);
18099         CHECK_ACCESS(e_ptr);
18100         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18101         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18102         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18103         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
18104         return tag_ptr(ret_conv, true);
18105 }
18106
18107 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
18108         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
18109         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
18110         return ret_conv;
18111 }
18112
18113 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
18114         if (!ptr_is_owned(_res)) return;
18115         void* _res_ptr = untag_ptr(_res);
18116         CHECK_ACCESS(_res_ptr);
18117         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
18118         FREE(untag_ptr(_res));
18119         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
18120 }
18121
18122 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
18123         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18124         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
18125         return tag_ptr(ret_conv, true);
18126 }
18127 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
18128         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
18129         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
18130         return ret_conv;
18131 }
18132
18133 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
18134         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
18135         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18136         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
18137         return tag_ptr(ret_conv, true);
18138 }
18139
18140 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
18141         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18142         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
18143         return tag_ptr(ret_conv, true);
18144 }
18145 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint64_t arg) {
18146         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
18147         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
18148         return ret_conv;
18149 }
18150
18151 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint64_t orig) {
18152         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
18153         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18154         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
18155         return tag_ptr(ret_conv, true);
18156 }
18157
18158 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint64_t a, int8_tArray b) {
18159         LDKOutPoint a_conv;
18160         a_conv.inner = untag_ptr(a);
18161         a_conv.is_owned = ptr_is_owned(a);
18162         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18163         a_conv = OutPoint_clone(&a_conv);
18164         LDKCVec_u8Z b_ref;
18165         b_ref.datalen = b->arr_len;
18166         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18167         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18168         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18169         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
18170         return tag_ptr(ret_conv, true);
18171 }
18172
18173 void  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint64_t _res) {
18174         if (!ptr_is_owned(_res)) return;
18175         void* _res_ptr = untag_ptr(_res);
18176         CHECK_ACCESS(_res_ptr);
18177         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
18178         FREE(untag_ptr(_res));
18179         C2Tuple_OutPointScriptZ_free(_res_conv);
18180 }
18181
18182 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
18183         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18184         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
18185         return tag_ptr(ret_conv, true);
18186 }
18187 int64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint64_t arg) {
18188         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
18189         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
18190         return ret_conv;
18191 }
18192
18193 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint64_t orig) {
18194         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
18195         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18196         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
18197         return tag_ptr(ret_conv, true);
18198 }
18199
18200 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
18201         LDKCVec_u8Z b_ref;
18202         b_ref.datalen = b->arr_len;
18203         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18204         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18205         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18206         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
18207         return tag_ptr(ret_conv, true);
18208 }
18209
18210 void  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint64_t _res) {
18211         if (!ptr_is_owned(_res)) return;
18212         void* _res_ptr = untag_ptr(_res);
18213         CHECK_ACCESS(_res_ptr);
18214         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
18215         FREE(untag_ptr(_res));
18216         C2Tuple_u32ScriptZ_free(_res_conv);
18217 }
18218
18219 void  __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint64_tArray _res) {
18220         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
18221         _res_constr.datalen = _res->arr_len;
18222         if (_res_constr.datalen > 0)
18223                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
18224         else
18225                 _res_constr.data = NULL;
18226         uint64_t* _res_vals = _res->elems;
18227         for (size_t v = 0; v < _res_constr.datalen; v++) {
18228                 uint64_t _res_conv_21 = _res_vals[v];
18229                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
18230                 CHECK_ACCESS(_res_conv_21_ptr);
18231                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
18232                 FREE(untag_ptr(_res_conv_21));
18233                 _res_constr.data[v] = _res_conv_21_conv;
18234         }
18235         FREE(_res);
18236         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
18237 }
18238
18239 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
18240         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18241         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
18242         return tag_ptr(ret_conv, true);
18243 }
18244 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint64_t arg) {
18245         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
18246         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
18247         return ret_conv;
18248 }
18249
18250 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint64_t orig) {
18251         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
18252         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18253         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
18254         return tag_ptr(ret_conv, true);
18255 }
18256
18257 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint64_tArray b) {
18258         LDKThirtyTwoBytes a_ref;
18259         CHECK(a->arr_len == 32);
18260         memcpy(a_ref.data, a->elems, 32); FREE(a);
18261         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
18262         b_constr.datalen = b->arr_len;
18263         if (b_constr.datalen > 0)
18264                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
18265         else
18266                 b_constr.data = NULL;
18267         uint64_t* b_vals = b->elems;
18268         for (size_t v = 0; v < b_constr.datalen; v++) {
18269                 uint64_t b_conv_21 = b_vals[v];
18270                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
18271                 CHECK_ACCESS(b_conv_21_ptr);
18272                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
18273                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
18274                 b_constr.data[v] = b_conv_21_conv;
18275         }
18276         FREE(b);
18277         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18278         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
18279         return tag_ptr(ret_conv, true);
18280 }
18281
18282 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint64_t _res) {
18283         if (!ptr_is_owned(_res)) return;
18284         void* _res_ptr = untag_ptr(_res);
18285         CHECK_ACCESS(_res_ptr);
18286         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
18287         FREE(untag_ptr(_res));
18288         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
18289 }
18290
18291 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint64_tArray _res) {
18292         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
18293         _res_constr.datalen = _res->arr_len;
18294         if (_res_constr.datalen > 0)
18295                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
18296         else
18297                 _res_constr.data = NULL;
18298         uint64_t* _res_vals = _res->elems;
18299         for (size_t o = 0; o < _res_constr.datalen; o++) {
18300                 uint64_t _res_conv_40 = _res_vals[o];
18301                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
18302                 CHECK_ACCESS(_res_conv_40_ptr);
18303                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
18304                 FREE(untag_ptr(_res_conv_40));
18305                 _res_constr.data[o] = _res_conv_40_conv;
18306         }
18307         FREE(_res);
18308         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
18309 }
18310
18311 void  __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint64_tArray _res) {
18312         LDKCVec_EventZ _res_constr;
18313         _res_constr.datalen = _res->arr_len;
18314         if (_res_constr.datalen > 0)
18315                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
18316         else
18317                 _res_constr.data = NULL;
18318         uint64_t* _res_vals = _res->elems;
18319         for (size_t h = 0; h < _res_constr.datalen; h++) {
18320                 uint64_t _res_conv_7 = _res_vals[h];
18321                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
18322                 CHECK_ACCESS(_res_conv_7_ptr);
18323                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
18324                 FREE(untag_ptr(_res_conv_7));
18325                 _res_constr.data[h] = _res_conv_7_conv;
18326         }
18327         FREE(_res);
18328         CVec_EventZ_free(_res_constr);
18329 }
18330
18331 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
18332         LDKCVec_TransactionZ _res_constr;
18333         _res_constr.datalen = _res->arr_len;
18334         if (_res_constr.datalen > 0)
18335                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
18336         else
18337                 _res_constr.data = NULL;
18338         int8_tArray* _res_vals = (void*) _res->elems;
18339         for (size_t m = 0; m < _res_constr.datalen; m++) {
18340                 int8_tArray _res_conv_12 = _res_vals[m];
18341                 LDKTransaction _res_conv_12_ref;
18342                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
18343                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
18344                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
18345                 _res_conv_12_ref.data_is_owned = true;
18346                 _res_constr.data[m] = _res_conv_12_ref;
18347         }
18348         FREE(_res);
18349         CVec_TransactionZ_free(_res_constr);
18350 }
18351
18352 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
18353         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18354         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
18355         return tag_ptr(ret_conv, true);
18356 }
18357 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
18358         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
18359         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
18360         return ret_conv;
18361 }
18362
18363 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
18364         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
18365         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18366         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
18367         return tag_ptr(ret_conv, true);
18368 }
18369
18370 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
18371         void* b_ptr = untag_ptr(b);
18372         CHECK_ACCESS(b_ptr);
18373         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
18374         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
18375         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18376         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
18377         return tag_ptr(ret_conv, true);
18378 }
18379
18380 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
18381         if (!ptr_is_owned(_res)) return;
18382         void* _res_ptr = untag_ptr(_res);
18383         CHECK_ACCESS(_res_ptr);
18384         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
18385         FREE(untag_ptr(_res));
18386         C2Tuple_u32TxOutZ_free(_res_conv);
18387 }
18388
18389 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
18390         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
18391         _res_constr.datalen = _res->arr_len;
18392         if (_res_constr.datalen > 0)
18393                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18394         else
18395                 _res_constr.data = NULL;
18396         uint64_t* _res_vals = _res->elems;
18397         for (size_t u = 0; u < _res_constr.datalen; u++) {
18398                 uint64_t _res_conv_20 = _res_vals[u];
18399                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
18400                 CHECK_ACCESS(_res_conv_20_ptr);
18401                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
18402                 FREE(untag_ptr(_res_conv_20));
18403                 _res_constr.data[u] = _res_conv_20_conv;
18404         }
18405         FREE(_res);
18406         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
18407 }
18408
18409 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
18410         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18411         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
18412         return tag_ptr(ret_conv, true);
18413 }
18414 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
18415         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
18416         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
18417         return ret_conv;
18418 }
18419
18420 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
18421         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
18422         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18423         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
18424         return tag_ptr(ret_conv, true);
18425 }
18426
18427 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
18428         LDKThirtyTwoBytes a_ref;
18429         CHECK(a->arr_len == 32);
18430         memcpy(a_ref.data, a->elems, 32); FREE(a);
18431         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
18432         b_constr.datalen = b->arr_len;
18433         if (b_constr.datalen > 0)
18434                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18435         else
18436                 b_constr.data = NULL;
18437         uint64_t* b_vals = b->elems;
18438         for (size_t u = 0; u < b_constr.datalen; u++) {
18439                 uint64_t b_conv_20 = b_vals[u];
18440                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
18441                 CHECK_ACCESS(b_conv_20_ptr);
18442                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
18443                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
18444                 b_constr.data[u] = b_conv_20_conv;
18445         }
18446         FREE(b);
18447         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18448         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
18449         return tag_ptr(ret_conv, true);
18450 }
18451
18452 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
18453         if (!ptr_is_owned(_res)) return;
18454         void* _res_ptr = untag_ptr(_res);
18455         CHECK_ACCESS(_res_ptr);
18456         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
18457         FREE(untag_ptr(_res));
18458         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
18459 }
18460
18461 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
18462         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
18463         _res_constr.datalen = _res->arr_len;
18464         if (_res_constr.datalen > 0)
18465                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
18466         else
18467                 _res_constr.data = NULL;
18468         uint64_t* _res_vals = _res->elems;
18469         for (size_t n = 0; n < _res_constr.datalen; n++) {
18470                 uint64_t _res_conv_39 = _res_vals[n];
18471                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
18472                 CHECK_ACCESS(_res_conv_39_ptr);
18473                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
18474                 FREE(untag_ptr(_res_conv_39));
18475                 _res_constr.data[n] = _res_conv_39_conv;
18476         }
18477         FREE(_res);
18478         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
18479 }
18480
18481 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
18482         LDKCVec_BalanceZ _res_constr;
18483         _res_constr.datalen = _res->arr_len;
18484         if (_res_constr.datalen > 0)
18485                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
18486         else
18487                 _res_constr.data = NULL;
18488         uint64_t* _res_vals = _res->elems;
18489         for (size_t j = 0; j < _res_constr.datalen; j++) {
18490                 uint64_t _res_conv_9 = _res_vals[j];
18491                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
18492                 CHECK_ACCESS(_res_conv_9_ptr);
18493                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
18494                 FREE(untag_ptr(_res_conv_9));
18495                 _res_constr.data[j] = _res_conv_9_conv;
18496         }
18497         FREE(_res);
18498         CVec_BalanceZ_free(_res_constr);
18499 }
18500
18501 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
18502         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18503         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
18504         return tag_ptr(ret_conv, true);
18505 }
18506 int64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint64_t arg) {
18507         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
18508         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
18509         return ret_conv;
18510 }
18511
18512 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint64_t orig) {
18513         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
18514         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18515         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
18516         return tag_ptr(ret_conv, true);
18517 }
18518
18519 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint64_t b) {
18520         LDKThirtyTwoBytes a_ref;
18521         CHECK(a->arr_len == 32);
18522         memcpy(a_ref.data, a->elems, 32); FREE(a);
18523         LDKChannelMonitor b_conv;
18524         b_conv.inner = untag_ptr(b);
18525         b_conv.is_owned = ptr_is_owned(b);
18526         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18527         b_conv = ChannelMonitor_clone(&b_conv);
18528         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18529         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
18530         return tag_ptr(ret_conv, true);
18531 }
18532
18533 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint64_t _res) {
18534         if (!ptr_is_owned(_res)) return;
18535         void* _res_ptr = untag_ptr(_res);
18536         CHECK_ACCESS(_res_ptr);
18537         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
18538         FREE(untag_ptr(_res));
18539         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
18540 }
18541
18542 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
18543         void* o_ptr = untag_ptr(o);
18544         CHECK_ACCESS(o_ptr);
18545         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
18546         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
18547         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18548         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
18549         return tag_ptr(ret_conv, true);
18550 }
18551
18552 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint64_t e) {
18553         void* e_ptr = untag_ptr(e);
18554         CHECK_ACCESS(e_ptr);
18555         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18556         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18557         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18558         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
18559         return tag_ptr(ret_conv, true);
18560 }
18561
18562 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
18563         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
18564         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
18565         return ret_conv;
18566 }
18567
18568 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
18569         if (!ptr_is_owned(_res)) return;
18570         void* _res_ptr = untag_ptr(_res);
18571         CHECK_ACCESS(_res_ptr);
18572         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
18573         FREE(untag_ptr(_res));
18574         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
18575 }
18576
18577 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
18578         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18579         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
18580         return tag_ptr(ret_conv, true);
18581 }
18582 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
18583         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
18584         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
18585         return ret_conv;
18586 }
18587
18588 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
18589         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
18590         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18591         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
18592         return tag_ptr(ret_conv, true);
18593 }
18594
18595 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
18596         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18597         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
18598         return tag_ptr(ret_conv, true);
18599 }
18600 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
18601         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
18602         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
18603         return ret_conv;
18604 }
18605
18606 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
18607         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
18608         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18609         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
18610         return tag_ptr(ret_conv, true);
18611 }
18612
18613 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
18614         LDKPublicKey a_ref;
18615         CHECK(a->arr_len == 33);
18616         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
18617         void* b_ptr = untag_ptr(b);
18618         CHECK_ACCESS(b_ptr);
18619         LDKType b_conv = *(LDKType*)(b_ptr);
18620         if (b_conv.free == LDKType_JCalls_free) {
18621                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18622                 LDKType_JCalls_cloned(&b_conv);
18623         }
18624         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18625         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
18626         return tag_ptr(ret_conv, true);
18627 }
18628
18629 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
18630         if (!ptr_is_owned(_res)) return;
18631         void* _res_ptr = untag_ptr(_res);
18632         CHECK_ACCESS(_res_ptr);
18633         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
18634         FREE(untag_ptr(_res));
18635         C2Tuple_PublicKeyTypeZ_free(_res_conv);
18636 }
18637
18638 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
18639         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
18640         _res_constr.datalen = _res->arr_len;
18641         if (_res_constr.datalen > 0)
18642                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
18643         else
18644                 _res_constr.data = NULL;
18645         uint64_t* _res_vals = _res->elems;
18646         for (size_t z = 0; z < _res_constr.datalen; z++) {
18647                 uint64_t _res_conv_25 = _res_vals[z];
18648                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
18649                 CHECK_ACCESS(_res_conv_25_ptr);
18650                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
18651                 FREE(untag_ptr(_res_conv_25));
18652                 _res_constr.data[z] = _res_conv_25_conv;
18653         }
18654         FREE(_res);
18655         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
18656 }
18657
18658 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_some"))) TS_COption_CustomOnionMessageContentsZ_some(uint64_t o) {
18659         void* o_ptr = untag_ptr(o);
18660         CHECK_ACCESS(o_ptr);
18661         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
18662         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
18663                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18664                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
18665         }
18666         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18667         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
18668         uint64_t ret_ref = tag_ptr(ret_copy, true);
18669         return ret_ref;
18670 }
18671
18672 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_none"))) TS_COption_CustomOnionMessageContentsZ_none() {
18673         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18674         *ret_copy = COption_CustomOnionMessageContentsZ_none();
18675         uint64_t ret_ref = tag_ptr(ret_copy, true);
18676         return ret_ref;
18677 }
18678
18679 void  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_free"))) TS_COption_CustomOnionMessageContentsZ_free(uint64_t _res) {
18680         if (!ptr_is_owned(_res)) return;
18681         void* _res_ptr = untag_ptr(_res);
18682         CHECK_ACCESS(_res_ptr);
18683         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
18684         FREE(untag_ptr(_res));
18685         COption_CustomOnionMessageContentsZ_free(_res_conv);
18686 }
18687
18688 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
18689         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18690         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
18691         uint64_t ret_ref = tag_ptr(ret_copy, true);
18692         return ret_ref;
18693 }
18694 int64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone_ptr"))) TS_COption_CustomOnionMessageContentsZ_clone_ptr(uint64_t arg) {
18695         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
18696         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
18697         return ret_conv;
18698 }
18699
18700 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone"))) TS_COption_CustomOnionMessageContentsZ_clone(uint64_t orig) {
18701         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
18702         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18703         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
18704         uint64_t ret_ref = tag_ptr(ret_copy, true);
18705         return ret_ref;
18706 }
18707
18708 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
18709         void* o_ptr = untag_ptr(o);
18710         CHECK_ACCESS(o_ptr);
18711         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
18712         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
18713         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18714         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
18715         return tag_ptr(ret_conv, true);
18716 }
18717
18718 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
18719         void* e_ptr = untag_ptr(e);
18720         CHECK_ACCESS(e_ptr);
18721         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18722         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18723         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18724         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
18725         return tag_ptr(ret_conv, true);
18726 }
18727
18728 jboolean  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
18729         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
18730         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
18731         return ret_conv;
18732 }
18733
18734 void  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
18735         if (!ptr_is_owned(_res)) return;
18736         void* _res_ptr = untag_ptr(_res);
18737         CHECK_ACCESS(_res_ptr);
18738         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
18739         FREE(untag_ptr(_res));
18740         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
18741 }
18742
18743 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
18744         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18745         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
18746         return tag_ptr(ret_conv, true);
18747 }
18748 int64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
18749         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
18750         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
18751         return ret_conv;
18752 }
18753
18754 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
18755         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
18756         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18757         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
18758         return tag_ptr(ret_conv, true);
18759 }
18760
18761 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint64_t o) {
18762         void* o_ptr = untag_ptr(o);
18763         CHECK_ACCESS(o_ptr);
18764         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
18765         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
18766         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18767         *ret_copy = COption_NetAddressZ_some(o_conv);
18768         uint64_t ret_ref = tag_ptr(ret_copy, true);
18769         return ret_ref;
18770 }
18771
18772 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
18773         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18774         *ret_copy = COption_NetAddressZ_none();
18775         uint64_t ret_ref = tag_ptr(ret_copy, true);
18776         return ret_ref;
18777 }
18778
18779 void  __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint64_t _res) {
18780         if (!ptr_is_owned(_res)) return;
18781         void* _res_ptr = untag_ptr(_res);
18782         CHECK_ACCESS(_res_ptr);
18783         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
18784         FREE(untag_ptr(_res));
18785         COption_NetAddressZ_free(_res_conv);
18786 }
18787
18788 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
18789         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18790         *ret_copy = COption_NetAddressZ_clone(arg);
18791         uint64_t ret_ref = tag_ptr(ret_copy, true);
18792         return ret_ref;
18793 }
18794 int64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint64_t arg) {
18795         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
18796         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
18797         return ret_conv;
18798 }
18799
18800 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint64_t orig) {
18801         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
18802         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18803         *ret_copy = COption_NetAddressZ_clone(orig_conv);
18804         uint64_t ret_ref = tag_ptr(ret_copy, true);
18805         return ret_ref;
18806 }
18807
18808 static inline uint64_t C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR arg) {
18809         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
18810         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(arg);
18811         return tag_ptr(ret_conv, true);
18812 }
18813 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(uint64_t arg) {
18814         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(arg);
18815         int64_t ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(arg_conv);
18816         return ret_conv;
18817 }
18818
18819 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone(uint64_t orig) {
18820         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(orig);
18821         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
18822         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig_conv);
18823         return tag_ptr(ret_conv, true);
18824 }
18825
18826 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_new"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_new(int8_tArray a, uint64_t b) {
18827         LDKPublicKey a_ref;
18828         CHECK(a->arr_len == 33);
18829         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
18830         void* b_ptr = untag_ptr(b);
18831         CHECK_ACCESS(b_ptr);
18832         LDKCOption_NetAddressZ b_conv = *(LDKCOption_NetAddressZ*)(b_ptr);
18833         b_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(b));
18834         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
18835         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_new(a_ref, b_conv);
18836         return tag_ptr(ret_conv, true);
18837 }
18838
18839 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_free"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_free(uint64_t _res) {
18840         if (!ptr_is_owned(_res)) return;
18841         void* _res_ptr = untag_ptr(_res);
18842         CHECK_ACCESS(_res_ptr);
18843         LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_ptr);
18844         FREE(untag_ptr(_res));
18845         C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res_conv);
18846 }
18847
18848 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(uint64_tArray _res) {
18849         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res_constr;
18850         _res_constr.datalen = _res->arr_len;
18851         if (_res_constr.datalen > 0)
18852                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ Elements");
18853         else
18854                 _res_constr.data = NULL;
18855         uint64_t* _res_vals = _res->elems;
18856         for (size_t o = 0; o < _res_constr.datalen; o++) {
18857                 uint64_t _res_conv_40 = _res_vals[o];
18858                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
18859                 CHECK_ACCESS(_res_conv_40_ptr);
18860                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_conv_40_ptr);
18861                 FREE(untag_ptr(_res_conv_40));
18862                 _res_constr.data[o] = _res_conv_40_conv;
18863         }
18864         FREE(_res);
18865         CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res_constr);
18866 }
18867
18868 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
18869         LDKCVec_u8Z o_ref;
18870         o_ref.datalen = o->arr_len;
18871         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18872         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18873         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18874         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
18875         return tag_ptr(ret_conv, true);
18876 }
18877
18878 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
18879         LDKPeerHandleError e_conv;
18880         e_conv.inner = untag_ptr(e);
18881         e_conv.is_owned = ptr_is_owned(e);
18882         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18883         e_conv = PeerHandleError_clone(&e_conv);
18884         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18885         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
18886         return tag_ptr(ret_conv, true);
18887 }
18888
18889 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
18890         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
18891         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
18892         return ret_conv;
18893 }
18894
18895 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
18896         if (!ptr_is_owned(_res)) return;
18897         void* _res_ptr = untag_ptr(_res);
18898         CHECK_ACCESS(_res_ptr);
18899         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
18900         FREE(untag_ptr(_res));
18901         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
18902 }
18903
18904 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
18905         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18906         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
18907         return tag_ptr(ret_conv, true);
18908 }
18909 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
18910         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
18911         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
18912         return ret_conv;
18913 }
18914
18915 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
18916         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
18917         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18918         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
18919         return tag_ptr(ret_conv, true);
18920 }
18921
18922 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
18923         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18924         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
18925         return tag_ptr(ret_conv, true);
18926 }
18927
18928 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
18929         LDKPeerHandleError e_conv;
18930         e_conv.inner = untag_ptr(e);
18931         e_conv.is_owned = ptr_is_owned(e);
18932         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18933         e_conv = PeerHandleError_clone(&e_conv);
18934         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18935         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
18936         return tag_ptr(ret_conv, true);
18937 }
18938
18939 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
18940         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
18941         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
18942         return ret_conv;
18943 }
18944
18945 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
18946         if (!ptr_is_owned(_res)) return;
18947         void* _res_ptr = untag_ptr(_res);
18948         CHECK_ACCESS(_res_ptr);
18949         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
18950         FREE(untag_ptr(_res));
18951         CResult_NonePeerHandleErrorZ_free(_res_conv);
18952 }
18953
18954 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
18955         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18956         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
18957         return tag_ptr(ret_conv, true);
18958 }
18959 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
18960         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
18961         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
18962         return ret_conv;
18963 }
18964
18965 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
18966         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
18967         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18968         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
18969         return tag_ptr(ret_conv, true);
18970 }
18971
18972 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
18973         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18974         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
18975         return tag_ptr(ret_conv, true);
18976 }
18977
18978 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
18979         LDKPeerHandleError e_conv;
18980         e_conv.inner = untag_ptr(e);
18981         e_conv.is_owned = ptr_is_owned(e);
18982         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18983         e_conv = PeerHandleError_clone(&e_conv);
18984         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18985         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
18986         return tag_ptr(ret_conv, true);
18987 }
18988
18989 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
18990         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
18991         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
18992         return ret_conv;
18993 }
18994
18995 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
18996         if (!ptr_is_owned(_res)) return;
18997         void* _res_ptr = untag_ptr(_res);
18998         CHECK_ACCESS(_res_ptr);
18999         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
19000         FREE(untag_ptr(_res));
19001         CResult_boolPeerHandleErrorZ_free(_res_conv);
19002 }
19003
19004 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
19005         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19006         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
19007         return tag_ptr(ret_conv, true);
19008 }
19009 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
19010         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
19011         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
19012         return ret_conv;
19013 }
19014
19015 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
19016         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
19017         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19018         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
19019         return tag_ptr(ret_conv, true);
19020 }
19021
19022 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_ok(uint64_t o) {
19023         void* o_ptr = untag_ptr(o);
19024         CHECK_ACCESS(o_ptr);
19025         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
19026         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
19027         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19028         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
19029         return tag_ptr(ret_conv, true);
19030 }
19031
19032 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_err"))) TS_CResult_TxOutUtxoLookupErrorZ_err(uint32_t e) {
19033         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_js(e);
19034         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19035         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
19036         return tag_ptr(ret_conv, true);
19037 }
19038
19039 jboolean  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_is_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_is_ok(uint64_t o) {
19040         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
19041         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
19042         return ret_conv;
19043 }
19044
19045 void  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_free"))) TS_CResult_TxOutUtxoLookupErrorZ_free(uint64_t _res) {
19046         if (!ptr_is_owned(_res)) return;
19047         void* _res_ptr = untag_ptr(_res);
19048         CHECK_ACCESS(_res_ptr);
19049         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
19050         FREE(untag_ptr(_res));
19051         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
19052 }
19053
19054 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
19055         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19056         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
19057         return tag_ptr(ret_conv, true);
19058 }
19059 int64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr"))) TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr(uint64_t arg) {
19060         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
19061         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
19062         return ret_conv;
19063 }
19064
19065 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone"))) TS_CResult_TxOutUtxoLookupErrorZ_clone(uint64_t orig) {
19066         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
19067         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19068         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
19069         return tag_ptr(ret_conv, true);
19070 }
19071
19072 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() {
19073         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
19074         *ret_conv = CResult_NoneSendErrorZ_ok();
19075         return tag_ptr(ret_conv, true);
19076 }
19077
19078 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) {
19079         void* e_ptr = untag_ptr(e);
19080         CHECK_ACCESS(e_ptr);
19081         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
19082         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
19083         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
19084         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
19085         return tag_ptr(ret_conv, true);
19086 }
19087
19088 jboolean  __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) {
19089         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
19090         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
19091         return ret_conv;
19092 }
19093
19094 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) {
19095         if (!ptr_is_owned(_res)) return;
19096         void* _res_ptr = untag_ptr(_res);
19097         CHECK_ACCESS(_res_ptr);
19098         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
19099         FREE(untag_ptr(_res));
19100         CResult_NoneSendErrorZ_free(_res_conv);
19101 }
19102
19103 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
19104         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
19105         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
19106         return tag_ptr(ret_conv, true);
19107 }
19108
19109 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
19110         void* e_ptr = untag_ptr(e);
19111         CHECK_ACCESS(e_ptr);
19112         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
19113         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
19114         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
19115         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
19116         return tag_ptr(ret_conv, true);
19117 }
19118
19119 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
19120         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
19121         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
19122         return ret_conv;
19123 }
19124
19125 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
19126         if (!ptr_is_owned(_res)) return;
19127         void* _res_ptr = untag_ptr(_res);
19128         CHECK_ACCESS(_res_ptr);
19129         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
19130         FREE(untag_ptr(_res));
19131         CResult_u32GraphSyncErrorZ_free(_res_conv);
19132 }
19133
19134 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) {
19135         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
19136         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19137         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
19138         return tag_ptr(ret_conv, true);
19139 }
19140
19141 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint64_t e) {
19142         void* e_ptr = untag_ptr(e);
19143         CHECK_ACCESS(e_ptr);
19144         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
19145         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
19146         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19147         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
19148         return tag_ptr(ret_conv, true);
19149 }
19150
19151 jboolean  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint64_t o) {
19152         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
19153         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
19154         return ret_conv;
19155 }
19156
19157 void  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint64_t _res) {
19158         if (!ptr_is_owned(_res)) return;
19159         void* _res_ptr = untag_ptr(_res);
19160         CHECK_ACCESS(_res_ptr);
19161         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
19162         FREE(untag_ptr(_res));
19163         CResult_SiPrefixParseErrorZ_free(_res_conv);
19164 }
19165
19166 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
19167         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19168         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
19169         return tag_ptr(ret_conv, true);
19170 }
19171 int64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint64_t arg) {
19172         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
19173         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
19174         return ret_conv;
19175 }
19176
19177 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint64_t orig) {
19178         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
19179         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19180         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
19181         return tag_ptr(ret_conv, true);
19182 }
19183
19184 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
19185         LDKInvoice o_conv;
19186         o_conv.inner = untag_ptr(o);
19187         o_conv.is_owned = ptr_is_owned(o);
19188         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19189         o_conv = Invoice_clone(&o_conv);
19190         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19191         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
19192         return tag_ptr(ret_conv, true);
19193 }
19194
19195 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
19196         void* e_ptr = untag_ptr(e);
19197         CHECK_ACCESS(e_ptr);
19198         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
19199         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
19200         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19201         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
19202         return tag_ptr(ret_conv, true);
19203 }
19204
19205 jboolean  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
19206         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
19207         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
19208         return ret_conv;
19209 }
19210
19211 void  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
19212         if (!ptr_is_owned(_res)) return;
19213         void* _res_ptr = untag_ptr(_res);
19214         CHECK_ACCESS(_res_ptr);
19215         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
19216         FREE(untag_ptr(_res));
19217         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
19218 }
19219
19220 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
19221         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19222         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
19223         return tag_ptr(ret_conv, true);
19224 }
19225 int64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
19226         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
19227         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
19228         return ret_conv;
19229 }
19230
19231 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
19232         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
19233         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19234         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
19235         return tag_ptr(ret_conv, true);
19236 }
19237
19238 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint64_t o) {
19239         LDKSignedRawInvoice o_conv;
19240         o_conv.inner = untag_ptr(o);
19241         o_conv.is_owned = ptr_is_owned(o);
19242         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19243         o_conv = SignedRawInvoice_clone(&o_conv);
19244         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19245         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
19246         return tag_ptr(ret_conv, true);
19247 }
19248
19249 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint64_t e) {
19250         void* e_ptr = untag_ptr(e);
19251         CHECK_ACCESS(e_ptr);
19252         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
19253         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
19254         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19255         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
19256         return tag_ptr(ret_conv, true);
19257 }
19258
19259 jboolean  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint64_t o) {
19260         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
19261         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
19262         return ret_conv;
19263 }
19264
19265 void  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint64_t _res) {
19266         if (!ptr_is_owned(_res)) return;
19267         void* _res_ptr = untag_ptr(_res);
19268         CHECK_ACCESS(_res_ptr);
19269         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
19270         FREE(untag_ptr(_res));
19271         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
19272 }
19273
19274 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
19275         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19276         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
19277         return tag_ptr(ret_conv, true);
19278 }
19279 int64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint64_t arg) {
19280         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
19281         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
19282         return ret_conv;
19283 }
19284
19285 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint64_t orig) {
19286         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
19287         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19288         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
19289         return tag_ptr(ret_conv, true);
19290 }
19291
19292 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
19293         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19294         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
19295         return tag_ptr(ret_conv, true);
19296 }
19297 int64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint64_t arg) {
19298         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
19299         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
19300         return ret_conv;
19301 }
19302
19303 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint64_t orig) {
19304         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
19305         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19306         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
19307         return tag_ptr(ret_conv, true);
19308 }
19309
19310 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
19311         LDKRawInvoice a_conv;
19312         a_conv.inner = untag_ptr(a);
19313         a_conv.is_owned = ptr_is_owned(a);
19314         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19315         a_conv = RawInvoice_clone(&a_conv);
19316         LDKThirtyTwoBytes b_ref;
19317         CHECK(b->arr_len == 32);
19318         memcpy(b_ref.data, b->elems, 32); FREE(b);
19319         LDKInvoiceSignature c_conv;
19320         c_conv.inner = untag_ptr(c);
19321         c_conv.is_owned = ptr_is_owned(c);
19322         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
19323         c_conv = InvoiceSignature_clone(&c_conv);
19324         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19325         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
19326         return tag_ptr(ret_conv, true);
19327 }
19328
19329 void  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint64_t _res) {
19330         if (!ptr_is_owned(_res)) return;
19331         void* _res_ptr = untag_ptr(_res);
19332         CHECK_ACCESS(_res_ptr);
19333         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
19334         FREE(untag_ptr(_res));
19335         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
19336 }
19337
19338 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint64_t o) {
19339         LDKPayeePubKey o_conv;
19340         o_conv.inner = untag_ptr(o);
19341         o_conv.is_owned = ptr_is_owned(o);
19342         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19343         o_conv = PayeePubKey_clone(&o_conv);
19344         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19345         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
19346         return tag_ptr(ret_conv, true);
19347 }
19348
19349 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
19350         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
19351         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19352         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
19353         return tag_ptr(ret_conv, true);
19354 }
19355
19356 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint64_t o) {
19357         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
19358         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
19359         return ret_conv;
19360 }
19361
19362 void  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint64_t _res) {
19363         if (!ptr_is_owned(_res)) return;
19364         void* _res_ptr = untag_ptr(_res);
19365         CHECK_ACCESS(_res_ptr);
19366         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
19367         FREE(untag_ptr(_res));
19368         CResult_PayeePubKeyErrorZ_free(_res_conv);
19369 }
19370
19371 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
19372         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19373         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
19374         return tag_ptr(ret_conv, true);
19375 }
19376 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint64_t arg) {
19377         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
19378         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
19379         return ret_conv;
19380 }
19381
19382 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint64_t orig) {
19383         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
19384         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19385         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
19386         return tag_ptr(ret_conv, true);
19387 }
19388
19389 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
19390         LDKCVec_PrivateRouteZ _res_constr;
19391         _res_constr.datalen = _res->arr_len;
19392         if (_res_constr.datalen > 0)
19393                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
19394         else
19395                 _res_constr.data = NULL;
19396         uint64_t* _res_vals = _res->elems;
19397         for (size_t o = 0; o < _res_constr.datalen; o++) {
19398                 uint64_t _res_conv_14 = _res_vals[o];
19399                 LDKPrivateRoute _res_conv_14_conv;
19400                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
19401                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
19402                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
19403                 _res_constr.data[o] = _res_conv_14_conv;
19404         }
19405         FREE(_res);
19406         CVec_PrivateRouteZ_free(_res_constr);
19407 }
19408
19409 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
19410         LDKPositiveTimestamp o_conv;
19411         o_conv.inner = untag_ptr(o);
19412         o_conv.is_owned = ptr_is_owned(o);
19413         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19414         o_conv = PositiveTimestamp_clone(&o_conv);
19415         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19416         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
19417         return tag_ptr(ret_conv, true);
19418 }
19419
19420 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
19421         LDKCreationError e_conv = LDKCreationError_from_js(e);
19422         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19423         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
19424         return tag_ptr(ret_conv, true);
19425 }
19426
19427 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
19428         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
19429         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
19430         return ret_conv;
19431 }
19432
19433 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
19434         if (!ptr_is_owned(_res)) return;
19435         void* _res_ptr = untag_ptr(_res);
19436         CHECK_ACCESS(_res_ptr);
19437         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
19438         FREE(untag_ptr(_res));
19439         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
19440 }
19441
19442 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
19443         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19444         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
19445         return tag_ptr(ret_conv, true);
19446 }
19447 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
19448         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
19449         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
19450         return ret_conv;
19451 }
19452
19453 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
19454         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
19455         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19456         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
19457         return tag_ptr(ret_conv, true);
19458 }
19459
19460 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
19461         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19462         *ret_conv = CResult_NoneSemanticErrorZ_ok();
19463         return tag_ptr(ret_conv, true);
19464 }
19465
19466 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
19467         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
19468         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19469         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
19470         return tag_ptr(ret_conv, true);
19471 }
19472
19473 jboolean  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint64_t o) {
19474         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
19475         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
19476         return ret_conv;
19477 }
19478
19479 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint64_t _res) {
19480         if (!ptr_is_owned(_res)) return;
19481         void* _res_ptr = untag_ptr(_res);
19482         CHECK_ACCESS(_res_ptr);
19483         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
19484         FREE(untag_ptr(_res));
19485         CResult_NoneSemanticErrorZ_free(_res_conv);
19486 }
19487
19488 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
19489         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19490         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
19491         return tag_ptr(ret_conv, true);
19492 }
19493 int64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint64_t arg) {
19494         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
19495         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
19496         return ret_conv;
19497 }
19498
19499 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint64_t orig) {
19500         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
19501         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19502         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
19503         return tag_ptr(ret_conv, true);
19504 }
19505
19506 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint64_t o) {
19507         LDKInvoice o_conv;
19508         o_conv.inner = untag_ptr(o);
19509         o_conv.is_owned = ptr_is_owned(o);
19510         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19511         o_conv = Invoice_clone(&o_conv);
19512         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19513         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
19514         return tag_ptr(ret_conv, true);
19515 }
19516
19517 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
19518         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
19519         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19520         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
19521         return tag_ptr(ret_conv, true);
19522 }
19523
19524 jboolean  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint64_t o) {
19525         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
19526         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
19527         return ret_conv;
19528 }
19529
19530 void  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint64_t _res) {
19531         if (!ptr_is_owned(_res)) return;
19532         void* _res_ptr = untag_ptr(_res);
19533         CHECK_ACCESS(_res_ptr);
19534         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
19535         FREE(untag_ptr(_res));
19536         CResult_InvoiceSemanticErrorZ_free(_res_conv);
19537 }
19538
19539 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
19540         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19541         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
19542         return tag_ptr(ret_conv, true);
19543 }
19544 int64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint64_t arg) {
19545         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
19546         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
19547         return ret_conv;
19548 }
19549
19550 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint64_t orig) {
19551         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
19552         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19553         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
19554         return tag_ptr(ret_conv, true);
19555 }
19556
19557 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
19558         LDKDescription o_conv;
19559         o_conv.inner = untag_ptr(o);
19560         o_conv.is_owned = ptr_is_owned(o);
19561         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19562         o_conv = Description_clone(&o_conv);
19563         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19564         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
19565         return tag_ptr(ret_conv, true);
19566 }
19567
19568 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
19569         LDKCreationError e_conv = LDKCreationError_from_js(e);
19570         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19571         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
19572         return tag_ptr(ret_conv, true);
19573 }
19574
19575 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
19576         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
19577         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
19578         return ret_conv;
19579 }
19580
19581 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
19582         if (!ptr_is_owned(_res)) return;
19583         void* _res_ptr = untag_ptr(_res);
19584         CHECK_ACCESS(_res_ptr);
19585         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
19586         FREE(untag_ptr(_res));
19587         CResult_DescriptionCreationErrorZ_free(_res_conv);
19588 }
19589
19590 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
19591         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19592         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
19593         return tag_ptr(ret_conv, true);
19594 }
19595 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
19596         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
19597         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
19598         return ret_conv;
19599 }
19600
19601 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
19602         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
19603         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19604         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
19605         return tag_ptr(ret_conv, true);
19606 }
19607
19608 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
19609         LDKPrivateRoute o_conv;
19610         o_conv.inner = untag_ptr(o);
19611         o_conv.is_owned = ptr_is_owned(o);
19612         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19613         o_conv = PrivateRoute_clone(&o_conv);
19614         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19615         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
19616         return tag_ptr(ret_conv, true);
19617 }
19618
19619 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
19620         LDKCreationError e_conv = LDKCreationError_from_js(e);
19621         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19622         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
19623         return tag_ptr(ret_conv, true);
19624 }
19625
19626 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
19627         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
19628         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
19629         return ret_conv;
19630 }
19631
19632 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
19633         if (!ptr_is_owned(_res)) return;
19634         void* _res_ptr = untag_ptr(_res);
19635         CHECK_ACCESS(_res_ptr);
19636         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
19637         FREE(untag_ptr(_res));
19638         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
19639 }
19640
19641 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
19642         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19643         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
19644         return tag_ptr(ret_conv, true);
19645 }
19646 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
19647         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
19648         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
19649         return ret_conv;
19650 }
19651
19652 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
19653         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
19654         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19655         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
19656         return tag_ptr(ret_conv, true);
19657 }
19658
19659 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
19660         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19661         *ret_conv = CResult_NoneErrorZ_ok();
19662         return tag_ptr(ret_conv, true);
19663 }
19664
19665 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
19666         LDKIOError e_conv = LDKIOError_from_js(e);
19667         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19668         *ret_conv = CResult_NoneErrorZ_err(e_conv);
19669         return tag_ptr(ret_conv, true);
19670 }
19671
19672 jboolean  __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint64_t o) {
19673         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
19674         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
19675         return ret_conv;
19676 }
19677
19678 void  __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint64_t _res) {
19679         if (!ptr_is_owned(_res)) return;
19680         void* _res_ptr = untag_ptr(_res);
19681         CHECK_ACCESS(_res_ptr);
19682         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
19683         FREE(untag_ptr(_res));
19684         CResult_NoneErrorZ_free(_res_conv);
19685 }
19686
19687 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
19688         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19689         *ret_conv = CResult_NoneErrorZ_clone(arg);
19690         return tag_ptr(ret_conv, true);
19691 }
19692 int64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint64_t arg) {
19693         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
19694         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
19695         return ret_conv;
19696 }
19697
19698 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint64_t orig) {
19699         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
19700         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19701         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
19702         return tag_ptr(ret_conv, true);
19703 }
19704
19705 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint64_t o) {
19706         void* o_ptr = untag_ptr(o);
19707         CHECK_ACCESS(o_ptr);
19708         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
19709         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
19710         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19711         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
19712         return tag_ptr(ret_conv, true);
19713 }
19714
19715 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint64_t e) {
19716         void* e_ptr = untag_ptr(e);
19717         CHECK_ACCESS(e_ptr);
19718         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19719         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19720         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19721         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
19722         return tag_ptr(ret_conv, true);
19723 }
19724
19725 jboolean  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint64_t o) {
19726         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
19727         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
19728         return ret_conv;
19729 }
19730
19731 void  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint64_t _res) {
19732         if (!ptr_is_owned(_res)) return;
19733         void* _res_ptr = untag_ptr(_res);
19734         CHECK_ACCESS(_res_ptr);
19735         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
19736         FREE(untag_ptr(_res));
19737         CResult_NetAddressDecodeErrorZ_free(_res_conv);
19738 }
19739
19740 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
19741         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19742         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
19743         return tag_ptr(ret_conv, true);
19744 }
19745 int64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
19746         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
19747         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
19748         return ret_conv;
19749 }
19750
19751 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint64_t orig) {
19752         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
19753         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19754         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
19755         return tag_ptr(ret_conv, true);
19756 }
19757
19758 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
19759         LDKCVec_UpdateAddHTLCZ _res_constr;
19760         _res_constr.datalen = _res->arr_len;
19761         if (_res_constr.datalen > 0)
19762                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19763         else
19764                 _res_constr.data = NULL;
19765         uint64_t* _res_vals = _res->elems;
19766         for (size_t p = 0; p < _res_constr.datalen; p++) {
19767                 uint64_t _res_conv_15 = _res_vals[p];
19768                 LDKUpdateAddHTLC _res_conv_15_conv;
19769                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
19770                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
19771                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
19772                 _res_constr.data[p] = _res_conv_15_conv;
19773         }
19774         FREE(_res);
19775         CVec_UpdateAddHTLCZ_free(_res_constr);
19776 }
19777
19778 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
19779         LDKCVec_UpdateFulfillHTLCZ _res_constr;
19780         _res_constr.datalen = _res->arr_len;
19781         if (_res_constr.datalen > 0)
19782                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19783         else
19784                 _res_constr.data = NULL;
19785         uint64_t* _res_vals = _res->elems;
19786         for (size_t t = 0; t < _res_constr.datalen; t++) {
19787                 uint64_t _res_conv_19 = _res_vals[t];
19788                 LDKUpdateFulfillHTLC _res_conv_19_conv;
19789                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
19790                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
19791                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
19792                 _res_constr.data[t] = _res_conv_19_conv;
19793         }
19794         FREE(_res);
19795         CVec_UpdateFulfillHTLCZ_free(_res_constr);
19796 }
19797
19798 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
19799         LDKCVec_UpdateFailHTLCZ _res_constr;
19800         _res_constr.datalen = _res->arr_len;
19801         if (_res_constr.datalen > 0)
19802                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19803         else
19804                 _res_constr.data = NULL;
19805         uint64_t* _res_vals = _res->elems;
19806         for (size_t q = 0; q < _res_constr.datalen; q++) {
19807                 uint64_t _res_conv_16 = _res_vals[q];
19808                 LDKUpdateFailHTLC _res_conv_16_conv;
19809                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
19810                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
19811                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
19812                 _res_constr.data[q] = _res_conv_16_conv;
19813         }
19814         FREE(_res);
19815         CVec_UpdateFailHTLCZ_free(_res_constr);
19816 }
19817
19818 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
19819         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
19820         _res_constr.datalen = _res->arr_len;
19821         if (_res_constr.datalen > 0)
19822                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
19823         else
19824                 _res_constr.data = NULL;
19825         uint64_t* _res_vals = _res->elems;
19826         for (size_t z = 0; z < _res_constr.datalen; z++) {
19827                 uint64_t _res_conv_25 = _res_vals[z];
19828                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
19829                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
19830                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
19831                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
19832                 _res_constr.data[z] = _res_conv_25_conv;
19833         }
19834         FREE(_res);
19835         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
19836 }
19837
19838 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
19839         LDKAcceptChannel o_conv;
19840         o_conv.inner = untag_ptr(o);
19841         o_conv.is_owned = ptr_is_owned(o);
19842         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19843         o_conv = AcceptChannel_clone(&o_conv);
19844         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19845         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
19846         return tag_ptr(ret_conv, true);
19847 }
19848
19849 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
19850         void* e_ptr = untag_ptr(e);
19851         CHECK_ACCESS(e_ptr);
19852         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19853         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19854         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19855         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
19856         return tag_ptr(ret_conv, true);
19857 }
19858
19859 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
19860         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
19861         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
19862         return ret_conv;
19863 }
19864
19865 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
19866         if (!ptr_is_owned(_res)) return;
19867         void* _res_ptr = untag_ptr(_res);
19868         CHECK_ACCESS(_res_ptr);
19869         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
19870         FREE(untag_ptr(_res));
19871         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
19872 }
19873
19874 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
19875         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19876         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
19877         return tag_ptr(ret_conv, true);
19878 }
19879 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
19880         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
19881         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
19882         return ret_conv;
19883 }
19884
19885 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
19886         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
19887         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19888         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
19889         return tag_ptr(ret_conv, true);
19890 }
19891
19892 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
19893         LDKAnnouncementSignatures o_conv;
19894         o_conv.inner = untag_ptr(o);
19895         o_conv.is_owned = ptr_is_owned(o);
19896         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19897         o_conv = AnnouncementSignatures_clone(&o_conv);
19898         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19899         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
19900         return tag_ptr(ret_conv, true);
19901 }
19902
19903 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
19904         void* e_ptr = untag_ptr(e);
19905         CHECK_ACCESS(e_ptr);
19906         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19907         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19908         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19909         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
19910         return tag_ptr(ret_conv, true);
19911 }
19912
19913 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
19914         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
19915         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
19916         return ret_conv;
19917 }
19918
19919 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
19920         if (!ptr_is_owned(_res)) return;
19921         void* _res_ptr = untag_ptr(_res);
19922         CHECK_ACCESS(_res_ptr);
19923         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
19924         FREE(untag_ptr(_res));
19925         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
19926 }
19927
19928 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
19929         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19930         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
19931         return tag_ptr(ret_conv, true);
19932 }
19933 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
19934         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
19935         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
19936         return ret_conv;
19937 }
19938
19939 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
19940         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
19941         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19942         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
19943         return tag_ptr(ret_conv, true);
19944 }
19945
19946 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
19947         LDKChannelReestablish o_conv;
19948         o_conv.inner = untag_ptr(o);
19949         o_conv.is_owned = ptr_is_owned(o);
19950         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19951         o_conv = ChannelReestablish_clone(&o_conv);
19952         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19953         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
19954         return tag_ptr(ret_conv, true);
19955 }
19956
19957 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
19958         void* e_ptr = untag_ptr(e);
19959         CHECK_ACCESS(e_ptr);
19960         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19961         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19962         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19963         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
19964         return tag_ptr(ret_conv, true);
19965 }
19966
19967 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
19968         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
19969         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
19970         return ret_conv;
19971 }
19972
19973 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
19974         if (!ptr_is_owned(_res)) return;
19975         void* _res_ptr = untag_ptr(_res);
19976         CHECK_ACCESS(_res_ptr);
19977         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
19978         FREE(untag_ptr(_res));
19979         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
19980 }
19981
19982 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
19983         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19984         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
19985         return tag_ptr(ret_conv, true);
19986 }
19987 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
19988         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
19989         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
19990         return ret_conv;
19991 }
19992
19993 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
19994         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
19995         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19996         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
19997         return tag_ptr(ret_conv, true);
19998 }
19999
20000 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
20001         LDKClosingSigned o_conv;
20002         o_conv.inner = untag_ptr(o);
20003         o_conv.is_owned = ptr_is_owned(o);
20004         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20005         o_conv = ClosingSigned_clone(&o_conv);
20006         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20007         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
20008         return tag_ptr(ret_conv, true);
20009 }
20010
20011 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
20012         void* e_ptr = untag_ptr(e);
20013         CHECK_ACCESS(e_ptr);
20014         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20015         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20016         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20017         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
20018         return tag_ptr(ret_conv, true);
20019 }
20020
20021 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
20022         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
20023         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
20024         return ret_conv;
20025 }
20026
20027 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
20028         if (!ptr_is_owned(_res)) return;
20029         void* _res_ptr = untag_ptr(_res);
20030         CHECK_ACCESS(_res_ptr);
20031         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
20032         FREE(untag_ptr(_res));
20033         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
20034 }
20035
20036 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
20037         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20038         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
20039         return tag_ptr(ret_conv, true);
20040 }
20041 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
20042         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
20043         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
20044         return ret_conv;
20045 }
20046
20047 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
20048         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
20049         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20050         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
20051         return tag_ptr(ret_conv, true);
20052 }
20053
20054 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
20055         LDKClosingSignedFeeRange o_conv;
20056         o_conv.inner = untag_ptr(o);
20057         o_conv.is_owned = ptr_is_owned(o);
20058         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20059         o_conv = ClosingSignedFeeRange_clone(&o_conv);
20060         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20061         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
20062         return tag_ptr(ret_conv, true);
20063 }
20064
20065 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
20066         void* e_ptr = untag_ptr(e);
20067         CHECK_ACCESS(e_ptr);
20068         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20069         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20070         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20071         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
20072         return tag_ptr(ret_conv, true);
20073 }
20074
20075 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
20076         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
20077         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
20078         return ret_conv;
20079 }
20080
20081 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
20082         if (!ptr_is_owned(_res)) return;
20083         void* _res_ptr = untag_ptr(_res);
20084         CHECK_ACCESS(_res_ptr);
20085         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
20086         FREE(untag_ptr(_res));
20087         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
20088 }
20089
20090 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
20091         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20092         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
20093         return tag_ptr(ret_conv, true);
20094 }
20095 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
20096         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
20097         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
20098         return ret_conv;
20099 }
20100
20101 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
20102         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
20103         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20104         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
20105         return tag_ptr(ret_conv, true);
20106 }
20107
20108 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
20109         LDKCommitmentSigned o_conv;
20110         o_conv.inner = untag_ptr(o);
20111         o_conv.is_owned = ptr_is_owned(o);
20112         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20113         o_conv = CommitmentSigned_clone(&o_conv);
20114         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20115         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
20116         return tag_ptr(ret_conv, true);
20117 }
20118
20119 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
20120         void* e_ptr = untag_ptr(e);
20121         CHECK_ACCESS(e_ptr);
20122         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20123         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20124         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20125         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
20126         return tag_ptr(ret_conv, true);
20127 }
20128
20129 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
20130         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
20131         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
20132         return ret_conv;
20133 }
20134
20135 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
20136         if (!ptr_is_owned(_res)) return;
20137         void* _res_ptr = untag_ptr(_res);
20138         CHECK_ACCESS(_res_ptr);
20139         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
20140         FREE(untag_ptr(_res));
20141         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
20142 }
20143
20144 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
20145         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20146         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
20147         return tag_ptr(ret_conv, true);
20148 }
20149 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
20150         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
20151         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
20152         return ret_conv;
20153 }
20154
20155 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
20156         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
20157         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20158         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
20159         return tag_ptr(ret_conv, true);
20160 }
20161
20162 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
20163         LDKFundingCreated o_conv;
20164         o_conv.inner = untag_ptr(o);
20165         o_conv.is_owned = ptr_is_owned(o);
20166         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20167         o_conv = FundingCreated_clone(&o_conv);
20168         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20169         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
20170         return tag_ptr(ret_conv, true);
20171 }
20172
20173 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
20174         void* e_ptr = untag_ptr(e);
20175         CHECK_ACCESS(e_ptr);
20176         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20177         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20178         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20179         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
20180         return tag_ptr(ret_conv, true);
20181 }
20182
20183 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
20184         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
20185         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
20186         return ret_conv;
20187 }
20188
20189 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
20190         if (!ptr_is_owned(_res)) return;
20191         void* _res_ptr = untag_ptr(_res);
20192         CHECK_ACCESS(_res_ptr);
20193         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
20194         FREE(untag_ptr(_res));
20195         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
20196 }
20197
20198 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
20199         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20200         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
20201         return tag_ptr(ret_conv, true);
20202 }
20203 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
20204         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
20205         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
20206         return ret_conv;
20207 }
20208
20209 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
20210         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
20211         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20212         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
20213         return tag_ptr(ret_conv, true);
20214 }
20215
20216 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
20217         LDKFundingSigned o_conv;
20218         o_conv.inner = untag_ptr(o);
20219         o_conv.is_owned = ptr_is_owned(o);
20220         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20221         o_conv = FundingSigned_clone(&o_conv);
20222         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20223         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
20224         return tag_ptr(ret_conv, true);
20225 }
20226
20227 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
20228         void* e_ptr = untag_ptr(e);
20229         CHECK_ACCESS(e_ptr);
20230         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20231         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20232         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20233         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
20234         return tag_ptr(ret_conv, true);
20235 }
20236
20237 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
20238         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
20239         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
20240         return ret_conv;
20241 }
20242
20243 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
20244         if (!ptr_is_owned(_res)) return;
20245         void* _res_ptr = untag_ptr(_res);
20246         CHECK_ACCESS(_res_ptr);
20247         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
20248         FREE(untag_ptr(_res));
20249         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
20250 }
20251
20252 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
20253         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20254         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
20255         return tag_ptr(ret_conv, true);
20256 }
20257 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
20258         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
20259         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
20260         return ret_conv;
20261 }
20262
20263 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
20264         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
20265         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20266         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
20267         return tag_ptr(ret_conv, true);
20268 }
20269
20270 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
20271         LDKChannelReady o_conv;
20272         o_conv.inner = untag_ptr(o);
20273         o_conv.is_owned = ptr_is_owned(o);
20274         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20275         o_conv = ChannelReady_clone(&o_conv);
20276         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20277         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
20278         return tag_ptr(ret_conv, true);
20279 }
20280
20281 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
20282         void* e_ptr = untag_ptr(e);
20283         CHECK_ACCESS(e_ptr);
20284         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20285         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20286         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20287         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
20288         return tag_ptr(ret_conv, true);
20289 }
20290
20291 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
20292         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
20293         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
20294         return ret_conv;
20295 }
20296
20297 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
20298         if (!ptr_is_owned(_res)) return;
20299         void* _res_ptr = untag_ptr(_res);
20300         CHECK_ACCESS(_res_ptr);
20301         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
20302         FREE(untag_ptr(_res));
20303         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
20304 }
20305
20306 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
20307         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20308         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
20309         return tag_ptr(ret_conv, true);
20310 }
20311 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
20312         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
20313         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
20314         return ret_conv;
20315 }
20316
20317 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
20318         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
20319         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20320         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
20321         return tag_ptr(ret_conv, true);
20322 }
20323
20324 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
20325         LDKInit o_conv;
20326         o_conv.inner = untag_ptr(o);
20327         o_conv.is_owned = ptr_is_owned(o);
20328         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20329         o_conv = Init_clone(&o_conv);
20330         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20331         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
20332         return tag_ptr(ret_conv, true);
20333 }
20334
20335 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
20336         void* e_ptr = untag_ptr(e);
20337         CHECK_ACCESS(e_ptr);
20338         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20339         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20340         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20341         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
20342         return tag_ptr(ret_conv, true);
20343 }
20344
20345 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
20346         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
20347         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
20348         return ret_conv;
20349 }
20350
20351 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
20352         if (!ptr_is_owned(_res)) return;
20353         void* _res_ptr = untag_ptr(_res);
20354         CHECK_ACCESS(_res_ptr);
20355         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
20356         FREE(untag_ptr(_res));
20357         CResult_InitDecodeErrorZ_free(_res_conv);
20358 }
20359
20360 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
20361         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20362         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
20363         return tag_ptr(ret_conv, true);
20364 }
20365 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
20366         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
20367         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
20368         return ret_conv;
20369 }
20370
20371 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
20372         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
20373         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20374         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
20375         return tag_ptr(ret_conv, true);
20376 }
20377
20378 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
20379         LDKOpenChannel o_conv;
20380         o_conv.inner = untag_ptr(o);
20381         o_conv.is_owned = ptr_is_owned(o);
20382         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20383         o_conv = OpenChannel_clone(&o_conv);
20384         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20385         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
20386         return tag_ptr(ret_conv, true);
20387 }
20388
20389 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
20390         void* e_ptr = untag_ptr(e);
20391         CHECK_ACCESS(e_ptr);
20392         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20393         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20394         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20395         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
20396         return tag_ptr(ret_conv, true);
20397 }
20398
20399 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
20400         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
20401         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
20402         return ret_conv;
20403 }
20404
20405 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
20406         if (!ptr_is_owned(_res)) return;
20407         void* _res_ptr = untag_ptr(_res);
20408         CHECK_ACCESS(_res_ptr);
20409         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
20410         FREE(untag_ptr(_res));
20411         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
20412 }
20413
20414 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
20415         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20416         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
20417         return tag_ptr(ret_conv, true);
20418 }
20419 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
20420         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
20421         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
20422         return ret_conv;
20423 }
20424
20425 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
20426         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
20427         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20428         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
20429         return tag_ptr(ret_conv, true);
20430 }
20431
20432 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
20433         LDKRevokeAndACK o_conv;
20434         o_conv.inner = untag_ptr(o);
20435         o_conv.is_owned = ptr_is_owned(o);
20436         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20437         o_conv = RevokeAndACK_clone(&o_conv);
20438         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20439         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
20440         return tag_ptr(ret_conv, true);
20441 }
20442
20443 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
20444         void* e_ptr = untag_ptr(e);
20445         CHECK_ACCESS(e_ptr);
20446         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20447         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20448         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20449         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
20450         return tag_ptr(ret_conv, true);
20451 }
20452
20453 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
20454         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
20455         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
20456         return ret_conv;
20457 }
20458
20459 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
20460         if (!ptr_is_owned(_res)) return;
20461         void* _res_ptr = untag_ptr(_res);
20462         CHECK_ACCESS(_res_ptr);
20463         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
20464         FREE(untag_ptr(_res));
20465         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
20466 }
20467
20468 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
20469         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20470         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
20471         return tag_ptr(ret_conv, true);
20472 }
20473 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
20474         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
20475         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
20476         return ret_conv;
20477 }
20478
20479 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
20480         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
20481         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20482         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
20483         return tag_ptr(ret_conv, true);
20484 }
20485
20486 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
20487         LDKShutdown o_conv;
20488         o_conv.inner = untag_ptr(o);
20489         o_conv.is_owned = ptr_is_owned(o);
20490         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20491         o_conv = Shutdown_clone(&o_conv);
20492         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20493         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
20494         return tag_ptr(ret_conv, true);
20495 }
20496
20497 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
20498         void* e_ptr = untag_ptr(e);
20499         CHECK_ACCESS(e_ptr);
20500         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20501         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20502         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20503         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
20504         return tag_ptr(ret_conv, true);
20505 }
20506
20507 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
20508         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
20509         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
20510         return ret_conv;
20511 }
20512
20513 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
20514         if (!ptr_is_owned(_res)) return;
20515         void* _res_ptr = untag_ptr(_res);
20516         CHECK_ACCESS(_res_ptr);
20517         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
20518         FREE(untag_ptr(_res));
20519         CResult_ShutdownDecodeErrorZ_free(_res_conv);
20520 }
20521
20522 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
20523         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20524         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
20525         return tag_ptr(ret_conv, true);
20526 }
20527 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
20528         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
20529         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
20530         return ret_conv;
20531 }
20532
20533 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
20534         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
20535         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20536         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
20537         return tag_ptr(ret_conv, true);
20538 }
20539
20540 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
20541         LDKUpdateFailHTLC o_conv;
20542         o_conv.inner = untag_ptr(o);
20543         o_conv.is_owned = ptr_is_owned(o);
20544         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20545         o_conv = UpdateFailHTLC_clone(&o_conv);
20546         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20547         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
20548         return tag_ptr(ret_conv, true);
20549 }
20550
20551 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
20552         void* e_ptr = untag_ptr(e);
20553         CHECK_ACCESS(e_ptr);
20554         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20555         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20556         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20557         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
20558         return tag_ptr(ret_conv, true);
20559 }
20560
20561 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
20562         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
20563         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
20564         return ret_conv;
20565 }
20566
20567 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
20568         if (!ptr_is_owned(_res)) return;
20569         void* _res_ptr = untag_ptr(_res);
20570         CHECK_ACCESS(_res_ptr);
20571         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
20572         FREE(untag_ptr(_res));
20573         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
20574 }
20575
20576 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
20577         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20578         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
20579         return tag_ptr(ret_conv, true);
20580 }
20581 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20582         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
20583         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
20584         return ret_conv;
20585 }
20586
20587 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
20588         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
20589         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20590         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
20591         return tag_ptr(ret_conv, true);
20592 }
20593
20594 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
20595         LDKUpdateFailMalformedHTLC o_conv;
20596         o_conv.inner = untag_ptr(o);
20597         o_conv.is_owned = ptr_is_owned(o);
20598         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20599         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
20600         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20601         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
20602         return tag_ptr(ret_conv, true);
20603 }
20604
20605 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
20606         void* e_ptr = untag_ptr(e);
20607         CHECK_ACCESS(e_ptr);
20608         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20609         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20610         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20611         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
20612         return tag_ptr(ret_conv, true);
20613 }
20614
20615 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
20616         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
20617         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
20618         return ret_conv;
20619 }
20620
20621 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
20622         if (!ptr_is_owned(_res)) return;
20623         void* _res_ptr = untag_ptr(_res);
20624         CHECK_ACCESS(_res_ptr);
20625         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
20626         FREE(untag_ptr(_res));
20627         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
20628 }
20629
20630 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
20631         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20632         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
20633         return tag_ptr(ret_conv, true);
20634 }
20635 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20636         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
20637         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
20638         return ret_conv;
20639 }
20640
20641 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
20642         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
20643         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20644         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
20645         return tag_ptr(ret_conv, true);
20646 }
20647
20648 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
20649         LDKUpdateFee o_conv;
20650         o_conv.inner = untag_ptr(o);
20651         o_conv.is_owned = ptr_is_owned(o);
20652         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20653         o_conv = UpdateFee_clone(&o_conv);
20654         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20655         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
20656         return tag_ptr(ret_conv, true);
20657 }
20658
20659 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
20660         void* e_ptr = untag_ptr(e);
20661         CHECK_ACCESS(e_ptr);
20662         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20663         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20664         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20665         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
20666         return tag_ptr(ret_conv, true);
20667 }
20668
20669 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
20670         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
20671         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
20672         return ret_conv;
20673 }
20674
20675 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
20676         if (!ptr_is_owned(_res)) return;
20677         void* _res_ptr = untag_ptr(_res);
20678         CHECK_ACCESS(_res_ptr);
20679         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
20680         FREE(untag_ptr(_res));
20681         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
20682 }
20683
20684 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
20685         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20686         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
20687         return tag_ptr(ret_conv, true);
20688 }
20689 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
20690         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
20691         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
20692         return ret_conv;
20693 }
20694
20695 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
20696         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
20697         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20698         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
20699         return tag_ptr(ret_conv, true);
20700 }
20701
20702 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
20703         LDKUpdateFulfillHTLC o_conv;
20704         o_conv.inner = untag_ptr(o);
20705         o_conv.is_owned = ptr_is_owned(o);
20706         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20707         o_conv = UpdateFulfillHTLC_clone(&o_conv);
20708         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20709         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
20710         return tag_ptr(ret_conv, true);
20711 }
20712
20713 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
20714         void* e_ptr = untag_ptr(e);
20715         CHECK_ACCESS(e_ptr);
20716         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20717         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20718         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20719         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
20720         return tag_ptr(ret_conv, true);
20721 }
20722
20723 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
20724         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
20725         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
20726         return ret_conv;
20727 }
20728
20729 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
20730         if (!ptr_is_owned(_res)) return;
20731         void* _res_ptr = untag_ptr(_res);
20732         CHECK_ACCESS(_res_ptr);
20733         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
20734         FREE(untag_ptr(_res));
20735         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
20736 }
20737
20738 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
20739         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20740         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
20741         return tag_ptr(ret_conv, true);
20742 }
20743 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20744         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
20745         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
20746         return ret_conv;
20747 }
20748
20749 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
20750         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
20751         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20752         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
20753         return tag_ptr(ret_conv, true);
20754 }
20755
20756 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
20757         LDKUpdateAddHTLC o_conv;
20758         o_conv.inner = untag_ptr(o);
20759         o_conv.is_owned = ptr_is_owned(o);
20760         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20761         o_conv = UpdateAddHTLC_clone(&o_conv);
20762         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20763         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
20764         return tag_ptr(ret_conv, true);
20765 }
20766
20767 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
20768         void* e_ptr = untag_ptr(e);
20769         CHECK_ACCESS(e_ptr);
20770         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20771         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20772         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20773         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
20774         return tag_ptr(ret_conv, true);
20775 }
20776
20777 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
20778         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
20779         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
20780         return ret_conv;
20781 }
20782
20783 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
20784         if (!ptr_is_owned(_res)) return;
20785         void* _res_ptr = untag_ptr(_res);
20786         CHECK_ACCESS(_res_ptr);
20787         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
20788         FREE(untag_ptr(_res));
20789         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
20790 }
20791
20792 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
20793         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20794         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
20795         return tag_ptr(ret_conv, true);
20796 }
20797 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20798         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
20799         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
20800         return ret_conv;
20801 }
20802
20803 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
20804         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
20805         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20806         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
20807         return tag_ptr(ret_conv, true);
20808 }
20809
20810 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
20811         LDKOnionMessage o_conv;
20812         o_conv.inner = untag_ptr(o);
20813         o_conv.is_owned = ptr_is_owned(o);
20814         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20815         o_conv = OnionMessage_clone(&o_conv);
20816         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
20817         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
20818         return tag_ptr(ret_conv, true);
20819 }
20820
20821 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
20822         void* e_ptr = untag_ptr(e);
20823         CHECK_ACCESS(e_ptr);
20824         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20825         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20826         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
20827         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
20828         return tag_ptr(ret_conv, true);
20829 }
20830
20831 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
20832         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
20833         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
20834         return ret_conv;
20835 }
20836
20837 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
20838         if (!ptr_is_owned(_res)) return;
20839         void* _res_ptr = untag_ptr(_res);
20840         CHECK_ACCESS(_res_ptr);
20841         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
20842         FREE(untag_ptr(_res));
20843         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
20844 }
20845
20846 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
20847         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
20848         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
20849         return tag_ptr(ret_conv, true);
20850 }
20851 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
20852         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
20853         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
20854         return ret_conv;
20855 }
20856
20857 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
20858         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
20859         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
20860         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
20861         return tag_ptr(ret_conv, true);
20862 }
20863
20864 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
20865         LDKPing o_conv;
20866         o_conv.inner = untag_ptr(o);
20867         o_conv.is_owned = ptr_is_owned(o);
20868         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20869         o_conv = Ping_clone(&o_conv);
20870         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20871         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
20872         return tag_ptr(ret_conv, true);
20873 }
20874
20875 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
20876         void* e_ptr = untag_ptr(e);
20877         CHECK_ACCESS(e_ptr);
20878         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20879         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20880         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20881         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
20882         return tag_ptr(ret_conv, true);
20883 }
20884
20885 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
20886         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
20887         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
20888         return ret_conv;
20889 }
20890
20891 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
20892         if (!ptr_is_owned(_res)) return;
20893         void* _res_ptr = untag_ptr(_res);
20894         CHECK_ACCESS(_res_ptr);
20895         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
20896         FREE(untag_ptr(_res));
20897         CResult_PingDecodeErrorZ_free(_res_conv);
20898 }
20899
20900 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
20901         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20902         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
20903         return tag_ptr(ret_conv, true);
20904 }
20905 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
20906         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
20907         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
20908         return ret_conv;
20909 }
20910
20911 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
20912         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
20913         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20914         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
20915         return tag_ptr(ret_conv, true);
20916 }
20917
20918 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
20919         LDKPong o_conv;
20920         o_conv.inner = untag_ptr(o);
20921         o_conv.is_owned = ptr_is_owned(o);
20922         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20923         o_conv = Pong_clone(&o_conv);
20924         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20925         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
20926         return tag_ptr(ret_conv, true);
20927 }
20928
20929 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
20930         void* e_ptr = untag_ptr(e);
20931         CHECK_ACCESS(e_ptr);
20932         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20933         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20934         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20935         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
20936         return tag_ptr(ret_conv, true);
20937 }
20938
20939 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
20940         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
20941         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
20942         return ret_conv;
20943 }
20944
20945 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
20946         if (!ptr_is_owned(_res)) return;
20947         void* _res_ptr = untag_ptr(_res);
20948         CHECK_ACCESS(_res_ptr);
20949         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
20950         FREE(untag_ptr(_res));
20951         CResult_PongDecodeErrorZ_free(_res_conv);
20952 }
20953
20954 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
20955         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20956         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
20957         return tag_ptr(ret_conv, true);
20958 }
20959 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
20960         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
20961         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
20962         return ret_conv;
20963 }
20964
20965 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
20966         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
20967         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20968         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
20969         return tag_ptr(ret_conv, true);
20970 }
20971
20972 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
20973         LDKUnsignedChannelAnnouncement o_conv;
20974         o_conv.inner = untag_ptr(o);
20975         o_conv.is_owned = ptr_is_owned(o);
20976         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20977         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
20978         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20979         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
20980         return tag_ptr(ret_conv, true);
20981 }
20982
20983 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
20984         void* e_ptr = untag_ptr(e);
20985         CHECK_ACCESS(e_ptr);
20986         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20987         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20988         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20989         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
20990         return tag_ptr(ret_conv, true);
20991 }
20992
20993 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
20994         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
20995         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
20996         return ret_conv;
20997 }
20998
20999 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
21000         if (!ptr_is_owned(_res)) return;
21001         void* _res_ptr = untag_ptr(_res);
21002         CHECK_ACCESS(_res_ptr);
21003         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
21004         FREE(untag_ptr(_res));
21005         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
21006 }
21007
21008 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21009         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21010         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
21011         return tag_ptr(ret_conv, true);
21012 }
21013 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21014         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
21015         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21016         return ret_conv;
21017 }
21018
21019 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21020         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
21021         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21022         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
21023         return tag_ptr(ret_conv, true);
21024 }
21025
21026 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
21027         LDKChannelAnnouncement o_conv;
21028         o_conv.inner = untag_ptr(o);
21029         o_conv.is_owned = ptr_is_owned(o);
21030         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21031         o_conv = ChannelAnnouncement_clone(&o_conv);
21032         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21033         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
21034         return tag_ptr(ret_conv, true);
21035 }
21036
21037 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
21038         void* e_ptr = untag_ptr(e);
21039         CHECK_ACCESS(e_ptr);
21040         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21041         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21042         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21043         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
21044         return tag_ptr(ret_conv, true);
21045 }
21046
21047 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21048         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
21049         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
21050         return ret_conv;
21051 }
21052
21053 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
21054         if (!ptr_is_owned(_res)) return;
21055         void* _res_ptr = untag_ptr(_res);
21056         CHECK_ACCESS(_res_ptr);
21057         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
21058         FREE(untag_ptr(_res));
21059         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
21060 }
21061
21062 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21063         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21064         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
21065         return tag_ptr(ret_conv, true);
21066 }
21067 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21068         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
21069         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21070         return ret_conv;
21071 }
21072
21073 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21074         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
21075         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21076         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
21077         return tag_ptr(ret_conv, true);
21078 }
21079
21080 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
21081         LDKUnsignedChannelUpdate o_conv;
21082         o_conv.inner = untag_ptr(o);
21083         o_conv.is_owned = ptr_is_owned(o);
21084         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21085         o_conv = UnsignedChannelUpdate_clone(&o_conv);
21086         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21087         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
21088         return tag_ptr(ret_conv, true);
21089 }
21090
21091 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
21092         void* e_ptr = untag_ptr(e);
21093         CHECK_ACCESS(e_ptr);
21094         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21095         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21096         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21097         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
21098         return tag_ptr(ret_conv, true);
21099 }
21100
21101 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
21102         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
21103         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
21104         return ret_conv;
21105 }
21106
21107 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
21108         if (!ptr_is_owned(_res)) return;
21109         void* _res_ptr = untag_ptr(_res);
21110         CHECK_ACCESS(_res_ptr);
21111         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
21112         FREE(untag_ptr(_res));
21113         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
21114 }
21115
21116 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
21117         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21118         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
21119         return tag_ptr(ret_conv, true);
21120 }
21121 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21122         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
21123         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
21124         return ret_conv;
21125 }
21126
21127 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
21128         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
21129         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21130         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
21131         return tag_ptr(ret_conv, true);
21132 }
21133
21134 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
21135         LDKChannelUpdate o_conv;
21136         o_conv.inner = untag_ptr(o);
21137         o_conv.is_owned = ptr_is_owned(o);
21138         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21139         o_conv = ChannelUpdate_clone(&o_conv);
21140         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21141         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
21142         return tag_ptr(ret_conv, true);
21143 }
21144
21145 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
21146         void* e_ptr = untag_ptr(e);
21147         CHECK_ACCESS(e_ptr);
21148         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21149         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21150         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21151         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
21152         return tag_ptr(ret_conv, true);
21153 }
21154
21155 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
21156         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
21157         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
21158         return ret_conv;
21159 }
21160
21161 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
21162         if (!ptr_is_owned(_res)) return;
21163         void* _res_ptr = untag_ptr(_res);
21164         CHECK_ACCESS(_res_ptr);
21165         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
21166         FREE(untag_ptr(_res));
21167         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
21168 }
21169
21170 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
21171         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21172         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
21173         return tag_ptr(ret_conv, true);
21174 }
21175 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21176         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
21177         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
21178         return ret_conv;
21179 }
21180
21181 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
21182         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
21183         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21184         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
21185         return tag_ptr(ret_conv, true);
21186 }
21187
21188 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
21189         LDKErrorMessage o_conv;
21190         o_conv.inner = untag_ptr(o);
21191         o_conv.is_owned = ptr_is_owned(o);
21192         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21193         o_conv = ErrorMessage_clone(&o_conv);
21194         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21195         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
21196         return tag_ptr(ret_conv, true);
21197 }
21198
21199 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
21200         void* e_ptr = untag_ptr(e);
21201         CHECK_ACCESS(e_ptr);
21202         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21203         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21204         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21205         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
21206         return tag_ptr(ret_conv, true);
21207 }
21208
21209 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
21210         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
21211         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
21212         return ret_conv;
21213 }
21214
21215 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
21216         if (!ptr_is_owned(_res)) return;
21217         void* _res_ptr = untag_ptr(_res);
21218         CHECK_ACCESS(_res_ptr);
21219         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
21220         FREE(untag_ptr(_res));
21221         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
21222 }
21223
21224 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
21225         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21226         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
21227         return tag_ptr(ret_conv, true);
21228 }
21229 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
21230         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
21231         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
21232         return ret_conv;
21233 }
21234
21235 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
21236         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
21237         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21238         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
21239         return tag_ptr(ret_conv, true);
21240 }
21241
21242 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
21243         LDKWarningMessage o_conv;
21244         o_conv.inner = untag_ptr(o);
21245         o_conv.is_owned = ptr_is_owned(o);
21246         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21247         o_conv = WarningMessage_clone(&o_conv);
21248         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21249         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
21250         return tag_ptr(ret_conv, true);
21251 }
21252
21253 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
21254         void* e_ptr = untag_ptr(e);
21255         CHECK_ACCESS(e_ptr);
21256         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21257         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21258         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21259         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
21260         return tag_ptr(ret_conv, true);
21261 }
21262
21263 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
21264         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
21265         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
21266         return ret_conv;
21267 }
21268
21269 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
21270         if (!ptr_is_owned(_res)) return;
21271         void* _res_ptr = untag_ptr(_res);
21272         CHECK_ACCESS(_res_ptr);
21273         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
21274         FREE(untag_ptr(_res));
21275         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
21276 }
21277
21278 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
21279         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21280         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
21281         return tag_ptr(ret_conv, true);
21282 }
21283 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
21284         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
21285         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
21286         return ret_conv;
21287 }
21288
21289 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
21290         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
21291         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21292         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
21293         return tag_ptr(ret_conv, true);
21294 }
21295
21296 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
21297         LDKUnsignedNodeAnnouncement o_conv;
21298         o_conv.inner = untag_ptr(o);
21299         o_conv.is_owned = ptr_is_owned(o);
21300         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21301         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
21302         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21303         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
21304         return tag_ptr(ret_conv, true);
21305 }
21306
21307 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
21308         void* e_ptr = untag_ptr(e);
21309         CHECK_ACCESS(e_ptr);
21310         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21311         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21312         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21313         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
21314         return tag_ptr(ret_conv, true);
21315 }
21316
21317 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21318         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
21319         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
21320         return ret_conv;
21321 }
21322
21323 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
21324         if (!ptr_is_owned(_res)) return;
21325         void* _res_ptr = untag_ptr(_res);
21326         CHECK_ACCESS(_res_ptr);
21327         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
21328         FREE(untag_ptr(_res));
21329         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
21330 }
21331
21332 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21333         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21334         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
21335         return tag_ptr(ret_conv, true);
21336 }
21337 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21338         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
21339         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21340         return ret_conv;
21341 }
21342
21343 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21344         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
21345         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21346         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
21347         return tag_ptr(ret_conv, true);
21348 }
21349
21350 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
21351         LDKNodeAnnouncement o_conv;
21352         o_conv.inner = untag_ptr(o);
21353         o_conv.is_owned = ptr_is_owned(o);
21354         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21355         o_conv = NodeAnnouncement_clone(&o_conv);
21356         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21357         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
21358         return tag_ptr(ret_conv, true);
21359 }
21360
21361 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
21362         void* e_ptr = untag_ptr(e);
21363         CHECK_ACCESS(e_ptr);
21364         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21365         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21366         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21367         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
21368         return tag_ptr(ret_conv, true);
21369 }
21370
21371 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21372         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
21373         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
21374         return ret_conv;
21375 }
21376
21377 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
21378         if (!ptr_is_owned(_res)) return;
21379         void* _res_ptr = untag_ptr(_res);
21380         CHECK_ACCESS(_res_ptr);
21381         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
21382         FREE(untag_ptr(_res));
21383         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
21384 }
21385
21386 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21387         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21388         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
21389         return tag_ptr(ret_conv, true);
21390 }
21391 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21392         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
21393         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21394         return ret_conv;
21395 }
21396
21397 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21398         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
21399         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21400         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
21401         return tag_ptr(ret_conv, true);
21402 }
21403
21404 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
21405         LDKQueryShortChannelIds o_conv;
21406         o_conv.inner = untag_ptr(o);
21407         o_conv.is_owned = ptr_is_owned(o);
21408         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21409         o_conv = QueryShortChannelIds_clone(&o_conv);
21410         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21411         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
21412         return tag_ptr(ret_conv, true);
21413 }
21414
21415 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
21416         void* e_ptr = untag_ptr(e);
21417         CHECK_ACCESS(e_ptr);
21418         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21419         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21420         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21421         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
21422         return tag_ptr(ret_conv, true);
21423 }
21424
21425 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
21426         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
21427         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
21428         return ret_conv;
21429 }
21430
21431 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
21432         if (!ptr_is_owned(_res)) return;
21433         void* _res_ptr = untag_ptr(_res);
21434         CHECK_ACCESS(_res_ptr);
21435         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
21436         FREE(untag_ptr(_res));
21437         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
21438 }
21439
21440 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
21441         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21442         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
21443         return tag_ptr(ret_conv, true);
21444 }
21445 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
21446         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
21447         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
21448         return ret_conv;
21449 }
21450
21451 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
21452         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
21453         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21454         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
21455         return tag_ptr(ret_conv, true);
21456 }
21457
21458 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
21459         LDKReplyShortChannelIdsEnd o_conv;
21460         o_conv.inner = untag_ptr(o);
21461         o_conv.is_owned = ptr_is_owned(o);
21462         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21463         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
21464         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21465         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
21466         return tag_ptr(ret_conv, true);
21467 }
21468
21469 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
21470         void* e_ptr = untag_ptr(e);
21471         CHECK_ACCESS(e_ptr);
21472         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21473         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21474         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21475         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
21476         return tag_ptr(ret_conv, true);
21477 }
21478
21479 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
21480         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
21481         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
21482         return ret_conv;
21483 }
21484
21485 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
21486         if (!ptr_is_owned(_res)) return;
21487         void* _res_ptr = untag_ptr(_res);
21488         CHECK_ACCESS(_res_ptr);
21489         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
21490         FREE(untag_ptr(_res));
21491         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
21492 }
21493
21494 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
21495         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21496         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
21497         return tag_ptr(ret_conv, true);
21498 }
21499 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
21500         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
21501         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
21502         return ret_conv;
21503 }
21504
21505 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
21506         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
21507         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21508         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
21509         return tag_ptr(ret_conv, true);
21510 }
21511
21512 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
21513         LDKQueryChannelRange o_conv;
21514         o_conv.inner = untag_ptr(o);
21515         o_conv.is_owned = ptr_is_owned(o);
21516         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21517         o_conv = QueryChannelRange_clone(&o_conv);
21518         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21519         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
21520         return tag_ptr(ret_conv, true);
21521 }
21522
21523 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
21524         void* e_ptr = untag_ptr(e);
21525         CHECK_ACCESS(e_ptr);
21526         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21527         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21528         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21529         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
21530         return tag_ptr(ret_conv, true);
21531 }
21532
21533 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
21534         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
21535         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
21536         return ret_conv;
21537 }
21538
21539 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
21540         if (!ptr_is_owned(_res)) return;
21541         void* _res_ptr = untag_ptr(_res);
21542         CHECK_ACCESS(_res_ptr);
21543         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
21544         FREE(untag_ptr(_res));
21545         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
21546 }
21547
21548 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
21549         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21550         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
21551         return tag_ptr(ret_conv, true);
21552 }
21553 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
21554         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
21555         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
21556         return ret_conv;
21557 }
21558
21559 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
21560         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
21561         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21562         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
21563         return tag_ptr(ret_conv, true);
21564 }
21565
21566 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
21567         LDKReplyChannelRange o_conv;
21568         o_conv.inner = untag_ptr(o);
21569         o_conv.is_owned = ptr_is_owned(o);
21570         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21571         o_conv = ReplyChannelRange_clone(&o_conv);
21572         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21573         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
21574         return tag_ptr(ret_conv, true);
21575 }
21576
21577 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
21578         void* e_ptr = untag_ptr(e);
21579         CHECK_ACCESS(e_ptr);
21580         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21581         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21582         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21583         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
21584         return tag_ptr(ret_conv, true);
21585 }
21586
21587 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
21588         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
21589         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
21590         return ret_conv;
21591 }
21592
21593 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
21594         if (!ptr_is_owned(_res)) return;
21595         void* _res_ptr = untag_ptr(_res);
21596         CHECK_ACCESS(_res_ptr);
21597         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
21598         FREE(untag_ptr(_res));
21599         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
21600 }
21601
21602 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
21603         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21604         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
21605         return tag_ptr(ret_conv, true);
21606 }
21607 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
21608         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
21609         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
21610         return ret_conv;
21611 }
21612
21613 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
21614         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
21615         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21616         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
21617         return tag_ptr(ret_conv, true);
21618 }
21619
21620 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
21621         LDKGossipTimestampFilter o_conv;
21622         o_conv.inner = untag_ptr(o);
21623         o_conv.is_owned = ptr_is_owned(o);
21624         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21625         o_conv = GossipTimestampFilter_clone(&o_conv);
21626         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21627         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
21628         return tag_ptr(ret_conv, true);
21629 }
21630
21631 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
21632         void* e_ptr = untag_ptr(e);
21633         CHECK_ACCESS(e_ptr);
21634         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21635         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21636         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21637         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
21638         return tag_ptr(ret_conv, true);
21639 }
21640
21641 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
21642         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
21643         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
21644         return ret_conv;
21645 }
21646
21647 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
21648         if (!ptr_is_owned(_res)) return;
21649         void* _res_ptr = untag_ptr(_res);
21650         CHECK_ACCESS(_res_ptr);
21651         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
21652         FREE(untag_ptr(_res));
21653         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
21654 }
21655
21656 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
21657         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21658         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
21659         return tag_ptr(ret_conv, true);
21660 }
21661 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
21662         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
21663         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
21664         return ret_conv;
21665 }
21666
21667 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
21668         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
21669         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21670         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
21671         return tag_ptr(ret_conv, true);
21672 }
21673
21674 void  __attribute__((export_name("TS_CVec_PhantomRouteHintsZ_free"))) TS_CVec_PhantomRouteHintsZ_free(uint64_tArray _res) {
21675         LDKCVec_PhantomRouteHintsZ _res_constr;
21676         _res_constr.datalen = _res->arr_len;
21677         if (_res_constr.datalen > 0)
21678                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
21679         else
21680                 _res_constr.data = NULL;
21681         uint64_t* _res_vals = _res->elems;
21682         for (size_t t = 0; t < _res_constr.datalen; t++) {
21683                 uint64_t _res_conv_19 = _res_vals[t];
21684                 LDKPhantomRouteHints _res_conv_19_conv;
21685                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
21686                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
21687                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
21688                 _res_constr.data[t] = _res_conv_19_conv;
21689         }
21690         FREE(_res);
21691         CVec_PhantomRouteHintsZ_free(_res_constr);
21692 }
21693
21694 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
21695         LDKInvoice o_conv;
21696         o_conv.inner = untag_ptr(o);
21697         o_conv.is_owned = ptr_is_owned(o);
21698         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21699         o_conv = Invoice_clone(&o_conv);
21700         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21701         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
21702         return tag_ptr(ret_conv, true);
21703 }
21704
21705 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint64_t e) {
21706         void* e_ptr = untag_ptr(e);
21707         CHECK_ACCESS(e_ptr);
21708         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
21709         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
21710         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21711         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
21712         return tag_ptr(ret_conv, true);
21713 }
21714
21715 jboolean  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
21716         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
21717         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
21718         return ret_conv;
21719 }
21720
21721 void  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
21722         if (!ptr_is_owned(_res)) return;
21723         void* _res_ptr = untag_ptr(_res);
21724         CHECK_ACCESS(_res_ptr);
21725         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
21726         FREE(untag_ptr(_res));
21727         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
21728 }
21729
21730 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
21731         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21732         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
21733         return tag_ptr(ret_conv, true);
21734 }
21735 int64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
21736         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
21737         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
21738         return ret_conv;
21739 }
21740
21741 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
21742         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
21743         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21744         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
21745         return tag_ptr(ret_conv, true);
21746 }
21747
21748 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
21749         void* o_ptr = untag_ptr(o);
21750         CHECK_ACCESS(o_ptr);
21751         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
21752         if (o_conv.free == LDKFilter_JCalls_free) {
21753                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21754                 LDKFilter_JCalls_cloned(&o_conv);
21755         }
21756         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
21757         *ret_copy = COption_FilterZ_some(o_conv);
21758         uint64_t ret_ref = tag_ptr(ret_copy, true);
21759         return ret_ref;
21760 }
21761
21762 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
21763         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
21764         *ret_copy = COption_FilterZ_none();
21765         uint64_t ret_ref = tag_ptr(ret_copy, true);
21766         return ret_ref;
21767 }
21768
21769 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
21770         if (!ptr_is_owned(_res)) return;
21771         void* _res_ptr = untag_ptr(_res);
21772         CHECK_ACCESS(_res_ptr);
21773         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
21774         FREE(untag_ptr(_res));
21775         COption_FilterZ_free(_res_conv);
21776 }
21777
21778 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
21779         LDKLockedChannelMonitor o_conv;
21780         o_conv.inner = untag_ptr(o);
21781         o_conv.is_owned = ptr_is_owned(o);
21782         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21783         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
21784         
21785         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21786         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
21787         return tag_ptr(ret_conv, true);
21788 }
21789
21790 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
21791         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21792         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
21793         return tag_ptr(ret_conv, true);
21794 }
21795
21796 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
21797         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
21798         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
21799         return ret_conv;
21800 }
21801
21802 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
21803         if (!ptr_is_owned(_res)) return;
21804         void* _res_ptr = untag_ptr(_res);
21805         CHECK_ACCESS(_res_ptr);
21806         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
21807         FREE(untag_ptr(_res));
21808         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
21809 }
21810
21811 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
21812         LDKCVec_OutPointZ _res_constr;
21813         _res_constr.datalen = _res->arr_len;
21814         if (_res_constr.datalen > 0)
21815                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
21816         else
21817                 _res_constr.data = NULL;
21818         uint64_t* _res_vals = _res->elems;
21819         for (size_t k = 0; k < _res_constr.datalen; k++) {
21820                 uint64_t _res_conv_10 = _res_vals[k];
21821                 LDKOutPoint _res_conv_10_conv;
21822                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
21823                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
21824                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
21825                 _res_constr.data[k] = _res_conv_10_conv;
21826         }
21827         FREE(_res);
21828         CVec_OutPointZ_free(_res_constr);
21829 }
21830
21831 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
21832         LDKCVec_MonitorUpdateIdZ _res_constr;
21833         _res_constr.datalen = _res->arr_len;
21834         if (_res_constr.datalen > 0)
21835                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
21836         else
21837                 _res_constr.data = NULL;
21838         uint64_t* _res_vals = _res->elems;
21839         for (size_t r = 0; r < _res_constr.datalen; r++) {
21840                 uint64_t _res_conv_17 = _res_vals[r];
21841                 LDKMonitorUpdateId _res_conv_17_conv;
21842                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
21843                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
21844                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
21845                 _res_constr.data[r] = _res_conv_17_conv;
21846         }
21847         FREE(_res);
21848         CVec_MonitorUpdateIdZ_free(_res_constr);
21849 }
21850
21851 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
21852         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
21853         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
21854         return tag_ptr(ret_conv, true);
21855 }
21856 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
21857         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
21858         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
21859         return ret_conv;
21860 }
21861
21862 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
21863         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
21864         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
21865         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
21866         return tag_ptr(ret_conv, true);
21867 }
21868
21869 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
21870         LDKOutPoint a_conv;
21871         a_conv.inner = untag_ptr(a);
21872         a_conv.is_owned = ptr_is_owned(a);
21873         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21874         a_conv = OutPoint_clone(&a_conv);
21875         LDKCVec_MonitorUpdateIdZ b_constr;
21876         b_constr.datalen = b->arr_len;
21877         if (b_constr.datalen > 0)
21878                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
21879         else
21880                 b_constr.data = NULL;
21881         uint64_t* b_vals = b->elems;
21882         for (size_t r = 0; r < b_constr.datalen; r++) {
21883                 uint64_t b_conv_17 = b_vals[r];
21884                 LDKMonitorUpdateId b_conv_17_conv;
21885                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
21886                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
21887                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
21888                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
21889                 b_constr.data[r] = b_conv_17_conv;
21890         }
21891         FREE(b);
21892         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
21893         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
21894         return tag_ptr(ret_conv, true);
21895 }
21896
21897 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
21898         if (!ptr_is_owned(_res)) return;
21899         void* _res_ptr = untag_ptr(_res);
21900         CHECK_ACCESS(_res_ptr);
21901         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
21902         FREE(untag_ptr(_res));
21903         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
21904 }
21905
21906 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
21907         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
21908         _res_constr.datalen = _res->arr_len;
21909         if (_res_constr.datalen > 0)
21910                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
21911         else
21912                 _res_constr.data = NULL;
21913         uint64_t* _res_vals = _res->elems;
21914         for (size_t p = 0; p < _res_constr.datalen; p++) {
21915                 uint64_t _res_conv_41 = _res_vals[p];
21916                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
21917                 CHECK_ACCESS(_res_conv_41_ptr);
21918                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
21919                 FREE(untag_ptr(_res_conv_41));
21920                 _res_constr.data[p] = _res_conv_41_conv;
21921         }
21922         FREE(_res);
21923         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
21924 }
21925
21926 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
21927         if (!ptr_is_owned(this_ptr)) return;
21928         void* this_ptr_ptr = untag_ptr(this_ptr);
21929         CHECK_ACCESS(this_ptr_ptr);
21930         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
21931         FREE(untag_ptr(this_ptr));
21932         PaymentPurpose_free(this_ptr_conv);
21933 }
21934
21935 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
21936         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21937         *ret_copy = PaymentPurpose_clone(arg);
21938         uint64_t ret_ref = tag_ptr(ret_copy, true);
21939         return ret_ref;
21940 }
21941 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
21942         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
21943         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
21944         return ret_conv;
21945 }
21946
21947 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
21948         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
21949         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21950         *ret_copy = PaymentPurpose_clone(orig_conv);
21951         uint64_t ret_ref = tag_ptr(ret_copy, true);
21952         return ret_ref;
21953 }
21954
21955 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
21956         LDKThirtyTwoBytes payment_preimage_ref;
21957         CHECK(payment_preimage->arr_len == 32);
21958         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
21959         LDKThirtyTwoBytes payment_secret_ref;
21960         CHECK(payment_secret->arr_len == 32);
21961         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
21962         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21963         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
21964         uint64_t ret_ref = tag_ptr(ret_copy, true);
21965         return ret_ref;
21966 }
21967
21968 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
21969         LDKThirtyTwoBytes a_ref;
21970         CHECK(a->arr_len == 32);
21971         memcpy(a_ref.data, a->elems, 32); FREE(a);
21972         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21973         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
21974         uint64_t ret_ref = tag_ptr(ret_copy, true);
21975         return ret_ref;
21976 }
21977
21978 jboolean  __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) {
21979         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
21980         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
21981         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
21982         return ret_conv;
21983 }
21984
21985 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
21986         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
21987         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
21988         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21989         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21990         CVec_u8Z_free(ret_var);
21991         return ret_arr;
21992 }
21993
21994 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
21995         LDKu8slice ser_ref;
21996         ser_ref.datalen = ser->arr_len;
21997         ser_ref.data = ser->elems;
21998         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
21999         *ret_conv = PaymentPurpose_read(ser_ref);
22000         FREE(ser);
22001         return tag_ptr(ret_conv, true);
22002 }
22003
22004 void  __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_free(uint64_t this_ptr) {
22005         if (!ptr_is_owned(this_ptr)) return;
22006         void* this_ptr_ptr = untag_ptr(this_ptr);
22007         CHECK_ACCESS(this_ptr_ptr);
22008         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
22009         FREE(untag_ptr(this_ptr));
22010         PathFailure_free(this_ptr_conv);
22011 }
22012
22013 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
22014         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
22015         *ret_copy = PathFailure_clone(arg);
22016         uint64_t ret_ref = tag_ptr(ret_copy, true);
22017         return ret_ref;
22018 }
22019 int64_t  __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) {
22020         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
22021         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
22022         return ret_conv;
22023 }
22024
22025 uint64_t  __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) {
22026         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
22027         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
22028         *ret_copy = PathFailure_clone(orig_conv);
22029         uint64_t ret_ref = tag_ptr(ret_copy, true);
22030         return ret_ref;
22031 }
22032
22033 uint64_t  __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) {
22034         void* err_ptr = untag_ptr(err);
22035         CHECK_ACCESS(err_ptr);
22036         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
22037         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
22038         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
22039         *ret_copy = PathFailure_initial_send(err_conv);
22040         uint64_t ret_ref = tag_ptr(ret_copy, true);
22041         return ret_ref;
22042 }
22043
22044 uint64_t  __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) {
22045         void* network_update_ptr = untag_ptr(network_update);
22046         CHECK_ACCESS(network_update_ptr);
22047         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
22048         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
22049         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
22050         *ret_copy = PathFailure_on_path(network_update_conv);
22051         uint64_t ret_ref = tag_ptr(ret_copy, true);
22052         return ret_ref;
22053 }
22054
22055 jboolean  __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) {
22056         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
22057         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
22058         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
22059         return ret_conv;
22060 }
22061
22062 int8_tArray  __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) {
22063         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
22064         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
22065         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22066         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22067         CVec_u8Z_free(ret_var);
22068         return ret_arr;
22069 }
22070
22071 uint64_t  __attribute__((export_name("TS_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) {
22072         LDKu8slice ser_ref;
22073         ser_ref.datalen = ser->arr_len;
22074         ser_ref.data = ser->elems;
22075         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
22076         *ret_conv = PathFailure_read(ser_ref);
22077         FREE(ser);
22078         return tag_ptr(ret_conv, true);
22079 }
22080
22081 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
22082         if (!ptr_is_owned(this_ptr)) return;
22083         void* this_ptr_ptr = untag_ptr(this_ptr);
22084         CHECK_ACCESS(this_ptr_ptr);
22085         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
22086         FREE(untag_ptr(this_ptr));
22087         ClosureReason_free(this_ptr_conv);
22088 }
22089
22090 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
22091         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22092         *ret_copy = ClosureReason_clone(arg);
22093         uint64_t ret_ref = tag_ptr(ret_copy, true);
22094         return ret_ref;
22095 }
22096 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
22097         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
22098         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
22099         return ret_conv;
22100 }
22101
22102 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
22103         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
22104         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22105         *ret_copy = ClosureReason_clone(orig_conv);
22106         uint64_t ret_ref = tag_ptr(ret_copy, true);
22107         return ret_ref;
22108 }
22109
22110 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
22111         LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
22112         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22113         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
22114         uint64_t ret_ref = tag_ptr(ret_copy, true);
22115         return ret_ref;
22116 }
22117
22118 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
22119         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22120         *ret_copy = ClosureReason_holder_force_closed();
22121         uint64_t ret_ref = tag_ptr(ret_copy, true);
22122         return ret_ref;
22123 }
22124
22125 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
22126         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22127         *ret_copy = ClosureReason_cooperative_closure();
22128         uint64_t ret_ref = tag_ptr(ret_copy, true);
22129         return ret_ref;
22130 }
22131
22132 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
22133         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22134         *ret_copy = ClosureReason_commitment_tx_confirmed();
22135         uint64_t ret_ref = tag_ptr(ret_copy, true);
22136         return ret_ref;
22137 }
22138
22139 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
22140         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22141         *ret_copy = ClosureReason_funding_timed_out();
22142         uint64_t ret_ref = tag_ptr(ret_copy, true);
22143         return ret_ref;
22144 }
22145
22146 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
22147         LDKStr err_conv = str_ref_to_owned_c(err);
22148         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22149         *ret_copy = ClosureReason_processing_error(err_conv);
22150         uint64_t ret_ref = tag_ptr(ret_copy, true);
22151         return ret_ref;
22152 }
22153
22154 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
22155         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22156         *ret_copy = ClosureReason_disconnected_peer();
22157         uint64_t ret_ref = tag_ptr(ret_copy, true);
22158         return ret_ref;
22159 }
22160
22161 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
22162         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22163         *ret_copy = ClosureReason_outdated_channel_manager();
22164         uint64_t ret_ref = tag_ptr(ret_copy, true);
22165         return ret_ref;
22166 }
22167
22168 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
22169         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
22170         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
22171         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
22172         return ret_conv;
22173 }
22174
22175 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
22176         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
22177         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
22178         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22179         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22180         CVec_u8Z_free(ret_var);
22181         return ret_arr;
22182 }
22183
22184 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
22185         LDKu8slice ser_ref;
22186         ser_ref.datalen = ser->arr_len;
22187         ser_ref.data = ser->elems;
22188         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
22189         *ret_conv = ClosureReason_read(ser_ref);
22190         FREE(ser);
22191         return tag_ptr(ret_conv, true);
22192 }
22193
22194 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
22195         if (!ptr_is_owned(this_ptr)) return;
22196         void* this_ptr_ptr = untag_ptr(this_ptr);
22197         CHECK_ACCESS(this_ptr_ptr);
22198         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
22199         FREE(untag_ptr(this_ptr));
22200         HTLCDestination_free(this_ptr_conv);
22201 }
22202
22203 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
22204         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
22205         *ret_copy = HTLCDestination_clone(arg);
22206         uint64_t ret_ref = tag_ptr(ret_copy, true);
22207         return ret_ref;
22208 }
22209 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
22210         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
22211         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
22212         return ret_conv;
22213 }
22214
22215 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
22216         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
22217         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
22218         *ret_copy = HTLCDestination_clone(orig_conv);
22219         uint64_t ret_ref = tag_ptr(ret_copy, true);
22220         return ret_ref;
22221 }
22222
22223 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
22224         LDKPublicKey node_id_ref;
22225         CHECK(node_id->arr_len == 33);
22226         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22227         LDKThirtyTwoBytes channel_id_ref;
22228         CHECK(channel_id->arr_len == 32);
22229         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
22230         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
22231         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
22232         uint64_t ret_ref = tag_ptr(ret_copy, true);
22233         return ret_ref;
22234 }
22235
22236 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
22237         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
22238         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
22239         uint64_t ret_ref = tag_ptr(ret_copy, true);
22240         return ret_ref;
22241 }
22242
22243 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
22244         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
22245         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
22246         uint64_t ret_ref = tag_ptr(ret_copy, true);
22247         return ret_ref;
22248 }
22249
22250 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
22251         LDKThirtyTwoBytes payment_hash_ref;
22252         CHECK(payment_hash->arr_len == 32);
22253         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22254         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
22255         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
22256         uint64_t ret_ref = tag_ptr(ret_copy, true);
22257         return ret_ref;
22258 }
22259
22260 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
22261         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
22262         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
22263         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
22264         return ret_conv;
22265 }
22266
22267 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
22268         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
22269         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
22270         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22271         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22272         CVec_u8Z_free(ret_var);
22273         return ret_arr;
22274 }
22275
22276 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
22277         LDKu8slice ser_ref;
22278         ser_ref.datalen = ser->arr_len;
22279         ser_ref.data = ser->elems;
22280         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
22281         *ret_conv = HTLCDestination_read(ser_ref);
22282         FREE(ser);
22283         return tag_ptr(ret_conv, true);
22284 }
22285
22286 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
22287         if (!ptr_is_owned(this_ptr)) return;
22288         void* this_ptr_ptr = untag_ptr(this_ptr);
22289         CHECK_ACCESS(this_ptr_ptr);
22290         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
22291         FREE(untag_ptr(this_ptr));
22292         Event_free(this_ptr_conv);
22293 }
22294
22295 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
22296         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22297         *ret_copy = Event_clone(arg);
22298         uint64_t ret_ref = tag_ptr(ret_copy, true);
22299         return ret_ref;
22300 }
22301 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
22302         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
22303         int64_t ret_conv = Event_clone_ptr(arg_conv);
22304         return ret_conv;
22305 }
22306
22307 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
22308         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
22309         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22310         *ret_copy = Event_clone(orig_conv);
22311         uint64_t ret_ref = tag_ptr(ret_copy, true);
22312         return ret_ref;
22313 }
22314
22315 uint64_t  __attribute__((export_name("TS_Event_funding_generation_ready"))) TS_Event_funding_generation_ready(int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int8_tArray user_channel_id) {
22316         LDKThirtyTwoBytes temporary_channel_id_ref;
22317         CHECK(temporary_channel_id->arr_len == 32);
22318         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
22319         LDKPublicKey counterparty_node_id_ref;
22320         CHECK(counterparty_node_id->arr_len == 33);
22321         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
22322         LDKCVec_u8Z output_script_ref;
22323         output_script_ref.datalen = output_script->arr_len;
22324         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
22325         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
22326         LDKU128 user_channel_id_ref;
22327         CHECK(user_channel_id->arr_len == 16);
22328         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
22329         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22330         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
22331         uint64_t ret_ref = tag_ptr(ret_copy, true);
22332         return ret_ref;
22333 }
22334
22335 uint64_t  __attribute__((export_name("TS_Event_payment_claimable"))) TS_Event_payment_claimable(int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose, int8_tArray via_channel_id, uint64_t via_user_channel_id) {
22336         LDKPublicKey receiver_node_id_ref;
22337         CHECK(receiver_node_id->arr_len == 33);
22338         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
22339         LDKThirtyTwoBytes payment_hash_ref;
22340         CHECK(payment_hash->arr_len == 32);
22341         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22342         void* purpose_ptr = untag_ptr(purpose);
22343         CHECK_ACCESS(purpose_ptr);
22344         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
22345         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
22346         LDKThirtyTwoBytes via_channel_id_ref;
22347         CHECK(via_channel_id->arr_len == 32);
22348         memcpy(via_channel_id_ref.data, via_channel_id->elems, 32); FREE(via_channel_id);
22349         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
22350         CHECK_ACCESS(via_user_channel_id_ptr);
22351         LDKCOption_u128Z via_user_channel_id_conv = *(LDKCOption_u128Z*)(via_user_channel_id_ptr);
22352         via_user_channel_id_conv = COption_u128Z_clone((LDKCOption_u128Z*)untag_ptr(via_user_channel_id));
22353         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22354         *ret_copy = Event_payment_claimable(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, via_channel_id_ref, via_user_channel_id_conv);
22355         uint64_t ret_ref = tag_ptr(ret_copy, true);
22356         return ret_ref;
22357 }
22358
22359 uint64_t  __attribute__((export_name("TS_Event_payment_claimed"))) TS_Event_payment_claimed(int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose) {
22360         LDKPublicKey receiver_node_id_ref;
22361         CHECK(receiver_node_id->arr_len == 33);
22362         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
22363         LDKThirtyTwoBytes payment_hash_ref;
22364         CHECK(payment_hash->arr_len == 32);
22365         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22366         void* purpose_ptr = untag_ptr(purpose);
22367         CHECK_ACCESS(purpose_ptr);
22368         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
22369         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
22370         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22371         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv);
22372         uint64_t ret_ref = tag_ptr(ret_copy, true);
22373         return ret_ref;
22374 }
22375
22376 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) {
22377         LDKThirtyTwoBytes payment_id_ref;
22378         CHECK(payment_id->arr_len == 32);
22379         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22380         LDKThirtyTwoBytes payment_preimage_ref;
22381         CHECK(payment_preimage->arr_len == 32);
22382         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
22383         LDKThirtyTwoBytes payment_hash_ref;
22384         CHECK(payment_hash->arr_len == 32);
22385         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22386         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
22387         CHECK_ACCESS(fee_paid_msat_ptr);
22388         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
22389         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
22390         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22391         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
22392         uint64_t ret_ref = tag_ptr(ret_copy, true);
22393         return ret_ref;
22394 }
22395
22396 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
22397         LDKThirtyTwoBytes payment_id_ref;
22398         CHECK(payment_id->arr_len == 32);
22399         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22400         LDKThirtyTwoBytes payment_hash_ref;
22401         CHECK(payment_hash->arr_len == 32);
22402         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22403         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22404         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
22405         uint64_t ret_ref = tag_ptr(ret_copy, true);
22406         return ret_ref;
22407 }
22408
22409 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) {
22410         LDKThirtyTwoBytes payment_id_ref;
22411         CHECK(payment_id->arr_len == 32);
22412         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22413         LDKThirtyTwoBytes payment_hash_ref;
22414         CHECK(payment_hash->arr_len == 32);
22415         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22416         LDKCVec_RouteHopZ path_constr;
22417         path_constr.datalen = path->arr_len;
22418         if (path_constr.datalen > 0)
22419                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22420         else
22421                 path_constr.data = NULL;
22422         uint64_t* path_vals = path->elems;
22423         for (size_t k = 0; k < path_constr.datalen; k++) {
22424                 uint64_t path_conv_10 = path_vals[k];
22425                 LDKRouteHop path_conv_10_conv;
22426                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
22427                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
22428                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22429                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22430                 path_constr.data[k] = path_conv_10_conv;
22431         }
22432         FREE(path);
22433         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22434         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
22435         uint64_t ret_ref = tag_ptr(ret_copy, true);
22436         return ret_ref;
22437 }
22438
22439 uint64_t  __attribute__((export_name("TS_Event_payment_path_failed"))) TS_Event_payment_path_failed(int8_tArray payment_id, int8_tArray payment_hash, jboolean payment_failed_permanently, uint64_t failure, uint64_tArray path, uint64_t short_channel_id, uint64_t retry) {
22440         LDKThirtyTwoBytes payment_id_ref;
22441         CHECK(payment_id->arr_len == 32);
22442         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22443         LDKThirtyTwoBytes payment_hash_ref;
22444         CHECK(payment_hash->arr_len == 32);
22445         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22446         void* failure_ptr = untag_ptr(failure);
22447         CHECK_ACCESS(failure_ptr);
22448         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
22449         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
22450         LDKCVec_RouteHopZ path_constr;
22451         path_constr.datalen = path->arr_len;
22452         if (path_constr.datalen > 0)
22453                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22454         else
22455                 path_constr.data = NULL;
22456         uint64_t* path_vals = path->elems;
22457         for (size_t k = 0; k < path_constr.datalen; k++) {
22458                 uint64_t path_conv_10 = path_vals[k];
22459                 LDKRouteHop path_conv_10_conv;
22460                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
22461                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
22462                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22463                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22464                 path_constr.data[k] = path_conv_10_conv;
22465         }
22466         FREE(path);
22467         void* short_channel_id_ptr = untag_ptr(short_channel_id);
22468         CHECK_ACCESS(short_channel_id_ptr);
22469         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
22470         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
22471         LDKRouteParameters retry_conv;
22472         retry_conv.inner = untag_ptr(retry);
22473         retry_conv.is_owned = ptr_is_owned(retry);
22474         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
22475         retry_conv = RouteParameters_clone(&retry_conv);
22476         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22477         *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, payment_failed_permanently, failure_conv, path_constr, short_channel_id_conv, retry_conv);
22478         uint64_t ret_ref = tag_ptr(ret_copy, true);
22479         return ret_ref;
22480 }
22481
22482 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_tArray path) {
22483         LDKThirtyTwoBytes payment_id_ref;
22484         CHECK(payment_id->arr_len == 32);
22485         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22486         LDKThirtyTwoBytes payment_hash_ref;
22487         CHECK(payment_hash->arr_len == 32);
22488         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22489         LDKCVec_RouteHopZ path_constr;
22490         path_constr.datalen = path->arr_len;
22491         if (path_constr.datalen > 0)
22492                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22493         else
22494                 path_constr.data = NULL;
22495         uint64_t* path_vals = path->elems;
22496         for (size_t k = 0; k < path_constr.datalen; k++) {
22497                 uint64_t path_conv_10 = path_vals[k];
22498                 LDKRouteHop path_conv_10_conv;
22499                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
22500                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
22501                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22502                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22503                 path_constr.data[k] = path_conv_10_conv;
22504         }
22505         FREE(path);
22506         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22507         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr);
22508         uint64_t ret_ref = tag_ptr(ret_copy, true);
22509         return ret_ref;
22510 }
22511
22512 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) {
22513         LDKThirtyTwoBytes payment_id_ref;
22514         CHECK(payment_id->arr_len == 32);
22515         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22516         LDKThirtyTwoBytes payment_hash_ref;
22517         CHECK(payment_hash->arr_len == 32);
22518         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22519         LDKCVec_RouteHopZ path_constr;
22520         path_constr.datalen = path->arr_len;
22521         if (path_constr.datalen > 0)
22522                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22523         else
22524                 path_constr.data = NULL;
22525         uint64_t* path_vals = path->elems;
22526         for (size_t k = 0; k < path_constr.datalen; k++) {
22527                 uint64_t path_conv_10 = path_vals[k];
22528                 LDKRouteHop path_conv_10_conv;
22529                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
22530                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
22531                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22532                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22533                 path_constr.data[k] = path_conv_10_conv;
22534         }
22535         FREE(path);
22536         void* short_channel_id_ptr = untag_ptr(short_channel_id);
22537         CHECK_ACCESS(short_channel_id_ptr);
22538         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
22539         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
22540         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22541         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv);
22542         uint64_t ret_ref = tag_ptr(ret_copy, true);
22543         return ret_ref;
22544 }
22545
22546 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
22547         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22548         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
22549         uint64_t ret_ref = tag_ptr(ret_copy, true);
22550         return ret_ref;
22551 }
22552
22553 uint64_t  __attribute__((export_name("TS_Event_htlcintercepted"))) TS_Event_htlcintercepted(int8_tArray intercept_id, int64_t requested_next_hop_scid, int8_tArray payment_hash, int64_t inbound_amount_msat, int64_t expected_outbound_amount_msat) {
22554         LDKThirtyTwoBytes intercept_id_ref;
22555         CHECK(intercept_id->arr_len == 32);
22556         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
22557         LDKThirtyTwoBytes payment_hash_ref;
22558         CHECK(payment_hash->arr_len == 32);
22559         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22560         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22561         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
22562         uint64_t ret_ref = tag_ptr(ret_copy, true);
22563         return ret_ref;
22564 }
22565
22566 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs) {
22567         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
22568         outputs_constr.datalen = outputs->arr_len;
22569         if (outputs_constr.datalen > 0)
22570                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
22571         else
22572                 outputs_constr.data = NULL;
22573         uint64_t* outputs_vals = outputs->elems;
22574         for (size_t b = 0; b < outputs_constr.datalen; b++) {
22575                 uint64_t outputs_conv_27 = outputs_vals[b];
22576                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
22577                 CHECK_ACCESS(outputs_conv_27_ptr);
22578                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
22579                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
22580                 outputs_constr.data[b] = outputs_conv_27_conv;
22581         }
22582         FREE(outputs);
22583         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22584         *ret_copy = Event_spendable_outputs(outputs_constr);
22585         uint64_t ret_ref = tag_ptr(ret_copy, true);
22586         return ret_ref;
22587 }
22588
22589 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) {
22590         LDKThirtyTwoBytes prev_channel_id_ref;
22591         CHECK(prev_channel_id->arr_len == 32);
22592         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
22593         LDKThirtyTwoBytes next_channel_id_ref;
22594         CHECK(next_channel_id->arr_len == 32);
22595         memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
22596         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
22597         CHECK_ACCESS(fee_earned_msat_ptr);
22598         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
22599         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
22600         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22601         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
22602         uint64_t ret_ref = tag_ptr(ret_copy, true);
22603         return ret_ref;
22604 }
22605
22606 uint64_t  __attribute__((export_name("TS_Event_channel_ready"))) TS_Event_channel_ready(int8_tArray channel_id, int8_tArray user_channel_id, int8_tArray counterparty_node_id, uint64_t channel_type) {
22607         LDKThirtyTwoBytes channel_id_ref;
22608         CHECK(channel_id->arr_len == 32);
22609         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
22610         LDKU128 user_channel_id_ref;
22611         CHECK(user_channel_id->arr_len == 16);
22612         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
22613         LDKPublicKey counterparty_node_id_ref;
22614         CHECK(counterparty_node_id->arr_len == 33);
22615         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
22616         LDKChannelTypeFeatures channel_type_conv;
22617         channel_type_conv.inner = untag_ptr(channel_type);
22618         channel_type_conv.is_owned = ptr_is_owned(channel_type);
22619         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
22620         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
22621         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22622         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
22623         uint64_t ret_ref = tag_ptr(ret_copy, true);
22624         return ret_ref;
22625 }
22626
22627 uint64_t  __attribute__((export_name("TS_Event_channel_closed"))) TS_Event_channel_closed(int8_tArray channel_id, int8_tArray user_channel_id, uint64_t reason) {
22628         LDKThirtyTwoBytes channel_id_ref;
22629         CHECK(channel_id->arr_len == 32);
22630         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
22631         LDKU128 user_channel_id_ref;
22632         CHECK(user_channel_id->arr_len == 16);
22633         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
22634         void* reason_ptr = untag_ptr(reason);
22635         CHECK_ACCESS(reason_ptr);
22636         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
22637         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
22638         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22639         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv);
22640         uint64_t ret_ref = tag_ptr(ret_copy, true);
22641         return ret_ref;
22642 }
22643
22644 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
22645         LDKThirtyTwoBytes channel_id_ref;
22646         CHECK(channel_id->arr_len == 32);
22647         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
22648         LDKTransaction transaction_ref;
22649         transaction_ref.datalen = transaction->arr_len;
22650         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
22651         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
22652         transaction_ref.data_is_owned = true;
22653         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22654         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
22655         uint64_t ret_ref = tag_ptr(ret_copy, true);
22656         return ret_ref;
22657 }
22658
22659 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) {
22660         LDKThirtyTwoBytes temporary_channel_id_ref;
22661         CHECK(temporary_channel_id->arr_len == 32);
22662         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
22663         LDKPublicKey counterparty_node_id_ref;
22664         CHECK(counterparty_node_id->arr_len == 33);
22665         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
22666         LDKChannelTypeFeatures channel_type_conv;
22667         channel_type_conv.inner = untag_ptr(channel_type);
22668         channel_type_conv.is_owned = ptr_is_owned(channel_type);
22669         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
22670         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
22671         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22672         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
22673         uint64_t ret_ref = tag_ptr(ret_copy, true);
22674         return ret_ref;
22675 }
22676
22677 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
22678         LDKThirtyTwoBytes prev_channel_id_ref;
22679         CHECK(prev_channel_id->arr_len == 32);
22680         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
22681         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
22682         CHECK_ACCESS(failed_next_destination_ptr);
22683         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
22684         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
22685         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22686         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
22687         uint64_t ret_ref = tag_ptr(ret_copy, true);
22688         return ret_ref;
22689 }
22690
22691 jboolean  __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) {
22692         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
22693         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
22694         jboolean ret_conv = Event_eq(a_conv, b_conv);
22695         return ret_conv;
22696 }
22697
22698 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
22699         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
22700         LDKCVec_u8Z ret_var = Event_write(obj_conv);
22701         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22702         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22703         CVec_u8Z_free(ret_var);
22704         return ret_arr;
22705 }
22706
22707 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
22708         LDKu8slice ser_ref;
22709         ser_ref.datalen = ser->arr_len;
22710         ser_ref.data = ser->elems;
22711         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
22712         *ret_conv = Event_read(ser_ref);
22713         FREE(ser);
22714         return tag_ptr(ret_conv, true);
22715 }
22716
22717 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
22718         if (!ptr_is_owned(this_ptr)) return;
22719         void* this_ptr_ptr = untag_ptr(this_ptr);
22720         CHECK_ACCESS(this_ptr_ptr);
22721         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
22722         FREE(untag_ptr(this_ptr));
22723         MessageSendEvent_free(this_ptr_conv);
22724 }
22725
22726 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
22727         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22728         *ret_copy = MessageSendEvent_clone(arg);
22729         uint64_t ret_ref = tag_ptr(ret_copy, true);
22730         return ret_ref;
22731 }
22732 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
22733         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
22734         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
22735         return ret_conv;
22736 }
22737
22738 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
22739         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
22740         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22741         *ret_copy = MessageSendEvent_clone(orig_conv);
22742         uint64_t ret_ref = tag_ptr(ret_copy, true);
22743         return ret_ref;
22744 }
22745
22746 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
22747         LDKPublicKey node_id_ref;
22748         CHECK(node_id->arr_len == 33);
22749         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22750         LDKAcceptChannel msg_conv;
22751         msg_conv.inner = untag_ptr(msg);
22752         msg_conv.is_owned = ptr_is_owned(msg);
22753         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22754         msg_conv = AcceptChannel_clone(&msg_conv);
22755         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22756         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
22757         uint64_t ret_ref = tag_ptr(ret_copy, true);
22758         return ret_ref;
22759 }
22760
22761 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
22762         LDKPublicKey node_id_ref;
22763         CHECK(node_id->arr_len == 33);
22764         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22765         LDKOpenChannel msg_conv;
22766         msg_conv.inner = untag_ptr(msg);
22767         msg_conv.is_owned = ptr_is_owned(msg);
22768         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22769         msg_conv = OpenChannel_clone(&msg_conv);
22770         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22771         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
22772         uint64_t ret_ref = tag_ptr(ret_copy, true);
22773         return ret_ref;
22774 }
22775
22776 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
22777         LDKPublicKey node_id_ref;
22778         CHECK(node_id->arr_len == 33);
22779         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22780         LDKFundingCreated msg_conv;
22781         msg_conv.inner = untag_ptr(msg);
22782         msg_conv.is_owned = ptr_is_owned(msg);
22783         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22784         msg_conv = FundingCreated_clone(&msg_conv);
22785         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22786         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
22787         uint64_t ret_ref = tag_ptr(ret_copy, true);
22788         return ret_ref;
22789 }
22790
22791 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
22792         LDKPublicKey node_id_ref;
22793         CHECK(node_id->arr_len == 33);
22794         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22795         LDKFundingSigned msg_conv;
22796         msg_conv.inner = untag_ptr(msg);
22797         msg_conv.is_owned = ptr_is_owned(msg);
22798         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22799         msg_conv = FundingSigned_clone(&msg_conv);
22800         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22801         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
22802         uint64_t ret_ref = tag_ptr(ret_copy, true);
22803         return ret_ref;
22804 }
22805
22806 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
22807         LDKPublicKey node_id_ref;
22808         CHECK(node_id->arr_len == 33);
22809         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22810         LDKChannelReady msg_conv;
22811         msg_conv.inner = untag_ptr(msg);
22812         msg_conv.is_owned = ptr_is_owned(msg);
22813         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22814         msg_conv = ChannelReady_clone(&msg_conv);
22815         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22816         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
22817         uint64_t ret_ref = tag_ptr(ret_copy, true);
22818         return ret_ref;
22819 }
22820
22821 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
22822         LDKPublicKey node_id_ref;
22823         CHECK(node_id->arr_len == 33);
22824         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22825         LDKAnnouncementSignatures msg_conv;
22826         msg_conv.inner = untag_ptr(msg);
22827         msg_conv.is_owned = ptr_is_owned(msg);
22828         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22829         msg_conv = AnnouncementSignatures_clone(&msg_conv);
22830         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22831         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
22832         uint64_t ret_ref = tag_ptr(ret_copy, true);
22833         return ret_ref;
22834 }
22835
22836 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
22837         LDKPublicKey node_id_ref;
22838         CHECK(node_id->arr_len == 33);
22839         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22840         LDKCommitmentUpdate updates_conv;
22841         updates_conv.inner = untag_ptr(updates);
22842         updates_conv.is_owned = ptr_is_owned(updates);
22843         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
22844         updates_conv = CommitmentUpdate_clone(&updates_conv);
22845         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22846         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
22847         uint64_t ret_ref = tag_ptr(ret_copy, true);
22848         return ret_ref;
22849 }
22850
22851 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
22852         LDKPublicKey node_id_ref;
22853         CHECK(node_id->arr_len == 33);
22854         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22855         LDKRevokeAndACK msg_conv;
22856         msg_conv.inner = untag_ptr(msg);
22857         msg_conv.is_owned = ptr_is_owned(msg);
22858         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22859         msg_conv = RevokeAndACK_clone(&msg_conv);
22860         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22861         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
22862         uint64_t ret_ref = tag_ptr(ret_copy, true);
22863         return ret_ref;
22864 }
22865
22866 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
22867         LDKPublicKey node_id_ref;
22868         CHECK(node_id->arr_len == 33);
22869         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22870         LDKClosingSigned msg_conv;
22871         msg_conv.inner = untag_ptr(msg);
22872         msg_conv.is_owned = ptr_is_owned(msg);
22873         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22874         msg_conv = ClosingSigned_clone(&msg_conv);
22875         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22876         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
22877         uint64_t ret_ref = tag_ptr(ret_copy, true);
22878         return ret_ref;
22879 }
22880
22881 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
22882         LDKPublicKey node_id_ref;
22883         CHECK(node_id->arr_len == 33);
22884         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22885         LDKShutdown msg_conv;
22886         msg_conv.inner = untag_ptr(msg);
22887         msg_conv.is_owned = ptr_is_owned(msg);
22888         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22889         msg_conv = Shutdown_clone(&msg_conv);
22890         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22891         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
22892         uint64_t ret_ref = tag_ptr(ret_copy, true);
22893         return ret_ref;
22894 }
22895
22896 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
22897         LDKPublicKey node_id_ref;
22898         CHECK(node_id->arr_len == 33);
22899         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22900         LDKChannelReestablish msg_conv;
22901         msg_conv.inner = untag_ptr(msg);
22902         msg_conv.is_owned = ptr_is_owned(msg);
22903         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22904         msg_conv = ChannelReestablish_clone(&msg_conv);
22905         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22906         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
22907         uint64_t ret_ref = tag_ptr(ret_copy, true);
22908         return ret_ref;
22909 }
22910
22911 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_announcement"))) TS_MessageSendEvent_send_channel_announcement(int8_tArray node_id, uint64_t msg, uint64_t update_msg) {
22912         LDKPublicKey node_id_ref;
22913         CHECK(node_id->arr_len == 33);
22914         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22915         LDKChannelAnnouncement msg_conv;
22916         msg_conv.inner = untag_ptr(msg);
22917         msg_conv.is_owned = ptr_is_owned(msg);
22918         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22919         msg_conv = ChannelAnnouncement_clone(&msg_conv);
22920         LDKChannelUpdate update_msg_conv;
22921         update_msg_conv.inner = untag_ptr(update_msg);
22922         update_msg_conv.is_owned = ptr_is_owned(update_msg);
22923         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
22924         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
22925         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22926         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
22927         uint64_t ret_ref = tag_ptr(ret_copy, true);
22928         return ret_ref;
22929 }
22930
22931 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
22932         LDKChannelAnnouncement msg_conv;
22933         msg_conv.inner = untag_ptr(msg);
22934         msg_conv.is_owned = ptr_is_owned(msg);
22935         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22936         msg_conv = ChannelAnnouncement_clone(&msg_conv);
22937         LDKChannelUpdate update_msg_conv;
22938         update_msg_conv.inner = untag_ptr(update_msg);
22939         update_msg_conv.is_owned = ptr_is_owned(update_msg);
22940         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
22941         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
22942         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22943         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
22944         uint64_t ret_ref = tag_ptr(ret_copy, true);
22945         return ret_ref;
22946 }
22947
22948 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
22949         LDKChannelUpdate msg_conv;
22950         msg_conv.inner = untag_ptr(msg);
22951         msg_conv.is_owned = ptr_is_owned(msg);
22952         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22953         msg_conv = ChannelUpdate_clone(&msg_conv);
22954         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22955         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
22956         uint64_t ret_ref = tag_ptr(ret_copy, true);
22957         return ret_ref;
22958 }
22959
22960 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
22961         LDKNodeAnnouncement msg_conv;
22962         msg_conv.inner = untag_ptr(msg);
22963         msg_conv.is_owned = ptr_is_owned(msg);
22964         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22965         msg_conv = NodeAnnouncement_clone(&msg_conv);
22966         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22967         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
22968         uint64_t ret_ref = tag_ptr(ret_copy, true);
22969         return ret_ref;
22970 }
22971
22972 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
22973         LDKPublicKey node_id_ref;
22974         CHECK(node_id->arr_len == 33);
22975         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22976         LDKChannelUpdate msg_conv;
22977         msg_conv.inner = untag_ptr(msg);
22978         msg_conv.is_owned = ptr_is_owned(msg);
22979         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22980         msg_conv = ChannelUpdate_clone(&msg_conv);
22981         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22982         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
22983         uint64_t ret_ref = tag_ptr(ret_copy, true);
22984         return ret_ref;
22985 }
22986
22987 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
22988         LDKPublicKey node_id_ref;
22989         CHECK(node_id->arr_len == 33);
22990         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22991         void* action_ptr = untag_ptr(action);
22992         CHECK_ACCESS(action_ptr);
22993         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
22994         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
22995         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22996         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
22997         uint64_t ret_ref = tag_ptr(ret_copy, true);
22998         return ret_ref;
22999 }
23000
23001 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
23002         LDKPublicKey node_id_ref;
23003         CHECK(node_id->arr_len == 33);
23004         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
23005         LDKQueryChannelRange msg_conv;
23006         msg_conv.inner = untag_ptr(msg);
23007         msg_conv.is_owned = ptr_is_owned(msg);
23008         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23009         msg_conv = QueryChannelRange_clone(&msg_conv);
23010         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23011         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
23012         uint64_t ret_ref = tag_ptr(ret_copy, true);
23013         return ret_ref;
23014 }
23015
23016 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
23017         LDKPublicKey node_id_ref;
23018         CHECK(node_id->arr_len == 33);
23019         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
23020         LDKQueryShortChannelIds msg_conv;
23021         msg_conv.inner = untag_ptr(msg);
23022         msg_conv.is_owned = ptr_is_owned(msg);
23023         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23024         msg_conv = QueryShortChannelIds_clone(&msg_conv);
23025         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23026         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
23027         uint64_t ret_ref = tag_ptr(ret_copy, true);
23028         return ret_ref;
23029 }
23030
23031 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
23032         LDKPublicKey node_id_ref;
23033         CHECK(node_id->arr_len == 33);
23034         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
23035         LDKReplyChannelRange msg_conv;
23036         msg_conv.inner = untag_ptr(msg);
23037         msg_conv.is_owned = ptr_is_owned(msg);
23038         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23039         msg_conv = ReplyChannelRange_clone(&msg_conv);
23040         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23041         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
23042         uint64_t ret_ref = tag_ptr(ret_copy, true);
23043         return ret_ref;
23044 }
23045
23046 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
23047         LDKPublicKey node_id_ref;
23048         CHECK(node_id->arr_len == 33);
23049         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
23050         LDKGossipTimestampFilter msg_conv;
23051         msg_conv.inner = untag_ptr(msg);
23052         msg_conv.is_owned = ptr_is_owned(msg);
23053         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23054         msg_conv = GossipTimestampFilter_clone(&msg_conv);
23055         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23056         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
23057         uint64_t ret_ref = tag_ptr(ret_copy, true);
23058         return ret_ref;
23059 }
23060
23061 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
23062         if (!ptr_is_owned(this_ptr)) return;
23063         void* this_ptr_ptr = untag_ptr(this_ptr);
23064         CHECK_ACCESS(this_ptr_ptr);
23065         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
23066         FREE(untag_ptr(this_ptr));
23067         MessageSendEventsProvider_free(this_ptr_conv);
23068 }
23069
23070 void  __attribute__((export_name("TS_OnionMessageProvider_free"))) TS_OnionMessageProvider_free(uint64_t this_ptr) {
23071         if (!ptr_is_owned(this_ptr)) return;
23072         void* this_ptr_ptr = untag_ptr(this_ptr);
23073         CHECK_ACCESS(this_ptr_ptr);
23074         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
23075         FREE(untag_ptr(this_ptr));
23076         OnionMessageProvider_free(this_ptr_conv);
23077 }
23078
23079 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
23080         if (!ptr_is_owned(this_ptr)) return;
23081         void* this_ptr_ptr = untag_ptr(this_ptr);
23082         CHECK_ACCESS(this_ptr_ptr);
23083         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
23084         FREE(untag_ptr(this_ptr));
23085         EventsProvider_free(this_ptr_conv);
23086 }
23087
23088 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
23089         if (!ptr_is_owned(this_ptr)) return;
23090         void* this_ptr_ptr = untag_ptr(this_ptr);
23091         CHECK_ACCESS(this_ptr_ptr);
23092         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
23093         FREE(untag_ptr(this_ptr));
23094         EventHandler_free(this_ptr_conv);
23095 }
23096
23097 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
23098         if (!ptr_is_owned(this_ptr)) return;
23099         void* this_ptr_ptr = untag_ptr(this_ptr);
23100         CHECK_ACCESS(this_ptr_ptr);
23101         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
23102         FREE(untag_ptr(this_ptr));
23103         APIError_free(this_ptr_conv);
23104 }
23105
23106 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
23107         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23108         *ret_copy = APIError_clone(arg);
23109         uint64_t ret_ref = tag_ptr(ret_copy, true);
23110         return ret_ref;
23111 }
23112 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
23113         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
23114         int64_t ret_conv = APIError_clone_ptr(arg_conv);
23115         return ret_conv;
23116 }
23117
23118 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
23119         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
23120         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23121         *ret_copy = APIError_clone(orig_conv);
23122         uint64_t ret_ref = tag_ptr(ret_copy, true);
23123         return ret_ref;
23124 }
23125
23126 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
23127         LDKStr err_conv = str_ref_to_owned_c(err);
23128         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23129         *ret_copy = APIError_apimisuse_error(err_conv);
23130         uint64_t ret_ref = tag_ptr(ret_copy, true);
23131         return ret_ref;
23132 }
23133
23134 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
23135         LDKStr err_conv = str_ref_to_owned_c(err);
23136         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23137         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
23138         uint64_t ret_ref = tag_ptr(ret_copy, true);
23139         return ret_ref;
23140 }
23141
23142 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
23143         LDKStr err_conv = str_ref_to_owned_c(err);
23144         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23145         *ret_copy = APIError_invalid_route(err_conv);
23146         uint64_t ret_ref = tag_ptr(ret_copy, true);
23147         return ret_ref;
23148 }
23149
23150 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
23151         LDKStr err_conv = str_ref_to_owned_c(err);
23152         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23153         *ret_copy = APIError_channel_unavailable(err_conv);
23154         uint64_t ret_ref = tag_ptr(ret_copy, true);
23155         return ret_ref;
23156 }
23157
23158 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
23159         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23160         *ret_copy = APIError_monitor_update_in_progress();
23161         uint64_t ret_ref = tag_ptr(ret_copy, true);
23162         return ret_ref;
23163 }
23164
23165 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
23166         LDKShutdownScript script_conv;
23167         script_conv.inner = untag_ptr(script);
23168         script_conv.is_owned = ptr_is_owned(script);
23169         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
23170         script_conv = ShutdownScript_clone(&script_conv);
23171         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23172         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
23173         uint64_t ret_ref = tag_ptr(ret_copy, true);
23174         return ret_ref;
23175 }
23176
23177 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
23178         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
23179         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
23180         jboolean ret_conv = APIError_eq(a_conv, b_conv);
23181         return ret_conv;
23182 }
23183
23184 int8_tArray  __attribute__((export_name("TS_APIError_write"))) TS_APIError_write(uint64_t obj) {
23185         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
23186         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
23187         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23188         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23189         CVec_u8Z_free(ret_var);
23190         return ret_arr;
23191 }
23192
23193 uint64_t  __attribute__((export_name("TS_APIError_read"))) TS_APIError_read(int8_tArray ser) {
23194         LDKu8slice ser_ref;
23195         ser_ref.datalen = ser->arr_len;
23196         ser_ref.data = ser->elems;
23197         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
23198         *ret_conv = APIError_read(ser_ref);
23199         FREE(ser);
23200         return tag_ptr(ret_conv, true);
23201 }
23202
23203 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
23204         LDKBigSize this_obj_conv;
23205         this_obj_conv.inner = untag_ptr(this_obj);
23206         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23208         BigSize_free(this_obj_conv);
23209 }
23210
23211 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
23212         LDKBigSize this_ptr_conv;
23213         this_ptr_conv.inner = untag_ptr(this_ptr);
23214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23216         this_ptr_conv.is_owned = false;
23217         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
23218         return ret_conv;
23219 }
23220
23221 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
23222         LDKBigSize this_ptr_conv;
23223         this_ptr_conv.inner = untag_ptr(this_ptr);
23224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23226         this_ptr_conv.is_owned = false;
23227         BigSize_set_a(&this_ptr_conv, val);
23228 }
23229
23230 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
23231         LDKBigSize ret_var = BigSize_new(a_arg);
23232         uint64_t ret_ref = 0;
23233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23235         return ret_ref;
23236 }
23237
23238 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
23239         LDKHostname this_obj_conv;
23240         this_obj_conv.inner = untag_ptr(this_obj);
23241         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23243         Hostname_free(this_obj_conv);
23244 }
23245
23246 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
23247         LDKHostname ret_var = Hostname_clone(arg);
23248         uint64_t ret_ref = 0;
23249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23251         return ret_ref;
23252 }
23253 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
23254         LDKHostname arg_conv;
23255         arg_conv.inner = untag_ptr(arg);
23256         arg_conv.is_owned = ptr_is_owned(arg);
23257         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23258         arg_conv.is_owned = false;
23259         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
23260         return ret_conv;
23261 }
23262
23263 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
23264         LDKHostname orig_conv;
23265         orig_conv.inner = untag_ptr(orig);
23266         orig_conv.is_owned = ptr_is_owned(orig);
23267         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23268         orig_conv.is_owned = false;
23269         LDKHostname ret_var = Hostname_clone(&orig_conv);
23270         uint64_t ret_ref = 0;
23271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23273         return ret_ref;
23274 }
23275
23276 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
23277         LDKHostname a_conv;
23278         a_conv.inner = untag_ptr(a);
23279         a_conv.is_owned = ptr_is_owned(a);
23280         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23281         a_conv.is_owned = false;
23282         LDKHostname b_conv;
23283         b_conv.inner = untag_ptr(b);
23284         b_conv.is_owned = ptr_is_owned(b);
23285         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23286         b_conv.is_owned = false;
23287         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
23288         return ret_conv;
23289 }
23290
23291 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
23292         LDKHostname this_arg_conv;
23293         this_arg_conv.inner = untag_ptr(this_arg);
23294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23296         this_arg_conv.is_owned = false;
23297         int8_t ret_conv = Hostname_len(&this_arg_conv);
23298         return ret_conv;
23299 }
23300
23301 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
23302         LDKu8slice msg_ref;
23303         msg_ref.datalen = msg->arr_len;
23304         msg_ref.data = msg->elems;
23305         uint8_t sk_arr[32];
23306         CHECK(sk->arr_len == 32);
23307         memcpy(sk_arr, sk->elems, 32); FREE(sk);
23308         uint8_t (*sk_ref)[32] = &sk_arr;
23309         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
23310         *ret_conv = sign(msg_ref, sk_ref);
23311         FREE(msg);
23312         return tag_ptr(ret_conv, true);
23313 }
23314
23315 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
23316         LDKu8slice msg_ref;
23317         msg_ref.datalen = msg->arr_len;
23318         msg_ref.data = msg->elems;
23319         LDKStr sig_conv = str_ref_to_owned_c(sig);
23320         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
23321         *ret_conv = recover_pk(msg_ref, sig_conv);
23322         FREE(msg);
23323         return tag_ptr(ret_conv, true);
23324 }
23325
23326 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
23327         LDKu8slice msg_ref;
23328         msg_ref.datalen = msg->arr_len;
23329         msg_ref.data = msg->elems;
23330         LDKStr sig_conv = str_ref_to_owned_c(sig);
23331         LDKPublicKey pk_ref;
23332         CHECK(pk->arr_len == 33);
23333         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
23334         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
23335         FREE(msg);
23336         return ret_conv;
23337 }
23338
23339 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
23340         LDKu8slice hrp_bytes_ref;
23341         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
23342         hrp_bytes_ref.data = hrp_bytes->elems;
23343         LDKCVec_U5Z data_without_signature_constr;
23344         data_without_signature_constr.datalen = data_without_signature->arr_len;
23345         if (data_without_signature_constr.datalen > 0)
23346                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
23347         else
23348                 data_without_signature_constr.data = NULL;
23349         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
23350         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
23351                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
23352                 
23353                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
23354         }
23355         FREE(data_without_signature);
23356         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
23357         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23358         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23359         CVec_u8Z_free(ret_var);
23360         FREE(hrp_bytes);
23361         return ret_arr;
23362 }
23363
23364 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
23365         if (!ptr_is_owned(this_ptr)) return;
23366         void* this_ptr_ptr = untag_ptr(this_ptr);
23367         CHECK_ACCESS(this_ptr_ptr);
23368         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
23369         FREE(untag_ptr(this_ptr));
23370         Persister_free(this_ptr_conv);
23371 }
23372
23373 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
23374         LDKPrintableString this_obj_conv;
23375         this_obj_conv.inner = untag_ptr(this_obj);
23376         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23378         PrintableString_free(this_obj_conv);
23379 }
23380
23381 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
23382         LDKPrintableString this_ptr_conv;
23383         this_ptr_conv.inner = untag_ptr(this_ptr);
23384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23386         this_ptr_conv.is_owned = false;
23387         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
23388         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23389         Str_free(ret_str);
23390         return ret_conv;
23391 }
23392
23393 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
23394         LDKPrintableString this_ptr_conv;
23395         this_ptr_conv.inner = untag_ptr(this_ptr);
23396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23398         this_ptr_conv.is_owned = false;
23399         LDKStr val_conv = str_ref_to_owned_c(val);
23400         PrintableString_set_a(&this_ptr_conv, val_conv);
23401 }
23402
23403 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
23404         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
23405         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
23406         uint64_t ret_ref = 0;
23407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23409         return ret_ref;
23410 }
23411
23412 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
23413         if (!ptr_is_owned(this_ptr)) return;
23414         void* this_ptr_ptr = untag_ptr(this_ptr);
23415         CHECK_ACCESS(this_ptr_ptr);
23416         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
23417         FREE(untag_ptr(this_ptr));
23418         FutureCallback_free(this_ptr_conv);
23419 }
23420
23421 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
23422         LDKFuture this_obj_conv;
23423         this_obj_conv.inner = untag_ptr(this_obj);
23424         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23426         Future_free(this_obj_conv);
23427 }
23428
23429 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
23430         LDKFuture this_arg_conv;
23431         this_arg_conv.inner = untag_ptr(this_arg);
23432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23434         this_arg_conv.is_owned = false;
23435         void* callback_ptr = untag_ptr(callback);
23436         CHECK_ACCESS(callback_ptr);
23437         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
23438         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
23439                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23440                 LDKFutureCallback_JCalls_cloned(&callback_conv);
23441         }
23442         Future_register_callback_fn(&this_arg_conv, callback_conv);
23443 }
23444
23445 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
23446         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
23447         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
23448         return ret_conv;
23449 }
23450
23451 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
23452         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
23453         return ret_conv;
23454 }
23455
23456 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
23457         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
23458         return ret_conv;
23459 }
23460
23461 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
23462         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
23463         return ret_conv;
23464 }
23465
23466 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
23467         uint32_t ret_conv = LDKLevel_to_js(Level_info());
23468         return ret_conv;
23469 }
23470
23471 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
23472         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
23473         return ret_conv;
23474 }
23475
23476 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
23477         uint32_t ret_conv = LDKLevel_to_js(Level_error());
23478         return ret_conv;
23479 }
23480
23481 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
23482         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
23483         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
23484         jboolean ret_conv = Level_eq(a_conv, b_conv);
23485         return ret_conv;
23486 }
23487
23488 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
23489         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
23490         int64_t ret_conv = Level_hash(o_conv);
23491         return ret_conv;
23492 }
23493
23494 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
23495         uint32_t ret_conv = LDKLevel_to_js(Level_max());
23496         return ret_conv;
23497 }
23498
23499 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
23500         LDKRecord this_obj_conv;
23501         this_obj_conv.inner = untag_ptr(this_obj);
23502         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23504         Record_free(this_obj_conv);
23505 }
23506
23507 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
23508         LDKRecord this_ptr_conv;
23509         this_ptr_conv.inner = untag_ptr(this_ptr);
23510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23512         this_ptr_conv.is_owned = false;
23513         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
23514         return ret_conv;
23515 }
23516
23517 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
23518         LDKRecord this_ptr_conv;
23519         this_ptr_conv.inner = untag_ptr(this_ptr);
23520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23522         this_ptr_conv.is_owned = false;
23523         LDKLevel val_conv = LDKLevel_from_js(val);
23524         Record_set_level(&this_ptr_conv, val_conv);
23525 }
23526
23527 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
23528         LDKRecord this_ptr_conv;
23529         this_ptr_conv.inner = untag_ptr(this_ptr);
23530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23532         this_ptr_conv.is_owned = false;
23533         LDKStr ret_str = Record_get_args(&this_ptr_conv);
23534         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23535         Str_free(ret_str);
23536         return ret_conv;
23537 }
23538
23539 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
23540         LDKRecord this_ptr_conv;
23541         this_ptr_conv.inner = untag_ptr(this_ptr);
23542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23544         this_ptr_conv.is_owned = false;
23545         LDKStr val_conv = str_ref_to_owned_c(val);
23546         Record_set_args(&this_ptr_conv, val_conv);
23547 }
23548
23549 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
23550         LDKRecord this_ptr_conv;
23551         this_ptr_conv.inner = untag_ptr(this_ptr);
23552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23554         this_ptr_conv.is_owned = false;
23555         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
23556         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23557         Str_free(ret_str);
23558         return ret_conv;
23559 }
23560
23561 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
23562         LDKRecord this_ptr_conv;
23563         this_ptr_conv.inner = untag_ptr(this_ptr);
23564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23566         this_ptr_conv.is_owned = false;
23567         LDKStr val_conv = str_ref_to_owned_c(val);
23568         Record_set_module_path(&this_ptr_conv, val_conv);
23569 }
23570
23571 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
23572         LDKRecord this_ptr_conv;
23573         this_ptr_conv.inner = untag_ptr(this_ptr);
23574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23576         this_ptr_conv.is_owned = false;
23577         LDKStr ret_str = Record_get_file(&this_ptr_conv);
23578         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23579         Str_free(ret_str);
23580         return ret_conv;
23581 }
23582
23583 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
23584         LDKRecord this_ptr_conv;
23585         this_ptr_conv.inner = untag_ptr(this_ptr);
23586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23588         this_ptr_conv.is_owned = false;
23589         LDKStr val_conv = str_ref_to_owned_c(val);
23590         Record_set_file(&this_ptr_conv, val_conv);
23591 }
23592
23593 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
23594         LDKRecord this_ptr_conv;
23595         this_ptr_conv.inner = untag_ptr(this_ptr);
23596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23598         this_ptr_conv.is_owned = false;
23599         int32_t ret_conv = Record_get_line(&this_ptr_conv);
23600         return ret_conv;
23601 }
23602
23603 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
23604         LDKRecord this_ptr_conv;
23605         this_ptr_conv.inner = untag_ptr(this_ptr);
23606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23608         this_ptr_conv.is_owned = false;
23609         Record_set_line(&this_ptr_conv, val);
23610 }
23611
23612 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
23613         LDKRecord ret_var = Record_clone(arg);
23614         uint64_t ret_ref = 0;
23615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23617         return ret_ref;
23618 }
23619 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
23620         LDKRecord arg_conv;
23621         arg_conv.inner = untag_ptr(arg);
23622         arg_conv.is_owned = ptr_is_owned(arg);
23623         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23624         arg_conv.is_owned = false;
23625         int64_t ret_conv = Record_clone_ptr(&arg_conv);
23626         return ret_conv;
23627 }
23628
23629 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
23630         LDKRecord orig_conv;
23631         orig_conv.inner = untag_ptr(orig);
23632         orig_conv.is_owned = ptr_is_owned(orig);
23633         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23634         orig_conv.is_owned = false;
23635         LDKRecord ret_var = Record_clone(&orig_conv);
23636         uint64_t ret_ref = 0;
23637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23639         return ret_ref;
23640 }
23641
23642 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
23643         if (!ptr_is_owned(this_ptr)) return;
23644         void* this_ptr_ptr = untag_ptr(this_ptr);
23645         CHECK_ACCESS(this_ptr_ptr);
23646         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
23647         FREE(untag_ptr(this_ptr));
23648         Logger_free(this_ptr_conv);
23649 }
23650
23651 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
23652         LDKChannelHandshakeConfig this_obj_conv;
23653         this_obj_conv.inner = untag_ptr(this_obj);
23654         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23656         ChannelHandshakeConfig_free(this_obj_conv);
23657 }
23658
23659 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
23660         LDKChannelHandshakeConfig this_ptr_conv;
23661         this_ptr_conv.inner = untag_ptr(this_ptr);
23662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23664         this_ptr_conv.is_owned = false;
23665         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
23666         return ret_conv;
23667 }
23668
23669 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
23670         LDKChannelHandshakeConfig this_ptr_conv;
23671         this_ptr_conv.inner = untag_ptr(this_ptr);
23672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23674         this_ptr_conv.is_owned = false;
23675         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
23676 }
23677
23678 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
23679         LDKChannelHandshakeConfig this_ptr_conv;
23680         this_ptr_conv.inner = untag_ptr(this_ptr);
23681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23683         this_ptr_conv.is_owned = false;
23684         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
23685         return ret_conv;
23686 }
23687
23688 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) {
23689         LDKChannelHandshakeConfig this_ptr_conv;
23690         this_ptr_conv.inner = untag_ptr(this_ptr);
23691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23693         this_ptr_conv.is_owned = false;
23694         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
23695 }
23696
23697 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
23698         LDKChannelHandshakeConfig this_ptr_conv;
23699         this_ptr_conv.inner = untag_ptr(this_ptr);
23700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23702         this_ptr_conv.is_owned = false;
23703         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
23704         return ret_conv;
23705 }
23706
23707 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) {
23708         LDKChannelHandshakeConfig this_ptr_conv;
23709         this_ptr_conv.inner = untag_ptr(this_ptr);
23710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23712         this_ptr_conv.is_owned = false;
23713         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
23714 }
23715
23716 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) {
23717         LDKChannelHandshakeConfig this_ptr_conv;
23718         this_ptr_conv.inner = untag_ptr(this_ptr);
23719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23721         this_ptr_conv.is_owned = false;
23722         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
23723         return ret_conv;
23724 }
23725
23726 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) {
23727         LDKChannelHandshakeConfig this_ptr_conv;
23728         this_ptr_conv.inner = untag_ptr(this_ptr);
23729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23731         this_ptr_conv.is_owned = false;
23732         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
23733 }
23734
23735 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
23736         LDKChannelHandshakeConfig this_ptr_conv;
23737         this_ptr_conv.inner = untag_ptr(this_ptr);
23738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23740         this_ptr_conv.is_owned = false;
23741         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
23742         return ret_conv;
23743 }
23744
23745 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
23746         LDKChannelHandshakeConfig this_ptr_conv;
23747         this_ptr_conv.inner = untag_ptr(this_ptr);
23748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23750         this_ptr_conv.is_owned = false;
23751         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
23752 }
23753
23754 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
23755         LDKChannelHandshakeConfig this_ptr_conv;
23756         this_ptr_conv.inner = untag_ptr(this_ptr);
23757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23759         this_ptr_conv.is_owned = false;
23760         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
23761         return ret_conv;
23762 }
23763
23764 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
23765         LDKChannelHandshakeConfig 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         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
23771 }
23772
23773 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
23774         LDKChannelHandshakeConfig this_ptr_conv;
23775         this_ptr_conv.inner = untag_ptr(this_ptr);
23776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23778         this_ptr_conv.is_owned = false;
23779         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
23780         return ret_conv;
23781 }
23782
23783 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
23784         LDKChannelHandshakeConfig this_ptr_conv;
23785         this_ptr_conv.inner = untag_ptr(this_ptr);
23786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23788         this_ptr_conv.is_owned = false;
23789         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
23790 }
23791
23792 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths"))) TS_ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(uint64_t this_ptr) {
23793         LDKChannelHandshakeConfig this_ptr_conv;
23794         this_ptr_conv.inner = untag_ptr(this_ptr);
23795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23797         this_ptr_conv.is_owned = false;
23798         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
23799         return ret_conv;
23800 }
23801
23802 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths"))) TS_ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(uint64_t this_ptr, int32_t val) {
23803         LDKChannelHandshakeConfig this_ptr_conv;
23804         this_ptr_conv.inner = untag_ptr(this_ptr);
23805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23807         this_ptr_conv.is_owned = false;
23808         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
23809 }
23810
23811 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_new"))) TS_ChannelHandshakeConfig_new(int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg, int8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, jboolean negotiate_scid_privacy_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int32_t their_channel_reserve_proportional_millionths_arg) {
23812         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, max_inbound_htlc_value_in_flight_percent_of_channel_arg, negotiate_scid_privacy_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, their_channel_reserve_proportional_millionths_arg);
23813         uint64_t ret_ref = 0;
23814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23816         return ret_ref;
23817 }
23818
23819 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
23820         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
23821         uint64_t ret_ref = 0;
23822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23824         return ret_ref;
23825 }
23826 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
23827         LDKChannelHandshakeConfig arg_conv;
23828         arg_conv.inner = untag_ptr(arg);
23829         arg_conv.is_owned = ptr_is_owned(arg);
23830         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23831         arg_conv.is_owned = false;
23832         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
23833         return ret_conv;
23834 }
23835
23836 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
23837         LDKChannelHandshakeConfig orig_conv;
23838         orig_conv.inner = untag_ptr(orig);
23839         orig_conv.is_owned = ptr_is_owned(orig);
23840         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23841         orig_conv.is_owned = false;
23842         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
23843         uint64_t ret_ref = 0;
23844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23846         return ret_ref;
23847 }
23848
23849 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
23850         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
23851         uint64_t ret_ref = 0;
23852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23854         return ret_ref;
23855 }
23856
23857 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
23858         LDKChannelHandshakeLimits this_obj_conv;
23859         this_obj_conv.inner = untag_ptr(this_obj);
23860         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23862         ChannelHandshakeLimits_free(this_obj_conv);
23863 }
23864
23865 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
23866         LDKChannelHandshakeLimits this_ptr_conv;
23867         this_ptr_conv.inner = untag_ptr(this_ptr);
23868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23870         this_ptr_conv.is_owned = false;
23871         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
23872         return ret_conv;
23873 }
23874
23875 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
23876         LDKChannelHandshakeLimits this_ptr_conv;
23877         this_ptr_conv.inner = untag_ptr(this_ptr);
23878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23880         this_ptr_conv.is_owned = false;
23881         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
23882 }
23883
23884 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
23885         LDKChannelHandshakeLimits this_ptr_conv;
23886         this_ptr_conv.inner = untag_ptr(this_ptr);
23887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23889         this_ptr_conv.is_owned = false;
23890         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
23891         return ret_conv;
23892 }
23893
23894 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
23895         LDKChannelHandshakeLimits this_ptr_conv;
23896         this_ptr_conv.inner = untag_ptr(this_ptr);
23897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23899         this_ptr_conv.is_owned = false;
23900         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
23901 }
23902
23903 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
23904         LDKChannelHandshakeLimits this_ptr_conv;
23905         this_ptr_conv.inner = untag_ptr(this_ptr);
23906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23908         this_ptr_conv.is_owned = false;
23909         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
23910         return ret_conv;
23911 }
23912
23913 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) {
23914         LDKChannelHandshakeLimits this_ptr_conv;
23915         this_ptr_conv.inner = untag_ptr(this_ptr);
23916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23918         this_ptr_conv.is_owned = false;
23919         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
23920 }
23921
23922 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) {
23923         LDKChannelHandshakeLimits this_ptr_conv;
23924         this_ptr_conv.inner = untag_ptr(this_ptr);
23925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23927         this_ptr_conv.is_owned = false;
23928         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
23929         return ret_conv;
23930 }
23931
23932 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) {
23933         LDKChannelHandshakeLimits this_ptr_conv;
23934         this_ptr_conv.inner = untag_ptr(this_ptr);
23935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23937         this_ptr_conv.is_owned = false;
23938         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
23939 }
23940
23941 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
23942         LDKChannelHandshakeLimits this_ptr_conv;
23943         this_ptr_conv.inner = untag_ptr(this_ptr);
23944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23946         this_ptr_conv.is_owned = false;
23947         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
23948         return ret_conv;
23949 }
23950
23951 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) {
23952         LDKChannelHandshakeLimits this_ptr_conv;
23953         this_ptr_conv.inner = untag_ptr(this_ptr);
23954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23956         this_ptr_conv.is_owned = false;
23957         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
23958 }
23959
23960 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
23961         LDKChannelHandshakeLimits this_ptr_conv;
23962         this_ptr_conv.inner = untag_ptr(this_ptr);
23963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23965         this_ptr_conv.is_owned = false;
23966         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
23967         return ret_conv;
23968 }
23969
23970 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) {
23971         LDKChannelHandshakeLimits this_ptr_conv;
23972         this_ptr_conv.inner = untag_ptr(this_ptr);
23973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23975         this_ptr_conv.is_owned = false;
23976         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
23977 }
23978
23979 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
23980         LDKChannelHandshakeLimits this_ptr_conv;
23981         this_ptr_conv.inner = untag_ptr(this_ptr);
23982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23984         this_ptr_conv.is_owned = false;
23985         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
23986         return ret_conv;
23987 }
23988
23989 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
23990         LDKChannelHandshakeLimits this_ptr_conv;
23991         this_ptr_conv.inner = untag_ptr(this_ptr);
23992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23994         this_ptr_conv.is_owned = false;
23995         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
23996 }
23997
23998 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
23999         LDKChannelHandshakeLimits this_ptr_conv;
24000         this_ptr_conv.inner = untag_ptr(this_ptr);
24001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24003         this_ptr_conv.is_owned = false;
24004         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
24005         return ret_conv;
24006 }
24007
24008 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
24009         LDKChannelHandshakeLimits this_ptr_conv;
24010         this_ptr_conv.inner = untag_ptr(this_ptr);
24011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24013         this_ptr_conv.is_owned = false;
24014         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
24015 }
24016
24017 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
24018         LDKChannelHandshakeLimits this_ptr_conv;
24019         this_ptr_conv.inner = untag_ptr(this_ptr);
24020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24022         this_ptr_conv.is_owned = false;
24023         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
24024         return ret_conv;
24025 }
24026
24027 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
24028         LDKChannelHandshakeLimits this_ptr_conv;
24029         this_ptr_conv.inner = untag_ptr(this_ptr);
24030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24032         this_ptr_conv.is_owned = false;
24033         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
24034 }
24035
24036 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
24037         LDKChannelHandshakeLimits this_ptr_conv;
24038         this_ptr_conv.inner = untag_ptr(this_ptr);
24039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24041         this_ptr_conv.is_owned = false;
24042         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
24043         return ret_conv;
24044 }
24045
24046 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) {
24047         LDKChannelHandshakeLimits this_ptr_conv;
24048         this_ptr_conv.inner = untag_ptr(this_ptr);
24049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24051         this_ptr_conv.is_owned = false;
24052         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
24053 }
24054
24055 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) {
24056         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);
24057         uint64_t ret_ref = 0;
24058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24060         return ret_ref;
24061 }
24062
24063 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
24064         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
24065         uint64_t ret_ref = 0;
24066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24068         return ret_ref;
24069 }
24070 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
24071         LDKChannelHandshakeLimits arg_conv;
24072         arg_conv.inner = untag_ptr(arg);
24073         arg_conv.is_owned = ptr_is_owned(arg);
24074         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24075         arg_conv.is_owned = false;
24076         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
24077         return ret_conv;
24078 }
24079
24080 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
24081         LDKChannelHandshakeLimits orig_conv;
24082         orig_conv.inner = untag_ptr(orig);
24083         orig_conv.is_owned = ptr_is_owned(orig);
24084         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24085         orig_conv.is_owned = false;
24086         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
24087         uint64_t ret_ref = 0;
24088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24090         return ret_ref;
24091 }
24092
24093 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
24094         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
24095         uint64_t ret_ref = 0;
24096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24098         return ret_ref;
24099 }
24100
24101 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
24102         LDKChannelConfig this_obj_conv;
24103         this_obj_conv.inner = untag_ptr(this_obj);
24104         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24106         ChannelConfig_free(this_obj_conv);
24107 }
24108
24109 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
24110         LDKChannelConfig this_ptr_conv;
24111         this_ptr_conv.inner = untag_ptr(this_ptr);
24112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24114         this_ptr_conv.is_owned = false;
24115         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
24116         return ret_conv;
24117 }
24118
24119 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) {
24120         LDKChannelConfig this_ptr_conv;
24121         this_ptr_conv.inner = untag_ptr(this_ptr);
24122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24124         this_ptr_conv.is_owned = false;
24125         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
24126 }
24127
24128 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
24129         LDKChannelConfig this_ptr_conv;
24130         this_ptr_conv.inner = untag_ptr(this_ptr);
24131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24133         this_ptr_conv.is_owned = false;
24134         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
24135         return ret_conv;
24136 }
24137
24138 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) {
24139         LDKChannelConfig this_ptr_conv;
24140         this_ptr_conv.inner = untag_ptr(this_ptr);
24141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24143         this_ptr_conv.is_owned = false;
24144         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
24145 }
24146
24147 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
24148         LDKChannelConfig this_ptr_conv;
24149         this_ptr_conv.inner = untag_ptr(this_ptr);
24150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24152         this_ptr_conv.is_owned = false;
24153         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
24154         return ret_conv;
24155 }
24156
24157 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
24158         LDKChannelConfig this_ptr_conv;
24159         this_ptr_conv.inner = untag_ptr(this_ptr);
24160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24162         this_ptr_conv.is_owned = false;
24163         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
24164 }
24165
24166 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) {
24167         LDKChannelConfig this_ptr_conv;
24168         this_ptr_conv.inner = untag_ptr(this_ptr);
24169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24171         this_ptr_conv.is_owned = false;
24172         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
24173         return ret_conv;
24174 }
24175
24176 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) {
24177         LDKChannelConfig this_ptr_conv;
24178         this_ptr_conv.inner = untag_ptr(this_ptr);
24179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24181         this_ptr_conv.is_owned = false;
24182         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
24183 }
24184
24185 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) {
24186         LDKChannelConfig this_ptr_conv;
24187         this_ptr_conv.inner = untag_ptr(this_ptr);
24188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24190         this_ptr_conv.is_owned = false;
24191         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
24192         return ret_conv;
24193 }
24194
24195 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) {
24196         LDKChannelConfig this_ptr_conv;
24197         this_ptr_conv.inner = untag_ptr(this_ptr);
24198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24200         this_ptr_conv.is_owned = false;
24201         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
24202 }
24203
24204 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) {
24205         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);
24206         uint64_t ret_ref = 0;
24207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24209         return ret_ref;
24210 }
24211
24212 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
24213         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
24214         uint64_t ret_ref = 0;
24215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24217         return ret_ref;
24218 }
24219 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
24220         LDKChannelConfig arg_conv;
24221         arg_conv.inner = untag_ptr(arg);
24222         arg_conv.is_owned = ptr_is_owned(arg);
24223         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24224         arg_conv.is_owned = false;
24225         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
24226         return ret_conv;
24227 }
24228
24229 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
24230         LDKChannelConfig orig_conv;
24231         orig_conv.inner = untag_ptr(orig);
24232         orig_conv.is_owned = ptr_is_owned(orig);
24233         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24234         orig_conv.is_owned = false;
24235         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
24236         uint64_t ret_ref = 0;
24237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24239         return ret_ref;
24240 }
24241
24242 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
24243         LDKChannelConfig a_conv;
24244         a_conv.inner = untag_ptr(a);
24245         a_conv.is_owned = ptr_is_owned(a);
24246         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24247         a_conv.is_owned = false;
24248         LDKChannelConfig b_conv;
24249         b_conv.inner = untag_ptr(b);
24250         b_conv.is_owned = ptr_is_owned(b);
24251         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24252         b_conv.is_owned = false;
24253         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
24254         return ret_conv;
24255 }
24256
24257 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
24258         LDKChannelConfig ret_var = ChannelConfig_default();
24259         uint64_t ret_ref = 0;
24260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24262         return ret_ref;
24263 }
24264
24265 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
24266         LDKChannelConfig obj_conv;
24267         obj_conv.inner = untag_ptr(obj);
24268         obj_conv.is_owned = ptr_is_owned(obj);
24269         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24270         obj_conv.is_owned = false;
24271         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
24272         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24273         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24274         CVec_u8Z_free(ret_var);
24275         return ret_arr;
24276 }
24277
24278 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
24279         LDKu8slice ser_ref;
24280         ser_ref.datalen = ser->arr_len;
24281         ser_ref.data = ser->elems;
24282         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
24283         *ret_conv = ChannelConfig_read(ser_ref);
24284         FREE(ser);
24285         return tag_ptr(ret_conv, true);
24286 }
24287
24288 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
24289         LDKUserConfig this_obj_conv;
24290         this_obj_conv.inner = untag_ptr(this_obj);
24291         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24293         UserConfig_free(this_obj_conv);
24294 }
24295
24296 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
24297         LDKUserConfig this_ptr_conv;
24298         this_ptr_conv.inner = untag_ptr(this_ptr);
24299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24301         this_ptr_conv.is_owned = false;
24302         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
24303         uint64_t ret_ref = 0;
24304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24306         return ret_ref;
24307 }
24308
24309 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
24310         LDKUserConfig this_ptr_conv;
24311         this_ptr_conv.inner = untag_ptr(this_ptr);
24312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24314         this_ptr_conv.is_owned = false;
24315         LDKChannelHandshakeConfig val_conv;
24316         val_conv.inner = untag_ptr(val);
24317         val_conv.is_owned = ptr_is_owned(val);
24318         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24319         val_conv = ChannelHandshakeConfig_clone(&val_conv);
24320         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
24321 }
24322
24323 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
24324         LDKUserConfig this_ptr_conv;
24325         this_ptr_conv.inner = untag_ptr(this_ptr);
24326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24328         this_ptr_conv.is_owned = false;
24329         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
24330         uint64_t ret_ref = 0;
24331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24333         return ret_ref;
24334 }
24335
24336 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
24337         LDKUserConfig this_ptr_conv;
24338         this_ptr_conv.inner = untag_ptr(this_ptr);
24339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24341         this_ptr_conv.is_owned = false;
24342         LDKChannelHandshakeLimits val_conv;
24343         val_conv.inner = untag_ptr(val);
24344         val_conv.is_owned = ptr_is_owned(val);
24345         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24346         val_conv = ChannelHandshakeLimits_clone(&val_conv);
24347         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
24348 }
24349
24350 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
24351         LDKUserConfig this_ptr_conv;
24352         this_ptr_conv.inner = untag_ptr(this_ptr);
24353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24355         this_ptr_conv.is_owned = false;
24356         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
24357         uint64_t ret_ref = 0;
24358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24360         return ret_ref;
24361 }
24362
24363 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
24364         LDKUserConfig 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         LDKChannelConfig val_conv;
24370         val_conv.inner = untag_ptr(val);
24371         val_conv.is_owned = ptr_is_owned(val);
24372         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24373         val_conv = ChannelConfig_clone(&val_conv);
24374         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
24375 }
24376
24377 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
24378         LDKUserConfig this_ptr_conv;
24379         this_ptr_conv.inner = untag_ptr(this_ptr);
24380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24382         this_ptr_conv.is_owned = false;
24383         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
24384         return ret_conv;
24385 }
24386
24387 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) {
24388         LDKUserConfig this_ptr_conv;
24389         this_ptr_conv.inner = untag_ptr(this_ptr);
24390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24392         this_ptr_conv.is_owned = false;
24393         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
24394 }
24395
24396 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
24397         LDKUserConfig this_ptr_conv;
24398         this_ptr_conv.inner = untag_ptr(this_ptr);
24399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24401         this_ptr_conv.is_owned = false;
24402         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
24403         return ret_conv;
24404 }
24405
24406 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
24407         LDKUserConfig this_ptr_conv;
24408         this_ptr_conv.inner = untag_ptr(this_ptr);
24409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24411         this_ptr_conv.is_owned = false;
24412         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
24413 }
24414
24415 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
24416         LDKUserConfig this_ptr_conv;
24417         this_ptr_conv.inner = untag_ptr(this_ptr);
24418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24420         this_ptr_conv.is_owned = false;
24421         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
24422         return ret_conv;
24423 }
24424
24425 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
24426         LDKUserConfig this_ptr_conv;
24427         this_ptr_conv.inner = untag_ptr(this_ptr);
24428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24430         this_ptr_conv.is_owned = false;
24431         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
24432 }
24433
24434 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
24435         LDKUserConfig this_ptr_conv;
24436         this_ptr_conv.inner = untag_ptr(this_ptr);
24437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24439         this_ptr_conv.is_owned = false;
24440         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
24441         return ret_conv;
24442 }
24443
24444 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
24445         LDKUserConfig this_ptr_conv;
24446         this_ptr_conv.inner = untag_ptr(this_ptr);
24447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24449         this_ptr_conv.is_owned = false;
24450         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
24451 }
24452
24453 uint64_t  __attribute__((export_name("TS_UserConfig_new"))) TS_UserConfig_new(uint64_t channel_handshake_config_arg, uint64_t channel_handshake_limits_arg, uint64_t channel_config_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg, jboolean manually_accept_inbound_channels_arg, jboolean accept_intercept_htlcs_arg) {
24454         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
24455         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
24456         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
24457         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
24458         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
24459         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
24460         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
24461         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
24462         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
24463         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
24464         LDKChannelConfig channel_config_arg_conv;
24465         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
24466         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
24467         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
24468         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
24469         LDKUserConfig ret_var = UserConfig_new(channel_handshake_config_arg_conv, channel_handshake_limits_arg_conv, channel_config_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg, manually_accept_inbound_channels_arg, accept_intercept_htlcs_arg);
24470         uint64_t ret_ref = 0;
24471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24473         return ret_ref;
24474 }
24475
24476 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
24477         LDKUserConfig ret_var = UserConfig_clone(arg);
24478         uint64_t ret_ref = 0;
24479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24481         return ret_ref;
24482 }
24483 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
24484         LDKUserConfig arg_conv;
24485         arg_conv.inner = untag_ptr(arg);
24486         arg_conv.is_owned = ptr_is_owned(arg);
24487         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24488         arg_conv.is_owned = false;
24489         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
24490         return ret_conv;
24491 }
24492
24493 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
24494         LDKUserConfig orig_conv;
24495         orig_conv.inner = untag_ptr(orig);
24496         orig_conv.is_owned = ptr_is_owned(orig);
24497         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24498         orig_conv.is_owned = false;
24499         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
24500         uint64_t ret_ref = 0;
24501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24503         return ret_ref;
24504 }
24505
24506 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
24507         LDKUserConfig ret_var = UserConfig_default();
24508         uint64_t ret_ref = 0;
24509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24511         return ret_ref;
24512 }
24513
24514 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
24515         LDKBestBlock this_obj_conv;
24516         this_obj_conv.inner = untag_ptr(this_obj);
24517         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24519         BestBlock_free(this_obj_conv);
24520 }
24521
24522 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
24523         LDKBestBlock ret_var = BestBlock_clone(arg);
24524         uint64_t ret_ref = 0;
24525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24527         return ret_ref;
24528 }
24529 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
24530         LDKBestBlock arg_conv;
24531         arg_conv.inner = untag_ptr(arg);
24532         arg_conv.is_owned = ptr_is_owned(arg);
24533         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24534         arg_conv.is_owned = false;
24535         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
24536         return ret_conv;
24537 }
24538
24539 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
24540         LDKBestBlock orig_conv;
24541         orig_conv.inner = untag_ptr(orig);
24542         orig_conv.is_owned = ptr_is_owned(orig);
24543         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24544         orig_conv.is_owned = false;
24545         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
24546         uint64_t ret_ref = 0;
24547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24549         return ret_ref;
24550 }
24551
24552 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
24553         LDKBestBlock a_conv;
24554         a_conv.inner = untag_ptr(a);
24555         a_conv.is_owned = ptr_is_owned(a);
24556         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24557         a_conv.is_owned = false;
24558         LDKBestBlock b_conv;
24559         b_conv.inner = untag_ptr(b);
24560         b_conv.is_owned = ptr_is_owned(b);
24561         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24562         b_conv.is_owned = false;
24563         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
24564         return ret_conv;
24565 }
24566
24567 uint64_t  __attribute__((export_name("TS_BestBlock_from_network"))) TS_BestBlock_from_network(uint32_t network) {
24568         LDKNetwork network_conv = LDKNetwork_from_js(network);
24569         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
24570         uint64_t ret_ref = 0;
24571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24573         return ret_ref;
24574 }
24575
24576 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
24577         LDKThirtyTwoBytes block_hash_ref;
24578         CHECK(block_hash->arr_len == 32);
24579         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
24580         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
24581         uint64_t ret_ref = 0;
24582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24584         return ret_ref;
24585 }
24586
24587 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
24588         LDKBestBlock this_arg_conv;
24589         this_arg_conv.inner = untag_ptr(this_arg);
24590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24592         this_arg_conv.is_owned = false;
24593         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24594         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
24595         return ret_arr;
24596 }
24597
24598 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
24599         LDKBestBlock this_arg_conv;
24600         this_arg_conv.inner = untag_ptr(this_arg);
24601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24603         this_arg_conv.is_owned = false;
24604         int32_t ret_conv = BestBlock_height(&this_arg_conv);
24605         return ret_conv;
24606 }
24607
24608 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
24609         if (!ptr_is_owned(this_ptr)) return;
24610         void* this_ptr_ptr = untag_ptr(this_ptr);
24611         CHECK_ACCESS(this_ptr_ptr);
24612         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
24613         FREE(untag_ptr(this_ptr));
24614         Listen_free(this_ptr_conv);
24615 }
24616
24617 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
24618         if (!ptr_is_owned(this_ptr)) return;
24619         void* this_ptr_ptr = untag_ptr(this_ptr);
24620         CHECK_ACCESS(this_ptr_ptr);
24621         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
24622         FREE(untag_ptr(this_ptr));
24623         Confirm_free(this_ptr_conv);
24624 }
24625
24626 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
24627         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
24628         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
24629         return ret_conv;
24630 }
24631
24632 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
24633         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
24634         return ret_conv;
24635 }
24636
24637 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
24638         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
24639         return ret_conv;
24640 }
24641
24642 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_permanent_failure"))) TS_ChannelMonitorUpdateStatus_permanent_failure() {
24643         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_permanent_failure());
24644         return ret_conv;
24645 }
24646
24647 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
24648         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
24649         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
24650         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
24651         return ret_conv;
24652 }
24653
24654 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
24655         if (!ptr_is_owned(this_ptr)) return;
24656         void* this_ptr_ptr = untag_ptr(this_ptr);
24657         CHECK_ACCESS(this_ptr_ptr);
24658         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
24659         FREE(untag_ptr(this_ptr));
24660         Watch_free(this_ptr_conv);
24661 }
24662
24663 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
24664         if (!ptr_is_owned(this_ptr)) return;
24665         void* this_ptr_ptr = untag_ptr(this_ptr);
24666         CHECK_ACCESS(this_ptr_ptr);
24667         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
24668         FREE(untag_ptr(this_ptr));
24669         Filter_free(this_ptr_conv);
24670 }
24671
24672 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
24673         LDKWatchedOutput this_obj_conv;
24674         this_obj_conv.inner = untag_ptr(this_obj);
24675         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24677         WatchedOutput_free(this_obj_conv);
24678 }
24679
24680 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
24681         LDKWatchedOutput this_ptr_conv;
24682         this_ptr_conv.inner = untag_ptr(this_ptr);
24683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24685         this_ptr_conv.is_owned = false;
24686         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24687         memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
24688         return ret_arr;
24689 }
24690
24691 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, int8_tArray val) {
24692         LDKWatchedOutput this_ptr_conv;
24693         this_ptr_conv.inner = untag_ptr(this_ptr);
24694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24696         this_ptr_conv.is_owned = false;
24697         LDKThirtyTwoBytes val_ref;
24698         CHECK(val->arr_len == 32);
24699         memcpy(val_ref.data, val->elems, 32); FREE(val);
24700         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
24701 }
24702
24703 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
24704         LDKWatchedOutput this_ptr_conv;
24705         this_ptr_conv.inner = untag_ptr(this_ptr);
24706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24708         this_ptr_conv.is_owned = false;
24709         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
24710         uint64_t ret_ref = 0;
24711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24713         return ret_ref;
24714 }
24715
24716 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
24717         LDKWatchedOutput this_ptr_conv;
24718         this_ptr_conv.inner = untag_ptr(this_ptr);
24719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24721         this_ptr_conv.is_owned = false;
24722         LDKOutPoint val_conv;
24723         val_conv.inner = untag_ptr(val);
24724         val_conv.is_owned = ptr_is_owned(val);
24725         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24726         val_conv = OutPoint_clone(&val_conv);
24727         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
24728 }
24729
24730 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
24731         LDKWatchedOutput this_ptr_conv;
24732         this_ptr_conv.inner = untag_ptr(this_ptr);
24733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24735         this_ptr_conv.is_owned = false;
24736         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
24737         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24738         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24739         return ret_arr;
24740 }
24741
24742 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
24743         LDKWatchedOutput this_ptr_conv;
24744         this_ptr_conv.inner = untag_ptr(this_ptr);
24745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24747         this_ptr_conv.is_owned = false;
24748         LDKCVec_u8Z val_ref;
24749         val_ref.datalen = val->arr_len;
24750         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
24751         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
24752         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
24753 }
24754
24755 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) {
24756         LDKThirtyTwoBytes block_hash_arg_ref;
24757         CHECK(block_hash_arg->arr_len == 32);
24758         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
24759         LDKOutPoint outpoint_arg_conv;
24760         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
24761         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
24762         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
24763         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
24764         LDKCVec_u8Z script_pubkey_arg_ref;
24765         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
24766         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
24767         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
24768         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
24769         uint64_t ret_ref = 0;
24770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24772         return ret_ref;
24773 }
24774
24775 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
24776         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
24777         uint64_t ret_ref = 0;
24778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24780         return ret_ref;
24781 }
24782 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
24783         LDKWatchedOutput arg_conv;
24784         arg_conv.inner = untag_ptr(arg);
24785         arg_conv.is_owned = ptr_is_owned(arg);
24786         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24787         arg_conv.is_owned = false;
24788         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
24789         return ret_conv;
24790 }
24791
24792 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
24793         LDKWatchedOutput orig_conv;
24794         orig_conv.inner = untag_ptr(orig);
24795         orig_conv.is_owned = ptr_is_owned(orig);
24796         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24797         orig_conv.is_owned = false;
24798         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
24799         uint64_t ret_ref = 0;
24800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24802         return ret_ref;
24803 }
24804
24805 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
24806         LDKWatchedOutput a_conv;
24807         a_conv.inner = untag_ptr(a);
24808         a_conv.is_owned = ptr_is_owned(a);
24809         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24810         a_conv.is_owned = false;
24811         LDKWatchedOutput b_conv;
24812         b_conv.inner = untag_ptr(b);
24813         b_conv.is_owned = ptr_is_owned(b);
24814         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24815         b_conv.is_owned = false;
24816         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
24817         return ret_conv;
24818 }
24819
24820 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
24821         LDKWatchedOutput o_conv;
24822         o_conv.inner = untag_ptr(o);
24823         o_conv.is_owned = ptr_is_owned(o);
24824         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24825         o_conv.is_owned = false;
24826         int64_t ret_conv = WatchedOutput_hash(&o_conv);
24827         return ret_conv;
24828 }
24829
24830 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
24831         if (!ptr_is_owned(this_ptr)) return;
24832         void* this_ptr_ptr = untag_ptr(this_ptr);
24833         CHECK_ACCESS(this_ptr_ptr);
24834         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
24835         FREE(untag_ptr(this_ptr));
24836         BroadcasterInterface_free(this_ptr_conv);
24837 }
24838
24839 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
24840         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
24841         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
24842         return ret_conv;
24843 }
24844
24845 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
24846         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
24847         return ret_conv;
24848 }
24849
24850 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
24851         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
24852         return ret_conv;
24853 }
24854
24855 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
24856         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
24857         return ret_conv;
24858 }
24859
24860 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
24861         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
24862         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
24863         return ret_conv;
24864 }
24865
24866 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
24867         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
24868         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
24869         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
24870         return ret_conv;
24871 }
24872
24873 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
24874         if (!ptr_is_owned(this_ptr)) return;
24875         void* this_ptr_ptr = untag_ptr(this_ptr);
24876         CHECK_ACCESS(this_ptr_ptr);
24877         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
24878         FREE(untag_ptr(this_ptr));
24879         FeeEstimator_free(this_ptr_conv);
24880 }
24881
24882 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
24883         LDKMonitorUpdateId this_obj_conv;
24884         this_obj_conv.inner = untag_ptr(this_obj);
24885         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24887         MonitorUpdateId_free(this_obj_conv);
24888 }
24889
24890 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
24891         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
24892         uint64_t ret_ref = 0;
24893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24895         return ret_ref;
24896 }
24897 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
24898         LDKMonitorUpdateId arg_conv;
24899         arg_conv.inner = untag_ptr(arg);
24900         arg_conv.is_owned = ptr_is_owned(arg);
24901         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24902         arg_conv.is_owned = false;
24903         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
24904         return ret_conv;
24905 }
24906
24907 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
24908         LDKMonitorUpdateId orig_conv;
24909         orig_conv.inner = untag_ptr(orig);
24910         orig_conv.is_owned = ptr_is_owned(orig);
24911         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24912         orig_conv.is_owned = false;
24913         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
24914         uint64_t ret_ref = 0;
24915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24917         return ret_ref;
24918 }
24919
24920 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
24921         LDKMonitorUpdateId o_conv;
24922         o_conv.inner = untag_ptr(o);
24923         o_conv.is_owned = ptr_is_owned(o);
24924         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24925         o_conv.is_owned = false;
24926         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
24927         return ret_conv;
24928 }
24929
24930 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
24931         LDKMonitorUpdateId a_conv;
24932         a_conv.inner = untag_ptr(a);
24933         a_conv.is_owned = ptr_is_owned(a);
24934         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24935         a_conv.is_owned = false;
24936         LDKMonitorUpdateId b_conv;
24937         b_conv.inner = untag_ptr(b);
24938         b_conv.is_owned = ptr_is_owned(b);
24939         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24940         b_conv.is_owned = false;
24941         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
24942         return ret_conv;
24943 }
24944
24945 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
24946         if (!ptr_is_owned(this_ptr)) return;
24947         void* this_ptr_ptr = untag_ptr(this_ptr);
24948         CHECK_ACCESS(this_ptr_ptr);
24949         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
24950         FREE(untag_ptr(this_ptr));
24951         Persist_free(this_ptr_conv);
24952 }
24953
24954 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
24955         LDKLockedChannelMonitor this_obj_conv;
24956         this_obj_conv.inner = untag_ptr(this_obj);
24957         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24959         LockedChannelMonitor_free(this_obj_conv);
24960 }
24961
24962 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
24963         LDKChainMonitor this_obj_conv;
24964         this_obj_conv.inner = untag_ptr(this_obj);
24965         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24967         ChainMonitor_free(this_obj_conv);
24968 }
24969
24970 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) {
24971         void* chain_source_ptr = untag_ptr(chain_source);
24972         CHECK_ACCESS(chain_source_ptr);
24973         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
24974         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
24975         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
24976                 // Manually implement clone for Java trait instances
24977                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
24978                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24979                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
24980                 }
24981         }
24982         void* broadcaster_ptr = untag_ptr(broadcaster);
24983         CHECK_ACCESS(broadcaster_ptr);
24984         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24985         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24986                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24987                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24988         }
24989         void* logger_ptr = untag_ptr(logger);
24990         CHECK_ACCESS(logger_ptr);
24991         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24992         if (logger_conv.free == LDKLogger_JCalls_free) {
24993                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24994                 LDKLogger_JCalls_cloned(&logger_conv);
24995         }
24996         void* feeest_ptr = untag_ptr(feeest);
24997         CHECK_ACCESS(feeest_ptr);
24998         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
24999         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
25000                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25001                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
25002         }
25003         void* persister_ptr = untag_ptr(persister);
25004         CHECK_ACCESS(persister_ptr);
25005         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
25006         if (persister_conv.free == LDKPersist_JCalls_free) {
25007                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25008                 LDKPersist_JCalls_cloned(&persister_conv);
25009         }
25010         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
25011         uint64_t ret_ref = 0;
25012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25014         return ret_ref;
25015 }
25016
25017 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
25018         LDKChainMonitor this_arg_conv;
25019         this_arg_conv.inner = untag_ptr(this_arg);
25020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25022         this_arg_conv.is_owned = false;
25023         LDKCVec_ChannelDetailsZ ignored_channels_constr;
25024         ignored_channels_constr.datalen = ignored_channels->arr_len;
25025         if (ignored_channels_constr.datalen > 0)
25026                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25027         else
25028                 ignored_channels_constr.data = NULL;
25029         uint64_t* ignored_channels_vals = ignored_channels->elems;
25030         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
25031                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
25032                 LDKChannelDetails ignored_channels_conv_16_conv;
25033                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
25034                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
25035                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
25036                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
25037                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
25038         }
25039         FREE(ignored_channels);
25040         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
25041         uint64_tArray ret_arr = NULL;
25042         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25043         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25044         for (size_t j = 0; j < ret_var.datalen; j++) {
25045                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25046                 *ret_conv_9_copy = ret_var.data[j];
25047                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
25048                 ret_arr_ptr[j] = ret_conv_9_ref;
25049         }
25050         
25051         FREE(ret_var.data);
25052         return ret_arr;
25053 }
25054
25055 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
25056         LDKChainMonitor this_arg_conv;
25057         this_arg_conv.inner = untag_ptr(this_arg);
25058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25060         this_arg_conv.is_owned = false;
25061         LDKOutPoint funding_txo_conv;
25062         funding_txo_conv.inner = untag_ptr(funding_txo);
25063         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
25064         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25065         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25066         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
25067         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
25068         return tag_ptr(ret_conv, true);
25069 }
25070
25071 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
25072         LDKChainMonitor this_arg_conv;
25073         this_arg_conv.inner = untag_ptr(this_arg);
25074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25076         this_arg_conv.is_owned = false;
25077         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
25078         uint64_tArray ret_arr = NULL;
25079         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25080         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25081         for (size_t k = 0; k < ret_var.datalen; k++) {
25082                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
25083                 uint64_t ret_conv_10_ref = 0;
25084                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
25085                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
25086                 ret_arr_ptr[k] = ret_conv_10_ref;
25087         }
25088         
25089         FREE(ret_var.data);
25090         return ret_arr;
25091 }
25092
25093 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
25094         LDKChainMonitor this_arg_conv;
25095         this_arg_conv.inner = untag_ptr(this_arg);
25096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25098         this_arg_conv.is_owned = false;
25099         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
25100         uint64_tArray ret_arr = NULL;
25101         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25102         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25103         for (size_t p = 0; p < ret_var.datalen; p++) {
25104                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
25105                 *ret_conv_41_conv = ret_var.data[p];
25106                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
25107         }
25108         
25109         FREE(ret_var.data);
25110         return ret_arr;
25111 }
25112
25113 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) {
25114         LDKChainMonitor this_arg_conv;
25115         this_arg_conv.inner = untag_ptr(this_arg);
25116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25118         this_arg_conv.is_owned = false;
25119         LDKOutPoint funding_txo_conv;
25120         funding_txo_conv.inner = untag_ptr(funding_txo);
25121         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
25122         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25123         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25124         LDKMonitorUpdateId completed_update_id_conv;
25125         completed_update_id_conv.inner = untag_ptr(completed_update_id);
25126         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
25127         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
25128         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
25129         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25130         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
25131         return tag_ptr(ret_conv, true);
25132 }
25133
25134 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
25135         LDKChainMonitor this_arg_conv;
25136         this_arg_conv.inner = untag_ptr(this_arg);
25137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25139         this_arg_conv.is_owned = false;
25140         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
25141         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
25142         return tag_ptr(ret_ret, true);
25143 }
25144
25145 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
25146         LDKChainMonitor this_arg_conv;
25147         this_arg_conv.inner = untag_ptr(this_arg);
25148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25150         this_arg_conv.is_owned = false;
25151         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
25152         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
25153         return tag_ptr(ret_ret, true);
25154 }
25155
25156 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
25157         LDKChainMonitor this_arg_conv;
25158         this_arg_conv.inner = untag_ptr(this_arg);
25159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25161         this_arg_conv.is_owned = false;
25162         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
25163         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
25164         return tag_ptr(ret_ret, true);
25165 }
25166
25167 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
25168         LDKChainMonitor this_arg_conv;
25169         this_arg_conv.inner = untag_ptr(this_arg);
25170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25172         this_arg_conv.is_owned = false;
25173         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
25174         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
25175         return tag_ptr(ret_ret, true);
25176 }
25177
25178 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
25179         LDKChannelMonitorUpdate this_obj_conv;
25180         this_obj_conv.inner = untag_ptr(this_obj);
25181         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25183         ChannelMonitorUpdate_free(this_obj_conv);
25184 }
25185
25186 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
25187         LDKChannelMonitorUpdate this_ptr_conv;
25188         this_ptr_conv.inner = untag_ptr(this_ptr);
25189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25191         this_ptr_conv.is_owned = false;
25192         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
25193         return ret_conv;
25194 }
25195
25196 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
25197         LDKChannelMonitorUpdate this_ptr_conv;
25198         this_ptr_conv.inner = untag_ptr(this_ptr);
25199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25201         this_ptr_conv.is_owned = false;
25202         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
25203 }
25204
25205 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
25206         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
25207         uint64_t ret_ref = 0;
25208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25210         return ret_ref;
25211 }
25212 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
25213         LDKChannelMonitorUpdate arg_conv;
25214         arg_conv.inner = untag_ptr(arg);
25215         arg_conv.is_owned = ptr_is_owned(arg);
25216         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25217         arg_conv.is_owned = false;
25218         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
25219         return ret_conv;
25220 }
25221
25222 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
25223         LDKChannelMonitorUpdate orig_conv;
25224         orig_conv.inner = untag_ptr(orig);
25225         orig_conv.is_owned = ptr_is_owned(orig);
25226         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25227         orig_conv.is_owned = false;
25228         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
25229         uint64_t ret_ref = 0;
25230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25232         return ret_ref;
25233 }
25234
25235 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
25236         LDKChannelMonitorUpdate obj_conv;
25237         obj_conv.inner = untag_ptr(obj);
25238         obj_conv.is_owned = ptr_is_owned(obj);
25239         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25240         obj_conv.is_owned = false;
25241         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
25242         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25243         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25244         CVec_u8Z_free(ret_var);
25245         return ret_arr;
25246 }
25247
25248 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
25249         LDKu8slice ser_ref;
25250         ser_ref.datalen = ser->arr_len;
25251         ser_ref.data = ser->elems;
25252         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25253         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
25254         FREE(ser);
25255         return tag_ptr(ret_conv, true);
25256 }
25257
25258 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
25259         if (!ptr_is_owned(this_ptr)) return;
25260         void* this_ptr_ptr = untag_ptr(this_ptr);
25261         CHECK_ACCESS(this_ptr_ptr);
25262         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
25263         FREE(untag_ptr(this_ptr));
25264         MonitorEvent_free(this_ptr_conv);
25265 }
25266
25267 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
25268         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25269         *ret_copy = MonitorEvent_clone(arg);
25270         uint64_t ret_ref = tag_ptr(ret_copy, true);
25271         return ret_ref;
25272 }
25273 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
25274         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
25275         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
25276         return ret_conv;
25277 }
25278
25279 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
25280         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
25281         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25282         *ret_copy = MonitorEvent_clone(orig_conv);
25283         uint64_t ret_ref = tag_ptr(ret_copy, true);
25284         return ret_ref;
25285 }
25286
25287 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
25288         LDKHTLCUpdate a_conv;
25289         a_conv.inner = untag_ptr(a);
25290         a_conv.is_owned = ptr_is_owned(a);
25291         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25292         a_conv = HTLCUpdate_clone(&a_conv);
25293         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25294         *ret_copy = MonitorEvent_htlcevent(a_conv);
25295         uint64_t ret_ref = tag_ptr(ret_copy, true);
25296         return ret_ref;
25297 }
25298
25299 uint64_t  __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint64_t a) {
25300         LDKOutPoint a_conv;
25301         a_conv.inner = untag_ptr(a);
25302         a_conv.is_owned = ptr_is_owned(a);
25303         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25304         a_conv = OutPoint_clone(&a_conv);
25305         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25306         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
25307         uint64_t ret_ref = tag_ptr(ret_copy, true);
25308         return ret_ref;
25309 }
25310
25311 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, int64_t monitor_update_id) {
25312         LDKOutPoint funding_txo_conv;
25313         funding_txo_conv.inner = untag_ptr(funding_txo);
25314         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
25315         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25316         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25317         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25318         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
25319         uint64_t ret_ref = tag_ptr(ret_copy, true);
25320         return ret_ref;
25321 }
25322
25323 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint64_t a) {
25324         LDKOutPoint a_conv;
25325         a_conv.inner = untag_ptr(a);
25326         a_conv.is_owned = ptr_is_owned(a);
25327         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25328         a_conv = OutPoint_clone(&a_conv);
25329         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25330         *ret_copy = MonitorEvent_update_failed(a_conv);
25331         uint64_t ret_ref = tag_ptr(ret_copy, true);
25332         return ret_ref;
25333 }
25334
25335 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
25336         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
25337         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
25338         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
25339         return ret_conv;
25340 }
25341
25342 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
25343         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
25344         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
25345         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25346         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25347         CVec_u8Z_free(ret_var);
25348         return ret_arr;
25349 }
25350
25351 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
25352         LDKu8slice ser_ref;
25353         ser_ref.datalen = ser->arr_len;
25354         ser_ref.data = ser->elems;
25355         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25356         *ret_conv = MonitorEvent_read(ser_ref);
25357         FREE(ser);
25358         return tag_ptr(ret_conv, true);
25359 }
25360
25361 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
25362         LDKHTLCUpdate this_obj_conv;
25363         this_obj_conv.inner = untag_ptr(this_obj);
25364         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25366         HTLCUpdate_free(this_obj_conv);
25367 }
25368
25369 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
25370         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
25371         uint64_t ret_ref = 0;
25372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25374         return ret_ref;
25375 }
25376 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
25377         LDKHTLCUpdate arg_conv;
25378         arg_conv.inner = untag_ptr(arg);
25379         arg_conv.is_owned = ptr_is_owned(arg);
25380         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25381         arg_conv.is_owned = false;
25382         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
25383         return ret_conv;
25384 }
25385
25386 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
25387         LDKHTLCUpdate orig_conv;
25388         orig_conv.inner = untag_ptr(orig);
25389         orig_conv.is_owned = ptr_is_owned(orig);
25390         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25391         orig_conv.is_owned = false;
25392         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
25393         uint64_t ret_ref = 0;
25394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25396         return ret_ref;
25397 }
25398
25399 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
25400         LDKHTLCUpdate a_conv;
25401         a_conv.inner = untag_ptr(a);
25402         a_conv.is_owned = ptr_is_owned(a);
25403         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25404         a_conv.is_owned = false;
25405         LDKHTLCUpdate b_conv;
25406         b_conv.inner = untag_ptr(b);
25407         b_conv.is_owned = ptr_is_owned(b);
25408         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25409         b_conv.is_owned = false;
25410         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
25411         return ret_conv;
25412 }
25413
25414 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
25415         LDKHTLCUpdate obj_conv;
25416         obj_conv.inner = untag_ptr(obj);
25417         obj_conv.is_owned = ptr_is_owned(obj);
25418         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25419         obj_conv.is_owned = false;
25420         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
25421         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25422         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25423         CVec_u8Z_free(ret_var);
25424         return ret_arr;
25425 }
25426
25427 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
25428         LDKu8slice ser_ref;
25429         ser_ref.datalen = ser->arr_len;
25430         ser_ref.data = ser->elems;
25431         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25432         *ret_conv = HTLCUpdate_read(ser_ref);
25433         FREE(ser);
25434         return tag_ptr(ret_conv, true);
25435 }
25436
25437 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
25438         if (!ptr_is_owned(this_ptr)) return;
25439         void* this_ptr_ptr = untag_ptr(this_ptr);
25440         CHECK_ACCESS(this_ptr_ptr);
25441         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
25442         FREE(untag_ptr(this_ptr));
25443         Balance_free(this_ptr_conv);
25444 }
25445
25446 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
25447         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25448         *ret_copy = Balance_clone(arg);
25449         uint64_t ret_ref = tag_ptr(ret_copy, true);
25450         return ret_ref;
25451 }
25452 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
25453         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
25454         int64_t ret_conv = Balance_clone_ptr(arg_conv);
25455         return ret_conv;
25456 }
25457
25458 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
25459         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
25460         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25461         *ret_copy = Balance_clone(orig_conv);
25462         uint64_t ret_ref = tag_ptr(ret_copy, true);
25463         return ret_ref;
25464 }
25465
25466 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
25467         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25468         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
25469         uint64_t ret_ref = tag_ptr(ret_copy, true);
25470         return ret_ref;
25471 }
25472
25473 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
25474         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25475         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
25476         uint64_t ret_ref = tag_ptr(ret_copy, true);
25477         return ret_ref;
25478 }
25479
25480 uint64_t  __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
25481         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25482         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
25483         uint64_t ret_ref = tag_ptr(ret_copy, true);
25484         return ret_ref;
25485 }
25486
25487 uint64_t  __attribute__((export_name("TS_Balance_maybe_timeout_claimable_htlc"))) TS_Balance_maybe_timeout_claimable_htlc(int64_t claimable_amount_satoshis, int32_t claimable_height) {
25488         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25489         *ret_copy = Balance_maybe_timeout_claimable_htlc(claimable_amount_satoshis, claimable_height);
25490         uint64_t ret_ref = tag_ptr(ret_copy, true);
25491         return ret_ref;
25492 }
25493
25494 uint64_t  __attribute__((export_name("TS_Balance_maybe_preimage_claimable_htlc"))) TS_Balance_maybe_preimage_claimable_htlc(int64_t claimable_amount_satoshis, int32_t expiry_height) {
25495         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25496         *ret_copy = Balance_maybe_preimage_claimable_htlc(claimable_amount_satoshis, expiry_height);
25497         uint64_t ret_ref = tag_ptr(ret_copy, true);
25498         return ret_ref;
25499 }
25500
25501 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t claimable_amount_satoshis) {
25502         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25503         *ret_copy = Balance_counterparty_revoked_output_claimable(claimable_amount_satoshis);
25504         uint64_t ret_ref = tag_ptr(ret_copy, true);
25505         return ret_ref;
25506 }
25507
25508 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
25509         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
25510         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
25511         jboolean ret_conv = Balance_eq(a_conv, b_conv);
25512         return ret_conv;
25513 }
25514
25515 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
25516         LDKChannelMonitor this_obj_conv;
25517         this_obj_conv.inner = untag_ptr(this_obj);
25518         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25520         ChannelMonitor_free(this_obj_conv);
25521 }
25522
25523 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
25524         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
25525         uint64_t ret_ref = 0;
25526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25528         return ret_ref;
25529 }
25530 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
25531         LDKChannelMonitor arg_conv;
25532         arg_conv.inner = untag_ptr(arg);
25533         arg_conv.is_owned = ptr_is_owned(arg);
25534         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25535         arg_conv.is_owned = false;
25536         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
25537         return ret_conv;
25538 }
25539
25540 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
25541         LDKChannelMonitor orig_conv;
25542         orig_conv.inner = untag_ptr(orig);
25543         orig_conv.is_owned = ptr_is_owned(orig);
25544         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25545         orig_conv.is_owned = false;
25546         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
25547         uint64_t ret_ref = 0;
25548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25550         return ret_ref;
25551 }
25552
25553 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
25554         LDKChannelMonitor obj_conv;
25555         obj_conv.inner = untag_ptr(obj);
25556         obj_conv.is_owned = ptr_is_owned(obj);
25557         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25558         obj_conv.is_owned = false;
25559         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
25560         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25561         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25562         CVec_u8Z_free(ret_var);
25563         return ret_arr;
25564 }
25565
25566 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) {
25567         LDKChannelMonitor this_arg_conv;
25568         this_arg_conv.inner = untag_ptr(this_arg);
25569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25571         this_arg_conv.is_owned = false;
25572         LDKChannelMonitorUpdate updates_conv;
25573         updates_conv.inner = untag_ptr(updates);
25574         updates_conv.is_owned = ptr_is_owned(updates);
25575         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
25576         updates_conv.is_owned = false;
25577         void* broadcaster_ptr = untag_ptr(broadcaster);
25578         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
25579         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
25580         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25581         CHECK_ACCESS(fee_estimator_ptr);
25582         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25583         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25584                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25585                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25586         }
25587         void* logger_ptr = untag_ptr(logger);
25588         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
25589         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25590         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25591         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
25592         return tag_ptr(ret_conv, true);
25593 }
25594
25595 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
25596         LDKChannelMonitor this_arg_conv;
25597         this_arg_conv.inner = untag_ptr(this_arg);
25598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25600         this_arg_conv.is_owned = false;
25601         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
25602         return ret_conv;
25603 }
25604
25605 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
25606         LDKChannelMonitor this_arg_conv;
25607         this_arg_conv.inner = untag_ptr(this_arg);
25608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25610         this_arg_conv.is_owned = false;
25611         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
25612         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
25613         return tag_ptr(ret_conv, true);
25614 }
25615
25616 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
25617         LDKChannelMonitor this_arg_conv;
25618         this_arg_conv.inner = untag_ptr(this_arg);
25619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25621         this_arg_conv.is_owned = false;
25622         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
25623         uint64_tArray ret_arr = NULL;
25624         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25625         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25626         for (size_t o = 0; o < ret_var.datalen; o++) {
25627                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
25628                 *ret_conv_40_conv = ret_var.data[o];
25629                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
25630         }
25631         
25632         FREE(ret_var.data);
25633         return ret_arr;
25634 }
25635
25636 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
25637         LDKChannelMonitor this_arg_conv;
25638         this_arg_conv.inner = untag_ptr(this_arg);
25639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25641         this_arg_conv.is_owned = false;
25642         void* filter_ptr = untag_ptr(filter);
25643         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
25644         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
25645         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
25646 }
25647
25648 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) {
25649         LDKChannelMonitor this_arg_conv;
25650         this_arg_conv.inner = untag_ptr(this_arg);
25651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25653         this_arg_conv.is_owned = false;
25654         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
25655         uint64_tArray ret_arr = NULL;
25656         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25657         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25658         for (size_t o = 0; o < ret_var.datalen; o++) {
25659                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25660                 *ret_conv_14_copy = ret_var.data[o];
25661                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
25662                 ret_arr_ptr[o] = ret_conv_14_ref;
25663         }
25664         
25665         FREE(ret_var.data);
25666         return ret_arr;
25667 }
25668
25669 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint64_t this_arg) {
25670         LDKChannelMonitor this_arg_conv;
25671         this_arg_conv.inner = untag_ptr(this_arg);
25672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25674         this_arg_conv.is_owned = false;
25675         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
25676         uint64_tArray ret_arr = NULL;
25677         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25678         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25679         for (size_t h = 0; h < ret_var.datalen; h++) {
25680                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25681                 *ret_conv_7_copy = ret_var.data[h];
25682                 uint64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
25683                 ret_arr_ptr[h] = ret_conv_7_ref;
25684         }
25685         
25686         FREE(ret_var.data);
25687         return ret_arr;
25688 }
25689
25690 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
25691         LDKChannelMonitor this_arg_conv;
25692         this_arg_conv.inner = untag_ptr(this_arg);
25693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25695         this_arg_conv.is_owned = false;
25696         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25697         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
25698         return ret_arr;
25699 }
25700
25701 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) {
25702         LDKChannelMonitor this_arg_conv;
25703         this_arg_conv.inner = untag_ptr(this_arg);
25704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25706         this_arg_conv.is_owned = false;
25707         void* logger_ptr = untag_ptr(logger);
25708         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
25709         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25710         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
25711         ptrArray ret_arr = NULL;
25712         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
25713         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
25714         for (size_t m = 0; m < ret_var.datalen; m++) {
25715                 LDKTransaction ret_conv_12_var = ret_var.data[m];
25716                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
25717                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
25718                 Transaction_free(ret_conv_12_var);
25719                 ret_arr_ptr[m] = ret_conv_12_arr;
25720         }
25721         
25722         FREE(ret_var.data);
25723         return ret_arr;
25724 }
25725
25726 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) {
25727         LDKChannelMonitor this_arg_conv;
25728         this_arg_conv.inner = untag_ptr(this_arg);
25729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25731         this_arg_conv.is_owned = false;
25732         uint8_t header_arr[80];
25733         CHECK(header->arr_len == 80);
25734         memcpy(header_arr, header->elems, 80); FREE(header);
25735         uint8_t (*header_ref)[80] = &header_arr;
25736         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25737         txdata_constr.datalen = txdata->arr_len;
25738         if (txdata_constr.datalen > 0)
25739                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25740         else
25741                 txdata_constr.data = NULL;
25742         uint64_t* txdata_vals = txdata->elems;
25743         for (size_t c = 0; c < txdata_constr.datalen; c++) {
25744                 uint64_t txdata_conv_28 = txdata_vals[c];
25745                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
25746                 CHECK_ACCESS(txdata_conv_28_ptr);
25747                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25748                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
25749                 txdata_constr.data[c] = txdata_conv_28_conv;
25750         }
25751         FREE(txdata);
25752         void* broadcaster_ptr = untag_ptr(broadcaster);
25753         CHECK_ACCESS(broadcaster_ptr);
25754         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25755         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25756                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25757                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25758         }
25759         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25760         CHECK_ACCESS(fee_estimator_ptr);
25761         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25762         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25763                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25764                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25765         }
25766         void* logger_ptr = untag_ptr(logger);
25767         CHECK_ACCESS(logger_ptr);
25768         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25769         if (logger_conv.free == LDKLogger_JCalls_free) {
25770                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25771                 LDKLogger_JCalls_cloned(&logger_conv);
25772         }
25773         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);
25774         uint64_tArray ret_arr = NULL;
25775         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25776         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25777         for (size_t n = 0; n < ret_var.datalen; n++) {
25778                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25779                 *ret_conv_39_conv = ret_var.data[n];
25780                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25781         }
25782         
25783         FREE(ret_var.data);
25784         return ret_arr;
25785 }
25786
25787 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) {
25788         LDKChannelMonitor this_arg_conv;
25789         this_arg_conv.inner = untag_ptr(this_arg);
25790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25792         this_arg_conv.is_owned = false;
25793         uint8_t header_arr[80];
25794         CHECK(header->arr_len == 80);
25795         memcpy(header_arr, header->elems, 80); FREE(header);
25796         uint8_t (*header_ref)[80] = &header_arr;
25797         void* broadcaster_ptr = untag_ptr(broadcaster);
25798         CHECK_ACCESS(broadcaster_ptr);
25799         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25800         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25801                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25802                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25803         }
25804         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25805         CHECK_ACCESS(fee_estimator_ptr);
25806         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25807         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25808                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25809                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25810         }
25811         void* logger_ptr = untag_ptr(logger);
25812         CHECK_ACCESS(logger_ptr);
25813         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25814         if (logger_conv.free == LDKLogger_JCalls_free) {
25815                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25816                 LDKLogger_JCalls_cloned(&logger_conv);
25817         }
25818         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25819 }
25820
25821 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) {
25822         LDKChannelMonitor this_arg_conv;
25823         this_arg_conv.inner = untag_ptr(this_arg);
25824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25826         this_arg_conv.is_owned = false;
25827         uint8_t header_arr[80];
25828         CHECK(header->arr_len == 80);
25829         memcpy(header_arr, header->elems, 80); FREE(header);
25830         uint8_t (*header_ref)[80] = &header_arr;
25831         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25832         txdata_constr.datalen = txdata->arr_len;
25833         if (txdata_constr.datalen > 0)
25834                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25835         else
25836                 txdata_constr.data = NULL;
25837         uint64_t* txdata_vals = txdata->elems;
25838         for (size_t c = 0; c < txdata_constr.datalen; c++) {
25839                 uint64_t txdata_conv_28 = txdata_vals[c];
25840                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
25841                 CHECK_ACCESS(txdata_conv_28_ptr);
25842                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25843                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
25844                 txdata_constr.data[c] = txdata_conv_28_conv;
25845         }
25846         FREE(txdata);
25847         void* broadcaster_ptr = untag_ptr(broadcaster);
25848         CHECK_ACCESS(broadcaster_ptr);
25849         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25850         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25851                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25852                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25853         }
25854         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25855         CHECK_ACCESS(fee_estimator_ptr);
25856         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25857         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25858                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25859                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25860         }
25861         void* logger_ptr = untag_ptr(logger);
25862         CHECK_ACCESS(logger_ptr);
25863         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25864         if (logger_conv.free == LDKLogger_JCalls_free) {
25865                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25866                 LDKLogger_JCalls_cloned(&logger_conv);
25867         }
25868         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);
25869         uint64_tArray ret_arr = NULL;
25870         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25871         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25872         for (size_t n = 0; n < ret_var.datalen; n++) {
25873                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25874                 *ret_conv_39_conv = ret_var.data[n];
25875                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25876         }
25877         
25878         FREE(ret_var.data);
25879         return ret_arr;
25880 }
25881
25882 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) {
25883         LDKChannelMonitor this_arg_conv;
25884         this_arg_conv.inner = untag_ptr(this_arg);
25885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25887         this_arg_conv.is_owned = false;
25888         uint8_t txid_arr[32];
25889         CHECK(txid->arr_len == 32);
25890         memcpy(txid_arr, txid->elems, 32); FREE(txid);
25891         uint8_t (*txid_ref)[32] = &txid_arr;
25892         void* broadcaster_ptr = untag_ptr(broadcaster);
25893         CHECK_ACCESS(broadcaster_ptr);
25894         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25895         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25896                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25897                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25898         }
25899         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25900         CHECK_ACCESS(fee_estimator_ptr);
25901         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25902         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25903                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25904                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25905         }
25906         void* logger_ptr = untag_ptr(logger);
25907         CHECK_ACCESS(logger_ptr);
25908         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25909         if (logger_conv.free == LDKLogger_JCalls_free) {
25910                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25911                 LDKLogger_JCalls_cloned(&logger_conv);
25912         }
25913         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
25914 }
25915
25916 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) {
25917         LDKChannelMonitor this_arg_conv;
25918         this_arg_conv.inner = untag_ptr(this_arg);
25919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25921         this_arg_conv.is_owned = false;
25922         uint8_t header_arr[80];
25923         CHECK(header->arr_len == 80);
25924         memcpy(header_arr, header->elems, 80); FREE(header);
25925         uint8_t (*header_ref)[80] = &header_arr;
25926         void* broadcaster_ptr = untag_ptr(broadcaster);
25927         CHECK_ACCESS(broadcaster_ptr);
25928         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25929         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25930                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25931                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25932         }
25933         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25934         CHECK_ACCESS(fee_estimator_ptr);
25935         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25936         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25937                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25938                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25939         }
25940         void* logger_ptr = untag_ptr(logger);
25941         CHECK_ACCESS(logger_ptr);
25942         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25943         if (logger_conv.free == LDKLogger_JCalls_free) {
25944                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25945                 LDKLogger_JCalls_cloned(&logger_conv);
25946         }
25947         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25948         uint64_tArray ret_arr = NULL;
25949         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25950         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25951         for (size_t n = 0; n < ret_var.datalen; n++) {
25952                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25953                 *ret_conv_39_conv = ret_var.data[n];
25954                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25955         }
25956         
25957         FREE(ret_var.data);
25958         return ret_arr;
25959 }
25960
25961 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
25962         LDKChannelMonitor this_arg_conv;
25963         this_arg_conv.inner = untag_ptr(this_arg);
25964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25966         this_arg_conv.is_owned = false;
25967         LDKCVec_C2Tuple_TxidBlockHashZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
25968         uint64_tArray ret_arr = NULL;
25969         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25970         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25971         for (size_t z = 0; z < ret_var.datalen; z++) {
25972                 LDKC2Tuple_TxidBlockHashZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
25973                 *ret_conv_25_conv = ret_var.data[z];
25974                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
25975         }
25976         
25977         FREE(ret_var.data);
25978         return ret_arr;
25979 }
25980
25981 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
25982         LDKChannelMonitor this_arg_conv;
25983         this_arg_conv.inner = untag_ptr(this_arg);
25984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25986         this_arg_conv.is_owned = false;
25987         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
25988         uint64_t ret_ref = 0;
25989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25991         return ret_ref;
25992 }
25993
25994 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
25995         LDKChannelMonitor this_arg_conv;
25996         this_arg_conv.inner = untag_ptr(this_arg);
25997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25999         this_arg_conv.is_owned = false;
26000         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
26001         uint64_tArray ret_arr = NULL;
26002         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
26003         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
26004         for (size_t j = 0; j < ret_var.datalen; j++) {
26005                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26006                 *ret_conv_9_copy = ret_var.data[j];
26007                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
26008                 ret_arr_ptr[j] = ret_conv_9_ref;
26009         }
26010         
26011         FREE(ret_var.data);
26012         return ret_arr;
26013 }
26014
26015 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b) {
26016         LDKu8slice ser_ref;
26017         ser_ref.datalen = ser->arr_len;
26018         ser_ref.data = ser->elems;
26019         void* arg_a_ptr = untag_ptr(arg_a);
26020         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
26021         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
26022         void* arg_b_ptr = untag_ptr(arg_b);
26023         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
26024         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
26025         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
26026         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
26027         FREE(ser);
26028         return tag_ptr(ret_conv, true);
26029 }
26030
26031 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
26032         LDKOutPoint this_obj_conv;
26033         this_obj_conv.inner = untag_ptr(this_obj);
26034         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26036         OutPoint_free(this_obj_conv);
26037 }
26038
26039 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
26040         LDKOutPoint this_ptr_conv;
26041         this_ptr_conv.inner = untag_ptr(this_ptr);
26042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26044         this_ptr_conv.is_owned = false;
26045         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26046         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
26047         return ret_arr;
26048 }
26049
26050 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
26051         LDKOutPoint this_ptr_conv;
26052         this_ptr_conv.inner = untag_ptr(this_ptr);
26053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26055         this_ptr_conv.is_owned = false;
26056         LDKThirtyTwoBytes val_ref;
26057         CHECK(val->arr_len == 32);
26058         memcpy(val_ref.data, val->elems, 32); FREE(val);
26059         OutPoint_set_txid(&this_ptr_conv, val_ref);
26060 }
26061
26062 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
26063         LDKOutPoint this_ptr_conv;
26064         this_ptr_conv.inner = untag_ptr(this_ptr);
26065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26067         this_ptr_conv.is_owned = false;
26068         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
26069         return ret_conv;
26070 }
26071
26072 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
26073         LDKOutPoint this_ptr_conv;
26074         this_ptr_conv.inner = untag_ptr(this_ptr);
26075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26077         this_ptr_conv.is_owned = false;
26078         OutPoint_set_index(&this_ptr_conv, val);
26079 }
26080
26081 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
26082         LDKThirtyTwoBytes txid_arg_ref;
26083         CHECK(txid_arg->arr_len == 32);
26084         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
26085         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
26086         uint64_t ret_ref = 0;
26087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26089         return ret_ref;
26090 }
26091
26092 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
26093         LDKOutPoint ret_var = OutPoint_clone(arg);
26094         uint64_t ret_ref = 0;
26095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26097         return ret_ref;
26098 }
26099 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
26100         LDKOutPoint arg_conv;
26101         arg_conv.inner = untag_ptr(arg);
26102         arg_conv.is_owned = ptr_is_owned(arg);
26103         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26104         arg_conv.is_owned = false;
26105         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
26106         return ret_conv;
26107 }
26108
26109 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
26110         LDKOutPoint orig_conv;
26111         orig_conv.inner = untag_ptr(orig);
26112         orig_conv.is_owned = ptr_is_owned(orig);
26113         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26114         orig_conv.is_owned = false;
26115         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
26116         uint64_t ret_ref = 0;
26117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26119         return ret_ref;
26120 }
26121
26122 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
26123         LDKOutPoint a_conv;
26124         a_conv.inner = untag_ptr(a);
26125         a_conv.is_owned = ptr_is_owned(a);
26126         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26127         a_conv.is_owned = false;
26128         LDKOutPoint b_conv;
26129         b_conv.inner = untag_ptr(b);
26130         b_conv.is_owned = ptr_is_owned(b);
26131         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26132         b_conv.is_owned = false;
26133         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
26134         return ret_conv;
26135 }
26136
26137 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
26138         LDKOutPoint o_conv;
26139         o_conv.inner = untag_ptr(o);
26140         o_conv.is_owned = ptr_is_owned(o);
26141         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26142         o_conv.is_owned = false;
26143         int64_t ret_conv = OutPoint_hash(&o_conv);
26144         return ret_conv;
26145 }
26146
26147 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
26148         LDKOutPoint this_arg_conv;
26149         this_arg_conv.inner = untag_ptr(this_arg);
26150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26152         this_arg_conv.is_owned = false;
26153         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26154         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
26155         return ret_arr;
26156 }
26157
26158 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
26159         LDKOutPoint obj_conv;
26160         obj_conv.inner = untag_ptr(obj);
26161         obj_conv.is_owned = ptr_is_owned(obj);
26162         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26163         obj_conv.is_owned = false;
26164         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
26165         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26166         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26167         CVec_u8Z_free(ret_var);
26168         return ret_arr;
26169 }
26170
26171 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
26172         LDKu8slice ser_ref;
26173         ser_ref.datalen = ser->arr_len;
26174         ser_ref.data = ser->elems;
26175         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
26176         *ret_conv = OutPoint_read(ser_ref);
26177         FREE(ser);
26178         return tag_ptr(ret_conv, true);
26179 }
26180
26181 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
26182         LDKDelayedPaymentOutputDescriptor this_obj_conv;
26183         this_obj_conv.inner = untag_ptr(this_obj);
26184         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26186         DelayedPaymentOutputDescriptor_free(this_obj_conv);
26187 }
26188
26189 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
26190         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26191         this_ptr_conv.inner = untag_ptr(this_ptr);
26192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26194         this_ptr_conv.is_owned = false;
26195         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26196         uint64_t ret_ref = 0;
26197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26199         return ret_ref;
26200 }
26201
26202 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
26203         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26204         this_ptr_conv.inner = untag_ptr(this_ptr);
26205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26207         this_ptr_conv.is_owned = false;
26208         LDKOutPoint val_conv;
26209         val_conv.inner = untag_ptr(val);
26210         val_conv.is_owned = ptr_is_owned(val);
26211         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26212         val_conv = OutPoint_clone(&val_conv);
26213         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26214 }
26215
26216 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
26217         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26218         this_ptr_conv.inner = untag_ptr(this_ptr);
26219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26221         this_ptr_conv.is_owned = false;
26222         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26223         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
26224         return ret_arr;
26225 }
26226
26227 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
26228         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26229         this_ptr_conv.inner = untag_ptr(this_ptr);
26230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26232         this_ptr_conv.is_owned = false;
26233         LDKPublicKey val_ref;
26234         CHECK(val->arr_len == 33);
26235         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26236         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
26237 }
26238
26239 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
26240         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26241         this_ptr_conv.inner = untag_ptr(this_ptr);
26242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26244         this_ptr_conv.is_owned = false;
26245         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
26246         return ret_conv;
26247 }
26248
26249 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
26250         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26251         this_ptr_conv.inner = untag_ptr(this_ptr);
26252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26254         this_ptr_conv.is_owned = false;
26255         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
26256 }
26257
26258 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
26259         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26260         this_ptr_conv.inner = untag_ptr(this_ptr);
26261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26263         this_ptr_conv.is_owned = false;
26264         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
26265         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
26266         return tag_ptr(ret_ref, true);
26267 }
26268
26269 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
26270         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26271         this_ptr_conv.inner = untag_ptr(this_ptr);
26272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26274         this_ptr_conv.is_owned = false;
26275         void* val_ptr = untag_ptr(val);
26276         CHECK_ACCESS(val_ptr);
26277         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26278         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
26279         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26280 }
26281
26282 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
26283         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26284         this_ptr_conv.inner = untag_ptr(this_ptr);
26285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26287         this_ptr_conv.is_owned = false;
26288         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26289         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
26290         return ret_arr;
26291 }
26292
26293 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
26294         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26295         this_ptr_conv.inner = untag_ptr(this_ptr);
26296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26298         this_ptr_conv.is_owned = false;
26299         LDKPublicKey val_ref;
26300         CHECK(val->arr_len == 33);
26301         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26302         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
26303 }
26304
26305 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
26306         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26307         this_ptr_conv.inner = untag_ptr(this_ptr);
26308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26310         this_ptr_conv.is_owned = false;
26311         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26312         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
26313         return ret_arr;
26314 }
26315
26316 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
26317         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26318         this_ptr_conv.inner = untag_ptr(this_ptr);
26319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26321         this_ptr_conv.is_owned = false;
26322         LDKThirtyTwoBytes val_ref;
26323         CHECK(val->arr_len == 32);
26324         memcpy(val_ref.data, val->elems, 32); FREE(val);
26325         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26326 }
26327
26328 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
26329         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26330         this_ptr_conv.inner = untag_ptr(this_ptr);
26331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26333         this_ptr_conv.is_owned = false;
26334         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26335         return ret_conv;
26336 }
26337
26338 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
26339         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26340         this_ptr_conv.inner = untag_ptr(this_ptr);
26341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26343         this_ptr_conv.is_owned = false;
26344         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26345 }
26346
26347 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) {
26348         LDKOutPoint outpoint_arg_conv;
26349         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
26350         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
26351         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26352         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26353         LDKPublicKey per_commitment_point_arg_ref;
26354         CHECK(per_commitment_point_arg->arr_len == 33);
26355         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
26356         void* output_arg_ptr = untag_ptr(output_arg);
26357         CHECK_ACCESS(output_arg_ptr);
26358         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26359         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
26360         LDKPublicKey revocation_pubkey_arg_ref;
26361         CHECK(revocation_pubkey_arg->arr_len == 33);
26362         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
26363         LDKThirtyTwoBytes channel_keys_id_arg_ref;
26364         CHECK(channel_keys_id_arg->arr_len == 32);
26365         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
26366         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);
26367         uint64_t ret_ref = 0;
26368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26370         return ret_ref;
26371 }
26372
26373 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
26374         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
26375         uint64_t ret_ref = 0;
26376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26378         return ret_ref;
26379 }
26380 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
26381         LDKDelayedPaymentOutputDescriptor arg_conv;
26382         arg_conv.inner = untag_ptr(arg);
26383         arg_conv.is_owned = ptr_is_owned(arg);
26384         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26385         arg_conv.is_owned = false;
26386         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
26387         return ret_conv;
26388 }
26389
26390 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
26391         LDKDelayedPaymentOutputDescriptor orig_conv;
26392         orig_conv.inner = untag_ptr(orig);
26393         orig_conv.is_owned = ptr_is_owned(orig);
26394         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26395         orig_conv.is_owned = false;
26396         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
26397         uint64_t ret_ref = 0;
26398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26400         return ret_ref;
26401 }
26402
26403 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
26404         LDKDelayedPaymentOutputDescriptor a_conv;
26405         a_conv.inner = untag_ptr(a);
26406         a_conv.is_owned = ptr_is_owned(a);
26407         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26408         a_conv.is_owned = false;
26409         LDKDelayedPaymentOutputDescriptor b_conv;
26410         b_conv.inner = untag_ptr(b);
26411         b_conv.is_owned = ptr_is_owned(b);
26412         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26413         b_conv.is_owned = false;
26414         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
26415         return ret_conv;
26416 }
26417
26418 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
26419         LDKDelayedPaymentOutputDescriptor obj_conv;
26420         obj_conv.inner = untag_ptr(obj);
26421         obj_conv.is_owned = ptr_is_owned(obj);
26422         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26423         obj_conv.is_owned = false;
26424         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
26425         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26426         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26427         CVec_u8Z_free(ret_var);
26428         return ret_arr;
26429 }
26430
26431 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
26432         LDKu8slice ser_ref;
26433         ser_ref.datalen = ser->arr_len;
26434         ser_ref.data = ser->elems;
26435         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
26436         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
26437         FREE(ser);
26438         return tag_ptr(ret_conv, true);
26439 }
26440
26441 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
26442         LDKStaticPaymentOutputDescriptor this_obj_conv;
26443         this_obj_conv.inner = untag_ptr(this_obj);
26444         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26446         StaticPaymentOutputDescriptor_free(this_obj_conv);
26447 }
26448
26449 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
26450         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26451         this_ptr_conv.inner = untag_ptr(this_ptr);
26452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26454         this_ptr_conv.is_owned = false;
26455         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26456         uint64_t ret_ref = 0;
26457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26459         return ret_ref;
26460 }
26461
26462 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
26463         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26464         this_ptr_conv.inner = untag_ptr(this_ptr);
26465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26467         this_ptr_conv.is_owned = false;
26468         LDKOutPoint val_conv;
26469         val_conv.inner = untag_ptr(val);
26470         val_conv.is_owned = ptr_is_owned(val);
26471         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26472         val_conv = OutPoint_clone(&val_conv);
26473         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26474 }
26475
26476 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
26477         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26478         this_ptr_conv.inner = untag_ptr(this_ptr);
26479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26481         this_ptr_conv.is_owned = false;
26482         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
26483         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
26484         return tag_ptr(ret_ref, true);
26485 }
26486
26487 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
26488         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26489         this_ptr_conv.inner = untag_ptr(this_ptr);
26490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26492         this_ptr_conv.is_owned = false;
26493         void* val_ptr = untag_ptr(val);
26494         CHECK_ACCESS(val_ptr);
26495         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26496         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
26497         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26498 }
26499
26500 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
26501         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26502         this_ptr_conv.inner = untag_ptr(this_ptr);
26503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26505         this_ptr_conv.is_owned = false;
26506         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26507         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
26508         return ret_arr;
26509 }
26510
26511 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
26512         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26513         this_ptr_conv.inner = untag_ptr(this_ptr);
26514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26516         this_ptr_conv.is_owned = false;
26517         LDKThirtyTwoBytes val_ref;
26518         CHECK(val->arr_len == 32);
26519         memcpy(val_ref.data, val->elems, 32); FREE(val);
26520         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26521 }
26522
26523 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
26524         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26525         this_ptr_conv.inner = untag_ptr(this_ptr);
26526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26528         this_ptr_conv.is_owned = false;
26529         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26530         return ret_conv;
26531 }
26532
26533 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
26534         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26535         this_ptr_conv.inner = untag_ptr(this_ptr);
26536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26538         this_ptr_conv.is_owned = false;
26539         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26540 }
26541
26542 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) {
26543         LDKOutPoint outpoint_arg_conv;
26544         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
26545         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
26546         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26547         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26548         void* output_arg_ptr = untag_ptr(output_arg);
26549         CHECK_ACCESS(output_arg_ptr);
26550         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26551         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
26552         LDKThirtyTwoBytes channel_keys_id_arg_ref;
26553         CHECK(channel_keys_id_arg->arr_len == 32);
26554         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
26555         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
26556         uint64_t ret_ref = 0;
26557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26559         return ret_ref;
26560 }
26561
26562 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
26563         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
26564         uint64_t ret_ref = 0;
26565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26567         return ret_ref;
26568 }
26569 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
26570         LDKStaticPaymentOutputDescriptor arg_conv;
26571         arg_conv.inner = untag_ptr(arg);
26572         arg_conv.is_owned = ptr_is_owned(arg);
26573         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26574         arg_conv.is_owned = false;
26575         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
26576         return ret_conv;
26577 }
26578
26579 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
26580         LDKStaticPaymentOutputDescriptor orig_conv;
26581         orig_conv.inner = untag_ptr(orig);
26582         orig_conv.is_owned = ptr_is_owned(orig);
26583         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26584         orig_conv.is_owned = false;
26585         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
26586         uint64_t ret_ref = 0;
26587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26589         return ret_ref;
26590 }
26591
26592 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
26593         LDKStaticPaymentOutputDescriptor a_conv;
26594         a_conv.inner = untag_ptr(a);
26595         a_conv.is_owned = ptr_is_owned(a);
26596         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26597         a_conv.is_owned = false;
26598         LDKStaticPaymentOutputDescriptor b_conv;
26599         b_conv.inner = untag_ptr(b);
26600         b_conv.is_owned = ptr_is_owned(b);
26601         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26602         b_conv.is_owned = false;
26603         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
26604         return ret_conv;
26605 }
26606
26607 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
26608         LDKStaticPaymentOutputDescriptor obj_conv;
26609         obj_conv.inner = untag_ptr(obj);
26610         obj_conv.is_owned = ptr_is_owned(obj);
26611         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26612         obj_conv.is_owned = false;
26613         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
26614         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26615         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26616         CVec_u8Z_free(ret_var);
26617         return ret_arr;
26618 }
26619
26620 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
26621         LDKu8slice ser_ref;
26622         ser_ref.datalen = ser->arr_len;
26623         ser_ref.data = ser->elems;
26624         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
26625         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
26626         FREE(ser);
26627         return tag_ptr(ret_conv, true);
26628 }
26629
26630 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
26631         if (!ptr_is_owned(this_ptr)) return;
26632         void* this_ptr_ptr = untag_ptr(this_ptr);
26633         CHECK_ACCESS(this_ptr_ptr);
26634         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
26635         FREE(untag_ptr(this_ptr));
26636         SpendableOutputDescriptor_free(this_ptr_conv);
26637 }
26638
26639 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
26640         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26641         *ret_copy = SpendableOutputDescriptor_clone(arg);
26642         uint64_t ret_ref = tag_ptr(ret_copy, true);
26643         return ret_ref;
26644 }
26645 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
26646         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
26647         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
26648         return ret_conv;
26649 }
26650
26651 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
26652         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
26653         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26654         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
26655         uint64_t ret_ref = tag_ptr(ret_copy, true);
26656         return ret_ref;
26657 }
26658
26659 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
26660         LDKOutPoint outpoint_conv;
26661         outpoint_conv.inner = untag_ptr(outpoint);
26662         outpoint_conv.is_owned = ptr_is_owned(outpoint);
26663         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
26664         outpoint_conv = OutPoint_clone(&outpoint_conv);
26665         void* output_ptr = untag_ptr(output);
26666         CHECK_ACCESS(output_ptr);
26667         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
26668         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
26669         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26670         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
26671         uint64_t ret_ref = tag_ptr(ret_copy, true);
26672         return ret_ref;
26673 }
26674
26675 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
26676         LDKDelayedPaymentOutputDescriptor a_conv;
26677         a_conv.inner = untag_ptr(a);
26678         a_conv.is_owned = ptr_is_owned(a);
26679         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26680         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
26681         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26682         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
26683         uint64_t ret_ref = tag_ptr(ret_copy, true);
26684         return ret_ref;
26685 }
26686
26687 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
26688         LDKStaticPaymentOutputDescriptor a_conv;
26689         a_conv.inner = untag_ptr(a);
26690         a_conv.is_owned = ptr_is_owned(a);
26691         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26692         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
26693         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26694         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
26695         uint64_t ret_ref = tag_ptr(ret_copy, true);
26696         return ret_ref;
26697 }
26698
26699 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
26700         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
26701         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
26702         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
26703         return ret_conv;
26704 }
26705
26706 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
26707         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
26708         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
26709         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26710         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26711         CVec_u8Z_free(ret_var);
26712         return ret_arr;
26713 }
26714
26715 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
26716         LDKu8slice ser_ref;
26717         ser_ref.datalen = ser->arr_len;
26718         ser_ref.data = ser->elems;
26719         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
26720         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
26721         FREE(ser);
26722         return tag_ptr(ret_conv, true);
26723 }
26724
26725 void  __attribute__((export_name("TS_ChannelSigner_free"))) TS_ChannelSigner_free(uint64_t this_ptr) {
26726         if (!ptr_is_owned(this_ptr)) return;
26727         void* this_ptr_ptr = untag_ptr(this_ptr);
26728         CHECK_ACCESS(this_ptr_ptr);
26729         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
26730         FREE(untag_ptr(this_ptr));
26731         ChannelSigner_free(this_ptr_conv);
26732 }
26733
26734 void  __attribute__((export_name("TS_EcdsaChannelSigner_free"))) TS_EcdsaChannelSigner_free(uint64_t this_ptr) {
26735         if (!ptr_is_owned(this_ptr)) return;
26736         void* this_ptr_ptr = untag_ptr(this_ptr);
26737         CHECK_ACCESS(this_ptr_ptr);
26738         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
26739         FREE(untag_ptr(this_ptr));
26740         EcdsaChannelSigner_free(this_ptr_conv);
26741 }
26742
26743 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
26744         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
26745         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
26746         return tag_ptr(ret_ret, true);
26747 }
26748 int64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone_ptr"))) TS_WriteableEcdsaChannelSigner_clone_ptr(uint64_t arg) {
26749         void* arg_ptr = untag_ptr(arg);
26750         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
26751         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
26752         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
26753         return ret_conv;
26754 }
26755
26756 uint64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone"))) TS_WriteableEcdsaChannelSigner_clone(uint64_t orig) {
26757         void* orig_ptr = untag_ptr(orig);
26758         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
26759         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
26760         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
26761         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
26762         return tag_ptr(ret_ret, true);
26763 }
26764
26765 void  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_free"))) TS_WriteableEcdsaChannelSigner_free(uint64_t this_ptr) {
26766         if (!ptr_is_owned(this_ptr)) return;
26767         void* this_ptr_ptr = untag_ptr(this_ptr);
26768         CHECK_ACCESS(this_ptr_ptr);
26769         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
26770         FREE(untag_ptr(this_ptr));
26771         WriteableEcdsaChannelSigner_free(this_ptr_conv);
26772 }
26773
26774 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
26775         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
26776         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
26777         return ret_conv;
26778 }
26779
26780 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
26781         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
26782         return ret_conv;
26783 }
26784
26785 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
26786         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
26787         return ret_conv;
26788 }
26789
26790 void  __attribute__((export_name("TS_EntropySource_free"))) TS_EntropySource_free(uint64_t this_ptr) {
26791         if (!ptr_is_owned(this_ptr)) return;
26792         void* this_ptr_ptr = untag_ptr(this_ptr);
26793         CHECK_ACCESS(this_ptr_ptr);
26794         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
26795         FREE(untag_ptr(this_ptr));
26796         EntropySource_free(this_ptr_conv);
26797 }
26798
26799 void  __attribute__((export_name("TS_NodeSigner_free"))) TS_NodeSigner_free(uint64_t this_ptr) {
26800         if (!ptr_is_owned(this_ptr)) return;
26801         void* this_ptr_ptr = untag_ptr(this_ptr);
26802         CHECK_ACCESS(this_ptr_ptr);
26803         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
26804         FREE(untag_ptr(this_ptr));
26805         NodeSigner_free(this_ptr_conv);
26806 }
26807
26808 void  __attribute__((export_name("TS_SignerProvider_free"))) TS_SignerProvider_free(uint64_t this_ptr) {
26809         if (!ptr_is_owned(this_ptr)) return;
26810         void* this_ptr_ptr = untag_ptr(this_ptr);
26811         CHECK_ACCESS(this_ptr_ptr);
26812         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
26813         FREE(untag_ptr(this_ptr));
26814         SignerProvider_free(this_ptr_conv);
26815 }
26816
26817 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
26818         LDKInMemorySigner this_obj_conv;
26819         this_obj_conv.inner = untag_ptr(this_obj);
26820         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26822         InMemorySigner_free(this_obj_conv);
26823 }
26824
26825 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
26826         LDKInMemorySigner this_ptr_conv;
26827         this_ptr_conv.inner = untag_ptr(this_ptr);
26828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26830         this_ptr_conv.is_owned = false;
26831         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26832         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
26833         return ret_arr;
26834 }
26835
26836 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
26837         LDKInMemorySigner this_ptr_conv;
26838         this_ptr_conv.inner = untag_ptr(this_ptr);
26839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26841         this_ptr_conv.is_owned = false;
26842         LDKSecretKey val_ref;
26843         CHECK(val->arr_len == 32);
26844         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26845         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
26846 }
26847
26848 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
26849         LDKInMemorySigner this_ptr_conv;
26850         this_ptr_conv.inner = untag_ptr(this_ptr);
26851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26853         this_ptr_conv.is_owned = false;
26854         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26855         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
26856         return ret_arr;
26857 }
26858
26859 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
26860         LDKInMemorySigner this_ptr_conv;
26861         this_ptr_conv.inner = untag_ptr(this_ptr);
26862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26864         this_ptr_conv.is_owned = false;
26865         LDKSecretKey val_ref;
26866         CHECK(val->arr_len == 32);
26867         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26868         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
26869 }
26870
26871 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
26872         LDKInMemorySigner this_ptr_conv;
26873         this_ptr_conv.inner = untag_ptr(this_ptr);
26874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26876         this_ptr_conv.is_owned = false;
26877         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26878         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
26879         return ret_arr;
26880 }
26881
26882 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
26883         LDKInMemorySigner this_ptr_conv;
26884         this_ptr_conv.inner = untag_ptr(this_ptr);
26885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26887         this_ptr_conv.is_owned = false;
26888         LDKSecretKey val_ref;
26889         CHECK(val->arr_len == 32);
26890         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26891         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
26892 }
26893
26894 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
26895         LDKInMemorySigner this_ptr_conv;
26896         this_ptr_conv.inner = untag_ptr(this_ptr);
26897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26899         this_ptr_conv.is_owned = false;
26900         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26901         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
26902         return ret_arr;
26903 }
26904
26905 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) {
26906         LDKInMemorySigner this_ptr_conv;
26907         this_ptr_conv.inner = untag_ptr(this_ptr);
26908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26910         this_ptr_conv.is_owned = false;
26911         LDKSecretKey val_ref;
26912         CHECK(val->arr_len == 32);
26913         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26914         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
26915 }
26916
26917 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
26918         LDKInMemorySigner this_ptr_conv;
26919         this_ptr_conv.inner = untag_ptr(this_ptr);
26920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26922         this_ptr_conv.is_owned = false;
26923         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26924         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
26925         return ret_arr;
26926 }
26927
26928 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
26929         LDKInMemorySigner this_ptr_conv;
26930         this_ptr_conv.inner = untag_ptr(this_ptr);
26931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26933         this_ptr_conv.is_owned = false;
26934         LDKSecretKey val_ref;
26935         CHECK(val->arr_len == 32);
26936         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26937         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
26938 }
26939
26940 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
26941         LDKInMemorySigner this_ptr_conv;
26942         this_ptr_conv.inner = untag_ptr(this_ptr);
26943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26945         this_ptr_conv.is_owned = false;
26946         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26947         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
26948         return ret_arr;
26949 }
26950
26951 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
26952         LDKInMemorySigner this_ptr_conv;
26953         this_ptr_conv.inner = untag_ptr(this_ptr);
26954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26956         this_ptr_conv.is_owned = false;
26957         LDKThirtyTwoBytes val_ref;
26958         CHECK(val->arr_len == 32);
26959         memcpy(val_ref.data, val->elems, 32); FREE(val);
26960         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
26961 }
26962
26963 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
26964         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
26965         uint64_t ret_ref = 0;
26966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26968         return ret_ref;
26969 }
26970 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
26971         LDKInMemorySigner arg_conv;
26972         arg_conv.inner = untag_ptr(arg);
26973         arg_conv.is_owned = ptr_is_owned(arg);
26974         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26975         arg_conv.is_owned = false;
26976         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
26977         return ret_conv;
26978 }
26979
26980 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
26981         LDKInMemorySigner orig_conv;
26982         orig_conv.inner = untag_ptr(orig);
26983         orig_conv.is_owned = ptr_is_owned(orig);
26984         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26985         orig_conv.is_owned = false;
26986         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
26987         uint64_t ret_ref = 0;
26988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26990         return ret_ref;
26991 }
26992
26993 uint64_t  __attribute__((export_name("TS_InMemorySigner_new"))) TS_InMemorySigner_new(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) {
26994         LDKSecretKey funding_key_ref;
26995         CHECK(funding_key->arr_len == 32);
26996         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
26997         LDKSecretKey revocation_base_key_ref;
26998         CHECK(revocation_base_key->arr_len == 32);
26999         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
27000         LDKSecretKey payment_key_ref;
27001         CHECK(payment_key->arr_len == 32);
27002         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
27003         LDKSecretKey delayed_payment_base_key_ref;
27004         CHECK(delayed_payment_base_key->arr_len == 32);
27005         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
27006         LDKSecretKey htlc_base_key_ref;
27007         CHECK(htlc_base_key->arr_len == 32);
27008         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
27009         LDKThirtyTwoBytes commitment_seed_ref;
27010         CHECK(commitment_seed->arr_len == 32);
27011         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
27012         LDKThirtyTwoBytes channel_keys_id_ref;
27013         CHECK(channel_keys_id->arr_len == 32);
27014         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
27015         LDKInMemorySigner ret_var = InMemorySigner_new(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);
27016         uint64_t ret_ref = 0;
27017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27019         return ret_ref;
27020 }
27021
27022 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
27023         LDKInMemorySigner this_arg_conv;
27024         this_arg_conv.inner = untag_ptr(this_arg);
27025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27027         this_arg_conv.is_owned = false;
27028         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
27029         uint64_t ret_ref = 0;
27030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27032         return ret_ref;
27033 }
27034
27035 int16_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
27036         LDKInMemorySigner this_arg_conv;
27037         this_arg_conv.inner = untag_ptr(this_arg);
27038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27040         this_arg_conv.is_owned = false;
27041         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
27042         return ret_conv;
27043 }
27044
27045 int16_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
27046         LDKInMemorySigner this_arg_conv;
27047         this_arg_conv.inner = untag_ptr(this_arg);
27048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27050         this_arg_conv.is_owned = false;
27051         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
27052         return ret_conv;
27053 }
27054
27055 jboolean  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
27056         LDKInMemorySigner this_arg_conv;
27057         this_arg_conv.inner = untag_ptr(this_arg);
27058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27060         this_arg_conv.is_owned = false;
27061         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
27062         return ret_conv;
27063 }
27064
27065 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
27066         LDKInMemorySigner this_arg_conv;
27067         this_arg_conv.inner = untag_ptr(this_arg);
27068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27070         this_arg_conv.is_owned = false;
27071         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
27072         uint64_t ret_ref = 0;
27073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27075         return ret_ref;
27076 }
27077
27078 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
27079         LDKInMemorySigner this_arg_conv;
27080         this_arg_conv.inner = untag_ptr(this_arg);
27081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27083         this_arg_conv.is_owned = false;
27084         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
27085         uint64_t ret_ref = 0;
27086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27088         return ret_ref;
27089 }
27090
27091 jboolean  __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint64_t this_arg) {
27092         LDKInMemorySigner this_arg_conv;
27093         this_arg_conv.inner = untag_ptr(this_arg);
27094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27096         this_arg_conv.is_owned = false;
27097         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
27098         return ret_conv;
27099 }
27100
27101 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) {
27102         LDKInMemorySigner this_arg_conv;
27103         this_arg_conv.inner = untag_ptr(this_arg);
27104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27106         this_arg_conv.is_owned = false;
27107         LDKTransaction spend_tx_ref;
27108         spend_tx_ref.datalen = spend_tx->arr_len;
27109         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
27110         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
27111         spend_tx_ref.data_is_owned = true;
27112         LDKStaticPaymentOutputDescriptor descriptor_conv;
27113         descriptor_conv.inner = untag_ptr(descriptor);
27114         descriptor_conv.is_owned = ptr_is_owned(descriptor);
27115         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
27116         descriptor_conv.is_owned = false;
27117         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
27118         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
27119         return tag_ptr(ret_conv, true);
27120 }
27121
27122 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) {
27123         LDKInMemorySigner this_arg_conv;
27124         this_arg_conv.inner = untag_ptr(this_arg);
27125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27127         this_arg_conv.is_owned = false;
27128         LDKTransaction spend_tx_ref;
27129         spend_tx_ref.datalen = spend_tx->arr_len;
27130         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
27131         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
27132         spend_tx_ref.data_is_owned = true;
27133         LDKDelayedPaymentOutputDescriptor descriptor_conv;
27134         descriptor_conv.inner = untag_ptr(descriptor);
27135         descriptor_conv.is_owned = ptr_is_owned(descriptor);
27136         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
27137         descriptor_conv.is_owned = false;
27138         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
27139         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
27140         return tag_ptr(ret_conv, true);
27141 }
27142
27143 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_ChannelSigner"))) TS_InMemorySigner_as_ChannelSigner(uint64_t this_arg) {
27144         LDKInMemorySigner this_arg_conv;
27145         this_arg_conv.inner = untag_ptr(this_arg);
27146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27148         this_arg_conv.is_owned = false;
27149         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
27150         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
27151         return tag_ptr(ret_ret, true);
27152 }
27153
27154 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EcdsaChannelSigner"))) TS_InMemorySigner_as_EcdsaChannelSigner(uint64_t this_arg) {
27155         LDKInMemorySigner this_arg_conv;
27156         this_arg_conv.inner = untag_ptr(this_arg);
27157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27159         this_arg_conv.is_owned = false;
27160         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
27161         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
27162         return tag_ptr(ret_ret, true);
27163 }
27164
27165 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_WriteableEcdsaChannelSigner"))) TS_InMemorySigner_as_WriteableEcdsaChannelSigner(uint64_t this_arg) {
27166         LDKInMemorySigner this_arg_conv;
27167         this_arg_conv.inner = untag_ptr(this_arg);
27168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27170         this_arg_conv.is_owned = false;
27171         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
27172         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
27173         return tag_ptr(ret_ret, true);
27174 }
27175
27176 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
27177         LDKInMemorySigner obj_conv;
27178         obj_conv.inner = untag_ptr(obj);
27179         obj_conv.is_owned = ptr_is_owned(obj);
27180         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27181         obj_conv.is_owned = false;
27182         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
27183         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27184         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27185         CVec_u8Z_free(ret_var);
27186         return ret_arr;
27187 }
27188
27189 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser) {
27190         LDKu8slice ser_ref;
27191         ser_ref.datalen = ser->arr_len;
27192         ser_ref.data = ser->elems;
27193         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
27194         *ret_conv = InMemorySigner_read(ser_ref);
27195         FREE(ser);
27196         return tag_ptr(ret_conv, true);
27197 }
27198
27199 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
27200         LDKKeysManager this_obj_conv;
27201         this_obj_conv.inner = untag_ptr(this_obj);
27202         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27204         KeysManager_free(this_obj_conv);
27205 }
27206
27207 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
27208         uint8_t seed_arr[32];
27209         CHECK(seed->arr_len == 32);
27210         memcpy(seed_arr, seed->elems, 32); FREE(seed);
27211         uint8_t (*seed_ref)[32] = &seed_arr;
27212         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
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
27219 int8_tArray  __attribute__((export_name("TS_KeysManager_get_node_secret_key"))) TS_KeysManager_get_node_secret_key(uint64_t this_arg) {
27220         LDKKeysManager this_arg_conv;
27221         this_arg_conv.inner = untag_ptr(this_arg);
27222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27224         this_arg_conv.is_owned = false;
27225         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27226         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
27227         return ret_arr;
27228 }
27229
27230 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) {
27231         LDKKeysManager this_arg_conv;
27232         this_arg_conv.inner = untag_ptr(this_arg);
27233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27235         this_arg_conv.is_owned = false;
27236         uint8_t params_arr[32];
27237         CHECK(params->arr_len == 32);
27238         memcpy(params_arr, params->elems, 32); FREE(params);
27239         uint8_t (*params_ref)[32] = &params_arr;
27240         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27241         uint64_t ret_ref = 0;
27242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27244         return ret_ref;
27245 }
27246
27247 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) {
27248         LDKKeysManager this_arg_conv;
27249         this_arg_conv.inner = untag_ptr(this_arg);
27250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27252         this_arg_conv.is_owned = false;
27253         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27254         descriptors_constr.datalen = descriptors->arr_len;
27255         if (descriptors_constr.datalen > 0)
27256                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27257         else
27258                 descriptors_constr.data = NULL;
27259         uint64_t* descriptors_vals = descriptors->elems;
27260         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27261                 uint64_t descriptors_conv_27 = descriptors_vals[b];
27262                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
27263                 CHECK_ACCESS(descriptors_conv_27_ptr);
27264                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27265                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
27266                 descriptors_constr.data[b] = descriptors_conv_27_conv;
27267         }
27268         FREE(descriptors);
27269         LDKCVec_TxOutZ outputs_constr;
27270         outputs_constr.datalen = outputs->arr_len;
27271         if (outputs_constr.datalen > 0)
27272                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27273         else
27274                 outputs_constr.data = NULL;
27275         uint64_t* outputs_vals = outputs->elems;
27276         for (size_t h = 0; h < outputs_constr.datalen; h++) {
27277                 uint64_t outputs_conv_7 = outputs_vals[h];
27278                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
27279                 CHECK_ACCESS(outputs_conv_7_ptr);
27280                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27281                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
27282                 outputs_constr.data[h] = outputs_conv_7_conv;
27283         }
27284         FREE(outputs);
27285         LDKCVec_u8Z change_destination_script_ref;
27286         change_destination_script_ref.datalen = change_destination_script->arr_len;
27287         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27288         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
27289         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27290         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27291         return tag_ptr(ret_conv, true);
27292 }
27293
27294 uint64_t  __attribute__((export_name("TS_KeysManager_as_EntropySource"))) TS_KeysManager_as_EntropySource(uint64_t this_arg) {
27295         LDKKeysManager this_arg_conv;
27296         this_arg_conv.inner = untag_ptr(this_arg);
27297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27299         this_arg_conv.is_owned = false;
27300         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
27301         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
27302         return tag_ptr(ret_ret, true);
27303 }
27304
27305 uint64_t  __attribute__((export_name("TS_KeysManager_as_NodeSigner"))) TS_KeysManager_as_NodeSigner(uint64_t this_arg) {
27306         LDKKeysManager this_arg_conv;
27307         this_arg_conv.inner = untag_ptr(this_arg);
27308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27310         this_arg_conv.is_owned = false;
27311         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
27312         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
27313         return tag_ptr(ret_ret, true);
27314 }
27315
27316 uint64_t  __attribute__((export_name("TS_KeysManager_as_SignerProvider"))) TS_KeysManager_as_SignerProvider(uint64_t this_arg) {
27317         LDKKeysManager this_arg_conv;
27318         this_arg_conv.inner = untag_ptr(this_arg);
27319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27321         this_arg_conv.is_owned = false;
27322         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
27323         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
27324         return tag_ptr(ret_ret, true);
27325 }
27326
27327 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
27328         LDKPhantomKeysManager this_obj_conv;
27329         this_obj_conv.inner = untag_ptr(this_obj);
27330         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27332         PhantomKeysManager_free(this_obj_conv);
27333 }
27334
27335 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_EntropySource"))) TS_PhantomKeysManager_as_EntropySource(uint64_t this_arg) {
27336         LDKPhantomKeysManager this_arg_conv;
27337         this_arg_conv.inner = untag_ptr(this_arg);
27338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27340         this_arg_conv.is_owned = false;
27341         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
27342         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
27343         return tag_ptr(ret_ret, true);
27344 }
27345
27346 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_NodeSigner"))) TS_PhantomKeysManager_as_NodeSigner(uint64_t this_arg) {
27347         LDKPhantomKeysManager this_arg_conv;
27348         this_arg_conv.inner = untag_ptr(this_arg);
27349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27351         this_arg_conv.is_owned = false;
27352         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
27353         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
27354         return tag_ptr(ret_ret, true);
27355 }
27356
27357 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_SignerProvider"))) TS_PhantomKeysManager_as_SignerProvider(uint64_t this_arg) {
27358         LDKPhantomKeysManager this_arg_conv;
27359         this_arg_conv.inner = untag_ptr(this_arg);
27360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27362         this_arg_conv.is_owned = false;
27363         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
27364         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
27365         return tag_ptr(ret_ret, true);
27366 }
27367
27368 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) {
27369         uint8_t seed_arr[32];
27370         CHECK(seed->arr_len == 32);
27371         memcpy(seed_arr, seed->elems, 32); FREE(seed);
27372         uint8_t (*seed_ref)[32] = &seed_arr;
27373         uint8_t cross_node_seed_arr[32];
27374         CHECK(cross_node_seed->arr_len == 32);
27375         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
27376         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
27377         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
27378         uint64_t ret_ref = 0;
27379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27381         return ret_ref;
27382 }
27383
27384 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) {
27385         LDKPhantomKeysManager this_arg_conv;
27386         this_arg_conv.inner = untag_ptr(this_arg);
27387         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27389         this_arg_conv.is_owned = false;
27390         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27391         descriptors_constr.datalen = descriptors->arr_len;
27392         if (descriptors_constr.datalen > 0)
27393                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27394         else
27395                 descriptors_constr.data = NULL;
27396         uint64_t* descriptors_vals = descriptors->elems;
27397         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27398                 uint64_t descriptors_conv_27 = descriptors_vals[b];
27399                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
27400                 CHECK_ACCESS(descriptors_conv_27_ptr);
27401                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27402                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
27403                 descriptors_constr.data[b] = descriptors_conv_27_conv;
27404         }
27405         FREE(descriptors);
27406         LDKCVec_TxOutZ outputs_constr;
27407         outputs_constr.datalen = outputs->arr_len;
27408         if (outputs_constr.datalen > 0)
27409                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27410         else
27411                 outputs_constr.data = NULL;
27412         uint64_t* outputs_vals = outputs->elems;
27413         for (size_t h = 0; h < outputs_constr.datalen; h++) {
27414                 uint64_t outputs_conv_7 = outputs_vals[h];
27415                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
27416                 CHECK_ACCESS(outputs_conv_7_ptr);
27417                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27418                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
27419                 outputs_constr.data[h] = outputs_conv_7_conv;
27420         }
27421         FREE(outputs);
27422         LDKCVec_u8Z change_destination_script_ref;
27423         change_destination_script_ref.datalen = change_destination_script->arr_len;
27424         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27425         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
27426         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27427         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27428         return tag_ptr(ret_conv, true);
27429 }
27430
27431 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) {
27432         LDKPhantomKeysManager this_arg_conv;
27433         this_arg_conv.inner = untag_ptr(this_arg);
27434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27436         this_arg_conv.is_owned = false;
27437         uint8_t params_arr[32];
27438         CHECK(params->arr_len == 32);
27439         memcpy(params_arr, params->elems, 32); FREE(params);
27440         uint8_t (*params_ref)[32] = &params_arr;
27441         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27442         uint64_t ret_ref = 0;
27443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27445         return ret_ref;
27446 }
27447
27448 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_node_secret_key"))) TS_PhantomKeysManager_get_node_secret_key(uint64_t this_arg) {
27449         LDKPhantomKeysManager this_arg_conv;
27450         this_arg_conv.inner = untag_ptr(this_arg);
27451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27453         this_arg_conv.is_owned = false;
27454         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27455         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
27456         return ret_arr;
27457 }
27458
27459 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_phantom_node_secret_key"))) TS_PhantomKeysManager_get_phantom_node_secret_key(uint64_t this_arg) {
27460         LDKPhantomKeysManager this_arg_conv;
27461         this_arg_conv.inner = untag_ptr(this_arg);
27462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27464         this_arg_conv.is_owned = false;
27465         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27466         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
27467         return ret_arr;
27468 }
27469
27470 uint32_t  __attribute__((export_name("TS_FailureCode_clone"))) TS_FailureCode_clone(uint64_t orig) {
27471         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
27472         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_clone(orig_conv));
27473         return ret_conv;
27474 }
27475
27476 uint32_t  __attribute__((export_name("TS_FailureCode_temporary_node_failure"))) TS_FailureCode_temporary_node_failure() {
27477         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_temporary_node_failure());
27478         return ret_conv;
27479 }
27480
27481 uint32_t  __attribute__((export_name("TS_FailureCode_required_node_feature_missing"))) TS_FailureCode_required_node_feature_missing() {
27482         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_required_node_feature_missing());
27483         return ret_conv;
27484 }
27485
27486 uint32_t  __attribute__((export_name("TS_FailureCode_incorrect_or_unknown_payment_details"))) TS_FailureCode_incorrect_or_unknown_payment_details() {
27487         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_incorrect_or_unknown_payment_details());
27488         return ret_conv;
27489 }
27490
27491 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
27492         LDKChannelManager this_obj_conv;
27493         this_obj_conv.inner = untag_ptr(this_obj);
27494         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27496         ChannelManager_free(this_obj_conv);
27497 }
27498
27499 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
27500         LDKChainParameters this_obj_conv;
27501         this_obj_conv.inner = untag_ptr(this_obj);
27502         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27504         ChainParameters_free(this_obj_conv);
27505 }
27506
27507 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
27508         LDKChainParameters this_ptr_conv;
27509         this_ptr_conv.inner = untag_ptr(this_ptr);
27510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27512         this_ptr_conv.is_owned = false;
27513         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
27514         return ret_conv;
27515 }
27516
27517 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
27518         LDKChainParameters this_ptr_conv;
27519         this_ptr_conv.inner = untag_ptr(this_ptr);
27520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27522         this_ptr_conv.is_owned = false;
27523         LDKNetwork val_conv = LDKNetwork_from_js(val);
27524         ChainParameters_set_network(&this_ptr_conv, val_conv);
27525 }
27526
27527 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
27528         LDKChainParameters this_ptr_conv;
27529         this_ptr_conv.inner = untag_ptr(this_ptr);
27530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27532         this_ptr_conv.is_owned = false;
27533         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
27534         uint64_t ret_ref = 0;
27535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27537         return ret_ref;
27538 }
27539
27540 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
27541         LDKChainParameters this_ptr_conv;
27542         this_ptr_conv.inner = untag_ptr(this_ptr);
27543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27545         this_ptr_conv.is_owned = false;
27546         LDKBestBlock val_conv;
27547         val_conv.inner = untag_ptr(val);
27548         val_conv.is_owned = ptr_is_owned(val);
27549         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27550         val_conv = BestBlock_clone(&val_conv);
27551         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
27552 }
27553
27554 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
27555         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
27556         LDKBestBlock best_block_arg_conv;
27557         best_block_arg_conv.inner = untag_ptr(best_block_arg);
27558         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
27559         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
27560         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
27561         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
27562         uint64_t ret_ref = 0;
27563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27565         return ret_ref;
27566 }
27567
27568 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
27569         LDKChainParameters ret_var = ChainParameters_clone(arg);
27570         uint64_t ret_ref = 0;
27571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27573         return ret_ref;
27574 }
27575 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
27576         LDKChainParameters arg_conv;
27577         arg_conv.inner = untag_ptr(arg);
27578         arg_conv.is_owned = ptr_is_owned(arg);
27579         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27580         arg_conv.is_owned = false;
27581         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
27582         return ret_conv;
27583 }
27584
27585 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
27586         LDKChainParameters orig_conv;
27587         orig_conv.inner = untag_ptr(orig);
27588         orig_conv.is_owned = ptr_is_owned(orig);
27589         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27590         orig_conv.is_owned = false;
27591         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
27592         uint64_t ret_ref = 0;
27593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27595         return ret_ref;
27596 }
27597
27598 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
27599         LDKCounterpartyForwardingInfo this_obj_conv;
27600         this_obj_conv.inner = untag_ptr(this_obj);
27601         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27603         CounterpartyForwardingInfo_free(this_obj_conv);
27604 }
27605
27606 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
27607         LDKCounterpartyForwardingInfo this_ptr_conv;
27608         this_ptr_conv.inner = untag_ptr(this_ptr);
27609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27611         this_ptr_conv.is_owned = false;
27612         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
27613         return ret_conv;
27614 }
27615
27616 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
27617         LDKCounterpartyForwardingInfo this_ptr_conv;
27618         this_ptr_conv.inner = untag_ptr(this_ptr);
27619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27621         this_ptr_conv.is_owned = false;
27622         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
27623 }
27624
27625 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
27626         LDKCounterpartyForwardingInfo this_ptr_conv;
27627         this_ptr_conv.inner = untag_ptr(this_ptr);
27628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27630         this_ptr_conv.is_owned = false;
27631         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
27632         return ret_conv;
27633 }
27634
27635 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
27636         LDKCounterpartyForwardingInfo this_ptr_conv;
27637         this_ptr_conv.inner = untag_ptr(this_ptr);
27638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27640         this_ptr_conv.is_owned = false;
27641         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
27642 }
27643
27644 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
27645         LDKCounterpartyForwardingInfo this_ptr_conv;
27646         this_ptr_conv.inner = untag_ptr(this_ptr);
27647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27649         this_ptr_conv.is_owned = false;
27650         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
27651         return ret_conv;
27652 }
27653
27654 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
27655         LDKCounterpartyForwardingInfo this_ptr_conv;
27656         this_ptr_conv.inner = untag_ptr(this_ptr);
27657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27659         this_ptr_conv.is_owned = false;
27660         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
27661 }
27662
27663 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) {
27664         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
27665         uint64_t ret_ref = 0;
27666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27668         return ret_ref;
27669 }
27670
27671 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
27672         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
27673         uint64_t ret_ref = 0;
27674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27676         return ret_ref;
27677 }
27678 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
27679         LDKCounterpartyForwardingInfo arg_conv;
27680         arg_conv.inner = untag_ptr(arg);
27681         arg_conv.is_owned = ptr_is_owned(arg);
27682         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27683         arg_conv.is_owned = false;
27684         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
27685         return ret_conv;
27686 }
27687
27688 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
27689         LDKCounterpartyForwardingInfo orig_conv;
27690         orig_conv.inner = untag_ptr(orig);
27691         orig_conv.is_owned = ptr_is_owned(orig);
27692         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27693         orig_conv.is_owned = false;
27694         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
27695         uint64_t ret_ref = 0;
27696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27698         return ret_ref;
27699 }
27700
27701 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
27702         LDKChannelCounterparty this_obj_conv;
27703         this_obj_conv.inner = untag_ptr(this_obj);
27704         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27706         ChannelCounterparty_free(this_obj_conv);
27707 }
27708
27709 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
27710         LDKChannelCounterparty this_ptr_conv;
27711         this_ptr_conv.inner = untag_ptr(this_ptr);
27712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27714         this_ptr_conv.is_owned = false;
27715         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27716         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
27717         return ret_arr;
27718 }
27719
27720 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
27721         LDKChannelCounterparty this_ptr_conv;
27722         this_ptr_conv.inner = untag_ptr(this_ptr);
27723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27725         this_ptr_conv.is_owned = false;
27726         LDKPublicKey val_ref;
27727         CHECK(val->arr_len == 33);
27728         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27729         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
27730 }
27731
27732 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
27733         LDKChannelCounterparty this_ptr_conv;
27734         this_ptr_conv.inner = untag_ptr(this_ptr);
27735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27737         this_ptr_conv.is_owned = false;
27738         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
27739         uint64_t ret_ref = 0;
27740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27742         return ret_ref;
27743 }
27744
27745 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
27746         LDKChannelCounterparty this_ptr_conv;
27747         this_ptr_conv.inner = untag_ptr(this_ptr);
27748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27750         this_ptr_conv.is_owned = false;
27751         LDKInitFeatures val_conv;
27752         val_conv.inner = untag_ptr(val);
27753         val_conv.is_owned = ptr_is_owned(val);
27754         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27755         val_conv = InitFeatures_clone(&val_conv);
27756         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
27757 }
27758
27759 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
27760         LDKChannelCounterparty 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         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
27766         return ret_conv;
27767 }
27768
27769 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
27770         LDKChannelCounterparty this_ptr_conv;
27771         this_ptr_conv.inner = untag_ptr(this_ptr);
27772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27774         this_ptr_conv.is_owned = false;
27775         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
27776 }
27777
27778 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
27779         LDKChannelCounterparty 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         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
27785         uint64_t ret_ref = 0;
27786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27788         return ret_ref;
27789 }
27790
27791 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
27792         LDKChannelCounterparty this_ptr_conv;
27793         this_ptr_conv.inner = untag_ptr(this_ptr);
27794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27796         this_ptr_conv.is_owned = false;
27797         LDKCounterpartyForwardingInfo val_conv;
27798         val_conv.inner = untag_ptr(val);
27799         val_conv.is_owned = ptr_is_owned(val);
27800         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27801         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
27802         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
27803 }
27804
27805 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
27806         LDKChannelCounterparty this_ptr_conv;
27807         this_ptr_conv.inner = untag_ptr(this_ptr);
27808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27810         this_ptr_conv.is_owned = false;
27811         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27812         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
27813         uint64_t ret_ref = tag_ptr(ret_copy, true);
27814         return ret_ref;
27815 }
27816
27817 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) {
27818         LDKChannelCounterparty this_ptr_conv;
27819         this_ptr_conv.inner = untag_ptr(this_ptr);
27820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27822         this_ptr_conv.is_owned = false;
27823         void* val_ptr = untag_ptr(val);
27824         CHECK_ACCESS(val_ptr);
27825         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27826         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27827         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
27828 }
27829
27830 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
27831         LDKChannelCounterparty this_ptr_conv;
27832         this_ptr_conv.inner = untag_ptr(this_ptr);
27833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27835         this_ptr_conv.is_owned = false;
27836         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27837         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
27838         uint64_t ret_ref = tag_ptr(ret_copy, true);
27839         return ret_ref;
27840 }
27841
27842 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) {
27843         LDKChannelCounterparty this_ptr_conv;
27844         this_ptr_conv.inner = untag_ptr(this_ptr);
27845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27847         this_ptr_conv.is_owned = false;
27848         void* val_ptr = untag_ptr(val);
27849         CHECK_ACCESS(val_ptr);
27850         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27851         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27852         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
27853 }
27854
27855 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) {
27856         LDKPublicKey node_id_arg_ref;
27857         CHECK(node_id_arg->arr_len == 33);
27858         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
27859         LDKInitFeatures features_arg_conv;
27860         features_arg_conv.inner = untag_ptr(features_arg);
27861         features_arg_conv.is_owned = ptr_is_owned(features_arg);
27862         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
27863         features_arg_conv = InitFeatures_clone(&features_arg_conv);
27864         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
27865         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
27866         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
27867         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
27868         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
27869         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
27870         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
27871         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
27872         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
27873         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
27874         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
27875         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
27876         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
27877         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);
27878         uint64_t ret_ref = 0;
27879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27881         return ret_ref;
27882 }
27883
27884 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
27885         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
27886         uint64_t ret_ref = 0;
27887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27889         return ret_ref;
27890 }
27891 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
27892         LDKChannelCounterparty arg_conv;
27893         arg_conv.inner = untag_ptr(arg);
27894         arg_conv.is_owned = ptr_is_owned(arg);
27895         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27896         arg_conv.is_owned = false;
27897         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
27898         return ret_conv;
27899 }
27900
27901 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
27902         LDKChannelCounterparty orig_conv;
27903         orig_conv.inner = untag_ptr(orig);
27904         orig_conv.is_owned = ptr_is_owned(orig);
27905         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27906         orig_conv.is_owned = false;
27907         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
27908         uint64_t ret_ref = 0;
27909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27911         return ret_ref;
27912 }
27913
27914 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
27915         LDKChannelDetails this_obj_conv;
27916         this_obj_conv.inner = untag_ptr(this_obj);
27917         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27919         ChannelDetails_free(this_obj_conv);
27920 }
27921
27922 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
27923         LDKChannelDetails this_ptr_conv;
27924         this_ptr_conv.inner = untag_ptr(this_ptr);
27925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27927         this_ptr_conv.is_owned = false;
27928         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27929         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
27930         return ret_arr;
27931 }
27932
27933 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
27934         LDKChannelDetails this_ptr_conv;
27935         this_ptr_conv.inner = untag_ptr(this_ptr);
27936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27938         this_ptr_conv.is_owned = false;
27939         LDKThirtyTwoBytes val_ref;
27940         CHECK(val->arr_len == 32);
27941         memcpy(val_ref.data, val->elems, 32); FREE(val);
27942         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
27943 }
27944
27945 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
27946         LDKChannelDetails this_ptr_conv;
27947         this_ptr_conv.inner = untag_ptr(this_ptr);
27948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27950         this_ptr_conv.is_owned = false;
27951         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
27952         uint64_t ret_ref = 0;
27953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27955         return ret_ref;
27956 }
27957
27958 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
27959         LDKChannelDetails this_ptr_conv;
27960         this_ptr_conv.inner = untag_ptr(this_ptr);
27961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27963         this_ptr_conv.is_owned = false;
27964         LDKChannelCounterparty val_conv;
27965         val_conv.inner = untag_ptr(val);
27966         val_conv.is_owned = ptr_is_owned(val);
27967         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27968         val_conv = ChannelCounterparty_clone(&val_conv);
27969         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
27970 }
27971
27972 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
27973         LDKChannelDetails this_ptr_conv;
27974         this_ptr_conv.inner = untag_ptr(this_ptr);
27975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27977         this_ptr_conv.is_owned = false;
27978         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
27979         uint64_t ret_ref = 0;
27980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27982         return ret_ref;
27983 }
27984
27985 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
27986         LDKChannelDetails this_ptr_conv;
27987         this_ptr_conv.inner = untag_ptr(this_ptr);
27988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27990         this_ptr_conv.is_owned = false;
27991         LDKOutPoint val_conv;
27992         val_conv.inner = untag_ptr(val);
27993         val_conv.is_owned = ptr_is_owned(val);
27994         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27995         val_conv = OutPoint_clone(&val_conv);
27996         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
27997 }
27998
27999 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
28000         LDKChannelDetails this_ptr_conv;
28001         this_ptr_conv.inner = untag_ptr(this_ptr);
28002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28004         this_ptr_conv.is_owned = false;
28005         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
28006         uint64_t ret_ref = 0;
28007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28009         return ret_ref;
28010 }
28011
28012 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
28013         LDKChannelDetails this_ptr_conv;
28014         this_ptr_conv.inner = untag_ptr(this_ptr);
28015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28017         this_ptr_conv.is_owned = false;
28018         LDKChannelTypeFeatures val_conv;
28019         val_conv.inner = untag_ptr(val);
28020         val_conv.is_owned = ptr_is_owned(val);
28021         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28022         val_conv = ChannelTypeFeatures_clone(&val_conv);
28023         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
28024 }
28025
28026 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
28027         LDKChannelDetails this_ptr_conv;
28028         this_ptr_conv.inner = untag_ptr(this_ptr);
28029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28031         this_ptr_conv.is_owned = false;
28032         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28033         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
28034         uint64_t ret_ref = tag_ptr(ret_copy, true);
28035         return ret_ref;
28036 }
28037
28038 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
28039         LDKChannelDetails this_ptr_conv;
28040         this_ptr_conv.inner = untag_ptr(this_ptr);
28041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28043         this_ptr_conv.is_owned = false;
28044         void* val_ptr = untag_ptr(val);
28045         CHECK_ACCESS(val_ptr);
28046         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28047         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28048         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
28049 }
28050
28051 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
28052         LDKChannelDetails this_ptr_conv;
28053         this_ptr_conv.inner = untag_ptr(this_ptr);
28054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28056         this_ptr_conv.is_owned = false;
28057         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28058         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
28059         uint64_t ret_ref = tag_ptr(ret_copy, true);
28060         return ret_ref;
28061 }
28062
28063 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
28064         LDKChannelDetails this_ptr_conv;
28065         this_ptr_conv.inner = untag_ptr(this_ptr);
28066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28068         this_ptr_conv.is_owned = false;
28069         void* val_ptr = untag_ptr(val);
28070         CHECK_ACCESS(val_ptr);
28071         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28072         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28073         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
28074 }
28075
28076 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
28077         LDKChannelDetails this_ptr_conv;
28078         this_ptr_conv.inner = untag_ptr(this_ptr);
28079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28081         this_ptr_conv.is_owned = false;
28082         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28083         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
28084         uint64_t ret_ref = tag_ptr(ret_copy, true);
28085         return ret_ref;
28086 }
28087
28088 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
28089         LDKChannelDetails this_ptr_conv;
28090         this_ptr_conv.inner = untag_ptr(this_ptr);
28091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28093         this_ptr_conv.is_owned = false;
28094         void* val_ptr = untag_ptr(val);
28095         CHECK_ACCESS(val_ptr);
28096         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28097         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28098         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
28099 }
28100
28101 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
28102         LDKChannelDetails this_ptr_conv;
28103         this_ptr_conv.inner = untag_ptr(this_ptr);
28104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28106         this_ptr_conv.is_owned = false;
28107         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
28108         return ret_conv;
28109 }
28110
28111 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
28112         LDKChannelDetails this_ptr_conv;
28113         this_ptr_conv.inner = untag_ptr(this_ptr);
28114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28116         this_ptr_conv.is_owned = false;
28117         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
28118 }
28119
28120 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
28121         LDKChannelDetails this_ptr_conv;
28122         this_ptr_conv.inner = untag_ptr(this_ptr);
28123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28125         this_ptr_conv.is_owned = false;
28126         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28127         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
28128         uint64_t ret_ref = tag_ptr(ret_copy, true);
28129         return ret_ref;
28130 }
28131
28132 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
28133         LDKChannelDetails this_ptr_conv;
28134         this_ptr_conv.inner = untag_ptr(this_ptr);
28135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28137         this_ptr_conv.is_owned = false;
28138         void* val_ptr = untag_ptr(val);
28139         CHECK_ACCESS(val_ptr);
28140         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28141         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28142         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
28143 }
28144
28145 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
28146         LDKChannelDetails this_ptr_conv;
28147         this_ptr_conv.inner = untag_ptr(this_ptr);
28148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28150         this_ptr_conv.is_owned = false;
28151         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
28152         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
28153         return ret_arr;
28154 }
28155
28156 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
28157         LDKChannelDetails this_ptr_conv;
28158         this_ptr_conv.inner = untag_ptr(this_ptr);
28159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28161         this_ptr_conv.is_owned = false;
28162         LDKU128 val_ref;
28163         CHECK(val->arr_len == 16);
28164         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
28165         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
28166 }
28167
28168 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
28169         LDKChannelDetails this_ptr_conv;
28170         this_ptr_conv.inner = untag_ptr(this_ptr);
28171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28173         this_ptr_conv.is_owned = false;
28174         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
28175         return ret_conv;
28176 }
28177
28178 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
28179         LDKChannelDetails this_ptr_conv;
28180         this_ptr_conv.inner = untag_ptr(this_ptr);
28181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28183         this_ptr_conv.is_owned = false;
28184         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
28185 }
28186
28187 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
28188         LDKChannelDetails this_ptr_conv;
28189         this_ptr_conv.inner = untag_ptr(this_ptr);
28190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28192         this_ptr_conv.is_owned = false;
28193         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
28194         return ret_conv;
28195 }
28196
28197 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
28198         LDKChannelDetails this_ptr_conv;
28199         this_ptr_conv.inner = untag_ptr(this_ptr);
28200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28202         this_ptr_conv.is_owned = false;
28203         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
28204 }
28205
28206 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) {
28207         LDKChannelDetails this_ptr_conv;
28208         this_ptr_conv.inner = untag_ptr(this_ptr);
28209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28211         this_ptr_conv.is_owned = false;
28212         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
28213         return ret_conv;
28214 }
28215
28216 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) {
28217         LDKChannelDetails this_ptr_conv;
28218         this_ptr_conv.inner = untag_ptr(this_ptr);
28219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28221         this_ptr_conv.is_owned = false;
28222         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
28223 }
28224
28225 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
28226         LDKChannelDetails this_ptr_conv;
28227         this_ptr_conv.inner = untag_ptr(this_ptr);
28228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28230         this_ptr_conv.is_owned = false;
28231         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
28232         return ret_conv;
28233 }
28234
28235 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
28236         LDKChannelDetails this_ptr_conv;
28237         this_ptr_conv.inner = untag_ptr(this_ptr);
28238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28240         this_ptr_conv.is_owned = false;
28241         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
28242 }
28243
28244 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
28245         LDKChannelDetails this_ptr_conv;
28246         this_ptr_conv.inner = untag_ptr(this_ptr);
28247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28249         this_ptr_conv.is_owned = false;
28250         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28251         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
28252         uint64_t ret_ref = tag_ptr(ret_copy, true);
28253         return ret_ref;
28254 }
28255
28256 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
28257         LDKChannelDetails this_ptr_conv;
28258         this_ptr_conv.inner = untag_ptr(this_ptr);
28259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28261         this_ptr_conv.is_owned = false;
28262         void* val_ptr = untag_ptr(val);
28263         CHECK_ACCESS(val_ptr);
28264         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28265         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28266         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
28267 }
28268
28269 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
28270         LDKChannelDetails this_ptr_conv;
28271         this_ptr_conv.inner = untag_ptr(this_ptr);
28272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28274         this_ptr_conv.is_owned = false;
28275         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28276         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
28277         uint64_t ret_ref = tag_ptr(ret_copy, true);
28278         return ret_ref;
28279 }
28280
28281 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
28282         LDKChannelDetails this_ptr_conv;
28283         this_ptr_conv.inner = untag_ptr(this_ptr);
28284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28286         this_ptr_conv.is_owned = false;
28287         void* val_ptr = untag_ptr(val);
28288         CHECK_ACCESS(val_ptr);
28289         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28290         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28291         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
28292 }
28293
28294 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
28295         LDKChannelDetails this_ptr_conv;
28296         this_ptr_conv.inner = untag_ptr(this_ptr);
28297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28299         this_ptr_conv.is_owned = false;
28300         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
28301         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
28302         uint64_t ret_ref = tag_ptr(ret_copy, true);
28303         return ret_ref;
28304 }
28305
28306 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) {
28307         LDKChannelDetails this_ptr_conv;
28308         this_ptr_conv.inner = untag_ptr(this_ptr);
28309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28311         this_ptr_conv.is_owned = false;
28312         void* val_ptr = untag_ptr(val);
28313         CHECK_ACCESS(val_ptr);
28314         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
28315         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
28316         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
28317 }
28318
28319 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
28320         LDKChannelDetails this_ptr_conv;
28321         this_ptr_conv.inner = untag_ptr(this_ptr);
28322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28324         this_ptr_conv.is_owned = false;
28325         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
28326         return ret_conv;
28327 }
28328
28329 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
28330         LDKChannelDetails this_ptr_conv;
28331         this_ptr_conv.inner = untag_ptr(this_ptr);
28332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28334         this_ptr_conv.is_owned = false;
28335         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
28336 }
28337
28338 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
28339         LDKChannelDetails this_ptr_conv;
28340         this_ptr_conv.inner = untag_ptr(this_ptr);
28341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28343         this_ptr_conv.is_owned = false;
28344         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
28345         return ret_conv;
28346 }
28347
28348 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
28349         LDKChannelDetails this_ptr_conv;
28350         this_ptr_conv.inner = untag_ptr(this_ptr);
28351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28353         this_ptr_conv.is_owned = false;
28354         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
28355 }
28356
28357 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
28358         LDKChannelDetails this_ptr_conv;
28359         this_ptr_conv.inner = untag_ptr(this_ptr);
28360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28362         this_ptr_conv.is_owned = false;
28363         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
28364         return ret_conv;
28365 }
28366
28367 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
28368         LDKChannelDetails this_ptr_conv;
28369         this_ptr_conv.inner = untag_ptr(this_ptr);
28370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28372         this_ptr_conv.is_owned = false;
28373         ChannelDetails_set_is_usable(&this_ptr_conv, val);
28374 }
28375
28376 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
28377         LDKChannelDetails this_ptr_conv;
28378         this_ptr_conv.inner = untag_ptr(this_ptr);
28379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28381         this_ptr_conv.is_owned = false;
28382         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
28383         return ret_conv;
28384 }
28385
28386 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
28387         LDKChannelDetails this_ptr_conv;
28388         this_ptr_conv.inner = untag_ptr(this_ptr);
28389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28391         this_ptr_conv.is_owned = false;
28392         ChannelDetails_set_is_public(&this_ptr_conv, val);
28393 }
28394
28395 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
28396         LDKChannelDetails this_ptr_conv;
28397         this_ptr_conv.inner = untag_ptr(this_ptr);
28398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28400         this_ptr_conv.is_owned = false;
28401         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28402         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
28403         uint64_t ret_ref = tag_ptr(ret_copy, true);
28404         return ret_ref;
28405 }
28406
28407 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) {
28408         LDKChannelDetails this_ptr_conv;
28409         this_ptr_conv.inner = untag_ptr(this_ptr);
28410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28412         this_ptr_conv.is_owned = false;
28413         void* val_ptr = untag_ptr(val);
28414         CHECK_ACCESS(val_ptr);
28415         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28416         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28417         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
28418 }
28419
28420 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
28421         LDKChannelDetails this_ptr_conv;
28422         this_ptr_conv.inner = untag_ptr(this_ptr);
28423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28425         this_ptr_conv.is_owned = false;
28426         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28427         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
28428         uint64_t ret_ref = tag_ptr(ret_copy, true);
28429         return ret_ref;
28430 }
28431
28432 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) {
28433         LDKChannelDetails this_ptr_conv;
28434         this_ptr_conv.inner = untag_ptr(this_ptr);
28435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28437         this_ptr_conv.is_owned = false;
28438         void* val_ptr = untag_ptr(val);
28439         CHECK_ACCESS(val_ptr);
28440         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28441         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28442         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
28443 }
28444
28445 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
28446         LDKChannelDetails this_ptr_conv;
28447         this_ptr_conv.inner = untag_ptr(this_ptr);
28448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28450         this_ptr_conv.is_owned = false;
28451         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
28452         uint64_t ret_ref = 0;
28453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28455         return ret_ref;
28456 }
28457
28458 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
28459         LDKChannelDetails this_ptr_conv;
28460         this_ptr_conv.inner = untag_ptr(this_ptr);
28461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28463         this_ptr_conv.is_owned = false;
28464         LDKChannelConfig val_conv;
28465         val_conv.inner = untag_ptr(val);
28466         val_conv.is_owned = ptr_is_owned(val);
28467         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28468         val_conv = ChannelConfig_clone(&val_conv);
28469         ChannelDetails_set_config(&this_ptr_conv, val_conv);
28470 }
28471
28472 uint64_t  __attribute__((export_name("TS_ChannelDetails_new"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint64_t counterparty_arg, uint64_t funding_txo_arg, uint64_t channel_type_arg, uint64_t short_channel_id_arg, uint64_t outbound_scid_alias_arg, uint64_t inbound_scid_alias_arg, int64_t channel_value_satoshis_arg, uint64_t unspendable_punishment_reserve_arg, int8_tArray user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t next_outbound_htlc_limit_msat_arg, int64_t inbound_capacity_msat_arg, uint64_t confirmations_required_arg, uint64_t confirmations_arg, uint64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_channel_ready_arg, jboolean is_usable_arg, jboolean is_public_arg, uint64_t inbound_htlc_minimum_msat_arg, uint64_t inbound_htlc_maximum_msat_arg, uint64_t config_arg) {
28473         LDKThirtyTwoBytes channel_id_arg_ref;
28474         CHECK(channel_id_arg->arr_len == 32);
28475         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28476         LDKChannelCounterparty counterparty_arg_conv;
28477         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
28478         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
28479         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
28480         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
28481         LDKOutPoint funding_txo_arg_conv;
28482         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
28483         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
28484         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
28485         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
28486         LDKChannelTypeFeatures channel_type_arg_conv;
28487         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
28488         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
28489         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
28490         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
28491         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
28492         CHECK_ACCESS(short_channel_id_arg_ptr);
28493         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
28494         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
28495         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
28496         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
28497         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
28498         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
28499         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
28500         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
28501         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
28502         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
28503         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
28504         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
28505         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
28506         LDKU128 user_channel_id_arg_ref;
28507         CHECK(user_channel_id_arg->arr_len == 16);
28508         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
28509         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
28510         CHECK_ACCESS(confirmations_required_arg_ptr);
28511         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
28512         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
28513         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
28514         CHECK_ACCESS(confirmations_arg_ptr);
28515         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
28516         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
28517         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
28518         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
28519         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
28520         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
28521         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
28522         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
28523         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
28524         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
28525         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
28526         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
28527         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
28528         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
28529         LDKChannelConfig config_arg_conv;
28530         config_arg_conv.inner = untag_ptr(config_arg);
28531         config_arg_conv.is_owned = ptr_is_owned(config_arg);
28532         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
28533         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
28534         LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, outbound_scid_alias_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg_ref, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, confirmations_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_channel_ready_arg, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv, config_arg_conv);
28535         uint64_t ret_ref = 0;
28536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28538         return ret_ref;
28539 }
28540
28541 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
28542         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
28543         uint64_t ret_ref = 0;
28544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28546         return ret_ref;
28547 }
28548 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
28549         LDKChannelDetails arg_conv;
28550         arg_conv.inner = untag_ptr(arg);
28551         arg_conv.is_owned = ptr_is_owned(arg);
28552         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28553         arg_conv.is_owned = false;
28554         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
28555         return ret_conv;
28556 }
28557
28558 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
28559         LDKChannelDetails orig_conv;
28560         orig_conv.inner = untag_ptr(orig);
28561         orig_conv.is_owned = ptr_is_owned(orig);
28562         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28563         orig_conv.is_owned = false;
28564         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
28565         uint64_t ret_ref = 0;
28566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28568         return ret_ref;
28569 }
28570
28571 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
28572         LDKChannelDetails this_arg_conv;
28573         this_arg_conv.inner = untag_ptr(this_arg);
28574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28576         this_arg_conv.is_owned = false;
28577         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28578         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
28579         uint64_t ret_ref = tag_ptr(ret_copy, true);
28580         return ret_ref;
28581 }
28582
28583 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
28584         LDKChannelDetails this_arg_conv;
28585         this_arg_conv.inner = untag_ptr(this_arg);
28586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28588         this_arg_conv.is_owned = false;
28589         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28590         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
28591         uint64_t ret_ref = tag_ptr(ret_copy, true);
28592         return ret_ref;
28593 }
28594
28595 void  __attribute__((export_name("TS_RecentPaymentDetails_free"))) TS_RecentPaymentDetails_free(uint64_t this_ptr) {
28596         if (!ptr_is_owned(this_ptr)) return;
28597         void* this_ptr_ptr = untag_ptr(this_ptr);
28598         CHECK_ACCESS(this_ptr_ptr);
28599         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
28600         FREE(untag_ptr(this_ptr));
28601         RecentPaymentDetails_free(this_ptr_conv);
28602 }
28603
28604 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
28605         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28606         *ret_copy = RecentPaymentDetails_clone(arg);
28607         uint64_t ret_ref = tag_ptr(ret_copy, true);
28608         return ret_ref;
28609 }
28610 int64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone_ptr"))) TS_RecentPaymentDetails_clone_ptr(uint64_t arg) {
28611         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
28612         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
28613         return ret_conv;
28614 }
28615
28616 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone"))) TS_RecentPaymentDetails_clone(uint64_t orig) {
28617         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
28618         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28619         *ret_copy = RecentPaymentDetails_clone(orig_conv);
28620         uint64_t ret_ref = tag_ptr(ret_copy, true);
28621         return ret_ref;
28622 }
28623
28624 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_pending"))) TS_RecentPaymentDetails_pending(int8_tArray payment_hash, int64_t total_msat) {
28625         LDKThirtyTwoBytes payment_hash_ref;
28626         CHECK(payment_hash->arr_len == 32);
28627         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28628         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28629         *ret_copy = RecentPaymentDetails_pending(payment_hash_ref, total_msat);
28630         uint64_t ret_ref = tag_ptr(ret_copy, true);
28631         return ret_ref;
28632 }
28633
28634 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_fulfilled"))) TS_RecentPaymentDetails_fulfilled(int8_tArray payment_hash) {
28635         LDKThirtyTwoBytes payment_hash_ref;
28636         CHECK(payment_hash->arr_len == 32);
28637         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28638         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28639         *ret_copy = RecentPaymentDetails_fulfilled(payment_hash_ref);
28640         uint64_t ret_ref = tag_ptr(ret_copy, true);
28641         return ret_ref;
28642 }
28643
28644 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_abandoned"))) TS_RecentPaymentDetails_abandoned(int8_tArray payment_hash) {
28645         LDKThirtyTwoBytes payment_hash_ref;
28646         CHECK(payment_hash->arr_len == 32);
28647         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28648         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28649         *ret_copy = RecentPaymentDetails_abandoned(payment_hash_ref);
28650         uint64_t ret_ref = tag_ptr(ret_copy, true);
28651         return ret_ref;
28652 }
28653
28654 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
28655         LDKPhantomRouteHints this_obj_conv;
28656         this_obj_conv.inner = untag_ptr(this_obj);
28657         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28659         PhantomRouteHints_free(this_obj_conv);
28660 }
28661
28662 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
28663         LDKPhantomRouteHints this_ptr_conv;
28664         this_ptr_conv.inner = untag_ptr(this_ptr);
28665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28667         this_ptr_conv.is_owned = false;
28668         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
28669         uint64_tArray ret_arr = NULL;
28670         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28671         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28672         for (size_t q = 0; q < ret_var.datalen; q++) {
28673                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28674                 uint64_t ret_conv_16_ref = 0;
28675                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28676                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28677                 ret_arr_ptr[q] = ret_conv_16_ref;
28678         }
28679         
28680         FREE(ret_var.data);
28681         return ret_arr;
28682 }
28683
28684 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
28685         LDKPhantomRouteHints this_ptr_conv;
28686         this_ptr_conv.inner = untag_ptr(this_ptr);
28687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28689         this_ptr_conv.is_owned = false;
28690         LDKCVec_ChannelDetailsZ val_constr;
28691         val_constr.datalen = val->arr_len;
28692         if (val_constr.datalen > 0)
28693                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28694         else
28695                 val_constr.data = NULL;
28696         uint64_t* val_vals = val->elems;
28697         for (size_t q = 0; q < val_constr.datalen; q++) {
28698                 uint64_t val_conv_16 = val_vals[q];
28699                 LDKChannelDetails val_conv_16_conv;
28700                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
28701                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
28702                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
28703                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
28704                 val_constr.data[q] = val_conv_16_conv;
28705         }
28706         FREE(val);
28707         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
28708 }
28709
28710 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
28711         LDKPhantomRouteHints this_ptr_conv;
28712         this_ptr_conv.inner = untag_ptr(this_ptr);
28713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28715         this_ptr_conv.is_owned = false;
28716         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
28717         return ret_conv;
28718 }
28719
28720 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
28721         LDKPhantomRouteHints this_ptr_conv;
28722         this_ptr_conv.inner = untag_ptr(this_ptr);
28723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28725         this_ptr_conv.is_owned = false;
28726         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
28727 }
28728
28729 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
28730         LDKPhantomRouteHints this_ptr_conv;
28731         this_ptr_conv.inner = untag_ptr(this_ptr);
28732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28734         this_ptr_conv.is_owned = false;
28735         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28736         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
28737         return ret_arr;
28738 }
28739
28740 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
28741         LDKPhantomRouteHints this_ptr_conv;
28742         this_ptr_conv.inner = untag_ptr(this_ptr);
28743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28745         this_ptr_conv.is_owned = false;
28746         LDKPublicKey val_ref;
28747         CHECK(val->arr_len == 33);
28748         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28749         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
28750 }
28751
28752 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) {
28753         LDKCVec_ChannelDetailsZ channels_arg_constr;
28754         channels_arg_constr.datalen = channels_arg->arr_len;
28755         if (channels_arg_constr.datalen > 0)
28756                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28757         else
28758                 channels_arg_constr.data = NULL;
28759         uint64_t* channels_arg_vals = channels_arg->elems;
28760         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
28761                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
28762                 LDKChannelDetails channels_arg_conv_16_conv;
28763                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
28764                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
28765                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
28766                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
28767                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
28768         }
28769         FREE(channels_arg);
28770         LDKPublicKey real_node_pubkey_arg_ref;
28771         CHECK(real_node_pubkey_arg->arr_len == 33);
28772         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
28773         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
28774         uint64_t ret_ref = 0;
28775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28777         return ret_ref;
28778 }
28779
28780 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
28781         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
28782         uint64_t ret_ref = 0;
28783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28785         return ret_ref;
28786 }
28787 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
28788         LDKPhantomRouteHints arg_conv;
28789         arg_conv.inner = untag_ptr(arg);
28790         arg_conv.is_owned = ptr_is_owned(arg);
28791         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28792         arg_conv.is_owned = false;
28793         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
28794         return ret_conv;
28795 }
28796
28797 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
28798         LDKPhantomRouteHints orig_conv;
28799         orig_conv.inner = untag_ptr(orig);
28800         orig_conv.is_owned = ptr_is_owned(orig);
28801         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28802         orig_conv.is_owned = false;
28803         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
28804         uint64_t ret_ref = 0;
28805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28807         return ret_ref;
28808 }
28809
28810 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 router, uint64_t logger, uint64_t entropy_source, uint64_t node_signer, uint64_t signer_provider, uint64_t config, uint64_t params) {
28811         void* fee_est_ptr = untag_ptr(fee_est);
28812         CHECK_ACCESS(fee_est_ptr);
28813         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
28814         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
28815                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28816                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
28817         }
28818         void* chain_monitor_ptr = untag_ptr(chain_monitor);
28819         CHECK_ACCESS(chain_monitor_ptr);
28820         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
28821         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
28822                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28823                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
28824         }
28825         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
28826         CHECK_ACCESS(tx_broadcaster_ptr);
28827         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
28828         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28829                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28830                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
28831         }
28832         void* router_ptr = untag_ptr(router);
28833         CHECK_ACCESS(router_ptr);
28834         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
28835         if (router_conv.free == LDKRouter_JCalls_free) {
28836                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28837                 LDKRouter_JCalls_cloned(&router_conv);
28838         }
28839         void* logger_ptr = untag_ptr(logger);
28840         CHECK_ACCESS(logger_ptr);
28841         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28842         if (logger_conv.free == LDKLogger_JCalls_free) {
28843                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28844                 LDKLogger_JCalls_cloned(&logger_conv);
28845         }
28846         void* entropy_source_ptr = untag_ptr(entropy_source);
28847         CHECK_ACCESS(entropy_source_ptr);
28848         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
28849         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
28850                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28851                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
28852         }
28853         void* node_signer_ptr = untag_ptr(node_signer);
28854         CHECK_ACCESS(node_signer_ptr);
28855         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
28856         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
28857                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28858                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
28859         }
28860         void* signer_provider_ptr = untag_ptr(signer_provider);
28861         CHECK_ACCESS(signer_provider_ptr);
28862         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
28863         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
28864                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28865                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
28866         }
28867         LDKUserConfig config_conv;
28868         config_conv.inner = untag_ptr(config);
28869         config_conv.is_owned = ptr_is_owned(config);
28870         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
28871         config_conv = UserConfig_clone(&config_conv);
28872         LDKChainParameters params_conv;
28873         params_conv.inner = untag_ptr(params);
28874         params_conv.is_owned = ptr_is_owned(params);
28875         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
28876         params_conv = ChainParameters_clone(&params_conv);
28877         LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, router_conv, logger_conv, entropy_source_conv, node_signer_conv, signer_provider_conv, config_conv, params_conv);
28878         uint64_t ret_ref = 0;
28879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28881         return ret_ref;
28882 }
28883
28884 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
28885         LDKChannelManager this_arg_conv;
28886         this_arg_conv.inner = untag_ptr(this_arg);
28887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28889         this_arg_conv.is_owned = false;
28890         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
28891         uint64_t ret_ref = 0;
28892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28894         return ret_ref;
28895 }
28896
28897 uint64_t  __attribute__((export_name("TS_ChannelManager_create_channel"))) TS_ChannelManager_create_channel(uint64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int8_tArray user_channel_id, uint64_t override_config) {
28898         LDKChannelManager this_arg_conv;
28899         this_arg_conv.inner = untag_ptr(this_arg);
28900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28902         this_arg_conv.is_owned = false;
28903         LDKPublicKey their_network_key_ref;
28904         CHECK(their_network_key->arr_len == 33);
28905         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
28906         LDKU128 user_channel_id_ref;
28907         CHECK(user_channel_id->arr_len == 16);
28908         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
28909         LDKUserConfig override_config_conv;
28910         override_config_conv.inner = untag_ptr(override_config);
28911         override_config_conv.is_owned = ptr_is_owned(override_config);
28912         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
28913         override_config_conv = UserConfig_clone(&override_config_conv);
28914         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
28915         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
28916         return tag_ptr(ret_conv, true);
28917 }
28918
28919 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
28920         LDKChannelManager this_arg_conv;
28921         this_arg_conv.inner = untag_ptr(this_arg);
28922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28924         this_arg_conv.is_owned = false;
28925         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
28926         uint64_tArray ret_arr = NULL;
28927         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28928         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28929         for (size_t q = 0; q < ret_var.datalen; q++) {
28930                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28931                 uint64_t ret_conv_16_ref = 0;
28932                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28933                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28934                 ret_arr_ptr[q] = ret_conv_16_ref;
28935         }
28936         
28937         FREE(ret_var.data);
28938         return ret_arr;
28939 }
28940
28941 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
28942         LDKChannelManager this_arg_conv;
28943         this_arg_conv.inner = untag_ptr(this_arg);
28944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28946         this_arg_conv.is_owned = false;
28947         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
28948         uint64_tArray ret_arr = NULL;
28949         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28950         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28951         for (size_t q = 0; q < ret_var.datalen; q++) {
28952                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28953                 uint64_t ret_conv_16_ref = 0;
28954                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28955                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28956                 ret_arr_ptr[q] = ret_conv_16_ref;
28957         }
28958         
28959         FREE(ret_var.data);
28960         return ret_arr;
28961 }
28962
28963 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_recent_payments"))) TS_ChannelManager_list_recent_payments(uint64_t this_arg) {
28964         LDKChannelManager this_arg_conv;
28965         this_arg_conv.inner = untag_ptr(this_arg);
28966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28968         this_arg_conv.is_owned = false;
28969         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
28970         uint64_tArray ret_arr = NULL;
28971         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28972         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28973         for (size_t w = 0; w < ret_var.datalen; w++) {
28974                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28975                 *ret_conv_22_copy = ret_var.data[w];
28976                 uint64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
28977                 ret_arr_ptr[w] = ret_conv_22_ref;
28978         }
28979         
28980         FREE(ret_var.data);
28981         return ret_arr;
28982 }
28983
28984 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) {
28985         LDKChannelManager this_arg_conv;
28986         this_arg_conv.inner = untag_ptr(this_arg);
28987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28989         this_arg_conv.is_owned = false;
28990         uint8_t channel_id_arr[32];
28991         CHECK(channel_id->arr_len == 32);
28992         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28993         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
28994         LDKPublicKey counterparty_node_id_ref;
28995         CHECK(counterparty_node_id->arr_len == 33);
28996         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28997         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28998         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28999         return tag_ptr(ret_conv, true);
29000 }
29001
29002 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) {
29003         LDKChannelManager this_arg_conv;
29004         this_arg_conv.inner = untag_ptr(this_arg);
29005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29007         this_arg_conv.is_owned = false;
29008         uint8_t channel_id_arr[32];
29009         CHECK(channel_id->arr_len == 32);
29010         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
29011         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
29012         LDKPublicKey counterparty_node_id_ref;
29013         CHECK(counterparty_node_id->arr_len == 33);
29014         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29015         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29016         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
29017         return tag_ptr(ret_conv, true);
29018 }
29019
29020 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) {
29021         LDKChannelManager this_arg_conv;
29022         this_arg_conv.inner = untag_ptr(this_arg);
29023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29025         this_arg_conv.is_owned = false;
29026         uint8_t channel_id_arr[32];
29027         CHECK(channel_id->arr_len == 32);
29028         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
29029         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
29030         LDKPublicKey counterparty_node_id_ref;
29031         CHECK(counterparty_node_id->arr_len == 33);
29032         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29033         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29034         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
29035         return tag_ptr(ret_conv, true);
29036 }
29037
29038 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) {
29039         LDKChannelManager this_arg_conv;
29040         this_arg_conv.inner = untag_ptr(this_arg);
29041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29043         this_arg_conv.is_owned = false;
29044         uint8_t channel_id_arr[32];
29045         CHECK(channel_id->arr_len == 32);
29046         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
29047         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
29048         LDKPublicKey counterparty_node_id_ref;
29049         CHECK(counterparty_node_id->arr_len == 33);
29050         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29051         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29052         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
29053         return tag_ptr(ret_conv, true);
29054 }
29055
29056 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) {
29057         LDKChannelManager this_arg_conv;
29058         this_arg_conv.inner = untag_ptr(this_arg);
29059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29061         this_arg_conv.is_owned = false;
29062         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
29063 }
29064
29065 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) {
29066         LDKChannelManager this_arg_conv;
29067         this_arg_conv.inner = untag_ptr(this_arg);
29068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29070         this_arg_conv.is_owned = false;
29071         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
29072 }
29073
29074 uint64_t  __attribute__((export_name("TS_ChannelManager_send_payment"))) TS_ChannelManager_send_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_hash, int8_tArray payment_secret, int8_tArray payment_id) {
29075         LDKChannelManager this_arg_conv;
29076         this_arg_conv.inner = untag_ptr(this_arg);
29077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29079         this_arg_conv.is_owned = false;
29080         LDKRoute route_conv;
29081         route_conv.inner = untag_ptr(route);
29082         route_conv.is_owned = ptr_is_owned(route);
29083         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29084         route_conv.is_owned = false;
29085         LDKThirtyTwoBytes payment_hash_ref;
29086         CHECK(payment_hash->arr_len == 32);
29087         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29088         LDKThirtyTwoBytes payment_secret_ref;
29089         CHECK(payment_secret->arr_len == 32);
29090         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
29091         LDKThirtyTwoBytes payment_id_ref;
29092         CHECK(payment_id->arr_len == 32);
29093         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29094         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
29095         *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref, payment_id_ref);
29096         return tag_ptr(ret_conv, true);
29097 }
29098
29099 uint64_t  __attribute__((export_name("TS_ChannelManager_send_payment_with_retry"))) TS_ChannelManager_send_payment_with_retry(uint64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret, int8_tArray payment_id, uint64_t route_params, uint64_t retry_strategy) {
29100         LDKChannelManager this_arg_conv;
29101         this_arg_conv.inner = untag_ptr(this_arg);
29102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29104         this_arg_conv.is_owned = false;
29105         LDKThirtyTwoBytes payment_hash_ref;
29106         CHECK(payment_hash->arr_len == 32);
29107         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29108         LDKThirtyTwoBytes payment_secret_ref;
29109         CHECK(payment_secret->arr_len == 32);
29110         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
29111         LDKThirtyTwoBytes payment_id_ref;
29112         CHECK(payment_id->arr_len == 32);
29113         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29114         LDKRouteParameters route_params_conv;
29115         route_params_conv.inner = untag_ptr(route_params);
29116         route_params_conv.is_owned = ptr_is_owned(route_params);
29117         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
29118         route_params_conv = RouteParameters_clone(&route_params_conv);
29119         void* retry_strategy_ptr = untag_ptr(retry_strategy);
29120         CHECK_ACCESS(retry_strategy_ptr);
29121         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
29122         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
29123         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
29124         *ret_conv = ChannelManager_send_payment_with_retry(&this_arg_conv, payment_hash_ref, payment_secret_ref, payment_id_ref, route_params_conv, retry_strategy_conv);
29125         return tag_ptr(ret_conv, true);
29126 }
29127
29128 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
29129         LDKChannelManager this_arg_conv;
29130         this_arg_conv.inner = untag_ptr(this_arg);
29131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29133         this_arg_conv.is_owned = false;
29134         LDKThirtyTwoBytes payment_id_ref;
29135         CHECK(payment_id->arr_len == 32);
29136         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29137         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
29138 }
29139
29140 uint64_t  __attribute__((export_name("TS_ChannelManager_send_spontaneous_payment"))) TS_ChannelManager_send_spontaneous_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_preimage, int8_tArray payment_id) {
29141         LDKChannelManager this_arg_conv;
29142         this_arg_conv.inner = untag_ptr(this_arg);
29143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29145         this_arg_conv.is_owned = false;
29146         LDKRoute route_conv;
29147         route_conv.inner = untag_ptr(route);
29148         route_conv.is_owned = ptr_is_owned(route);
29149         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29150         route_conv.is_owned = false;
29151         LDKThirtyTwoBytes payment_preimage_ref;
29152         CHECK(payment_preimage->arr_len == 32);
29153         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
29154         LDKThirtyTwoBytes payment_id_ref;
29155         CHECK(payment_id->arr_len == 32);
29156         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29157         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
29158         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref, payment_id_ref);
29159         return tag_ptr(ret_conv, true);
29160 }
29161
29162 uint64_t  __attribute__((export_name("TS_ChannelManager_send_spontaneous_payment_with_retry"))) TS_ChannelManager_send_spontaneous_payment_with_retry(uint64_t this_arg, int8_tArray payment_preimage, int8_tArray payment_id, uint64_t route_params, uint64_t retry_strategy) {
29163         LDKChannelManager this_arg_conv;
29164         this_arg_conv.inner = untag_ptr(this_arg);
29165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29167         this_arg_conv.is_owned = false;
29168         LDKThirtyTwoBytes payment_preimage_ref;
29169         CHECK(payment_preimage->arr_len == 32);
29170         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
29171         LDKThirtyTwoBytes payment_id_ref;
29172         CHECK(payment_id->arr_len == 32);
29173         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29174         LDKRouteParameters route_params_conv;
29175         route_params_conv.inner = untag_ptr(route_params);
29176         route_params_conv.is_owned = ptr_is_owned(route_params);
29177         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
29178         route_params_conv = RouteParameters_clone(&route_params_conv);
29179         void* retry_strategy_ptr = untag_ptr(retry_strategy);
29180         CHECK_ACCESS(retry_strategy_ptr);
29181         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
29182         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
29183         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
29184         *ret_conv = ChannelManager_send_spontaneous_payment_with_retry(&this_arg_conv, payment_preimage_ref, payment_id_ref, route_params_conv, retry_strategy_conv);
29185         return tag_ptr(ret_conv, true);
29186 }
29187
29188 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_tArray hops) {
29189         LDKChannelManager this_arg_conv;
29190         this_arg_conv.inner = untag_ptr(this_arg);
29191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29193         this_arg_conv.is_owned = false;
29194         LDKCVec_RouteHopZ hops_constr;
29195         hops_constr.datalen = hops->arr_len;
29196         if (hops_constr.datalen > 0)
29197                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
29198         else
29199                 hops_constr.data = NULL;
29200         uint64_t* hops_vals = hops->elems;
29201         for (size_t k = 0; k < hops_constr.datalen; k++) {
29202                 uint64_t hops_conv_10 = hops_vals[k];
29203                 LDKRouteHop hops_conv_10_conv;
29204                 hops_conv_10_conv.inner = untag_ptr(hops_conv_10);
29205                 hops_conv_10_conv.is_owned = ptr_is_owned(hops_conv_10);
29206                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv);
29207                 hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv);
29208                 hops_constr.data[k] = hops_conv_10_conv;
29209         }
29210         FREE(hops);
29211         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
29212         *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr);
29213         return tag_ptr(ret_conv, true);
29214 }
29215
29216 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) {
29217         LDKChannelManager this_arg_conv;
29218         this_arg_conv.inner = untag_ptr(this_arg);
29219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29221         this_arg_conv.is_owned = false;
29222         uint8_t temporary_channel_id_arr[32];
29223         CHECK(temporary_channel_id->arr_len == 32);
29224         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
29225         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29226         LDKPublicKey counterparty_node_id_ref;
29227         CHECK(counterparty_node_id->arr_len == 33);
29228         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29229         LDKTransaction funding_transaction_ref;
29230         funding_transaction_ref.datalen = funding_transaction->arr_len;
29231         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
29232         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
29233         funding_transaction_ref.data_is_owned = true;
29234         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29235         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
29236         return tag_ptr(ret_conv, true);
29237 }
29238
29239 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) {
29240         LDKChannelManager this_arg_conv;
29241         this_arg_conv.inner = untag_ptr(this_arg);
29242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29244         this_arg_conv.is_owned = false;
29245         LDKPublicKey counterparty_node_id_ref;
29246         CHECK(counterparty_node_id->arr_len == 33);
29247         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29248         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
29249         channel_ids_constr.datalen = channel_ids->arr_len;
29250         if (channel_ids_constr.datalen > 0)
29251                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
29252         else
29253                 channel_ids_constr.data = NULL;
29254         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
29255         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
29256                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
29257                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
29258                 CHECK(channel_ids_conv_12->arr_len == 32);
29259                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
29260                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
29261         }
29262         FREE(channel_ids);
29263         LDKChannelConfig config_conv;
29264         config_conv.inner = untag_ptr(config);
29265         config_conv.is_owned = ptr_is_owned(config);
29266         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
29267         config_conv.is_owned = false;
29268         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29269         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
29270         return tag_ptr(ret_conv, true);
29271 }
29272
29273 uint64_t  __attribute__((export_name("TS_ChannelManager_forward_intercepted_htlc"))) TS_ChannelManager_forward_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id, int8_tArray next_hop_channel_id, int8_tArray next_node_id, int64_t amt_to_forward_msat) {
29274         LDKChannelManager this_arg_conv;
29275         this_arg_conv.inner = untag_ptr(this_arg);
29276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29278         this_arg_conv.is_owned = false;
29279         LDKThirtyTwoBytes intercept_id_ref;
29280         CHECK(intercept_id->arr_len == 32);
29281         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
29282         uint8_t next_hop_channel_id_arr[32];
29283         CHECK(next_hop_channel_id->arr_len == 32);
29284         memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id);
29285         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
29286         LDKPublicKey next_node_id_ref;
29287         CHECK(next_node_id->arr_len == 33);
29288         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
29289         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29290         *ret_conv = ChannelManager_forward_intercepted_htlc(&this_arg_conv, intercept_id_ref, next_hop_channel_id_ref, next_node_id_ref, amt_to_forward_msat);
29291         return tag_ptr(ret_conv, true);
29292 }
29293
29294 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
29295         LDKChannelManager this_arg_conv;
29296         this_arg_conv.inner = untag_ptr(this_arg);
29297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29299         this_arg_conv.is_owned = false;
29300         LDKThirtyTwoBytes intercept_id_ref;
29301         CHECK(intercept_id->arr_len == 32);
29302         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
29303         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29304         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
29305         return tag_ptr(ret_conv, true);
29306 }
29307
29308 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
29309         LDKChannelManager this_arg_conv;
29310         this_arg_conv.inner = untag_ptr(this_arg);
29311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29313         this_arg_conv.is_owned = false;
29314         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
29315 }
29316
29317 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
29318         LDKChannelManager this_arg_conv;
29319         this_arg_conv.inner = untag_ptr(this_arg);
29320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29322         this_arg_conv.is_owned = false;
29323         ChannelManager_timer_tick_occurred(&this_arg_conv);
29324 }
29325
29326 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
29327         LDKChannelManager this_arg_conv;
29328         this_arg_conv.inner = untag_ptr(this_arg);
29329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29331         this_arg_conv.is_owned = false;
29332         uint8_t payment_hash_arr[32];
29333         CHECK(payment_hash->arr_len == 32);
29334         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
29335         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
29336         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
29337 }
29338
29339 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards_with_reason"))) TS_ChannelManager_fail_htlc_backwards_with_reason(uint64_t this_arg, int8_tArray payment_hash, uint32_t failure_code) {
29340         LDKChannelManager this_arg_conv;
29341         this_arg_conv.inner = untag_ptr(this_arg);
29342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29344         this_arg_conv.is_owned = false;
29345         uint8_t payment_hash_arr[32];
29346         CHECK(payment_hash->arr_len == 32);
29347         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
29348         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
29349         LDKFailureCode failure_code_conv = LDKFailureCode_from_js(failure_code);
29350         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
29351 }
29352
29353 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
29354         LDKChannelManager this_arg_conv;
29355         this_arg_conv.inner = untag_ptr(this_arg);
29356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29358         this_arg_conv.is_owned = false;
29359         LDKThirtyTwoBytes payment_preimage_ref;
29360         CHECK(payment_preimage->arr_len == 32);
29361         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
29362         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
29363 }
29364
29365 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
29366         LDKChannelManager this_arg_conv;
29367         this_arg_conv.inner = untag_ptr(this_arg);
29368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29370         this_arg_conv.is_owned = false;
29371         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29372         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
29373         return ret_arr;
29374 }
29375
29376 uint64_t  __attribute__((export_name("TS_ChannelManager_accept_inbound_channel"))) TS_ChannelManager_accept_inbound_channel(uint64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
29377         LDKChannelManager this_arg_conv;
29378         this_arg_conv.inner = untag_ptr(this_arg);
29379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29381         this_arg_conv.is_owned = false;
29382         uint8_t temporary_channel_id_arr[32];
29383         CHECK(temporary_channel_id->arr_len == 32);
29384         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
29385         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29386         LDKPublicKey counterparty_node_id_ref;
29387         CHECK(counterparty_node_id->arr_len == 33);
29388         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29389         LDKU128 user_channel_id_ref;
29390         CHECK(user_channel_id->arr_len == 16);
29391         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
29392         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29393         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
29394         return tag_ptr(ret_conv, true);
29395 }
29396
29397 uint64_t  __attribute__((export_name("TS_ChannelManager_accept_inbound_channel_from_trusted_peer_0conf"))) TS_ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(uint64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
29398         LDKChannelManager this_arg_conv;
29399         this_arg_conv.inner = untag_ptr(this_arg);
29400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29402         this_arg_conv.is_owned = false;
29403         uint8_t temporary_channel_id_arr[32];
29404         CHECK(temporary_channel_id->arr_len == 32);
29405         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
29406         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29407         LDKPublicKey counterparty_node_id_ref;
29408         CHECK(counterparty_node_id->arr_len == 33);
29409         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29410         LDKU128 user_channel_id_ref;
29411         CHECK(user_channel_id->arr_len == 16);
29412         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
29413         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29414         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
29415         return tag_ptr(ret_conv, true);
29416 }
29417
29418 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, uint64_t min_final_cltv_expiry_delta) {
29419         LDKChannelManager this_arg_conv;
29420         this_arg_conv.inner = untag_ptr(this_arg);
29421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29423         this_arg_conv.is_owned = false;
29424         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29425         CHECK_ACCESS(min_value_msat_ptr);
29426         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29427         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29428         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
29429         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
29430         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
29431         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
29432         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
29433         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
29434         return tag_ptr(ret_conv, true);
29435 }
29436
29437 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) {
29438         LDKChannelManager this_arg_conv;
29439         this_arg_conv.inner = untag_ptr(this_arg);
29440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29442         this_arg_conv.is_owned = false;
29443         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29444         CHECK_ACCESS(min_value_msat_ptr);
29445         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29446         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29447         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
29448         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
29449         return tag_ptr(ret_conv, true);
29450 }
29451
29452 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, uint64_t min_final_cltv_expiry) {
29453         LDKChannelManager this_arg_conv;
29454         this_arg_conv.inner = untag_ptr(this_arg);
29455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29457         this_arg_conv.is_owned = false;
29458         LDKThirtyTwoBytes payment_hash_ref;
29459         CHECK(payment_hash->arr_len == 32);
29460         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29461         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29462         CHECK_ACCESS(min_value_msat_ptr);
29463         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29464         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29465         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
29466         CHECK_ACCESS(min_final_cltv_expiry_ptr);
29467         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
29468         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
29469         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
29470         *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_conv);
29471         return tag_ptr(ret_conv, true);
29472 }
29473
29474 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) {
29475         LDKChannelManager this_arg_conv;
29476         this_arg_conv.inner = untag_ptr(this_arg);
29477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29479         this_arg_conv.is_owned = false;
29480         LDKThirtyTwoBytes payment_hash_ref;
29481         CHECK(payment_hash->arr_len == 32);
29482         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29483         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29484         CHECK_ACCESS(min_value_msat_ptr);
29485         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29486         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29487         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
29488         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
29489         return tag_ptr(ret_conv, true);
29490 }
29491
29492 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) {
29493         LDKChannelManager this_arg_conv;
29494         this_arg_conv.inner = untag_ptr(this_arg);
29495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29497         this_arg_conv.is_owned = false;
29498         LDKThirtyTwoBytes payment_hash_ref;
29499         CHECK(payment_hash->arr_len == 32);
29500         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29501         LDKThirtyTwoBytes payment_secret_ref;
29502         CHECK(payment_secret->arr_len == 32);
29503         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
29504         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
29505         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
29506         return tag_ptr(ret_conv, true);
29507 }
29508
29509 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
29510         LDKChannelManager this_arg_conv;
29511         this_arg_conv.inner = untag_ptr(this_arg);
29512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29514         this_arg_conv.is_owned = false;
29515         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
29516         return ret_conv;
29517 }
29518
29519 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
29520         LDKChannelManager this_arg_conv;
29521         this_arg_conv.inner = untag_ptr(this_arg);
29522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29524         this_arg_conv.is_owned = false;
29525         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
29526         uint64_t ret_ref = 0;
29527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29529         return ret_ref;
29530 }
29531
29532 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
29533         LDKChannelManager this_arg_conv;
29534         this_arg_conv.inner = untag_ptr(this_arg);
29535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29537         this_arg_conv.is_owned = false;
29538         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
29539         return ret_conv;
29540 }
29541
29542 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
29543         LDKChannelManager this_arg_conv;
29544         this_arg_conv.inner = untag_ptr(this_arg);
29545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29547         this_arg_conv.is_owned = false;
29548         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
29549         uint64_t ret_ref = 0;
29550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29552         return ret_ref;
29553 }
29554
29555 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
29556         LDKChannelManager this_arg_conv;
29557         this_arg_conv.inner = untag_ptr(this_arg);
29558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29560         this_arg_conv.is_owned = false;
29561         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
29562         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
29563         return tag_ptr(ret_ret, true);
29564 }
29565
29566 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
29567         LDKChannelManager this_arg_conv;
29568         this_arg_conv.inner = untag_ptr(this_arg);
29569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29571         this_arg_conv.is_owned = false;
29572         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
29573         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
29574         return tag_ptr(ret_ret, true);
29575 }
29576
29577 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
29578         LDKChannelManager this_arg_conv;
29579         this_arg_conv.inner = untag_ptr(this_arg);
29580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29582         this_arg_conv.is_owned = false;
29583         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
29584         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
29585         return tag_ptr(ret_ret, true);
29586 }
29587
29588 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
29589         LDKChannelManager this_arg_conv;
29590         this_arg_conv.inner = untag_ptr(this_arg);
29591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29593         this_arg_conv.is_owned = false;
29594         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
29595         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
29596         return tag_ptr(ret_ret, true);
29597 }
29598
29599 void  __attribute__((export_name("TS_ChannelManager_await_persistable_update"))) TS_ChannelManager_await_persistable_update(uint64_t this_arg) {
29600         LDKChannelManager this_arg_conv;
29601         this_arg_conv.inner = untag_ptr(this_arg);
29602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29604         this_arg_conv.is_owned = false;
29605         ChannelManager_await_persistable_update(&this_arg_conv);
29606 }
29607
29608 uint64_t  __attribute__((export_name("TS_ChannelManager_get_persistable_update_future"))) TS_ChannelManager_get_persistable_update_future(uint64_t this_arg) {
29609         LDKChannelManager this_arg_conv;
29610         this_arg_conv.inner = untag_ptr(this_arg);
29611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29613         this_arg_conv.is_owned = false;
29614         LDKFuture ret_var = ChannelManager_get_persistable_update_future(&this_arg_conv);
29615         uint64_t ret_ref = 0;
29616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29618         return ret_ref;
29619 }
29620
29621 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
29622         LDKChannelManager this_arg_conv;
29623         this_arg_conv.inner = untag_ptr(this_arg);
29624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29626         this_arg_conv.is_owned = false;
29627         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
29628         uint64_t ret_ref = 0;
29629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29631         return ret_ref;
29632 }
29633
29634 uint64_t  __attribute__((export_name("TS_ChannelManager_node_features"))) TS_ChannelManager_node_features(uint64_t this_arg) {
29635         LDKChannelManager this_arg_conv;
29636         this_arg_conv.inner = untag_ptr(this_arg);
29637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29639         this_arg_conv.is_owned = false;
29640         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
29641         uint64_t ret_ref = 0;
29642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29644         return ret_ref;
29645 }
29646
29647 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_features"))) TS_ChannelManager_channel_features(uint64_t this_arg) {
29648         LDKChannelManager this_arg_conv;
29649         this_arg_conv.inner = untag_ptr(this_arg);
29650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29652         this_arg_conv.is_owned = false;
29653         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
29654         uint64_t ret_ref = 0;
29655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29657         return ret_ref;
29658 }
29659
29660 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_type_features"))) TS_ChannelManager_channel_type_features(uint64_t this_arg) {
29661         LDKChannelManager this_arg_conv;
29662         this_arg_conv.inner = untag_ptr(this_arg);
29663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29665         this_arg_conv.is_owned = false;
29666         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
29667         uint64_t ret_ref = 0;
29668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29670         return ret_ref;
29671 }
29672
29673 uint64_t  __attribute__((export_name("TS_ChannelManager_init_features"))) TS_ChannelManager_init_features(uint64_t this_arg) {
29674         LDKChannelManager this_arg_conv;
29675         this_arg_conv.inner = untag_ptr(this_arg);
29676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29678         this_arg_conv.is_owned = false;
29679         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
29680         uint64_t ret_ref = 0;
29681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29683         return ret_ref;
29684 }
29685
29686 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
29687         LDKChannelManager this_arg_conv;
29688         this_arg_conv.inner = untag_ptr(this_arg);
29689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29691         this_arg_conv.is_owned = false;
29692         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
29693         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
29694         return tag_ptr(ret_ret, true);
29695 }
29696
29697 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features(uint64_t _config) {
29698         LDKUserConfig _config_conv;
29699         _config_conv.inner = untag_ptr(_config);
29700         _config_conv.is_owned = ptr_is_owned(_config);
29701         CHECK_INNER_FIELD_ACCESS_OR_NULL(_config_conv);
29702         _config_conv.is_owned = false;
29703         LDKInitFeatures ret_var = provided_init_features(&_config_conv);
29704         uint64_t ret_ref = 0;
29705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29707         return ret_ref;
29708 }
29709
29710 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
29711         LDKCounterpartyForwardingInfo obj_conv;
29712         obj_conv.inner = untag_ptr(obj);
29713         obj_conv.is_owned = ptr_is_owned(obj);
29714         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29715         obj_conv.is_owned = false;
29716         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
29717         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29718         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29719         CVec_u8Z_free(ret_var);
29720         return ret_arr;
29721 }
29722
29723 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
29724         LDKu8slice ser_ref;
29725         ser_ref.datalen = ser->arr_len;
29726         ser_ref.data = ser->elems;
29727         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
29728         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
29729         FREE(ser);
29730         return tag_ptr(ret_conv, true);
29731 }
29732
29733 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
29734         LDKChannelCounterparty obj_conv;
29735         obj_conv.inner = untag_ptr(obj);
29736         obj_conv.is_owned = ptr_is_owned(obj);
29737         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29738         obj_conv.is_owned = false;
29739         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
29740         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29741         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29742         CVec_u8Z_free(ret_var);
29743         return ret_arr;
29744 }
29745
29746 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
29747         LDKu8slice ser_ref;
29748         ser_ref.datalen = ser->arr_len;
29749         ser_ref.data = ser->elems;
29750         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
29751         *ret_conv = ChannelCounterparty_read(ser_ref);
29752         FREE(ser);
29753         return tag_ptr(ret_conv, true);
29754 }
29755
29756 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
29757         LDKChannelDetails obj_conv;
29758         obj_conv.inner = untag_ptr(obj);
29759         obj_conv.is_owned = ptr_is_owned(obj);
29760         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29761         obj_conv.is_owned = false;
29762         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
29763         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29764         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29765         CVec_u8Z_free(ret_var);
29766         return ret_arr;
29767 }
29768
29769 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
29770         LDKu8slice ser_ref;
29771         ser_ref.datalen = ser->arr_len;
29772         ser_ref.data = ser->elems;
29773         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
29774         *ret_conv = ChannelDetails_read(ser_ref);
29775         FREE(ser);
29776         return tag_ptr(ret_conv, true);
29777 }
29778
29779 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
29780         LDKPhantomRouteHints obj_conv;
29781         obj_conv.inner = untag_ptr(obj);
29782         obj_conv.is_owned = ptr_is_owned(obj);
29783         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29784         obj_conv.is_owned = false;
29785         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
29786         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29787         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29788         CVec_u8Z_free(ret_var);
29789         return ret_arr;
29790 }
29791
29792 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
29793         LDKu8slice ser_ref;
29794         ser_ref.datalen = ser->arr_len;
29795         ser_ref.data = ser->elems;
29796         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
29797         *ret_conv = PhantomRouteHints_read(ser_ref);
29798         FREE(ser);
29799         return tag_ptr(ret_conv, true);
29800 }
29801
29802 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
29803         LDKChannelManager obj_conv;
29804         obj_conv.inner = untag_ptr(obj);
29805         obj_conv.is_owned = ptr_is_owned(obj);
29806         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29807         obj_conv.is_owned = false;
29808         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
29809         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29810         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29811         CVec_u8Z_free(ret_var);
29812         return ret_arr;
29813 }
29814
29815 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
29816         LDKChannelManagerReadArgs this_obj_conv;
29817         this_obj_conv.inner = untag_ptr(this_obj);
29818         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29820         ChannelManagerReadArgs_free(this_obj_conv);
29821 }
29822
29823 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_entropy_source"))) TS_ChannelManagerReadArgs_get_entropy_source(uint64_t this_ptr) {
29824         LDKChannelManagerReadArgs this_ptr_conv;
29825         this_ptr_conv.inner = untag_ptr(this_ptr);
29826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29828         this_ptr_conv.is_owned = false;
29829         // WARNING: This object doesn't live past this scope, needs clone!
29830         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
29831         return ret_ret;
29832 }
29833
29834 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_entropy_source"))) TS_ChannelManagerReadArgs_set_entropy_source(uint64_t this_ptr, uint64_t val) {
29835         LDKChannelManagerReadArgs this_ptr_conv;
29836         this_ptr_conv.inner = untag_ptr(this_ptr);
29837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29839         this_ptr_conv.is_owned = false;
29840         void* val_ptr = untag_ptr(val);
29841         CHECK_ACCESS(val_ptr);
29842         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
29843         if (val_conv.free == LDKEntropySource_JCalls_free) {
29844                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29845                 LDKEntropySource_JCalls_cloned(&val_conv);
29846         }
29847         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
29848 }
29849
29850 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_node_signer"))) TS_ChannelManagerReadArgs_get_node_signer(uint64_t this_ptr) {
29851         LDKChannelManagerReadArgs this_ptr_conv;
29852         this_ptr_conv.inner = untag_ptr(this_ptr);
29853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29855         this_ptr_conv.is_owned = false;
29856         // WARNING: This object doesn't live past this scope, needs clone!
29857         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
29858         return ret_ret;
29859 }
29860
29861 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_node_signer"))) TS_ChannelManagerReadArgs_set_node_signer(uint64_t this_ptr, uint64_t val) {
29862         LDKChannelManagerReadArgs this_ptr_conv;
29863         this_ptr_conv.inner = untag_ptr(this_ptr);
29864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29866         this_ptr_conv.is_owned = false;
29867         void* val_ptr = untag_ptr(val);
29868         CHECK_ACCESS(val_ptr);
29869         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
29870         if (val_conv.free == LDKNodeSigner_JCalls_free) {
29871                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29872                 LDKNodeSigner_JCalls_cloned(&val_conv);
29873         }
29874         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
29875 }
29876
29877 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_signer_provider"))) TS_ChannelManagerReadArgs_get_signer_provider(uint64_t this_ptr) {
29878         LDKChannelManagerReadArgs this_ptr_conv;
29879         this_ptr_conv.inner = untag_ptr(this_ptr);
29880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29882         this_ptr_conv.is_owned = false;
29883         // WARNING: This object doesn't live past this scope, needs clone!
29884         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
29885         return ret_ret;
29886 }
29887
29888 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_signer_provider"))) TS_ChannelManagerReadArgs_set_signer_provider(uint64_t this_ptr, uint64_t val) {
29889         LDKChannelManagerReadArgs this_ptr_conv;
29890         this_ptr_conv.inner = untag_ptr(this_ptr);
29891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29893         this_ptr_conv.is_owned = false;
29894         void* val_ptr = untag_ptr(val);
29895         CHECK_ACCESS(val_ptr);
29896         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
29897         if (val_conv.free == LDKSignerProvider_JCalls_free) {
29898                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29899                 LDKSignerProvider_JCalls_cloned(&val_conv);
29900         }
29901         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
29902 }
29903
29904 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
29905         LDKChannelManagerReadArgs this_ptr_conv;
29906         this_ptr_conv.inner = untag_ptr(this_ptr);
29907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29909         this_ptr_conv.is_owned = false;
29910         // WARNING: This object doesn't live past this scope, needs clone!
29911         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
29912         return ret_ret;
29913 }
29914
29915 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
29916         LDKChannelManagerReadArgs this_ptr_conv;
29917         this_ptr_conv.inner = untag_ptr(this_ptr);
29918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29920         this_ptr_conv.is_owned = false;
29921         void* val_ptr = untag_ptr(val);
29922         CHECK_ACCESS(val_ptr);
29923         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
29924         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
29925                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29926                 LDKFeeEstimator_JCalls_cloned(&val_conv);
29927         }
29928         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
29929 }
29930
29931 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
29932         LDKChannelManagerReadArgs this_ptr_conv;
29933         this_ptr_conv.inner = untag_ptr(this_ptr);
29934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29936         this_ptr_conv.is_owned = false;
29937         // WARNING: This object doesn't live past this scope, needs clone!
29938         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
29939         return ret_ret;
29940 }
29941
29942 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
29943         LDKChannelManagerReadArgs this_ptr_conv;
29944         this_ptr_conv.inner = untag_ptr(this_ptr);
29945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29947         this_ptr_conv.is_owned = false;
29948         void* val_ptr = untag_ptr(val);
29949         CHECK_ACCESS(val_ptr);
29950         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
29951         if (val_conv.free == LDKWatch_JCalls_free) {
29952                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29953                 LDKWatch_JCalls_cloned(&val_conv);
29954         }
29955         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
29956 }
29957
29958 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
29959         LDKChannelManagerReadArgs this_ptr_conv;
29960         this_ptr_conv.inner = untag_ptr(this_ptr);
29961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29963         this_ptr_conv.is_owned = false;
29964         // WARNING: This object doesn't live past this scope, needs clone!
29965         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
29966         return ret_ret;
29967 }
29968
29969 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
29970         LDKChannelManagerReadArgs this_ptr_conv;
29971         this_ptr_conv.inner = untag_ptr(this_ptr);
29972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29974         this_ptr_conv.is_owned = false;
29975         void* val_ptr = untag_ptr(val);
29976         CHECK_ACCESS(val_ptr);
29977         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
29978         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
29979                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29980                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
29981         }
29982         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
29983 }
29984
29985 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_router"))) TS_ChannelManagerReadArgs_get_router(uint64_t this_ptr) {
29986         LDKChannelManagerReadArgs this_ptr_conv;
29987         this_ptr_conv.inner = untag_ptr(this_ptr);
29988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29990         this_ptr_conv.is_owned = false;
29991         // WARNING: This object doesn't live past this scope, needs clone!
29992         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
29993         return ret_ret;
29994 }
29995
29996 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_router"))) TS_ChannelManagerReadArgs_set_router(uint64_t this_ptr, uint64_t val) {
29997         LDKChannelManagerReadArgs this_ptr_conv;
29998         this_ptr_conv.inner = untag_ptr(this_ptr);
29999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30001         this_ptr_conv.is_owned = false;
30002         void* val_ptr = untag_ptr(val);
30003         CHECK_ACCESS(val_ptr);
30004         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
30005         if (val_conv.free == LDKRouter_JCalls_free) {
30006                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30007                 LDKRouter_JCalls_cloned(&val_conv);
30008         }
30009         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
30010 }
30011
30012 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
30013         LDKChannelManagerReadArgs this_ptr_conv;
30014         this_ptr_conv.inner = untag_ptr(this_ptr);
30015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30017         this_ptr_conv.is_owned = false;
30018         // WARNING: This object doesn't live past this scope, needs clone!
30019         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
30020         return ret_ret;
30021 }
30022
30023 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
30024         LDKChannelManagerReadArgs this_ptr_conv;
30025         this_ptr_conv.inner = untag_ptr(this_ptr);
30026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30028         this_ptr_conv.is_owned = false;
30029         void* val_ptr = untag_ptr(val);
30030         CHECK_ACCESS(val_ptr);
30031         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
30032         if (val_conv.free == LDKLogger_JCalls_free) {
30033                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30034                 LDKLogger_JCalls_cloned(&val_conv);
30035         }
30036         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
30037 }
30038
30039 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
30040         LDKChannelManagerReadArgs this_ptr_conv;
30041         this_ptr_conv.inner = untag_ptr(this_ptr);
30042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30044         this_ptr_conv.is_owned = false;
30045         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
30046         uint64_t ret_ref = 0;
30047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30049         return ret_ref;
30050 }
30051
30052 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
30053         LDKChannelManagerReadArgs this_ptr_conv;
30054         this_ptr_conv.inner = untag_ptr(this_ptr);
30055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30057         this_ptr_conv.is_owned = false;
30058         LDKUserConfig val_conv;
30059         val_conv.inner = untag_ptr(val);
30060         val_conv.is_owned = ptr_is_owned(val);
30061         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30062         val_conv = UserConfig_clone(&val_conv);
30063         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
30064 }
30065
30066 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_new"))) TS_ChannelManagerReadArgs_new(uint64_t entropy_source, uint64_t node_signer, uint64_t signer_provider, uint64_t fee_estimator, uint64_t chain_monitor, uint64_t tx_broadcaster, uint64_t router, uint64_t logger, uint64_t default_config, uint64_tArray channel_monitors) {
30067         void* entropy_source_ptr = untag_ptr(entropy_source);
30068         CHECK_ACCESS(entropy_source_ptr);
30069         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
30070         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
30071                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30072                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
30073         }
30074         void* node_signer_ptr = untag_ptr(node_signer);
30075         CHECK_ACCESS(node_signer_ptr);
30076         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
30077         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
30078                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30079                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
30080         }
30081         void* signer_provider_ptr = untag_ptr(signer_provider);
30082         CHECK_ACCESS(signer_provider_ptr);
30083         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
30084         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
30085                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30086                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
30087         }
30088         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30089         CHECK_ACCESS(fee_estimator_ptr);
30090         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30091         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30092                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30093                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30094         }
30095         void* chain_monitor_ptr = untag_ptr(chain_monitor);
30096         CHECK_ACCESS(chain_monitor_ptr);
30097         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
30098         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
30099                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30100                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
30101         }
30102         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
30103         CHECK_ACCESS(tx_broadcaster_ptr);
30104         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
30105         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30106                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30107                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
30108         }
30109         void* router_ptr = untag_ptr(router);
30110         CHECK_ACCESS(router_ptr);
30111         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
30112         if (router_conv.free == LDKRouter_JCalls_free) {
30113                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30114                 LDKRouter_JCalls_cloned(&router_conv);
30115         }
30116         void* logger_ptr = untag_ptr(logger);
30117         CHECK_ACCESS(logger_ptr);
30118         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30119         if (logger_conv.free == LDKLogger_JCalls_free) {
30120                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30121                 LDKLogger_JCalls_cloned(&logger_conv);
30122         }
30123         LDKUserConfig default_config_conv;
30124         default_config_conv.inner = untag_ptr(default_config);
30125         default_config_conv.is_owned = ptr_is_owned(default_config);
30126         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
30127         default_config_conv = UserConfig_clone(&default_config_conv);
30128         LDKCVec_ChannelMonitorZ channel_monitors_constr;
30129         channel_monitors_constr.datalen = channel_monitors->arr_len;
30130         if (channel_monitors_constr.datalen > 0)
30131                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
30132         else
30133                 channel_monitors_constr.data = NULL;
30134         uint64_t* channel_monitors_vals = channel_monitors->elems;
30135         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
30136                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
30137                 LDKChannelMonitor channel_monitors_conv_16_conv;
30138                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
30139                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
30140                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
30141                 channel_monitors_conv_16_conv.is_owned = false;
30142                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
30143         }
30144         FREE(channel_monitors);
30145         LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(entropy_source_conv, node_signer_conv, signer_provider_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, router_conv, logger_conv, default_config_conv, channel_monitors_constr);
30146         uint64_t ret_ref = 0;
30147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30149         return ret_ref;
30150 }
30151
30152 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
30153         LDKu8slice ser_ref;
30154         ser_ref.datalen = ser->arr_len;
30155         ser_ref.data = ser->elems;
30156         LDKChannelManagerReadArgs arg_conv;
30157         arg_conv.inner = untag_ptr(arg);
30158         arg_conv.is_owned = ptr_is_owned(arg);
30159         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30160         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
30161         
30162         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
30163         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
30164         FREE(ser);
30165         return tag_ptr(ret_conv, true);
30166 }
30167
30168 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
30169         LDKExpandedKey this_obj_conv;
30170         this_obj_conv.inner = untag_ptr(this_obj);
30171         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30173         ExpandedKey_free(this_obj_conv);
30174 }
30175
30176 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
30177         uint8_t key_material_arr[32];
30178         CHECK(key_material->arr_len == 32);
30179         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
30180         uint8_t (*key_material_ref)[32] = &key_material_arr;
30181         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
30182         uint64_t ret_ref = 0;
30183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30185         return ret_ref;
30186 }
30187
30188 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 entropy_source, int64_t current_time, uint64_t min_final_cltv_expiry_delta) {
30189         LDKExpandedKey keys_conv;
30190         keys_conv.inner = untag_ptr(keys);
30191         keys_conv.is_owned = ptr_is_owned(keys);
30192         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30193         keys_conv.is_owned = false;
30194         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30195         CHECK_ACCESS(min_value_msat_ptr);
30196         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30197         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30198         void* entropy_source_ptr = untag_ptr(entropy_source);
30199         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
30200         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
30201         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
30202         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
30203         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
30204         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
30205         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
30206         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
30207         return tag_ptr(ret_conv, true);
30208 }
30209
30210 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, uint64_t min_final_cltv_expiry_delta) {
30211         LDKExpandedKey keys_conv;
30212         keys_conv.inner = untag_ptr(keys);
30213         keys_conv.is_owned = ptr_is_owned(keys);
30214         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30215         keys_conv.is_owned = false;
30216         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30217         CHECK_ACCESS(min_value_msat_ptr);
30218         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30219         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30220         LDKThirtyTwoBytes payment_hash_ref;
30221         CHECK(payment_hash->arr_len == 32);
30222         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
30223         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
30224         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
30225         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
30226         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
30227         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
30228         *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time, min_final_cltv_expiry_delta_conv);
30229         return tag_ptr(ret_conv, true);
30230 }
30231
30232 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
30233         if (!ptr_is_owned(this_ptr)) return;
30234         void* this_ptr_ptr = untag_ptr(this_ptr);
30235         CHECK_ACCESS(this_ptr_ptr);
30236         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
30237         FREE(untag_ptr(this_ptr));
30238         DecodeError_free(this_ptr_conv);
30239 }
30240
30241 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
30242         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30243         *ret_copy = DecodeError_clone(arg);
30244         uint64_t ret_ref = tag_ptr(ret_copy, true);
30245         return ret_ref;
30246 }
30247 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
30248         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
30249         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
30250         return ret_conv;
30251 }
30252
30253 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
30254         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
30255         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30256         *ret_copy = DecodeError_clone(orig_conv);
30257         uint64_t ret_ref = tag_ptr(ret_copy, true);
30258         return ret_ref;
30259 }
30260
30261 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
30262         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30263         *ret_copy = DecodeError_unknown_version();
30264         uint64_t ret_ref = tag_ptr(ret_copy, true);
30265         return ret_ref;
30266 }
30267
30268 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
30269         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30270         *ret_copy = DecodeError_unknown_required_feature();
30271         uint64_t ret_ref = tag_ptr(ret_copy, true);
30272         return ret_ref;
30273 }
30274
30275 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
30276         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30277         *ret_copy = DecodeError_invalid_value();
30278         uint64_t ret_ref = tag_ptr(ret_copy, true);
30279         return ret_ref;
30280 }
30281
30282 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
30283         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30284         *ret_copy = DecodeError_short_read();
30285         uint64_t ret_ref = tag_ptr(ret_copy, true);
30286         return ret_ref;
30287 }
30288
30289 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
30290         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30291         *ret_copy = DecodeError_bad_length_descriptor();
30292         uint64_t ret_ref = tag_ptr(ret_copy, true);
30293         return ret_ref;
30294 }
30295
30296 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
30297         LDKIOError a_conv = LDKIOError_from_js(a);
30298         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30299         *ret_copy = DecodeError_io(a_conv);
30300         uint64_t ret_ref = tag_ptr(ret_copy, true);
30301         return ret_ref;
30302 }
30303
30304 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
30305         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30306         *ret_copy = DecodeError_unsupported_compression();
30307         uint64_t ret_ref = tag_ptr(ret_copy, true);
30308         return ret_ref;
30309 }
30310
30311 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
30312         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
30313         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
30314         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
30315         return ret_conv;
30316 }
30317
30318 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
30319         LDKInit this_obj_conv;
30320         this_obj_conv.inner = untag_ptr(this_obj);
30321         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30323         Init_free(this_obj_conv);
30324 }
30325
30326 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
30327         LDKInit this_ptr_conv;
30328         this_ptr_conv.inner = untag_ptr(this_ptr);
30329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30331         this_ptr_conv.is_owned = false;
30332         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
30333         uint64_t ret_ref = 0;
30334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30336         return ret_ref;
30337 }
30338
30339 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
30340         LDKInit 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         LDKInitFeatures val_conv;
30346         val_conv.inner = untag_ptr(val);
30347         val_conv.is_owned = ptr_is_owned(val);
30348         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30349         val_conv = InitFeatures_clone(&val_conv);
30350         Init_set_features(&this_ptr_conv, val_conv);
30351 }
30352
30353 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
30354         LDKInit this_ptr_conv;
30355         this_ptr_conv.inner = untag_ptr(this_ptr);
30356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30358         this_ptr_conv.is_owned = false;
30359         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
30360         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
30361         uint64_t ret_ref = tag_ptr(ret_copy, true);
30362         return ret_ref;
30363 }
30364
30365 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
30366         LDKInit this_ptr_conv;
30367         this_ptr_conv.inner = untag_ptr(this_ptr);
30368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30370         this_ptr_conv.is_owned = false;
30371         void* val_ptr = untag_ptr(val);
30372         CHECK_ACCESS(val_ptr);
30373         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
30374         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
30375         Init_set_remote_network_address(&this_ptr_conv, val_conv);
30376 }
30377
30378 uint64_t  __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint64_t features_arg, uint64_t remote_network_address_arg) {
30379         LDKInitFeatures features_arg_conv;
30380         features_arg_conv.inner = untag_ptr(features_arg);
30381         features_arg_conv.is_owned = ptr_is_owned(features_arg);
30382         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
30383         features_arg_conv = InitFeatures_clone(&features_arg_conv);
30384         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
30385         CHECK_ACCESS(remote_network_address_arg_ptr);
30386         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
30387         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
30388         uint64_t ret_ref = 0;
30389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30391         return ret_ref;
30392 }
30393
30394 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
30395         LDKInit ret_var = Init_clone(arg);
30396         uint64_t ret_ref = 0;
30397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30399         return ret_ref;
30400 }
30401 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
30402         LDKInit arg_conv;
30403         arg_conv.inner = untag_ptr(arg);
30404         arg_conv.is_owned = ptr_is_owned(arg);
30405         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30406         arg_conv.is_owned = false;
30407         int64_t ret_conv = Init_clone_ptr(&arg_conv);
30408         return ret_conv;
30409 }
30410
30411 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
30412         LDKInit orig_conv;
30413         orig_conv.inner = untag_ptr(orig);
30414         orig_conv.is_owned = ptr_is_owned(orig);
30415         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30416         orig_conv.is_owned = false;
30417         LDKInit ret_var = Init_clone(&orig_conv);
30418         uint64_t ret_ref = 0;
30419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30421         return ret_ref;
30422 }
30423
30424 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
30425         LDKInit a_conv;
30426         a_conv.inner = untag_ptr(a);
30427         a_conv.is_owned = ptr_is_owned(a);
30428         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30429         a_conv.is_owned = false;
30430         LDKInit b_conv;
30431         b_conv.inner = untag_ptr(b);
30432         b_conv.is_owned = ptr_is_owned(b);
30433         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30434         b_conv.is_owned = false;
30435         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
30436         return ret_conv;
30437 }
30438
30439 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
30440         LDKErrorMessage this_obj_conv;
30441         this_obj_conv.inner = untag_ptr(this_obj);
30442         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30444         ErrorMessage_free(this_obj_conv);
30445 }
30446
30447 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
30448         LDKErrorMessage this_ptr_conv;
30449         this_ptr_conv.inner = untag_ptr(this_ptr);
30450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30452         this_ptr_conv.is_owned = false;
30453         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30454         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
30455         return ret_arr;
30456 }
30457
30458 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30459         LDKErrorMessage this_ptr_conv;
30460         this_ptr_conv.inner = untag_ptr(this_ptr);
30461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30463         this_ptr_conv.is_owned = false;
30464         LDKThirtyTwoBytes val_ref;
30465         CHECK(val->arr_len == 32);
30466         memcpy(val_ref.data, val->elems, 32); FREE(val);
30467         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
30468 }
30469
30470 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
30471         LDKErrorMessage this_ptr_conv;
30472         this_ptr_conv.inner = untag_ptr(this_ptr);
30473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30475         this_ptr_conv.is_owned = false;
30476         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
30477         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30478         Str_free(ret_str);
30479         return ret_conv;
30480 }
30481
30482 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
30483         LDKErrorMessage this_ptr_conv;
30484         this_ptr_conv.inner = untag_ptr(this_ptr);
30485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30487         this_ptr_conv.is_owned = false;
30488         LDKStr val_conv = str_ref_to_owned_c(val);
30489         ErrorMessage_set_data(&this_ptr_conv, val_conv);
30490 }
30491
30492 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
30493         LDKThirtyTwoBytes channel_id_arg_ref;
30494         CHECK(channel_id_arg->arr_len == 32);
30495         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30496         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
30497         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
30498         uint64_t ret_ref = 0;
30499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30501         return ret_ref;
30502 }
30503
30504 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
30505         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
30506         uint64_t ret_ref = 0;
30507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30509         return ret_ref;
30510 }
30511 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
30512         LDKErrorMessage arg_conv;
30513         arg_conv.inner = untag_ptr(arg);
30514         arg_conv.is_owned = ptr_is_owned(arg);
30515         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30516         arg_conv.is_owned = false;
30517         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
30518         return ret_conv;
30519 }
30520
30521 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
30522         LDKErrorMessage orig_conv;
30523         orig_conv.inner = untag_ptr(orig);
30524         orig_conv.is_owned = ptr_is_owned(orig);
30525         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30526         orig_conv.is_owned = false;
30527         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
30528         uint64_t ret_ref = 0;
30529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30531         return ret_ref;
30532 }
30533
30534 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
30535         LDKErrorMessage a_conv;
30536         a_conv.inner = untag_ptr(a);
30537         a_conv.is_owned = ptr_is_owned(a);
30538         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30539         a_conv.is_owned = false;
30540         LDKErrorMessage b_conv;
30541         b_conv.inner = untag_ptr(b);
30542         b_conv.is_owned = ptr_is_owned(b);
30543         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30544         b_conv.is_owned = false;
30545         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
30546         return ret_conv;
30547 }
30548
30549 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
30550         LDKWarningMessage this_obj_conv;
30551         this_obj_conv.inner = untag_ptr(this_obj);
30552         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30554         WarningMessage_free(this_obj_conv);
30555 }
30556
30557 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
30558         LDKWarningMessage 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30564         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
30565         return ret_arr;
30566 }
30567
30568 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30569         LDKWarningMessage this_ptr_conv;
30570         this_ptr_conv.inner = untag_ptr(this_ptr);
30571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30573         this_ptr_conv.is_owned = false;
30574         LDKThirtyTwoBytes val_ref;
30575         CHECK(val->arr_len == 32);
30576         memcpy(val_ref.data, val->elems, 32); FREE(val);
30577         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
30578 }
30579
30580 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
30581         LDKWarningMessage 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         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
30587         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30588         Str_free(ret_str);
30589         return ret_conv;
30590 }
30591
30592 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
30593         LDKWarningMessage 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         LDKStr val_conv = str_ref_to_owned_c(val);
30599         WarningMessage_set_data(&this_ptr_conv, val_conv);
30600 }
30601
30602 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
30603         LDKThirtyTwoBytes channel_id_arg_ref;
30604         CHECK(channel_id_arg->arr_len == 32);
30605         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30606         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
30607         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
30608         uint64_t ret_ref = 0;
30609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30611         return ret_ref;
30612 }
30613
30614 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
30615         LDKWarningMessage ret_var = WarningMessage_clone(arg);
30616         uint64_t ret_ref = 0;
30617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30619         return ret_ref;
30620 }
30621 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
30622         LDKWarningMessage arg_conv;
30623         arg_conv.inner = untag_ptr(arg);
30624         arg_conv.is_owned = ptr_is_owned(arg);
30625         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30626         arg_conv.is_owned = false;
30627         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
30628         return ret_conv;
30629 }
30630
30631 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
30632         LDKWarningMessage orig_conv;
30633         orig_conv.inner = untag_ptr(orig);
30634         orig_conv.is_owned = ptr_is_owned(orig);
30635         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30636         orig_conv.is_owned = false;
30637         LDKWarningMessage ret_var = WarningMessage_clone(&orig_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 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
30645         LDKWarningMessage a_conv;
30646         a_conv.inner = untag_ptr(a);
30647         a_conv.is_owned = ptr_is_owned(a);
30648         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30649         a_conv.is_owned = false;
30650         LDKWarningMessage b_conv;
30651         b_conv.inner = untag_ptr(b);
30652         b_conv.is_owned = ptr_is_owned(b);
30653         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30654         b_conv.is_owned = false;
30655         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
30656         return ret_conv;
30657 }
30658
30659 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
30660         LDKPing this_obj_conv;
30661         this_obj_conv.inner = untag_ptr(this_obj);
30662         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30664         Ping_free(this_obj_conv);
30665 }
30666
30667 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
30668         LDKPing this_ptr_conv;
30669         this_ptr_conv.inner = untag_ptr(this_ptr);
30670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30672         this_ptr_conv.is_owned = false;
30673         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
30674         return ret_conv;
30675 }
30676
30677 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
30678         LDKPing this_ptr_conv;
30679         this_ptr_conv.inner = untag_ptr(this_ptr);
30680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30682         this_ptr_conv.is_owned = false;
30683         Ping_set_ponglen(&this_ptr_conv, val);
30684 }
30685
30686 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
30687         LDKPing this_ptr_conv;
30688         this_ptr_conv.inner = untag_ptr(this_ptr);
30689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30691         this_ptr_conv.is_owned = false;
30692         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
30693         return ret_conv;
30694 }
30695
30696 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
30697         LDKPing this_ptr_conv;
30698         this_ptr_conv.inner = untag_ptr(this_ptr);
30699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30701         this_ptr_conv.is_owned = false;
30702         Ping_set_byteslen(&this_ptr_conv, val);
30703 }
30704
30705 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
30706         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
30707         uint64_t ret_ref = 0;
30708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30710         return ret_ref;
30711 }
30712
30713 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
30714         LDKPing ret_var = Ping_clone(arg);
30715         uint64_t ret_ref = 0;
30716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30718         return ret_ref;
30719 }
30720 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
30721         LDKPing arg_conv;
30722         arg_conv.inner = untag_ptr(arg);
30723         arg_conv.is_owned = ptr_is_owned(arg);
30724         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30725         arg_conv.is_owned = false;
30726         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
30727         return ret_conv;
30728 }
30729
30730 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
30731         LDKPing orig_conv;
30732         orig_conv.inner = untag_ptr(orig);
30733         orig_conv.is_owned = ptr_is_owned(orig);
30734         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30735         orig_conv.is_owned = false;
30736         LDKPing ret_var = Ping_clone(&orig_conv);
30737         uint64_t ret_ref = 0;
30738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30740         return ret_ref;
30741 }
30742
30743 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
30744         LDKPing a_conv;
30745         a_conv.inner = untag_ptr(a);
30746         a_conv.is_owned = ptr_is_owned(a);
30747         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30748         a_conv.is_owned = false;
30749         LDKPing b_conv;
30750         b_conv.inner = untag_ptr(b);
30751         b_conv.is_owned = ptr_is_owned(b);
30752         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30753         b_conv.is_owned = false;
30754         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
30755         return ret_conv;
30756 }
30757
30758 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
30759         LDKPong this_obj_conv;
30760         this_obj_conv.inner = untag_ptr(this_obj);
30761         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30763         Pong_free(this_obj_conv);
30764 }
30765
30766 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
30767         LDKPong this_ptr_conv;
30768         this_ptr_conv.inner = untag_ptr(this_ptr);
30769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30771         this_ptr_conv.is_owned = false;
30772         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
30773         return ret_conv;
30774 }
30775
30776 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
30777         LDKPong this_ptr_conv;
30778         this_ptr_conv.inner = untag_ptr(this_ptr);
30779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30781         this_ptr_conv.is_owned = false;
30782         Pong_set_byteslen(&this_ptr_conv, val);
30783 }
30784
30785 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
30786         LDKPong ret_var = Pong_new(byteslen_arg);
30787         uint64_t ret_ref = 0;
30788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30790         return ret_ref;
30791 }
30792
30793 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
30794         LDKPong ret_var = Pong_clone(arg);
30795         uint64_t ret_ref = 0;
30796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30798         return ret_ref;
30799 }
30800 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
30801         LDKPong arg_conv;
30802         arg_conv.inner = untag_ptr(arg);
30803         arg_conv.is_owned = ptr_is_owned(arg);
30804         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30805         arg_conv.is_owned = false;
30806         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
30807         return ret_conv;
30808 }
30809
30810 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
30811         LDKPong orig_conv;
30812         orig_conv.inner = untag_ptr(orig);
30813         orig_conv.is_owned = ptr_is_owned(orig);
30814         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30815         orig_conv.is_owned = false;
30816         LDKPong ret_var = Pong_clone(&orig_conv);
30817         uint64_t ret_ref = 0;
30818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30820         return ret_ref;
30821 }
30822
30823 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
30824         LDKPong a_conv;
30825         a_conv.inner = untag_ptr(a);
30826         a_conv.is_owned = ptr_is_owned(a);
30827         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30828         a_conv.is_owned = false;
30829         LDKPong b_conv;
30830         b_conv.inner = untag_ptr(b);
30831         b_conv.is_owned = ptr_is_owned(b);
30832         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30833         b_conv.is_owned = false;
30834         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
30835         return ret_conv;
30836 }
30837
30838 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
30839         LDKOpenChannel this_obj_conv;
30840         this_obj_conv.inner = untag_ptr(this_obj);
30841         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30843         OpenChannel_free(this_obj_conv);
30844 }
30845
30846 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
30847         LDKOpenChannel this_ptr_conv;
30848         this_ptr_conv.inner = untag_ptr(this_ptr);
30849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30851         this_ptr_conv.is_owned = false;
30852         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30853         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
30854         return ret_arr;
30855 }
30856
30857 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
30858         LDKOpenChannel 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         LDKThirtyTwoBytes val_ref;
30864         CHECK(val->arr_len == 32);
30865         memcpy(val_ref.data, val->elems, 32); FREE(val);
30866         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
30867 }
30868
30869 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
30870         LDKOpenChannel this_ptr_conv;
30871         this_ptr_conv.inner = untag_ptr(this_ptr);
30872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30874         this_ptr_conv.is_owned = false;
30875         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30876         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
30877         return ret_arr;
30878 }
30879
30880 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
30881         LDKOpenChannel this_ptr_conv;
30882         this_ptr_conv.inner = untag_ptr(this_ptr);
30883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30885         this_ptr_conv.is_owned = false;
30886         LDKThirtyTwoBytes val_ref;
30887         CHECK(val->arr_len == 32);
30888         memcpy(val_ref.data, val->elems, 32); FREE(val);
30889         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
30890 }
30891
30892 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
30893         LDKOpenChannel this_ptr_conv;
30894         this_ptr_conv.inner = untag_ptr(this_ptr);
30895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30897         this_ptr_conv.is_owned = false;
30898         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
30899         return ret_conv;
30900 }
30901
30902 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
30903         LDKOpenChannel this_ptr_conv;
30904         this_ptr_conv.inner = untag_ptr(this_ptr);
30905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30907         this_ptr_conv.is_owned = false;
30908         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
30909 }
30910
30911 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
30912         LDKOpenChannel this_ptr_conv;
30913         this_ptr_conv.inner = untag_ptr(this_ptr);
30914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30916         this_ptr_conv.is_owned = false;
30917         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
30918         return ret_conv;
30919 }
30920
30921 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
30922         LDKOpenChannel this_ptr_conv;
30923         this_ptr_conv.inner = untag_ptr(this_ptr);
30924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30926         this_ptr_conv.is_owned = false;
30927         OpenChannel_set_push_msat(&this_ptr_conv, val);
30928 }
30929
30930 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
30931         LDKOpenChannel this_ptr_conv;
30932         this_ptr_conv.inner = untag_ptr(this_ptr);
30933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30935         this_ptr_conv.is_owned = false;
30936         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
30937         return ret_conv;
30938 }
30939
30940 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
30941         LDKOpenChannel this_ptr_conv;
30942         this_ptr_conv.inner = untag_ptr(this_ptr);
30943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30945         this_ptr_conv.is_owned = false;
30946         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
30947 }
30948
30949 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) {
30950         LDKOpenChannel this_ptr_conv;
30951         this_ptr_conv.inner = untag_ptr(this_ptr);
30952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30954         this_ptr_conv.is_owned = false;
30955         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
30956         return ret_conv;
30957 }
30958
30959 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) {
30960         LDKOpenChannel 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         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30966 }
30967
30968 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
30969         LDKOpenChannel this_ptr_conv;
30970         this_ptr_conv.inner = untag_ptr(this_ptr);
30971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30973         this_ptr_conv.is_owned = false;
30974         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
30975         return ret_conv;
30976 }
30977
30978 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
30979         LDKOpenChannel this_ptr_conv;
30980         this_ptr_conv.inner = untag_ptr(this_ptr);
30981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30983         this_ptr_conv.is_owned = false;
30984         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
30985 }
30986
30987 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
30988         LDKOpenChannel this_ptr_conv;
30989         this_ptr_conv.inner = untag_ptr(this_ptr);
30990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30992         this_ptr_conv.is_owned = false;
30993         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
30994         return ret_conv;
30995 }
30996
30997 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
30998         LDKOpenChannel this_ptr_conv;
30999         this_ptr_conv.inner = untag_ptr(this_ptr);
31000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31002         this_ptr_conv.is_owned = false;
31003         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
31004 }
31005
31006 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
31007         LDKOpenChannel this_ptr_conv;
31008         this_ptr_conv.inner = untag_ptr(this_ptr);
31009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31011         this_ptr_conv.is_owned = false;
31012         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
31013         return ret_conv;
31014 }
31015
31016 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
31017         LDKOpenChannel this_ptr_conv;
31018         this_ptr_conv.inner = untag_ptr(this_ptr);
31019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31021         this_ptr_conv.is_owned = false;
31022         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
31023 }
31024
31025 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
31026         LDKOpenChannel this_ptr_conv;
31027         this_ptr_conv.inner = untag_ptr(this_ptr);
31028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31030         this_ptr_conv.is_owned = false;
31031         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
31032         return ret_conv;
31033 }
31034
31035 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
31036         LDKOpenChannel this_ptr_conv;
31037         this_ptr_conv.inner = untag_ptr(this_ptr);
31038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31040         this_ptr_conv.is_owned = false;
31041         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
31042 }
31043
31044 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
31045         LDKOpenChannel this_ptr_conv;
31046         this_ptr_conv.inner = untag_ptr(this_ptr);
31047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31049         this_ptr_conv.is_owned = false;
31050         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
31051         return ret_conv;
31052 }
31053
31054 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
31055         LDKOpenChannel this_ptr_conv;
31056         this_ptr_conv.inner = untag_ptr(this_ptr);
31057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31059         this_ptr_conv.is_owned = false;
31060         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
31061 }
31062
31063 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
31064         LDKOpenChannel 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31070         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
31071         return ret_arr;
31072 }
31073
31074 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
31075         LDKOpenChannel this_ptr_conv;
31076         this_ptr_conv.inner = untag_ptr(this_ptr);
31077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31079         this_ptr_conv.is_owned = false;
31080         LDKPublicKey val_ref;
31081         CHECK(val->arr_len == 33);
31082         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31083         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
31084 }
31085
31086 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
31087         LDKOpenChannel this_ptr_conv;
31088         this_ptr_conv.inner = untag_ptr(this_ptr);
31089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31091         this_ptr_conv.is_owned = false;
31092         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31093         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
31094         return ret_arr;
31095 }
31096
31097 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
31098         LDKOpenChannel this_ptr_conv;
31099         this_ptr_conv.inner = untag_ptr(this_ptr);
31100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31102         this_ptr_conv.is_owned = false;
31103         LDKPublicKey val_ref;
31104         CHECK(val->arr_len == 33);
31105         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31106         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31107 }
31108
31109 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
31110         LDKOpenChannel this_ptr_conv;
31111         this_ptr_conv.inner = untag_ptr(this_ptr);
31112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31114         this_ptr_conv.is_owned = false;
31115         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31116         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
31117         return ret_arr;
31118 }
31119
31120 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
31121         LDKOpenChannel this_ptr_conv;
31122         this_ptr_conv.inner = untag_ptr(this_ptr);
31123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31125         this_ptr_conv.is_owned = false;
31126         LDKPublicKey val_ref;
31127         CHECK(val->arr_len == 33);
31128         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31129         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
31130 }
31131
31132 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
31133         LDKOpenChannel this_ptr_conv;
31134         this_ptr_conv.inner = untag_ptr(this_ptr);
31135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31137         this_ptr_conv.is_owned = false;
31138         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31139         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
31140         return ret_arr;
31141 }
31142
31143 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
31144         LDKOpenChannel this_ptr_conv;
31145         this_ptr_conv.inner = untag_ptr(this_ptr);
31146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31148         this_ptr_conv.is_owned = false;
31149         LDKPublicKey val_ref;
31150         CHECK(val->arr_len == 33);
31151         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31152         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31153 }
31154
31155 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
31156         LDKOpenChannel this_ptr_conv;
31157         this_ptr_conv.inner = untag_ptr(this_ptr);
31158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31160         this_ptr_conv.is_owned = false;
31161         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31162         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
31163         return ret_arr;
31164 }
31165
31166 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
31167         LDKOpenChannel this_ptr_conv;
31168         this_ptr_conv.inner = untag_ptr(this_ptr);
31169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31171         this_ptr_conv.is_owned = false;
31172         LDKPublicKey val_ref;
31173         CHECK(val->arr_len == 33);
31174         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31175         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31176 }
31177
31178 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
31179         LDKOpenChannel this_ptr_conv;
31180         this_ptr_conv.inner = untag_ptr(this_ptr);
31181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31183         this_ptr_conv.is_owned = false;
31184         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31185         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31186         return ret_arr;
31187 }
31188
31189 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) {
31190         LDKOpenChannel this_ptr_conv;
31191         this_ptr_conv.inner = untag_ptr(this_ptr);
31192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31194         this_ptr_conv.is_owned = false;
31195         LDKPublicKey val_ref;
31196         CHECK(val->arr_len == 33);
31197         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31198         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31199 }
31200
31201 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
31202         LDKOpenChannel this_ptr_conv;
31203         this_ptr_conv.inner = untag_ptr(this_ptr);
31204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31206         this_ptr_conv.is_owned = false;
31207         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
31208         return ret_conv;
31209 }
31210
31211 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
31212         LDKOpenChannel 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         OpenChannel_set_channel_flags(&this_ptr_conv, val);
31218 }
31219
31220 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
31221         LDKOpenChannel this_ptr_conv;
31222         this_ptr_conv.inner = untag_ptr(this_ptr);
31223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31225         this_ptr_conv.is_owned = false;
31226         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
31227         uint64_t ret_ref = 0;
31228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31230         return ret_ref;
31231 }
31232
31233 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
31234         LDKOpenChannel this_ptr_conv;
31235         this_ptr_conv.inner = untag_ptr(this_ptr);
31236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31238         this_ptr_conv.is_owned = false;
31239         LDKChannelTypeFeatures val_conv;
31240         val_conv.inner = untag_ptr(val);
31241         val_conv.is_owned = ptr_is_owned(val);
31242         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31243         val_conv = ChannelTypeFeatures_clone(&val_conv);
31244         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
31245 }
31246
31247 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
31248         LDKOpenChannel ret_var = OpenChannel_clone(arg);
31249         uint64_t ret_ref = 0;
31250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31252         return ret_ref;
31253 }
31254 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
31255         LDKOpenChannel arg_conv;
31256         arg_conv.inner = untag_ptr(arg);
31257         arg_conv.is_owned = ptr_is_owned(arg);
31258         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31259         arg_conv.is_owned = false;
31260         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
31261         return ret_conv;
31262 }
31263
31264 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
31265         LDKOpenChannel orig_conv;
31266         orig_conv.inner = untag_ptr(orig);
31267         orig_conv.is_owned = ptr_is_owned(orig);
31268         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31269         orig_conv.is_owned = false;
31270         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
31271         uint64_t ret_ref = 0;
31272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31274         return ret_ref;
31275 }
31276
31277 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
31278         LDKOpenChannel a_conv;
31279         a_conv.inner = untag_ptr(a);
31280         a_conv.is_owned = ptr_is_owned(a);
31281         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31282         a_conv.is_owned = false;
31283         LDKOpenChannel b_conv;
31284         b_conv.inner = untag_ptr(b);
31285         b_conv.is_owned = ptr_is_owned(b);
31286         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31287         b_conv.is_owned = false;
31288         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
31289         return ret_conv;
31290 }
31291
31292 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
31293         LDKAcceptChannel this_obj_conv;
31294         this_obj_conv.inner = untag_ptr(this_obj);
31295         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31297         AcceptChannel_free(this_obj_conv);
31298 }
31299
31300 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
31301         LDKAcceptChannel this_ptr_conv;
31302         this_ptr_conv.inner = untag_ptr(this_ptr);
31303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31305         this_ptr_conv.is_owned = false;
31306         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31307         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
31308         return ret_arr;
31309 }
31310
31311 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
31312         LDKAcceptChannel this_ptr_conv;
31313         this_ptr_conv.inner = untag_ptr(this_ptr);
31314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31316         this_ptr_conv.is_owned = false;
31317         LDKThirtyTwoBytes val_ref;
31318         CHECK(val->arr_len == 32);
31319         memcpy(val_ref.data, val->elems, 32); FREE(val);
31320         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
31321 }
31322
31323 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
31324         LDKAcceptChannel this_ptr_conv;
31325         this_ptr_conv.inner = untag_ptr(this_ptr);
31326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31328         this_ptr_conv.is_owned = false;
31329         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
31330         return ret_conv;
31331 }
31332
31333 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
31334         LDKAcceptChannel this_ptr_conv;
31335         this_ptr_conv.inner = untag_ptr(this_ptr);
31336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31338         this_ptr_conv.is_owned = false;
31339         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
31340 }
31341
31342 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) {
31343         LDKAcceptChannel 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         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
31349         return ret_conv;
31350 }
31351
31352 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) {
31353         LDKAcceptChannel this_ptr_conv;
31354         this_ptr_conv.inner = untag_ptr(this_ptr);
31355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31357         this_ptr_conv.is_owned = false;
31358         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
31359 }
31360
31361 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
31362         LDKAcceptChannel this_ptr_conv;
31363         this_ptr_conv.inner = untag_ptr(this_ptr);
31364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31366         this_ptr_conv.is_owned = false;
31367         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
31368         return ret_conv;
31369 }
31370
31371 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
31372         LDKAcceptChannel this_ptr_conv;
31373         this_ptr_conv.inner = untag_ptr(this_ptr);
31374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31376         this_ptr_conv.is_owned = false;
31377         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
31378 }
31379
31380 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
31381         LDKAcceptChannel this_ptr_conv;
31382         this_ptr_conv.inner = untag_ptr(this_ptr);
31383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31385         this_ptr_conv.is_owned = false;
31386         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
31387         return ret_conv;
31388 }
31389
31390 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
31391         LDKAcceptChannel this_ptr_conv;
31392         this_ptr_conv.inner = untag_ptr(this_ptr);
31393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31395         this_ptr_conv.is_owned = false;
31396         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
31397 }
31398
31399 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
31400         LDKAcceptChannel this_ptr_conv;
31401         this_ptr_conv.inner = untag_ptr(this_ptr);
31402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31404         this_ptr_conv.is_owned = false;
31405         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
31406         return ret_conv;
31407 }
31408
31409 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
31410         LDKAcceptChannel this_ptr_conv;
31411         this_ptr_conv.inner = untag_ptr(this_ptr);
31412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31414         this_ptr_conv.is_owned = false;
31415         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
31416 }
31417
31418 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
31419         LDKAcceptChannel this_ptr_conv;
31420         this_ptr_conv.inner = untag_ptr(this_ptr);
31421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31423         this_ptr_conv.is_owned = false;
31424         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
31425         return ret_conv;
31426 }
31427
31428 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
31429         LDKAcceptChannel this_ptr_conv;
31430         this_ptr_conv.inner = untag_ptr(this_ptr);
31431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31433         this_ptr_conv.is_owned = false;
31434         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
31435 }
31436
31437 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
31438         LDKAcceptChannel this_ptr_conv;
31439         this_ptr_conv.inner = untag_ptr(this_ptr);
31440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31442         this_ptr_conv.is_owned = false;
31443         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
31444         return ret_conv;
31445 }
31446
31447 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
31448         LDKAcceptChannel this_ptr_conv;
31449         this_ptr_conv.inner = untag_ptr(this_ptr);
31450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31452         this_ptr_conv.is_owned = false;
31453         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
31454 }
31455
31456 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
31457         LDKAcceptChannel this_ptr_conv;
31458         this_ptr_conv.inner = untag_ptr(this_ptr);
31459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31461         this_ptr_conv.is_owned = false;
31462         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31463         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
31464         return ret_arr;
31465 }
31466
31467 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
31468         LDKAcceptChannel this_ptr_conv;
31469         this_ptr_conv.inner = untag_ptr(this_ptr);
31470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31472         this_ptr_conv.is_owned = false;
31473         LDKPublicKey val_ref;
31474         CHECK(val->arr_len == 33);
31475         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31476         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
31477 }
31478
31479 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
31480         LDKAcceptChannel this_ptr_conv;
31481         this_ptr_conv.inner = untag_ptr(this_ptr);
31482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31484         this_ptr_conv.is_owned = false;
31485         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31486         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
31487         return ret_arr;
31488 }
31489
31490 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
31491         LDKAcceptChannel this_ptr_conv;
31492         this_ptr_conv.inner = untag_ptr(this_ptr);
31493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31495         this_ptr_conv.is_owned = false;
31496         LDKPublicKey val_ref;
31497         CHECK(val->arr_len == 33);
31498         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31499         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31500 }
31501
31502 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
31503         LDKAcceptChannel this_ptr_conv;
31504         this_ptr_conv.inner = untag_ptr(this_ptr);
31505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31507         this_ptr_conv.is_owned = false;
31508         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31509         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
31510         return ret_arr;
31511 }
31512
31513 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
31514         LDKAcceptChannel this_ptr_conv;
31515         this_ptr_conv.inner = untag_ptr(this_ptr);
31516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31518         this_ptr_conv.is_owned = false;
31519         LDKPublicKey val_ref;
31520         CHECK(val->arr_len == 33);
31521         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31522         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
31523 }
31524
31525 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
31526         LDKAcceptChannel this_ptr_conv;
31527         this_ptr_conv.inner = untag_ptr(this_ptr);
31528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31530         this_ptr_conv.is_owned = false;
31531         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31532         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
31533         return ret_arr;
31534 }
31535
31536 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
31537         LDKAcceptChannel this_ptr_conv;
31538         this_ptr_conv.inner = untag_ptr(this_ptr);
31539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31541         this_ptr_conv.is_owned = false;
31542         LDKPublicKey val_ref;
31543         CHECK(val->arr_len == 33);
31544         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31545         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31546 }
31547
31548 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
31549         LDKAcceptChannel this_ptr_conv;
31550         this_ptr_conv.inner = untag_ptr(this_ptr);
31551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31553         this_ptr_conv.is_owned = false;
31554         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31555         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
31556         return ret_arr;
31557 }
31558
31559 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
31560         LDKAcceptChannel this_ptr_conv;
31561         this_ptr_conv.inner = untag_ptr(this_ptr);
31562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31564         this_ptr_conv.is_owned = false;
31565         LDKPublicKey val_ref;
31566         CHECK(val->arr_len == 33);
31567         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31568         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31569 }
31570
31571 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
31572         LDKAcceptChannel this_ptr_conv;
31573         this_ptr_conv.inner = untag_ptr(this_ptr);
31574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31576         this_ptr_conv.is_owned = false;
31577         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31578         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31579         return ret_arr;
31580 }
31581
31582 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) {
31583         LDKAcceptChannel this_ptr_conv;
31584         this_ptr_conv.inner = untag_ptr(this_ptr);
31585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31587         this_ptr_conv.is_owned = false;
31588         LDKPublicKey val_ref;
31589         CHECK(val->arr_len == 33);
31590         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31591         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31592 }
31593
31594 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
31595         LDKAcceptChannel this_ptr_conv;
31596         this_ptr_conv.inner = untag_ptr(this_ptr);
31597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31599         this_ptr_conv.is_owned = false;
31600         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
31601         uint64_t ret_ref = 0;
31602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31604         return ret_ref;
31605 }
31606
31607 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
31608         LDKAcceptChannel this_ptr_conv;
31609         this_ptr_conv.inner = untag_ptr(this_ptr);
31610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31612         this_ptr_conv.is_owned = false;
31613         LDKChannelTypeFeatures val_conv;
31614         val_conv.inner = untag_ptr(val);
31615         val_conv.is_owned = ptr_is_owned(val);
31616         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31617         val_conv = ChannelTypeFeatures_clone(&val_conv);
31618         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
31619 }
31620
31621 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
31622         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
31623         uint64_t ret_ref = 0;
31624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31626         return ret_ref;
31627 }
31628 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
31629         LDKAcceptChannel arg_conv;
31630         arg_conv.inner = untag_ptr(arg);
31631         arg_conv.is_owned = ptr_is_owned(arg);
31632         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31633         arg_conv.is_owned = false;
31634         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
31635         return ret_conv;
31636 }
31637
31638 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
31639         LDKAcceptChannel orig_conv;
31640         orig_conv.inner = untag_ptr(orig);
31641         orig_conv.is_owned = ptr_is_owned(orig);
31642         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31643         orig_conv.is_owned = false;
31644         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
31645         uint64_t ret_ref = 0;
31646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31648         return ret_ref;
31649 }
31650
31651 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
31652         LDKAcceptChannel a_conv;
31653         a_conv.inner = untag_ptr(a);
31654         a_conv.is_owned = ptr_is_owned(a);
31655         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31656         a_conv.is_owned = false;
31657         LDKAcceptChannel b_conv;
31658         b_conv.inner = untag_ptr(b);
31659         b_conv.is_owned = ptr_is_owned(b);
31660         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31661         b_conv.is_owned = false;
31662         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
31663         return ret_conv;
31664 }
31665
31666 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
31667         LDKFundingCreated this_obj_conv;
31668         this_obj_conv.inner = untag_ptr(this_obj);
31669         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31671         FundingCreated_free(this_obj_conv);
31672 }
31673
31674 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
31675         LDKFundingCreated this_ptr_conv;
31676         this_ptr_conv.inner = untag_ptr(this_ptr);
31677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31679         this_ptr_conv.is_owned = false;
31680         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31681         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
31682         return ret_arr;
31683 }
31684
31685 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
31686         LDKFundingCreated this_ptr_conv;
31687         this_ptr_conv.inner = untag_ptr(this_ptr);
31688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31690         this_ptr_conv.is_owned = false;
31691         LDKThirtyTwoBytes val_ref;
31692         CHECK(val->arr_len == 32);
31693         memcpy(val_ref.data, val->elems, 32); FREE(val);
31694         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
31695 }
31696
31697 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
31698         LDKFundingCreated this_ptr_conv;
31699         this_ptr_conv.inner = untag_ptr(this_ptr);
31700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31702         this_ptr_conv.is_owned = false;
31703         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31704         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
31705         return ret_arr;
31706 }
31707
31708 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
31709         LDKFundingCreated this_ptr_conv;
31710         this_ptr_conv.inner = untag_ptr(this_ptr);
31711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31713         this_ptr_conv.is_owned = false;
31714         LDKThirtyTwoBytes val_ref;
31715         CHECK(val->arr_len == 32);
31716         memcpy(val_ref.data, val->elems, 32); FREE(val);
31717         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
31718 }
31719
31720 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
31721         LDKFundingCreated this_ptr_conv;
31722         this_ptr_conv.inner = untag_ptr(this_ptr);
31723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31725         this_ptr_conv.is_owned = false;
31726         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
31727         return ret_conv;
31728 }
31729
31730 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
31731         LDKFundingCreated this_ptr_conv;
31732         this_ptr_conv.inner = untag_ptr(this_ptr);
31733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31735         this_ptr_conv.is_owned = false;
31736         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
31737 }
31738
31739 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
31740         LDKFundingCreated this_ptr_conv;
31741         this_ptr_conv.inner = untag_ptr(this_ptr);
31742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31744         this_ptr_conv.is_owned = false;
31745         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31746         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
31747         return ret_arr;
31748 }
31749
31750 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
31751         LDKFundingCreated this_ptr_conv;
31752         this_ptr_conv.inner = untag_ptr(this_ptr);
31753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31755         this_ptr_conv.is_owned = false;
31756         LDKSignature val_ref;
31757         CHECK(val->arr_len == 64);
31758         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31759         FundingCreated_set_signature(&this_ptr_conv, val_ref);
31760 }
31761
31762 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) {
31763         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
31764         CHECK(temporary_channel_id_arg->arr_len == 32);
31765         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
31766         LDKThirtyTwoBytes funding_txid_arg_ref;
31767         CHECK(funding_txid_arg->arr_len == 32);
31768         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
31769         LDKSignature signature_arg_ref;
31770         CHECK(signature_arg->arr_len == 64);
31771         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31772         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
31773         uint64_t ret_ref = 0;
31774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31776         return ret_ref;
31777 }
31778
31779 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
31780         LDKFundingCreated ret_var = FundingCreated_clone(arg);
31781         uint64_t ret_ref = 0;
31782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31784         return ret_ref;
31785 }
31786 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
31787         LDKFundingCreated arg_conv;
31788         arg_conv.inner = untag_ptr(arg);
31789         arg_conv.is_owned = ptr_is_owned(arg);
31790         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31791         arg_conv.is_owned = false;
31792         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
31793         return ret_conv;
31794 }
31795
31796 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
31797         LDKFundingCreated orig_conv;
31798         orig_conv.inner = untag_ptr(orig);
31799         orig_conv.is_owned = ptr_is_owned(orig);
31800         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31801         orig_conv.is_owned = false;
31802         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
31803         uint64_t ret_ref = 0;
31804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31806         return ret_ref;
31807 }
31808
31809 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
31810         LDKFundingCreated a_conv;
31811         a_conv.inner = untag_ptr(a);
31812         a_conv.is_owned = ptr_is_owned(a);
31813         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31814         a_conv.is_owned = false;
31815         LDKFundingCreated b_conv;
31816         b_conv.inner = untag_ptr(b);
31817         b_conv.is_owned = ptr_is_owned(b);
31818         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31819         b_conv.is_owned = false;
31820         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
31821         return ret_conv;
31822 }
31823
31824 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
31825         LDKFundingSigned this_obj_conv;
31826         this_obj_conv.inner = untag_ptr(this_obj);
31827         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31829         FundingSigned_free(this_obj_conv);
31830 }
31831
31832 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
31833         LDKFundingSigned this_ptr_conv;
31834         this_ptr_conv.inner = untag_ptr(this_ptr);
31835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31837         this_ptr_conv.is_owned = false;
31838         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31839         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
31840         return ret_arr;
31841 }
31842
31843 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31844         LDKFundingSigned this_ptr_conv;
31845         this_ptr_conv.inner = untag_ptr(this_ptr);
31846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31848         this_ptr_conv.is_owned = false;
31849         LDKThirtyTwoBytes val_ref;
31850         CHECK(val->arr_len == 32);
31851         memcpy(val_ref.data, val->elems, 32); FREE(val);
31852         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
31853 }
31854
31855 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
31856         LDKFundingSigned this_ptr_conv;
31857         this_ptr_conv.inner = untag_ptr(this_ptr);
31858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31860         this_ptr_conv.is_owned = false;
31861         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31862         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
31863         return ret_arr;
31864 }
31865
31866 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
31867         LDKFundingSigned this_ptr_conv;
31868         this_ptr_conv.inner = untag_ptr(this_ptr);
31869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31871         this_ptr_conv.is_owned = false;
31872         LDKSignature val_ref;
31873         CHECK(val->arr_len == 64);
31874         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31875         FundingSigned_set_signature(&this_ptr_conv, val_ref);
31876 }
31877
31878 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
31879         LDKThirtyTwoBytes channel_id_arg_ref;
31880         CHECK(channel_id_arg->arr_len == 32);
31881         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31882         LDKSignature signature_arg_ref;
31883         CHECK(signature_arg->arr_len == 64);
31884         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31885         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
31886         uint64_t ret_ref = 0;
31887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31889         return ret_ref;
31890 }
31891
31892 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
31893         LDKFundingSigned ret_var = FundingSigned_clone(arg);
31894         uint64_t ret_ref = 0;
31895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31897         return ret_ref;
31898 }
31899 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
31900         LDKFundingSigned arg_conv;
31901         arg_conv.inner = untag_ptr(arg);
31902         arg_conv.is_owned = ptr_is_owned(arg);
31903         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31904         arg_conv.is_owned = false;
31905         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
31906         return ret_conv;
31907 }
31908
31909 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
31910         LDKFundingSigned orig_conv;
31911         orig_conv.inner = untag_ptr(orig);
31912         orig_conv.is_owned = ptr_is_owned(orig);
31913         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31914         orig_conv.is_owned = false;
31915         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
31916         uint64_t ret_ref = 0;
31917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31919         return ret_ref;
31920 }
31921
31922 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
31923         LDKFundingSigned a_conv;
31924         a_conv.inner = untag_ptr(a);
31925         a_conv.is_owned = ptr_is_owned(a);
31926         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31927         a_conv.is_owned = false;
31928         LDKFundingSigned b_conv;
31929         b_conv.inner = untag_ptr(b);
31930         b_conv.is_owned = ptr_is_owned(b);
31931         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31932         b_conv.is_owned = false;
31933         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
31934         return ret_conv;
31935 }
31936
31937 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
31938         LDKChannelReady this_obj_conv;
31939         this_obj_conv.inner = untag_ptr(this_obj);
31940         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31942         ChannelReady_free(this_obj_conv);
31943 }
31944
31945 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
31946         LDKChannelReady this_ptr_conv;
31947         this_ptr_conv.inner = untag_ptr(this_ptr);
31948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31950         this_ptr_conv.is_owned = false;
31951         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31952         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
31953         return ret_arr;
31954 }
31955
31956 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31957         LDKChannelReady this_ptr_conv;
31958         this_ptr_conv.inner = untag_ptr(this_ptr);
31959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31961         this_ptr_conv.is_owned = false;
31962         LDKThirtyTwoBytes val_ref;
31963         CHECK(val->arr_len == 32);
31964         memcpy(val_ref.data, val->elems, 32); FREE(val);
31965         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
31966 }
31967
31968 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
31969         LDKChannelReady this_ptr_conv;
31970         this_ptr_conv.inner = untag_ptr(this_ptr);
31971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31973         this_ptr_conv.is_owned = false;
31974         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31975         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31976         return ret_arr;
31977 }
31978
31979 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) {
31980         LDKChannelReady this_ptr_conv;
31981         this_ptr_conv.inner = untag_ptr(this_ptr);
31982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31984         this_ptr_conv.is_owned = false;
31985         LDKPublicKey val_ref;
31986         CHECK(val->arr_len == 33);
31987         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31988         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
31989 }
31990
31991 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
31992         LDKChannelReady this_ptr_conv;
31993         this_ptr_conv.inner = untag_ptr(this_ptr);
31994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31996         this_ptr_conv.is_owned = false;
31997         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31998         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
31999         uint64_t ret_ref = tag_ptr(ret_copy, true);
32000         return ret_ref;
32001 }
32002
32003 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) {
32004         LDKChannelReady this_ptr_conv;
32005         this_ptr_conv.inner = untag_ptr(this_ptr);
32006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32008         this_ptr_conv.is_owned = false;
32009         void* val_ptr = untag_ptr(val);
32010         CHECK_ACCESS(val_ptr);
32011         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32012         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
32013         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
32014 }
32015
32016 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) {
32017         LDKThirtyTwoBytes channel_id_arg_ref;
32018         CHECK(channel_id_arg->arr_len == 32);
32019         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32020         LDKPublicKey next_per_commitment_point_arg_ref;
32021         CHECK(next_per_commitment_point_arg->arr_len == 33);
32022         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
32023         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
32024         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
32025         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
32026         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
32027         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
32028         uint64_t ret_ref = 0;
32029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32031         return ret_ref;
32032 }
32033
32034 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
32035         LDKChannelReady ret_var = ChannelReady_clone(arg);
32036         uint64_t ret_ref = 0;
32037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32039         return ret_ref;
32040 }
32041 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
32042         LDKChannelReady arg_conv;
32043         arg_conv.inner = untag_ptr(arg);
32044         arg_conv.is_owned = ptr_is_owned(arg);
32045         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32046         arg_conv.is_owned = false;
32047         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
32048         return ret_conv;
32049 }
32050
32051 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
32052         LDKChannelReady orig_conv;
32053         orig_conv.inner = untag_ptr(orig);
32054         orig_conv.is_owned = ptr_is_owned(orig);
32055         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32056         orig_conv.is_owned = false;
32057         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
32058         uint64_t ret_ref = 0;
32059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32061         return ret_ref;
32062 }
32063
32064 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
32065         LDKChannelReady a_conv;
32066         a_conv.inner = untag_ptr(a);
32067         a_conv.is_owned = ptr_is_owned(a);
32068         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32069         a_conv.is_owned = false;
32070         LDKChannelReady b_conv;
32071         b_conv.inner = untag_ptr(b);
32072         b_conv.is_owned = ptr_is_owned(b);
32073         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32074         b_conv.is_owned = false;
32075         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
32076         return ret_conv;
32077 }
32078
32079 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
32080         LDKShutdown this_obj_conv;
32081         this_obj_conv.inner = untag_ptr(this_obj);
32082         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32084         Shutdown_free(this_obj_conv);
32085 }
32086
32087 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
32088         LDKShutdown this_ptr_conv;
32089         this_ptr_conv.inner = untag_ptr(this_ptr);
32090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32092         this_ptr_conv.is_owned = false;
32093         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32094         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
32095         return ret_arr;
32096 }
32097
32098 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32099         LDKShutdown this_ptr_conv;
32100         this_ptr_conv.inner = untag_ptr(this_ptr);
32101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32103         this_ptr_conv.is_owned = false;
32104         LDKThirtyTwoBytes val_ref;
32105         CHECK(val->arr_len == 32);
32106         memcpy(val_ref.data, val->elems, 32); FREE(val);
32107         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
32108 }
32109
32110 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
32111         LDKShutdown this_ptr_conv;
32112         this_ptr_conv.inner = untag_ptr(this_ptr);
32113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32115         this_ptr_conv.is_owned = false;
32116         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
32117         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32118         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32119         return ret_arr;
32120 }
32121
32122 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
32123         LDKShutdown this_ptr_conv;
32124         this_ptr_conv.inner = untag_ptr(this_ptr);
32125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32127         this_ptr_conv.is_owned = false;
32128         LDKCVec_u8Z val_ref;
32129         val_ref.datalen = val->arr_len;
32130         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
32131         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
32132         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
32133 }
32134
32135 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
32136         LDKThirtyTwoBytes channel_id_arg_ref;
32137         CHECK(channel_id_arg->arr_len == 32);
32138         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32139         LDKCVec_u8Z scriptpubkey_arg_ref;
32140         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
32141         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
32142         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
32143         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
32144         uint64_t ret_ref = 0;
32145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32147         return ret_ref;
32148 }
32149
32150 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
32151         LDKShutdown ret_var = Shutdown_clone(arg);
32152         uint64_t ret_ref = 0;
32153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32155         return ret_ref;
32156 }
32157 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
32158         LDKShutdown arg_conv;
32159         arg_conv.inner = untag_ptr(arg);
32160         arg_conv.is_owned = ptr_is_owned(arg);
32161         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32162         arg_conv.is_owned = false;
32163         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
32164         return ret_conv;
32165 }
32166
32167 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
32168         LDKShutdown orig_conv;
32169         orig_conv.inner = untag_ptr(orig);
32170         orig_conv.is_owned = ptr_is_owned(orig);
32171         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32172         orig_conv.is_owned = false;
32173         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
32174         uint64_t ret_ref = 0;
32175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32177         return ret_ref;
32178 }
32179
32180 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
32181         LDKShutdown a_conv;
32182         a_conv.inner = untag_ptr(a);
32183         a_conv.is_owned = ptr_is_owned(a);
32184         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32185         a_conv.is_owned = false;
32186         LDKShutdown b_conv;
32187         b_conv.inner = untag_ptr(b);
32188         b_conv.is_owned = ptr_is_owned(b);
32189         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32190         b_conv.is_owned = false;
32191         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
32192         return ret_conv;
32193 }
32194
32195 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
32196         LDKClosingSignedFeeRange this_obj_conv;
32197         this_obj_conv.inner = untag_ptr(this_obj);
32198         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32200         ClosingSignedFeeRange_free(this_obj_conv);
32201 }
32202
32203 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
32204         LDKClosingSignedFeeRange this_ptr_conv;
32205         this_ptr_conv.inner = untag_ptr(this_ptr);
32206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32208         this_ptr_conv.is_owned = false;
32209         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
32210         return ret_conv;
32211 }
32212
32213 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
32214         LDKClosingSignedFeeRange this_ptr_conv;
32215         this_ptr_conv.inner = untag_ptr(this_ptr);
32216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32218         this_ptr_conv.is_owned = false;
32219         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
32220 }
32221
32222 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
32223         LDKClosingSignedFeeRange this_ptr_conv;
32224         this_ptr_conv.inner = untag_ptr(this_ptr);
32225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32227         this_ptr_conv.is_owned = false;
32228         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
32229         return ret_conv;
32230 }
32231
32232 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
32233         LDKClosingSignedFeeRange this_ptr_conv;
32234         this_ptr_conv.inner = untag_ptr(this_ptr);
32235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32237         this_ptr_conv.is_owned = false;
32238         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
32239 }
32240
32241 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
32242         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
32243         uint64_t ret_ref = 0;
32244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32246         return ret_ref;
32247 }
32248
32249 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
32250         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
32251         uint64_t ret_ref = 0;
32252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32254         return ret_ref;
32255 }
32256 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
32257         LDKClosingSignedFeeRange arg_conv;
32258         arg_conv.inner = untag_ptr(arg);
32259         arg_conv.is_owned = ptr_is_owned(arg);
32260         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32261         arg_conv.is_owned = false;
32262         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
32263         return ret_conv;
32264 }
32265
32266 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
32267         LDKClosingSignedFeeRange orig_conv;
32268         orig_conv.inner = untag_ptr(orig);
32269         orig_conv.is_owned = ptr_is_owned(orig);
32270         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32271         orig_conv.is_owned = false;
32272         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
32273         uint64_t ret_ref = 0;
32274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32276         return ret_ref;
32277 }
32278
32279 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
32280         LDKClosingSignedFeeRange a_conv;
32281         a_conv.inner = untag_ptr(a);
32282         a_conv.is_owned = ptr_is_owned(a);
32283         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32284         a_conv.is_owned = false;
32285         LDKClosingSignedFeeRange b_conv;
32286         b_conv.inner = untag_ptr(b);
32287         b_conv.is_owned = ptr_is_owned(b);
32288         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32289         b_conv.is_owned = false;
32290         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
32291         return ret_conv;
32292 }
32293
32294 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
32295         LDKClosingSigned this_obj_conv;
32296         this_obj_conv.inner = untag_ptr(this_obj);
32297         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32299         ClosingSigned_free(this_obj_conv);
32300 }
32301
32302 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
32303         LDKClosingSigned this_ptr_conv;
32304         this_ptr_conv.inner = untag_ptr(this_ptr);
32305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32307         this_ptr_conv.is_owned = false;
32308         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32309         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
32310         return ret_arr;
32311 }
32312
32313 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32314         LDKClosingSigned this_ptr_conv;
32315         this_ptr_conv.inner = untag_ptr(this_ptr);
32316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32318         this_ptr_conv.is_owned = false;
32319         LDKThirtyTwoBytes val_ref;
32320         CHECK(val->arr_len == 32);
32321         memcpy(val_ref.data, val->elems, 32); FREE(val);
32322         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
32323 }
32324
32325 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
32326         LDKClosingSigned this_ptr_conv;
32327         this_ptr_conv.inner = untag_ptr(this_ptr);
32328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32330         this_ptr_conv.is_owned = false;
32331         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
32332         return ret_conv;
32333 }
32334
32335 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
32336         LDKClosingSigned this_ptr_conv;
32337         this_ptr_conv.inner = untag_ptr(this_ptr);
32338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32340         this_ptr_conv.is_owned = false;
32341         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
32342 }
32343
32344 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
32345         LDKClosingSigned this_ptr_conv;
32346         this_ptr_conv.inner = untag_ptr(this_ptr);
32347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32349         this_ptr_conv.is_owned = false;
32350         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32351         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
32352         return ret_arr;
32353 }
32354
32355 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
32356         LDKClosingSigned this_ptr_conv;
32357         this_ptr_conv.inner = untag_ptr(this_ptr);
32358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32360         this_ptr_conv.is_owned = false;
32361         LDKSignature val_ref;
32362         CHECK(val->arr_len == 64);
32363         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32364         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
32365 }
32366
32367 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
32368         LDKClosingSigned this_ptr_conv;
32369         this_ptr_conv.inner = untag_ptr(this_ptr);
32370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32372         this_ptr_conv.is_owned = false;
32373         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
32374         uint64_t ret_ref = 0;
32375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32377         return ret_ref;
32378 }
32379
32380 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
32381         LDKClosingSigned this_ptr_conv;
32382         this_ptr_conv.inner = untag_ptr(this_ptr);
32383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32385         this_ptr_conv.is_owned = false;
32386         LDKClosingSignedFeeRange val_conv;
32387         val_conv.inner = untag_ptr(val);
32388         val_conv.is_owned = ptr_is_owned(val);
32389         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32390         val_conv = ClosingSignedFeeRange_clone(&val_conv);
32391         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
32392 }
32393
32394 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) {
32395         LDKThirtyTwoBytes channel_id_arg_ref;
32396         CHECK(channel_id_arg->arr_len == 32);
32397         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32398         LDKSignature signature_arg_ref;
32399         CHECK(signature_arg->arr_len == 64);
32400         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
32401         LDKClosingSignedFeeRange fee_range_arg_conv;
32402         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
32403         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
32404         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
32405         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
32406         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
32407         uint64_t ret_ref = 0;
32408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32410         return ret_ref;
32411 }
32412
32413 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
32414         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
32415         uint64_t ret_ref = 0;
32416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32418         return ret_ref;
32419 }
32420 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
32421         LDKClosingSigned arg_conv;
32422         arg_conv.inner = untag_ptr(arg);
32423         arg_conv.is_owned = ptr_is_owned(arg);
32424         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32425         arg_conv.is_owned = false;
32426         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
32427         return ret_conv;
32428 }
32429
32430 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
32431         LDKClosingSigned orig_conv;
32432         orig_conv.inner = untag_ptr(orig);
32433         orig_conv.is_owned = ptr_is_owned(orig);
32434         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32435         orig_conv.is_owned = false;
32436         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
32437         uint64_t ret_ref = 0;
32438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32440         return ret_ref;
32441 }
32442
32443 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
32444         LDKClosingSigned a_conv;
32445         a_conv.inner = untag_ptr(a);
32446         a_conv.is_owned = ptr_is_owned(a);
32447         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32448         a_conv.is_owned = false;
32449         LDKClosingSigned b_conv;
32450         b_conv.inner = untag_ptr(b);
32451         b_conv.is_owned = ptr_is_owned(b);
32452         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32453         b_conv.is_owned = false;
32454         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
32455         return ret_conv;
32456 }
32457
32458 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
32459         LDKUpdateAddHTLC this_obj_conv;
32460         this_obj_conv.inner = untag_ptr(this_obj);
32461         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32463         UpdateAddHTLC_free(this_obj_conv);
32464 }
32465
32466 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
32467         LDKUpdateAddHTLC this_ptr_conv;
32468         this_ptr_conv.inner = untag_ptr(this_ptr);
32469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32471         this_ptr_conv.is_owned = false;
32472         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32473         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
32474         return ret_arr;
32475 }
32476
32477 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32478         LDKUpdateAddHTLC this_ptr_conv;
32479         this_ptr_conv.inner = untag_ptr(this_ptr);
32480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32482         this_ptr_conv.is_owned = false;
32483         LDKThirtyTwoBytes val_ref;
32484         CHECK(val->arr_len == 32);
32485         memcpy(val_ref.data, val->elems, 32); FREE(val);
32486         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
32487 }
32488
32489 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
32490         LDKUpdateAddHTLC this_ptr_conv;
32491         this_ptr_conv.inner = untag_ptr(this_ptr);
32492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32494         this_ptr_conv.is_owned = false;
32495         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
32496         return ret_conv;
32497 }
32498
32499 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32500         LDKUpdateAddHTLC this_ptr_conv;
32501         this_ptr_conv.inner = untag_ptr(this_ptr);
32502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32504         this_ptr_conv.is_owned = false;
32505         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
32506 }
32507
32508 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
32509         LDKUpdateAddHTLC this_ptr_conv;
32510         this_ptr_conv.inner = untag_ptr(this_ptr);
32511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32513         this_ptr_conv.is_owned = false;
32514         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
32515         return ret_conv;
32516 }
32517
32518 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
32519         LDKUpdateAddHTLC this_ptr_conv;
32520         this_ptr_conv.inner = untag_ptr(this_ptr);
32521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32523         this_ptr_conv.is_owned = false;
32524         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
32525 }
32526
32527 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
32528         LDKUpdateAddHTLC this_ptr_conv;
32529         this_ptr_conv.inner = untag_ptr(this_ptr);
32530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32532         this_ptr_conv.is_owned = false;
32533         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32534         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
32535         return ret_arr;
32536 }
32537
32538 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
32539         LDKUpdateAddHTLC this_ptr_conv;
32540         this_ptr_conv.inner = untag_ptr(this_ptr);
32541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32543         this_ptr_conv.is_owned = false;
32544         LDKThirtyTwoBytes val_ref;
32545         CHECK(val->arr_len == 32);
32546         memcpy(val_ref.data, val->elems, 32); FREE(val);
32547         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
32548 }
32549
32550 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
32551         LDKUpdateAddHTLC this_ptr_conv;
32552         this_ptr_conv.inner = untag_ptr(this_ptr);
32553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32555         this_ptr_conv.is_owned = false;
32556         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
32557         return ret_conv;
32558 }
32559
32560 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
32561         LDKUpdateAddHTLC this_ptr_conv;
32562         this_ptr_conv.inner = untag_ptr(this_ptr);
32563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32565         this_ptr_conv.is_owned = false;
32566         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
32567 }
32568
32569 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
32570         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
32571         uint64_t ret_ref = 0;
32572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32574         return ret_ref;
32575 }
32576 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
32577         LDKUpdateAddHTLC arg_conv;
32578         arg_conv.inner = untag_ptr(arg);
32579         arg_conv.is_owned = ptr_is_owned(arg);
32580         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32581         arg_conv.is_owned = false;
32582         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
32583         return ret_conv;
32584 }
32585
32586 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
32587         LDKUpdateAddHTLC orig_conv;
32588         orig_conv.inner = untag_ptr(orig);
32589         orig_conv.is_owned = ptr_is_owned(orig);
32590         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32591         orig_conv.is_owned = false;
32592         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
32593         uint64_t ret_ref = 0;
32594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32596         return ret_ref;
32597 }
32598
32599 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
32600         LDKUpdateAddHTLC a_conv;
32601         a_conv.inner = untag_ptr(a);
32602         a_conv.is_owned = ptr_is_owned(a);
32603         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32604         a_conv.is_owned = false;
32605         LDKUpdateAddHTLC b_conv;
32606         b_conv.inner = untag_ptr(b);
32607         b_conv.is_owned = ptr_is_owned(b);
32608         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32609         b_conv.is_owned = false;
32610         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
32611         return ret_conv;
32612 }
32613
32614 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
32615         LDKOnionMessage this_obj_conv;
32616         this_obj_conv.inner = untag_ptr(this_obj);
32617         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32619         OnionMessage_free(this_obj_conv);
32620 }
32621
32622 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
32623         LDKOnionMessage this_ptr_conv;
32624         this_ptr_conv.inner = untag_ptr(this_ptr);
32625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32627         this_ptr_conv.is_owned = false;
32628         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32629         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
32630         return ret_arr;
32631 }
32632
32633 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
32634         LDKOnionMessage this_ptr_conv;
32635         this_ptr_conv.inner = untag_ptr(this_ptr);
32636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32638         this_ptr_conv.is_owned = false;
32639         LDKPublicKey val_ref;
32640         CHECK(val->arr_len == 33);
32641         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32642         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
32643 }
32644
32645 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
32646         LDKOnionMessage ret_var = OnionMessage_clone(arg);
32647         uint64_t ret_ref = 0;
32648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32650         return ret_ref;
32651 }
32652 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
32653         LDKOnionMessage arg_conv;
32654         arg_conv.inner = untag_ptr(arg);
32655         arg_conv.is_owned = ptr_is_owned(arg);
32656         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32657         arg_conv.is_owned = false;
32658         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
32659         return ret_conv;
32660 }
32661
32662 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
32663         LDKOnionMessage orig_conv;
32664         orig_conv.inner = untag_ptr(orig);
32665         orig_conv.is_owned = ptr_is_owned(orig);
32666         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32667         orig_conv.is_owned = false;
32668         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
32669         uint64_t ret_ref = 0;
32670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32672         return ret_ref;
32673 }
32674
32675 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
32676         LDKOnionMessage a_conv;
32677         a_conv.inner = untag_ptr(a);
32678         a_conv.is_owned = ptr_is_owned(a);
32679         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32680         a_conv.is_owned = false;
32681         LDKOnionMessage b_conv;
32682         b_conv.inner = untag_ptr(b);
32683         b_conv.is_owned = ptr_is_owned(b);
32684         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32685         b_conv.is_owned = false;
32686         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
32687         return ret_conv;
32688 }
32689
32690 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
32691         LDKUpdateFulfillHTLC this_obj_conv;
32692         this_obj_conv.inner = untag_ptr(this_obj);
32693         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32695         UpdateFulfillHTLC_free(this_obj_conv);
32696 }
32697
32698 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
32699         LDKUpdateFulfillHTLC this_ptr_conv;
32700         this_ptr_conv.inner = untag_ptr(this_ptr);
32701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32703         this_ptr_conv.is_owned = false;
32704         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32705         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
32706         return ret_arr;
32707 }
32708
32709 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32710         LDKUpdateFulfillHTLC this_ptr_conv;
32711         this_ptr_conv.inner = untag_ptr(this_ptr);
32712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32714         this_ptr_conv.is_owned = false;
32715         LDKThirtyTwoBytes val_ref;
32716         CHECK(val->arr_len == 32);
32717         memcpy(val_ref.data, val->elems, 32); FREE(val);
32718         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
32719 }
32720
32721 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
32722         LDKUpdateFulfillHTLC this_ptr_conv;
32723         this_ptr_conv.inner = untag_ptr(this_ptr);
32724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32726         this_ptr_conv.is_owned = false;
32727         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
32728         return ret_conv;
32729 }
32730
32731 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32732         LDKUpdateFulfillHTLC this_ptr_conv;
32733         this_ptr_conv.inner = untag_ptr(this_ptr);
32734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32736         this_ptr_conv.is_owned = false;
32737         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
32738 }
32739
32740 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
32741         LDKUpdateFulfillHTLC this_ptr_conv;
32742         this_ptr_conv.inner = untag_ptr(this_ptr);
32743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32745         this_ptr_conv.is_owned = false;
32746         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32747         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
32748         return ret_arr;
32749 }
32750
32751 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
32752         LDKUpdateFulfillHTLC this_ptr_conv;
32753         this_ptr_conv.inner = untag_ptr(this_ptr);
32754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32756         this_ptr_conv.is_owned = false;
32757         LDKThirtyTwoBytes val_ref;
32758         CHECK(val->arr_len == 32);
32759         memcpy(val_ref.data, val->elems, 32); FREE(val);
32760         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
32761 }
32762
32763 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) {
32764         LDKThirtyTwoBytes channel_id_arg_ref;
32765         CHECK(channel_id_arg->arr_len == 32);
32766         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32767         LDKThirtyTwoBytes payment_preimage_arg_ref;
32768         CHECK(payment_preimage_arg->arr_len == 32);
32769         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
32770         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
32771         uint64_t ret_ref = 0;
32772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32774         return ret_ref;
32775 }
32776
32777 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
32778         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
32779         uint64_t ret_ref = 0;
32780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32782         return ret_ref;
32783 }
32784 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
32785         LDKUpdateFulfillHTLC arg_conv;
32786         arg_conv.inner = untag_ptr(arg);
32787         arg_conv.is_owned = ptr_is_owned(arg);
32788         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32789         arg_conv.is_owned = false;
32790         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
32791         return ret_conv;
32792 }
32793
32794 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
32795         LDKUpdateFulfillHTLC orig_conv;
32796         orig_conv.inner = untag_ptr(orig);
32797         orig_conv.is_owned = ptr_is_owned(orig);
32798         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32799         orig_conv.is_owned = false;
32800         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
32801         uint64_t ret_ref = 0;
32802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32804         return ret_ref;
32805 }
32806
32807 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
32808         LDKUpdateFulfillHTLC a_conv;
32809         a_conv.inner = untag_ptr(a);
32810         a_conv.is_owned = ptr_is_owned(a);
32811         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32812         a_conv.is_owned = false;
32813         LDKUpdateFulfillHTLC b_conv;
32814         b_conv.inner = untag_ptr(b);
32815         b_conv.is_owned = ptr_is_owned(b);
32816         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32817         b_conv.is_owned = false;
32818         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
32819         return ret_conv;
32820 }
32821
32822 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
32823         LDKUpdateFailHTLC this_obj_conv;
32824         this_obj_conv.inner = untag_ptr(this_obj);
32825         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32827         UpdateFailHTLC_free(this_obj_conv);
32828 }
32829
32830 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
32831         LDKUpdateFailHTLC this_ptr_conv;
32832         this_ptr_conv.inner = untag_ptr(this_ptr);
32833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32835         this_ptr_conv.is_owned = false;
32836         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32837         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
32838         return ret_arr;
32839 }
32840
32841 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32842         LDKUpdateFailHTLC this_ptr_conv;
32843         this_ptr_conv.inner = untag_ptr(this_ptr);
32844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32846         this_ptr_conv.is_owned = false;
32847         LDKThirtyTwoBytes val_ref;
32848         CHECK(val->arr_len == 32);
32849         memcpy(val_ref.data, val->elems, 32); FREE(val);
32850         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
32851 }
32852
32853 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
32854         LDKUpdateFailHTLC this_ptr_conv;
32855         this_ptr_conv.inner = untag_ptr(this_ptr);
32856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32858         this_ptr_conv.is_owned = false;
32859         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
32860         return ret_conv;
32861 }
32862
32863 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32864         LDKUpdateFailHTLC this_ptr_conv;
32865         this_ptr_conv.inner = untag_ptr(this_ptr);
32866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32868         this_ptr_conv.is_owned = false;
32869         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
32870 }
32871
32872 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
32873         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
32874         uint64_t ret_ref = 0;
32875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32877         return ret_ref;
32878 }
32879 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
32880         LDKUpdateFailHTLC arg_conv;
32881         arg_conv.inner = untag_ptr(arg);
32882         arg_conv.is_owned = ptr_is_owned(arg);
32883         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32884         arg_conv.is_owned = false;
32885         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
32886         return ret_conv;
32887 }
32888
32889 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
32890         LDKUpdateFailHTLC orig_conv;
32891         orig_conv.inner = untag_ptr(orig);
32892         orig_conv.is_owned = ptr_is_owned(orig);
32893         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32894         orig_conv.is_owned = false;
32895         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
32896         uint64_t ret_ref = 0;
32897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32899         return ret_ref;
32900 }
32901
32902 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
32903         LDKUpdateFailHTLC a_conv;
32904         a_conv.inner = untag_ptr(a);
32905         a_conv.is_owned = ptr_is_owned(a);
32906         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32907         a_conv.is_owned = false;
32908         LDKUpdateFailHTLC b_conv;
32909         b_conv.inner = untag_ptr(b);
32910         b_conv.is_owned = ptr_is_owned(b);
32911         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32912         b_conv.is_owned = false;
32913         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
32914         return ret_conv;
32915 }
32916
32917 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
32918         LDKUpdateFailMalformedHTLC this_obj_conv;
32919         this_obj_conv.inner = untag_ptr(this_obj);
32920         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32922         UpdateFailMalformedHTLC_free(this_obj_conv);
32923 }
32924
32925 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
32926         LDKUpdateFailMalformedHTLC this_ptr_conv;
32927         this_ptr_conv.inner = untag_ptr(this_ptr);
32928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32930         this_ptr_conv.is_owned = false;
32931         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32932         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
32933         return ret_arr;
32934 }
32935
32936 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32937         LDKUpdateFailMalformedHTLC this_ptr_conv;
32938         this_ptr_conv.inner = untag_ptr(this_ptr);
32939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32941         this_ptr_conv.is_owned = false;
32942         LDKThirtyTwoBytes val_ref;
32943         CHECK(val->arr_len == 32);
32944         memcpy(val_ref.data, val->elems, 32); FREE(val);
32945         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
32946 }
32947
32948 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
32949         LDKUpdateFailMalformedHTLC this_ptr_conv;
32950         this_ptr_conv.inner = untag_ptr(this_ptr);
32951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32953         this_ptr_conv.is_owned = false;
32954         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
32955         return ret_conv;
32956 }
32957
32958 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32959         LDKUpdateFailMalformedHTLC this_ptr_conv;
32960         this_ptr_conv.inner = untag_ptr(this_ptr);
32961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32963         this_ptr_conv.is_owned = false;
32964         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
32965 }
32966
32967 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
32968         LDKUpdateFailMalformedHTLC this_ptr_conv;
32969         this_ptr_conv.inner = untag_ptr(this_ptr);
32970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32972         this_ptr_conv.is_owned = false;
32973         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
32974         return ret_conv;
32975 }
32976
32977 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
32978         LDKUpdateFailMalformedHTLC this_ptr_conv;
32979         this_ptr_conv.inner = untag_ptr(this_ptr);
32980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32982         this_ptr_conv.is_owned = false;
32983         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
32984 }
32985
32986 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
32987         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
32988         uint64_t ret_ref = 0;
32989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32991         return ret_ref;
32992 }
32993 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
32994         LDKUpdateFailMalformedHTLC arg_conv;
32995         arg_conv.inner = untag_ptr(arg);
32996         arg_conv.is_owned = ptr_is_owned(arg);
32997         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32998         arg_conv.is_owned = false;
32999         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
33000         return ret_conv;
33001 }
33002
33003 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
33004         LDKUpdateFailMalformedHTLC orig_conv;
33005         orig_conv.inner = untag_ptr(orig);
33006         orig_conv.is_owned = ptr_is_owned(orig);
33007         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33008         orig_conv.is_owned = false;
33009         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
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 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
33017         LDKUpdateFailMalformedHTLC a_conv;
33018         a_conv.inner = untag_ptr(a);
33019         a_conv.is_owned = ptr_is_owned(a);
33020         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33021         a_conv.is_owned = false;
33022         LDKUpdateFailMalformedHTLC b_conv;
33023         b_conv.inner = untag_ptr(b);
33024         b_conv.is_owned = ptr_is_owned(b);
33025         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33026         b_conv.is_owned = false;
33027         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
33028         return ret_conv;
33029 }
33030
33031 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
33032         LDKCommitmentSigned this_obj_conv;
33033         this_obj_conv.inner = untag_ptr(this_obj);
33034         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33036         CommitmentSigned_free(this_obj_conv);
33037 }
33038
33039 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
33040         LDKCommitmentSigned this_ptr_conv;
33041         this_ptr_conv.inner = untag_ptr(this_ptr);
33042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33044         this_ptr_conv.is_owned = false;
33045         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33046         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
33047         return ret_arr;
33048 }
33049
33050 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33051         LDKCommitmentSigned this_ptr_conv;
33052         this_ptr_conv.inner = untag_ptr(this_ptr);
33053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33055         this_ptr_conv.is_owned = false;
33056         LDKThirtyTwoBytes val_ref;
33057         CHECK(val->arr_len == 32);
33058         memcpy(val_ref.data, val->elems, 32); FREE(val);
33059         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
33060 }
33061
33062 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
33063         LDKCommitmentSigned this_ptr_conv;
33064         this_ptr_conv.inner = untag_ptr(this_ptr);
33065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33067         this_ptr_conv.is_owned = false;
33068         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33069         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
33070         return ret_arr;
33071 }
33072
33073 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
33074         LDKCommitmentSigned this_ptr_conv;
33075         this_ptr_conv.inner = untag_ptr(this_ptr);
33076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33078         this_ptr_conv.is_owned = false;
33079         LDKSignature val_ref;
33080         CHECK(val->arr_len == 64);
33081         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33082         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
33083 }
33084
33085 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
33086         LDKCommitmentSigned this_ptr_conv;
33087         this_ptr_conv.inner = untag_ptr(this_ptr);
33088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33090         this_ptr_conv.is_owned = false;
33091         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
33092         ptrArray ret_arr = NULL;
33093         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
33094         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
33095         for (size_t m = 0; m < ret_var.datalen; m++) {
33096                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
33097                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
33098                 ret_arr_ptr[m] = ret_conv_12_arr;
33099         }
33100         
33101         FREE(ret_var.data);
33102         return ret_arr;
33103 }
33104
33105 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
33106         LDKCommitmentSigned this_ptr_conv;
33107         this_ptr_conv.inner = untag_ptr(this_ptr);
33108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33110         this_ptr_conv.is_owned = false;
33111         LDKCVec_SignatureZ val_constr;
33112         val_constr.datalen = val->arr_len;
33113         if (val_constr.datalen > 0)
33114                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33115         else
33116                 val_constr.data = NULL;
33117         int8_tArray* val_vals = (void*) val->elems;
33118         for (size_t m = 0; m < val_constr.datalen; m++) {
33119                 int8_tArray val_conv_12 = val_vals[m];
33120                 LDKSignature val_conv_12_ref;
33121                 CHECK(val_conv_12->arr_len == 64);
33122                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
33123                 val_constr.data[m] = val_conv_12_ref;
33124         }
33125         FREE(val);
33126         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
33127 }
33128
33129 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
33130         LDKThirtyTwoBytes channel_id_arg_ref;
33131         CHECK(channel_id_arg->arr_len == 32);
33132         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33133         LDKSignature signature_arg_ref;
33134         CHECK(signature_arg->arr_len == 64);
33135         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
33136         LDKCVec_SignatureZ htlc_signatures_arg_constr;
33137         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
33138         if (htlc_signatures_arg_constr.datalen > 0)
33139                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33140         else
33141                 htlc_signatures_arg_constr.data = NULL;
33142         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
33143         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
33144                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
33145                 LDKSignature htlc_signatures_arg_conv_12_ref;
33146                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
33147                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
33148                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
33149         }
33150         FREE(htlc_signatures_arg);
33151         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
33152         uint64_t ret_ref = 0;
33153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33155         return ret_ref;
33156 }
33157
33158 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
33159         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
33160         uint64_t ret_ref = 0;
33161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33163         return ret_ref;
33164 }
33165 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
33166         LDKCommitmentSigned arg_conv;
33167         arg_conv.inner = untag_ptr(arg);
33168         arg_conv.is_owned = ptr_is_owned(arg);
33169         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33170         arg_conv.is_owned = false;
33171         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
33172         return ret_conv;
33173 }
33174
33175 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
33176         LDKCommitmentSigned orig_conv;
33177         orig_conv.inner = untag_ptr(orig);
33178         orig_conv.is_owned = ptr_is_owned(orig);
33179         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33180         orig_conv.is_owned = false;
33181         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
33182         uint64_t ret_ref = 0;
33183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33185         return ret_ref;
33186 }
33187
33188 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
33189         LDKCommitmentSigned a_conv;
33190         a_conv.inner = untag_ptr(a);
33191         a_conv.is_owned = ptr_is_owned(a);
33192         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33193         a_conv.is_owned = false;
33194         LDKCommitmentSigned b_conv;
33195         b_conv.inner = untag_ptr(b);
33196         b_conv.is_owned = ptr_is_owned(b);
33197         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33198         b_conv.is_owned = false;
33199         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
33200         return ret_conv;
33201 }
33202
33203 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
33204         LDKRevokeAndACK this_obj_conv;
33205         this_obj_conv.inner = untag_ptr(this_obj);
33206         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33208         RevokeAndACK_free(this_obj_conv);
33209 }
33210
33211 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
33212         LDKRevokeAndACK this_ptr_conv;
33213         this_ptr_conv.inner = untag_ptr(this_ptr);
33214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33216         this_ptr_conv.is_owned = false;
33217         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33218         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
33219         return ret_arr;
33220 }
33221
33222 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33223         LDKRevokeAndACK this_ptr_conv;
33224         this_ptr_conv.inner = untag_ptr(this_ptr);
33225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33227         this_ptr_conv.is_owned = false;
33228         LDKThirtyTwoBytes val_ref;
33229         CHECK(val->arr_len == 32);
33230         memcpy(val_ref.data, val->elems, 32); FREE(val);
33231         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
33232 }
33233
33234 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
33235         LDKRevokeAndACK this_ptr_conv;
33236         this_ptr_conv.inner = untag_ptr(this_ptr);
33237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33239         this_ptr_conv.is_owned = false;
33240         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33241         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
33242         return ret_arr;
33243 }
33244
33245 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
33246         LDKRevokeAndACK this_ptr_conv;
33247         this_ptr_conv.inner = untag_ptr(this_ptr);
33248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33250         this_ptr_conv.is_owned = false;
33251         LDKThirtyTwoBytes val_ref;
33252         CHECK(val->arr_len == 32);
33253         memcpy(val_ref.data, val->elems, 32); FREE(val);
33254         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
33255 }
33256
33257 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
33258         LDKRevokeAndACK this_ptr_conv;
33259         this_ptr_conv.inner = untag_ptr(this_ptr);
33260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33262         this_ptr_conv.is_owned = false;
33263         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33264         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
33265         return ret_arr;
33266 }
33267
33268 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) {
33269         LDKRevokeAndACK this_ptr_conv;
33270         this_ptr_conv.inner = untag_ptr(this_ptr);
33271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33273         this_ptr_conv.is_owned = false;
33274         LDKPublicKey val_ref;
33275         CHECK(val->arr_len == 33);
33276         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33277         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
33278 }
33279
33280 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) {
33281         LDKThirtyTwoBytes channel_id_arg_ref;
33282         CHECK(channel_id_arg->arr_len == 32);
33283         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33284         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
33285         CHECK(per_commitment_secret_arg->arr_len == 32);
33286         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
33287         LDKPublicKey next_per_commitment_point_arg_ref;
33288         CHECK(next_per_commitment_point_arg->arr_len == 33);
33289         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
33290         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
33291         uint64_t ret_ref = 0;
33292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33294         return ret_ref;
33295 }
33296
33297 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
33298         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
33299         uint64_t ret_ref = 0;
33300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33302         return ret_ref;
33303 }
33304 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
33305         LDKRevokeAndACK arg_conv;
33306         arg_conv.inner = untag_ptr(arg);
33307         arg_conv.is_owned = ptr_is_owned(arg);
33308         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33309         arg_conv.is_owned = false;
33310         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
33311         return ret_conv;
33312 }
33313
33314 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
33315         LDKRevokeAndACK orig_conv;
33316         orig_conv.inner = untag_ptr(orig);
33317         orig_conv.is_owned = ptr_is_owned(orig);
33318         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33319         orig_conv.is_owned = false;
33320         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
33321         uint64_t ret_ref = 0;
33322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33324         return ret_ref;
33325 }
33326
33327 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
33328         LDKRevokeAndACK a_conv;
33329         a_conv.inner = untag_ptr(a);
33330         a_conv.is_owned = ptr_is_owned(a);
33331         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33332         a_conv.is_owned = false;
33333         LDKRevokeAndACK b_conv;
33334         b_conv.inner = untag_ptr(b);
33335         b_conv.is_owned = ptr_is_owned(b);
33336         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33337         b_conv.is_owned = false;
33338         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
33339         return ret_conv;
33340 }
33341
33342 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
33343         LDKUpdateFee this_obj_conv;
33344         this_obj_conv.inner = untag_ptr(this_obj);
33345         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33347         UpdateFee_free(this_obj_conv);
33348 }
33349
33350 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
33351         LDKUpdateFee this_ptr_conv;
33352         this_ptr_conv.inner = untag_ptr(this_ptr);
33353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33355         this_ptr_conv.is_owned = false;
33356         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33357         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
33358         return ret_arr;
33359 }
33360
33361 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33362         LDKUpdateFee this_ptr_conv;
33363         this_ptr_conv.inner = untag_ptr(this_ptr);
33364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33366         this_ptr_conv.is_owned = false;
33367         LDKThirtyTwoBytes val_ref;
33368         CHECK(val->arr_len == 32);
33369         memcpy(val_ref.data, val->elems, 32); FREE(val);
33370         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
33371 }
33372
33373 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
33374         LDKUpdateFee this_ptr_conv;
33375         this_ptr_conv.inner = untag_ptr(this_ptr);
33376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33378         this_ptr_conv.is_owned = false;
33379         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
33380         return ret_conv;
33381 }
33382
33383 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
33384         LDKUpdateFee this_ptr_conv;
33385         this_ptr_conv.inner = untag_ptr(this_ptr);
33386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33388         this_ptr_conv.is_owned = false;
33389         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
33390 }
33391
33392 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
33393         LDKThirtyTwoBytes channel_id_arg_ref;
33394         CHECK(channel_id_arg->arr_len == 32);
33395         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33396         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
33397         uint64_t ret_ref = 0;
33398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33400         return ret_ref;
33401 }
33402
33403 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
33404         LDKUpdateFee ret_var = UpdateFee_clone(arg);
33405         uint64_t ret_ref = 0;
33406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33408         return ret_ref;
33409 }
33410 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
33411         LDKUpdateFee arg_conv;
33412         arg_conv.inner = untag_ptr(arg);
33413         arg_conv.is_owned = ptr_is_owned(arg);
33414         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33415         arg_conv.is_owned = false;
33416         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
33417         return ret_conv;
33418 }
33419
33420 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
33421         LDKUpdateFee orig_conv;
33422         orig_conv.inner = untag_ptr(orig);
33423         orig_conv.is_owned = ptr_is_owned(orig);
33424         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33425         orig_conv.is_owned = false;
33426         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
33427         uint64_t ret_ref = 0;
33428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33430         return ret_ref;
33431 }
33432
33433 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
33434         LDKUpdateFee a_conv;
33435         a_conv.inner = untag_ptr(a);
33436         a_conv.is_owned = ptr_is_owned(a);
33437         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33438         a_conv.is_owned = false;
33439         LDKUpdateFee b_conv;
33440         b_conv.inner = untag_ptr(b);
33441         b_conv.is_owned = ptr_is_owned(b);
33442         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33443         b_conv.is_owned = false;
33444         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
33445         return ret_conv;
33446 }
33447
33448 void  __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint64_t this_obj) {
33449         LDKDataLossProtect this_obj_conv;
33450         this_obj_conv.inner = untag_ptr(this_obj);
33451         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33453         DataLossProtect_free(this_obj_conv);
33454 }
33455
33456 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) {
33457         LDKDataLossProtect this_ptr_conv;
33458         this_ptr_conv.inner = untag_ptr(this_ptr);
33459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33461         this_ptr_conv.is_owned = false;
33462         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33463         memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
33464         return ret_arr;
33465 }
33466
33467 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) {
33468         LDKDataLossProtect this_ptr_conv;
33469         this_ptr_conv.inner = untag_ptr(this_ptr);
33470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33472         this_ptr_conv.is_owned = false;
33473         LDKThirtyTwoBytes val_ref;
33474         CHECK(val->arr_len == 32);
33475         memcpy(val_ref.data, val->elems, 32); FREE(val);
33476         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
33477 }
33478
33479 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) {
33480         LDKDataLossProtect this_ptr_conv;
33481         this_ptr_conv.inner = untag_ptr(this_ptr);
33482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33484         this_ptr_conv.is_owned = false;
33485         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33486         memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
33487         return ret_arr;
33488 }
33489
33490 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) {
33491         LDKDataLossProtect this_ptr_conv;
33492         this_ptr_conv.inner = untag_ptr(this_ptr);
33493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33495         this_ptr_conv.is_owned = false;
33496         LDKPublicKey val_ref;
33497         CHECK(val->arr_len == 33);
33498         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33499         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
33500 }
33501
33502 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) {
33503         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
33504         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
33505         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
33506         LDKPublicKey my_current_per_commitment_point_arg_ref;
33507         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
33508         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);
33509         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
33510         uint64_t ret_ref = 0;
33511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33513         return ret_ref;
33514 }
33515
33516 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
33517         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
33518         uint64_t ret_ref = 0;
33519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33521         return ret_ref;
33522 }
33523 int64_t  __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint64_t arg) {
33524         LDKDataLossProtect arg_conv;
33525         arg_conv.inner = untag_ptr(arg);
33526         arg_conv.is_owned = ptr_is_owned(arg);
33527         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33528         arg_conv.is_owned = false;
33529         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
33530         return ret_conv;
33531 }
33532
33533 uint64_t  __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint64_t orig) {
33534         LDKDataLossProtect orig_conv;
33535         orig_conv.inner = untag_ptr(orig);
33536         orig_conv.is_owned = ptr_is_owned(orig);
33537         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33538         orig_conv.is_owned = false;
33539         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
33540         uint64_t ret_ref = 0;
33541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33543         return ret_ref;
33544 }
33545
33546 jboolean  __attribute__((export_name("TS_DataLossProtect_eq"))) TS_DataLossProtect_eq(uint64_t a, uint64_t b) {
33547         LDKDataLossProtect a_conv;
33548         a_conv.inner = untag_ptr(a);
33549         a_conv.is_owned = ptr_is_owned(a);
33550         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33551         a_conv.is_owned = false;
33552         LDKDataLossProtect b_conv;
33553         b_conv.inner = untag_ptr(b);
33554         b_conv.is_owned = ptr_is_owned(b);
33555         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33556         b_conv.is_owned = false;
33557         jboolean ret_conv = DataLossProtect_eq(&a_conv, &b_conv);
33558         return ret_conv;
33559 }
33560
33561 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
33562         LDKChannelReestablish this_obj_conv;
33563         this_obj_conv.inner = untag_ptr(this_obj);
33564         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33566         ChannelReestablish_free(this_obj_conv);
33567 }
33568
33569 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
33570         LDKChannelReestablish this_ptr_conv;
33571         this_ptr_conv.inner = untag_ptr(this_ptr);
33572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33574         this_ptr_conv.is_owned = false;
33575         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33576         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
33577         return ret_arr;
33578 }
33579
33580 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33581         LDKChannelReestablish this_ptr_conv;
33582         this_ptr_conv.inner = untag_ptr(this_ptr);
33583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33585         this_ptr_conv.is_owned = false;
33586         LDKThirtyTwoBytes val_ref;
33587         CHECK(val->arr_len == 32);
33588         memcpy(val_ref.data, val->elems, 32); FREE(val);
33589         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
33590 }
33591
33592 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
33593         LDKChannelReestablish this_ptr_conv;
33594         this_ptr_conv.inner = untag_ptr(this_ptr);
33595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33597         this_ptr_conv.is_owned = false;
33598         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
33599         return ret_conv;
33600 }
33601
33602 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) {
33603         LDKChannelReestablish this_ptr_conv;
33604         this_ptr_conv.inner = untag_ptr(this_ptr);
33605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33607         this_ptr_conv.is_owned = false;
33608         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
33609 }
33610
33611 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
33612         LDKChannelReestablish this_ptr_conv;
33613         this_ptr_conv.inner = untag_ptr(this_ptr);
33614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33616         this_ptr_conv.is_owned = false;
33617         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
33618         return ret_conv;
33619 }
33620
33621 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) {
33622         LDKChannelReestablish this_ptr_conv;
33623         this_ptr_conv.inner = untag_ptr(this_ptr);
33624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33626         this_ptr_conv.is_owned = false;
33627         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
33628 }
33629
33630 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
33631         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
33632         uint64_t ret_ref = 0;
33633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33635         return ret_ref;
33636 }
33637 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
33638         LDKChannelReestablish arg_conv;
33639         arg_conv.inner = untag_ptr(arg);
33640         arg_conv.is_owned = ptr_is_owned(arg);
33641         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33642         arg_conv.is_owned = false;
33643         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
33644         return ret_conv;
33645 }
33646
33647 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
33648         LDKChannelReestablish orig_conv;
33649         orig_conv.inner = untag_ptr(orig);
33650         orig_conv.is_owned = ptr_is_owned(orig);
33651         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33652         orig_conv.is_owned = false;
33653         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
33654         uint64_t ret_ref = 0;
33655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33657         return ret_ref;
33658 }
33659
33660 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
33661         LDKChannelReestablish a_conv;
33662         a_conv.inner = untag_ptr(a);
33663         a_conv.is_owned = ptr_is_owned(a);
33664         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33665         a_conv.is_owned = false;
33666         LDKChannelReestablish b_conv;
33667         b_conv.inner = untag_ptr(b);
33668         b_conv.is_owned = ptr_is_owned(b);
33669         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33670         b_conv.is_owned = false;
33671         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
33672         return ret_conv;
33673 }
33674
33675 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
33676         LDKAnnouncementSignatures this_obj_conv;
33677         this_obj_conv.inner = untag_ptr(this_obj);
33678         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33680         AnnouncementSignatures_free(this_obj_conv);
33681 }
33682
33683 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
33684         LDKAnnouncementSignatures this_ptr_conv;
33685         this_ptr_conv.inner = untag_ptr(this_ptr);
33686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33688         this_ptr_conv.is_owned = false;
33689         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33690         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
33691         return ret_arr;
33692 }
33693
33694 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33695         LDKAnnouncementSignatures this_ptr_conv;
33696         this_ptr_conv.inner = untag_ptr(this_ptr);
33697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33699         this_ptr_conv.is_owned = false;
33700         LDKThirtyTwoBytes val_ref;
33701         CHECK(val->arr_len == 32);
33702         memcpy(val_ref.data, val->elems, 32); FREE(val);
33703         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
33704 }
33705
33706 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
33707         LDKAnnouncementSignatures this_ptr_conv;
33708         this_ptr_conv.inner = untag_ptr(this_ptr);
33709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33711         this_ptr_conv.is_owned = false;
33712         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
33713         return ret_conv;
33714 }
33715
33716 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
33717         LDKAnnouncementSignatures this_ptr_conv;
33718         this_ptr_conv.inner = untag_ptr(this_ptr);
33719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33721         this_ptr_conv.is_owned = false;
33722         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
33723 }
33724
33725 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
33726         LDKAnnouncementSignatures this_ptr_conv;
33727         this_ptr_conv.inner = untag_ptr(this_ptr);
33728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33730         this_ptr_conv.is_owned = false;
33731         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33732         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
33733         return ret_arr;
33734 }
33735
33736 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
33737         LDKAnnouncementSignatures this_ptr_conv;
33738         this_ptr_conv.inner = untag_ptr(this_ptr);
33739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33741         this_ptr_conv.is_owned = false;
33742         LDKSignature val_ref;
33743         CHECK(val->arr_len == 64);
33744         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33745         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
33746 }
33747
33748 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
33749         LDKAnnouncementSignatures this_ptr_conv;
33750         this_ptr_conv.inner = untag_ptr(this_ptr);
33751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33753         this_ptr_conv.is_owned = false;
33754         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33755         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
33756         return ret_arr;
33757 }
33758
33759 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
33760         LDKAnnouncementSignatures this_ptr_conv;
33761         this_ptr_conv.inner = untag_ptr(this_ptr);
33762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33764         this_ptr_conv.is_owned = false;
33765         LDKSignature val_ref;
33766         CHECK(val->arr_len == 64);
33767         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33768         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
33769 }
33770
33771 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) {
33772         LDKThirtyTwoBytes channel_id_arg_ref;
33773         CHECK(channel_id_arg->arr_len == 32);
33774         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33775         LDKSignature node_signature_arg_ref;
33776         CHECK(node_signature_arg->arr_len == 64);
33777         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
33778         LDKSignature bitcoin_signature_arg_ref;
33779         CHECK(bitcoin_signature_arg->arr_len == 64);
33780         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
33781         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
33782         uint64_t ret_ref = 0;
33783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33785         return ret_ref;
33786 }
33787
33788 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
33789         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
33790         uint64_t ret_ref = 0;
33791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33793         return ret_ref;
33794 }
33795 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
33796         LDKAnnouncementSignatures arg_conv;
33797         arg_conv.inner = untag_ptr(arg);
33798         arg_conv.is_owned = ptr_is_owned(arg);
33799         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33800         arg_conv.is_owned = false;
33801         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
33802         return ret_conv;
33803 }
33804
33805 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
33806         LDKAnnouncementSignatures orig_conv;
33807         orig_conv.inner = untag_ptr(orig);
33808         orig_conv.is_owned = ptr_is_owned(orig);
33809         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33810         orig_conv.is_owned = false;
33811         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
33812         uint64_t ret_ref = 0;
33813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33815         return ret_ref;
33816 }
33817
33818 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
33819         LDKAnnouncementSignatures a_conv;
33820         a_conv.inner = untag_ptr(a);
33821         a_conv.is_owned = ptr_is_owned(a);
33822         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33823         a_conv.is_owned = false;
33824         LDKAnnouncementSignatures b_conv;
33825         b_conv.inner = untag_ptr(b);
33826         b_conv.is_owned = ptr_is_owned(b);
33827         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33828         b_conv.is_owned = false;
33829         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
33830         return ret_conv;
33831 }
33832
33833 void  __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint64_t this_ptr) {
33834         if (!ptr_is_owned(this_ptr)) return;
33835         void* this_ptr_ptr = untag_ptr(this_ptr);
33836         CHECK_ACCESS(this_ptr_ptr);
33837         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
33838         FREE(untag_ptr(this_ptr));
33839         NetAddress_free(this_ptr_conv);
33840 }
33841
33842 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
33843         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33844         *ret_copy = NetAddress_clone(arg);
33845         uint64_t ret_ref = tag_ptr(ret_copy, true);
33846         return ret_ref;
33847 }
33848 int64_t  __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint64_t arg) {
33849         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
33850         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
33851         return ret_conv;
33852 }
33853
33854 uint64_t  __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint64_t orig) {
33855         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
33856         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33857         *ret_copy = NetAddress_clone(orig_conv);
33858         uint64_t ret_ref = tag_ptr(ret_copy, true);
33859         return ret_ref;
33860 }
33861
33862 uint64_t  __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
33863         LDKFourBytes addr_ref;
33864         CHECK(addr->arr_len == 4);
33865         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
33866         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33867         *ret_copy = NetAddress_ipv4(addr_ref, port);
33868         uint64_t ret_ref = tag_ptr(ret_copy, true);
33869         return ret_ref;
33870 }
33871
33872 uint64_t  __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
33873         LDKSixteenBytes addr_ref;
33874         CHECK(addr->arr_len == 16);
33875         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
33876         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33877         *ret_copy = NetAddress_ipv6(addr_ref, port);
33878         uint64_t ret_ref = tag_ptr(ret_copy, true);
33879         return ret_ref;
33880 }
33881
33882 uint64_t  __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
33883         LDKTwelveBytes a_ref;
33884         CHECK(a->arr_len == 12);
33885         memcpy(a_ref.data, a->elems, 12); FREE(a);
33886         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33887         *ret_copy = NetAddress_onion_v2(a_ref);
33888         uint64_t ret_ref = tag_ptr(ret_copy, true);
33889         return ret_ref;
33890 }
33891
33892 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) {
33893         LDKThirtyTwoBytes ed25519_pubkey_ref;
33894         CHECK(ed25519_pubkey->arr_len == 32);
33895         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
33896         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33897         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
33898         uint64_t ret_ref = tag_ptr(ret_copy, true);
33899         return ret_ref;
33900 }
33901
33902 uint64_t  __attribute__((export_name("TS_NetAddress_hostname"))) TS_NetAddress_hostname(uint64_t hostname, int16_t port) {
33903         LDKHostname hostname_conv;
33904         hostname_conv.inner = untag_ptr(hostname);
33905         hostname_conv.is_owned = ptr_is_owned(hostname);
33906         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
33907         hostname_conv = Hostname_clone(&hostname_conv);
33908         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33909         *ret_copy = NetAddress_hostname(hostname_conv, port);
33910         uint64_t ret_ref = tag_ptr(ret_copy, true);
33911         return ret_ref;
33912 }
33913
33914 jboolean  __attribute__((export_name("TS_NetAddress_eq"))) TS_NetAddress_eq(uint64_t a, uint64_t b) {
33915         LDKNetAddress* a_conv = (LDKNetAddress*)untag_ptr(a);
33916         LDKNetAddress* b_conv = (LDKNetAddress*)untag_ptr(b);
33917         jboolean ret_conv = NetAddress_eq(a_conv, b_conv);
33918         return ret_conv;
33919 }
33920
33921 int8_tArray  __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint64_t obj) {
33922         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
33923         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
33924         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33925         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33926         CVec_u8Z_free(ret_var);
33927         return ret_arr;
33928 }
33929
33930 uint64_t  __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
33931         LDKu8slice ser_ref;
33932         ser_ref.datalen = ser->arr_len;
33933         ser_ref.data = ser->elems;
33934         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
33935         *ret_conv = NetAddress_read(ser_ref);
33936         FREE(ser);
33937         return tag_ptr(ret_conv, true);
33938 }
33939
33940 void  __attribute__((export_name("TS_UnsignedGossipMessage_free"))) TS_UnsignedGossipMessage_free(uint64_t this_ptr) {
33941         if (!ptr_is_owned(this_ptr)) return;
33942         void* this_ptr_ptr = untag_ptr(this_ptr);
33943         CHECK_ACCESS(this_ptr_ptr);
33944         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
33945         FREE(untag_ptr(this_ptr));
33946         UnsignedGossipMessage_free(this_ptr_conv);
33947 }
33948
33949 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
33950         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33951         *ret_copy = UnsignedGossipMessage_clone(arg);
33952         uint64_t ret_ref = tag_ptr(ret_copy, true);
33953         return ret_ref;
33954 }
33955 int64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone_ptr"))) TS_UnsignedGossipMessage_clone_ptr(uint64_t arg) {
33956         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
33957         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
33958         return ret_conv;
33959 }
33960
33961 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone"))) TS_UnsignedGossipMessage_clone(uint64_t orig) {
33962         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
33963         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33964         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
33965         uint64_t ret_ref = tag_ptr(ret_copy, true);
33966         return ret_ref;
33967 }
33968
33969 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_announcement"))) TS_UnsignedGossipMessage_channel_announcement(uint64_t a) {
33970         LDKUnsignedChannelAnnouncement a_conv;
33971         a_conv.inner = untag_ptr(a);
33972         a_conv.is_owned = ptr_is_owned(a);
33973         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33974         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
33975         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33976         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
33977         uint64_t ret_ref = tag_ptr(ret_copy, true);
33978         return ret_ref;
33979 }
33980
33981 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_update"))) TS_UnsignedGossipMessage_channel_update(uint64_t a) {
33982         LDKUnsignedChannelUpdate a_conv;
33983         a_conv.inner = untag_ptr(a);
33984         a_conv.is_owned = ptr_is_owned(a);
33985         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33986         a_conv = UnsignedChannelUpdate_clone(&a_conv);
33987         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33988         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
33989         uint64_t ret_ref = tag_ptr(ret_copy, true);
33990         return ret_ref;
33991 }
33992
33993 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_node_announcement"))) TS_UnsignedGossipMessage_node_announcement(uint64_t a) {
33994         LDKUnsignedNodeAnnouncement a_conv;
33995         a_conv.inner = untag_ptr(a);
33996         a_conv.is_owned = ptr_is_owned(a);
33997         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33998         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
33999         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
34000         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
34001         uint64_t ret_ref = tag_ptr(ret_copy, true);
34002         return ret_ref;
34003 }
34004
34005 int8_tArray  __attribute__((export_name("TS_UnsignedGossipMessage_write"))) TS_UnsignedGossipMessage_write(uint64_t obj) {
34006         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
34007         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
34008         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34009         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34010         CVec_u8Z_free(ret_var);
34011         return ret_arr;
34012 }
34013
34014 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
34015         LDKUnsignedNodeAnnouncement this_obj_conv;
34016         this_obj_conv.inner = untag_ptr(this_obj);
34017         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34019         UnsignedNodeAnnouncement_free(this_obj_conv);
34020 }
34021
34022 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
34023         LDKUnsignedNodeAnnouncement this_ptr_conv;
34024         this_ptr_conv.inner = untag_ptr(this_ptr);
34025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34027         this_ptr_conv.is_owned = false;
34028         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
34029         uint64_t ret_ref = 0;
34030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34032         return ret_ref;
34033 }
34034
34035 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
34036         LDKUnsignedNodeAnnouncement this_ptr_conv;
34037         this_ptr_conv.inner = untag_ptr(this_ptr);
34038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34040         this_ptr_conv.is_owned = false;
34041         LDKNodeFeatures val_conv;
34042         val_conv.inner = untag_ptr(val);
34043         val_conv.is_owned = ptr_is_owned(val);
34044         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34045         val_conv = NodeFeatures_clone(&val_conv);
34046         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
34047 }
34048
34049 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
34050         LDKUnsignedNodeAnnouncement this_ptr_conv;
34051         this_ptr_conv.inner = untag_ptr(this_ptr);
34052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34054         this_ptr_conv.is_owned = false;
34055         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
34056         return ret_conv;
34057 }
34058
34059 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
34060         LDKUnsignedNodeAnnouncement this_ptr_conv;
34061         this_ptr_conv.inner = untag_ptr(this_ptr);
34062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34064         this_ptr_conv.is_owned = false;
34065         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
34066 }
34067
34068 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
34069         LDKUnsignedNodeAnnouncement this_ptr_conv;
34070         this_ptr_conv.inner = untag_ptr(this_ptr);
34071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34073         this_ptr_conv.is_owned = false;
34074         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
34075         uint64_t ret_ref = 0;
34076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34078         return ret_ref;
34079 }
34080
34081 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, uint64_t val) {
34082         LDKUnsignedNodeAnnouncement this_ptr_conv;
34083         this_ptr_conv.inner = untag_ptr(this_ptr);
34084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34086         this_ptr_conv.is_owned = false;
34087         LDKNodeId val_conv;
34088         val_conv.inner = untag_ptr(val);
34089         val_conv.is_owned = ptr_is_owned(val);
34090         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34091         val_conv = NodeId_clone(&val_conv);
34092         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
34093 }
34094
34095 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
34096         LDKUnsignedNodeAnnouncement this_ptr_conv;
34097         this_ptr_conv.inner = untag_ptr(this_ptr);
34098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34100         this_ptr_conv.is_owned = false;
34101         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
34102         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
34103         return ret_arr;
34104 }
34105
34106 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
34107         LDKUnsignedNodeAnnouncement this_ptr_conv;
34108         this_ptr_conv.inner = untag_ptr(this_ptr);
34109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34111         this_ptr_conv.is_owned = false;
34112         LDKThreeBytes val_ref;
34113         CHECK(val->arr_len == 3);
34114         memcpy(val_ref.data, val->elems, 3); FREE(val);
34115         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
34116 }
34117
34118 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
34119         LDKUnsignedNodeAnnouncement this_ptr_conv;
34120         this_ptr_conv.inner = untag_ptr(this_ptr);
34121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34123         this_ptr_conv.is_owned = false;
34124         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34125         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
34126         return ret_arr;
34127 }
34128
34129 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, int8_tArray val) {
34130         LDKUnsignedNodeAnnouncement this_ptr_conv;
34131         this_ptr_conv.inner = untag_ptr(this_ptr);
34132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34134         this_ptr_conv.is_owned = false;
34135         LDKThirtyTwoBytes val_ref;
34136         CHECK(val->arr_len == 32);
34137         memcpy(val_ref.data, val->elems, 32); FREE(val);
34138         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
34139 }
34140
34141 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
34142         LDKUnsignedNodeAnnouncement this_ptr_conv;
34143         this_ptr_conv.inner = untag_ptr(this_ptr);
34144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34146         this_ptr_conv.is_owned = false;
34147         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
34148         uint64_tArray ret_arr = NULL;
34149         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34150         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34151         for (size_t m = 0; m < ret_var.datalen; m++) {
34152                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
34153                 *ret_conv_12_copy = ret_var.data[m];
34154                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
34155                 ret_arr_ptr[m] = ret_conv_12_ref;
34156         }
34157         
34158         FREE(ret_var.data);
34159         return ret_arr;
34160 }
34161
34162 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
34163         LDKUnsignedNodeAnnouncement this_ptr_conv;
34164         this_ptr_conv.inner = untag_ptr(this_ptr);
34165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34167         this_ptr_conv.is_owned = false;
34168         LDKCVec_NetAddressZ val_constr;
34169         val_constr.datalen = val->arr_len;
34170         if (val_constr.datalen > 0)
34171                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
34172         else
34173                 val_constr.data = NULL;
34174         uint64_t* val_vals = val->elems;
34175         for (size_t m = 0; m < val_constr.datalen; m++) {
34176                 uint64_t val_conv_12 = val_vals[m];
34177                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
34178                 CHECK_ACCESS(val_conv_12_ptr);
34179                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
34180                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
34181                 val_constr.data[m] = val_conv_12_conv;
34182         }
34183         FREE(val);
34184         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
34185 }
34186
34187 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
34188         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
34189         uint64_t ret_ref = 0;
34190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34192         return ret_ref;
34193 }
34194 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
34195         LDKUnsignedNodeAnnouncement arg_conv;
34196         arg_conv.inner = untag_ptr(arg);
34197         arg_conv.is_owned = ptr_is_owned(arg);
34198         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34199         arg_conv.is_owned = false;
34200         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
34201         return ret_conv;
34202 }
34203
34204 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
34205         LDKUnsignedNodeAnnouncement orig_conv;
34206         orig_conv.inner = untag_ptr(orig);
34207         orig_conv.is_owned = ptr_is_owned(orig);
34208         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34209         orig_conv.is_owned = false;
34210         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
34211         uint64_t ret_ref = 0;
34212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34214         return ret_ref;
34215 }
34216
34217 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
34218         LDKUnsignedNodeAnnouncement a_conv;
34219         a_conv.inner = untag_ptr(a);
34220         a_conv.is_owned = ptr_is_owned(a);
34221         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34222         a_conv.is_owned = false;
34223         LDKUnsignedNodeAnnouncement b_conv;
34224         b_conv.inner = untag_ptr(b);
34225         b_conv.is_owned = ptr_is_owned(b);
34226         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34227         b_conv.is_owned = false;
34228         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
34229         return ret_conv;
34230 }
34231
34232 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
34233         LDKNodeAnnouncement this_obj_conv;
34234         this_obj_conv.inner = untag_ptr(this_obj);
34235         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34237         NodeAnnouncement_free(this_obj_conv);
34238 }
34239
34240 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
34241         LDKNodeAnnouncement this_ptr_conv;
34242         this_ptr_conv.inner = untag_ptr(this_ptr);
34243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34245         this_ptr_conv.is_owned = false;
34246         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34247         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
34248         return ret_arr;
34249 }
34250
34251 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
34252         LDKNodeAnnouncement this_ptr_conv;
34253         this_ptr_conv.inner = untag_ptr(this_ptr);
34254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34256         this_ptr_conv.is_owned = false;
34257         LDKSignature val_ref;
34258         CHECK(val->arr_len == 64);
34259         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34260         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
34261 }
34262
34263 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
34264         LDKNodeAnnouncement this_ptr_conv;
34265         this_ptr_conv.inner = untag_ptr(this_ptr);
34266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34268         this_ptr_conv.is_owned = false;
34269         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
34270         uint64_t ret_ref = 0;
34271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34273         return ret_ref;
34274 }
34275
34276 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
34277         LDKNodeAnnouncement this_ptr_conv;
34278         this_ptr_conv.inner = untag_ptr(this_ptr);
34279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34281         this_ptr_conv.is_owned = false;
34282         LDKUnsignedNodeAnnouncement val_conv;
34283         val_conv.inner = untag_ptr(val);
34284         val_conv.is_owned = ptr_is_owned(val);
34285         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34286         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
34287         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
34288 }
34289
34290 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
34291         LDKSignature signature_arg_ref;
34292         CHECK(signature_arg->arr_len == 64);
34293         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
34294         LDKUnsignedNodeAnnouncement contents_arg_conv;
34295         contents_arg_conv.inner = untag_ptr(contents_arg);
34296         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34297         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34298         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
34299         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
34300         uint64_t ret_ref = 0;
34301         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34302         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34303         return ret_ref;
34304 }
34305
34306 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
34307         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
34308         uint64_t ret_ref = 0;
34309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34311         return ret_ref;
34312 }
34313 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
34314         LDKNodeAnnouncement arg_conv;
34315         arg_conv.inner = untag_ptr(arg);
34316         arg_conv.is_owned = ptr_is_owned(arg);
34317         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34318         arg_conv.is_owned = false;
34319         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
34320         return ret_conv;
34321 }
34322
34323 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
34324         LDKNodeAnnouncement orig_conv;
34325         orig_conv.inner = untag_ptr(orig);
34326         orig_conv.is_owned = ptr_is_owned(orig);
34327         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34328         orig_conv.is_owned = false;
34329         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
34330         uint64_t ret_ref = 0;
34331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34333         return ret_ref;
34334 }
34335
34336 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
34337         LDKNodeAnnouncement a_conv;
34338         a_conv.inner = untag_ptr(a);
34339         a_conv.is_owned = ptr_is_owned(a);
34340         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34341         a_conv.is_owned = false;
34342         LDKNodeAnnouncement b_conv;
34343         b_conv.inner = untag_ptr(b);
34344         b_conv.is_owned = ptr_is_owned(b);
34345         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34346         b_conv.is_owned = false;
34347         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
34348         return ret_conv;
34349 }
34350
34351 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
34352         LDKUnsignedChannelAnnouncement this_obj_conv;
34353         this_obj_conv.inner = untag_ptr(this_obj);
34354         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34356         UnsignedChannelAnnouncement_free(this_obj_conv);
34357 }
34358
34359 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
34360         LDKUnsignedChannelAnnouncement this_ptr_conv;
34361         this_ptr_conv.inner = untag_ptr(this_ptr);
34362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34364         this_ptr_conv.is_owned = false;
34365         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
34366         uint64_t ret_ref = 0;
34367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34369         return ret_ref;
34370 }
34371
34372 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
34373         LDKUnsignedChannelAnnouncement 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         LDKChannelFeatures val_conv;
34379         val_conv.inner = untag_ptr(val);
34380         val_conv.is_owned = ptr_is_owned(val);
34381         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34382         val_conv = ChannelFeatures_clone(&val_conv);
34383         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
34384 }
34385
34386 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
34387         LDKUnsignedChannelAnnouncement this_ptr_conv;
34388         this_ptr_conv.inner = untag_ptr(this_ptr);
34389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34391         this_ptr_conv.is_owned = false;
34392         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34393         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
34394         return ret_arr;
34395 }
34396
34397 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34398         LDKUnsignedChannelAnnouncement this_ptr_conv;
34399         this_ptr_conv.inner = untag_ptr(this_ptr);
34400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34402         this_ptr_conv.is_owned = false;
34403         LDKThirtyTwoBytes val_ref;
34404         CHECK(val->arr_len == 32);
34405         memcpy(val_ref.data, val->elems, 32); FREE(val);
34406         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
34407 }
34408
34409 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
34410         LDKUnsignedChannelAnnouncement 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         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
34416         return ret_conv;
34417 }
34418
34419 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
34420         LDKUnsignedChannelAnnouncement this_ptr_conv;
34421         this_ptr_conv.inner = untag_ptr(this_ptr);
34422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34424         this_ptr_conv.is_owned = false;
34425         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
34426 }
34427
34428 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
34429         LDKUnsignedChannelAnnouncement 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         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
34435         uint64_t ret_ref = 0;
34436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34438         return ret_ref;
34439 }
34440
34441 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, uint64_t val) {
34442         LDKUnsignedChannelAnnouncement this_ptr_conv;
34443         this_ptr_conv.inner = untag_ptr(this_ptr);
34444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34446         this_ptr_conv.is_owned = false;
34447         LDKNodeId val_conv;
34448         val_conv.inner = untag_ptr(val);
34449         val_conv.is_owned = ptr_is_owned(val);
34450         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34451         val_conv = NodeId_clone(&val_conv);
34452         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
34453 }
34454
34455 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
34456         LDKUnsignedChannelAnnouncement this_ptr_conv;
34457         this_ptr_conv.inner = untag_ptr(this_ptr);
34458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34460         this_ptr_conv.is_owned = false;
34461         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
34462         uint64_t ret_ref = 0;
34463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34465         return ret_ref;
34466 }
34467
34468 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, uint64_t val) {
34469         LDKUnsignedChannelAnnouncement this_ptr_conv;
34470         this_ptr_conv.inner = untag_ptr(this_ptr);
34471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34473         this_ptr_conv.is_owned = false;
34474         LDKNodeId val_conv;
34475         val_conv.inner = untag_ptr(val);
34476         val_conv.is_owned = ptr_is_owned(val);
34477         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34478         val_conv = NodeId_clone(&val_conv);
34479         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
34480 }
34481
34482 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
34483         LDKUnsignedChannelAnnouncement this_ptr_conv;
34484         this_ptr_conv.inner = untag_ptr(this_ptr);
34485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34487         this_ptr_conv.is_owned = false;
34488         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
34489         uint64_t ret_ref = 0;
34490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34492         return ret_ref;
34493 }
34494
34495 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, uint64_t val) {
34496         LDKUnsignedChannelAnnouncement this_ptr_conv;
34497         this_ptr_conv.inner = untag_ptr(this_ptr);
34498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34500         this_ptr_conv.is_owned = false;
34501         LDKNodeId val_conv;
34502         val_conv.inner = untag_ptr(val);
34503         val_conv.is_owned = ptr_is_owned(val);
34504         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34505         val_conv = NodeId_clone(&val_conv);
34506         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
34507 }
34508
34509 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
34510         LDKUnsignedChannelAnnouncement this_ptr_conv;
34511         this_ptr_conv.inner = untag_ptr(this_ptr);
34512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34514         this_ptr_conv.is_owned = false;
34515         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
34516         uint64_t ret_ref = 0;
34517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34519         return ret_ref;
34520 }
34521
34522 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, uint64_t val) {
34523         LDKUnsignedChannelAnnouncement this_ptr_conv;
34524         this_ptr_conv.inner = untag_ptr(this_ptr);
34525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34527         this_ptr_conv.is_owned = false;
34528         LDKNodeId val_conv;
34529         val_conv.inner = untag_ptr(val);
34530         val_conv.is_owned = ptr_is_owned(val);
34531         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34532         val_conv = NodeId_clone(&val_conv);
34533         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
34534 }
34535
34536 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
34537         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
34538         uint64_t ret_ref = 0;
34539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34541         return ret_ref;
34542 }
34543 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
34544         LDKUnsignedChannelAnnouncement arg_conv;
34545         arg_conv.inner = untag_ptr(arg);
34546         arg_conv.is_owned = ptr_is_owned(arg);
34547         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34548         arg_conv.is_owned = false;
34549         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
34550         return ret_conv;
34551 }
34552
34553 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
34554         LDKUnsignedChannelAnnouncement orig_conv;
34555         orig_conv.inner = untag_ptr(orig);
34556         orig_conv.is_owned = ptr_is_owned(orig);
34557         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34558         orig_conv.is_owned = false;
34559         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
34560         uint64_t ret_ref = 0;
34561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34563         return ret_ref;
34564 }
34565
34566 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
34567         LDKUnsignedChannelAnnouncement a_conv;
34568         a_conv.inner = untag_ptr(a);
34569         a_conv.is_owned = ptr_is_owned(a);
34570         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34571         a_conv.is_owned = false;
34572         LDKUnsignedChannelAnnouncement b_conv;
34573         b_conv.inner = untag_ptr(b);
34574         b_conv.is_owned = ptr_is_owned(b);
34575         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34576         b_conv.is_owned = false;
34577         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
34578         return ret_conv;
34579 }
34580
34581 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
34582         LDKChannelAnnouncement this_obj_conv;
34583         this_obj_conv.inner = untag_ptr(this_obj);
34584         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34586         ChannelAnnouncement_free(this_obj_conv);
34587 }
34588
34589 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
34590         LDKChannelAnnouncement this_ptr_conv;
34591         this_ptr_conv.inner = untag_ptr(this_ptr);
34592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34594         this_ptr_conv.is_owned = false;
34595         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34596         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
34597         return ret_arr;
34598 }
34599
34600 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
34601         LDKChannelAnnouncement 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         LDKSignature val_ref;
34607         CHECK(val->arr_len == 64);
34608         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34609         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
34610 }
34611
34612 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
34613         LDKChannelAnnouncement this_ptr_conv;
34614         this_ptr_conv.inner = untag_ptr(this_ptr);
34615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34617         this_ptr_conv.is_owned = false;
34618         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34619         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
34620         return ret_arr;
34621 }
34622
34623 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
34624         LDKChannelAnnouncement this_ptr_conv;
34625         this_ptr_conv.inner = untag_ptr(this_ptr);
34626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34628         this_ptr_conv.is_owned = false;
34629         LDKSignature val_ref;
34630         CHECK(val->arr_len == 64);
34631         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34632         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
34633 }
34634
34635 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
34636         LDKChannelAnnouncement this_ptr_conv;
34637         this_ptr_conv.inner = untag_ptr(this_ptr);
34638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34640         this_ptr_conv.is_owned = false;
34641         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34642         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
34643         return ret_arr;
34644 }
34645
34646 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
34647         LDKChannelAnnouncement this_ptr_conv;
34648         this_ptr_conv.inner = untag_ptr(this_ptr);
34649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34651         this_ptr_conv.is_owned = false;
34652         LDKSignature val_ref;
34653         CHECK(val->arr_len == 64);
34654         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34655         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
34656 }
34657
34658 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
34659         LDKChannelAnnouncement this_ptr_conv;
34660         this_ptr_conv.inner = untag_ptr(this_ptr);
34661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34663         this_ptr_conv.is_owned = false;
34664         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34665         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
34666         return ret_arr;
34667 }
34668
34669 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
34670         LDKChannelAnnouncement this_ptr_conv;
34671         this_ptr_conv.inner = untag_ptr(this_ptr);
34672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34674         this_ptr_conv.is_owned = false;
34675         LDKSignature val_ref;
34676         CHECK(val->arr_len == 64);
34677         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34678         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
34679 }
34680
34681 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
34682         LDKChannelAnnouncement this_ptr_conv;
34683         this_ptr_conv.inner = untag_ptr(this_ptr);
34684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34686         this_ptr_conv.is_owned = false;
34687         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
34688         uint64_t ret_ref = 0;
34689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34691         return ret_ref;
34692 }
34693
34694 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
34695         LDKChannelAnnouncement this_ptr_conv;
34696         this_ptr_conv.inner = untag_ptr(this_ptr);
34697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34699         this_ptr_conv.is_owned = false;
34700         LDKUnsignedChannelAnnouncement val_conv;
34701         val_conv.inner = untag_ptr(val);
34702         val_conv.is_owned = ptr_is_owned(val);
34703         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34704         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
34705         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
34706 }
34707
34708 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) {
34709         LDKSignature node_signature_1_arg_ref;
34710         CHECK(node_signature_1_arg->arr_len == 64);
34711         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
34712         LDKSignature node_signature_2_arg_ref;
34713         CHECK(node_signature_2_arg->arr_len == 64);
34714         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
34715         LDKSignature bitcoin_signature_1_arg_ref;
34716         CHECK(bitcoin_signature_1_arg->arr_len == 64);
34717         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
34718         LDKSignature bitcoin_signature_2_arg_ref;
34719         CHECK(bitcoin_signature_2_arg->arr_len == 64);
34720         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
34721         LDKUnsignedChannelAnnouncement contents_arg_conv;
34722         contents_arg_conv.inner = untag_ptr(contents_arg);
34723         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34724         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34725         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
34726         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);
34727         uint64_t ret_ref = 0;
34728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34730         return ret_ref;
34731 }
34732
34733 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
34734         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
34735         uint64_t ret_ref = 0;
34736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34738         return ret_ref;
34739 }
34740 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
34741         LDKChannelAnnouncement arg_conv;
34742         arg_conv.inner = untag_ptr(arg);
34743         arg_conv.is_owned = ptr_is_owned(arg);
34744         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34745         arg_conv.is_owned = false;
34746         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
34747         return ret_conv;
34748 }
34749
34750 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
34751         LDKChannelAnnouncement orig_conv;
34752         orig_conv.inner = untag_ptr(orig);
34753         orig_conv.is_owned = ptr_is_owned(orig);
34754         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34755         orig_conv.is_owned = false;
34756         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
34757         uint64_t ret_ref = 0;
34758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34760         return ret_ref;
34761 }
34762
34763 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
34764         LDKChannelAnnouncement a_conv;
34765         a_conv.inner = untag_ptr(a);
34766         a_conv.is_owned = ptr_is_owned(a);
34767         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34768         a_conv.is_owned = false;
34769         LDKChannelAnnouncement b_conv;
34770         b_conv.inner = untag_ptr(b);
34771         b_conv.is_owned = ptr_is_owned(b);
34772         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34773         b_conv.is_owned = false;
34774         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
34775         return ret_conv;
34776 }
34777
34778 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
34779         LDKUnsignedChannelUpdate this_obj_conv;
34780         this_obj_conv.inner = untag_ptr(this_obj);
34781         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34783         UnsignedChannelUpdate_free(this_obj_conv);
34784 }
34785
34786 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
34787         LDKUnsignedChannelUpdate this_ptr_conv;
34788         this_ptr_conv.inner = untag_ptr(this_ptr);
34789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34791         this_ptr_conv.is_owned = false;
34792         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34793         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
34794         return ret_arr;
34795 }
34796
34797 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34798         LDKUnsignedChannelUpdate this_ptr_conv;
34799         this_ptr_conv.inner = untag_ptr(this_ptr);
34800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34802         this_ptr_conv.is_owned = false;
34803         LDKThirtyTwoBytes val_ref;
34804         CHECK(val->arr_len == 32);
34805         memcpy(val_ref.data, val->elems, 32); FREE(val);
34806         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
34807 }
34808
34809 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
34810         LDKUnsignedChannelUpdate this_ptr_conv;
34811         this_ptr_conv.inner = untag_ptr(this_ptr);
34812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34814         this_ptr_conv.is_owned = false;
34815         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
34816         return ret_conv;
34817 }
34818
34819 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
34820         LDKUnsignedChannelUpdate this_ptr_conv;
34821         this_ptr_conv.inner = untag_ptr(this_ptr);
34822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34824         this_ptr_conv.is_owned = false;
34825         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
34826 }
34827
34828 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
34829         LDKUnsignedChannelUpdate this_ptr_conv;
34830         this_ptr_conv.inner = untag_ptr(this_ptr);
34831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34833         this_ptr_conv.is_owned = false;
34834         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
34835         return ret_conv;
34836 }
34837
34838 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
34839         LDKUnsignedChannelUpdate this_ptr_conv;
34840         this_ptr_conv.inner = untag_ptr(this_ptr);
34841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34843         this_ptr_conv.is_owned = false;
34844         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
34845 }
34846
34847 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
34848         LDKUnsignedChannelUpdate this_ptr_conv;
34849         this_ptr_conv.inner = untag_ptr(this_ptr);
34850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34852         this_ptr_conv.is_owned = false;
34853         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
34854         return ret_conv;
34855 }
34856
34857 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
34858         LDKUnsignedChannelUpdate this_ptr_conv;
34859         this_ptr_conv.inner = untag_ptr(this_ptr);
34860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34862         this_ptr_conv.is_owned = false;
34863         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
34864 }
34865
34866 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
34867         LDKUnsignedChannelUpdate this_ptr_conv;
34868         this_ptr_conv.inner = untag_ptr(this_ptr);
34869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34871         this_ptr_conv.is_owned = false;
34872         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
34873         return ret_conv;
34874 }
34875
34876 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
34877         LDKUnsignedChannelUpdate this_ptr_conv;
34878         this_ptr_conv.inner = untag_ptr(this_ptr);
34879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34881         this_ptr_conv.is_owned = false;
34882         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
34883 }
34884
34885 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
34886         LDKUnsignedChannelUpdate this_ptr_conv;
34887         this_ptr_conv.inner = untag_ptr(this_ptr);
34888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34890         this_ptr_conv.is_owned = false;
34891         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
34892         return ret_conv;
34893 }
34894
34895 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
34896         LDKUnsignedChannelUpdate this_ptr_conv;
34897         this_ptr_conv.inner = untag_ptr(this_ptr);
34898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34900         this_ptr_conv.is_owned = false;
34901         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
34902 }
34903
34904 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
34905         LDKUnsignedChannelUpdate this_ptr_conv;
34906         this_ptr_conv.inner = untag_ptr(this_ptr);
34907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34909         this_ptr_conv.is_owned = false;
34910         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
34911         return ret_conv;
34912 }
34913
34914 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
34915         LDKUnsignedChannelUpdate this_ptr_conv;
34916         this_ptr_conv.inner = untag_ptr(this_ptr);
34917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34919         this_ptr_conv.is_owned = false;
34920         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
34921 }
34922
34923 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
34924         LDKUnsignedChannelUpdate this_ptr_conv;
34925         this_ptr_conv.inner = untag_ptr(this_ptr);
34926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34928         this_ptr_conv.is_owned = false;
34929         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
34930         return ret_conv;
34931 }
34932
34933 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
34934         LDKUnsignedChannelUpdate this_ptr_conv;
34935         this_ptr_conv.inner = untag_ptr(this_ptr);
34936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34938         this_ptr_conv.is_owned = false;
34939         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
34940 }
34941
34942 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
34943         LDKUnsignedChannelUpdate this_ptr_conv;
34944         this_ptr_conv.inner = untag_ptr(this_ptr);
34945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34947         this_ptr_conv.is_owned = false;
34948         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
34949         return ret_conv;
34950 }
34951
34952 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
34953         LDKUnsignedChannelUpdate this_ptr_conv;
34954         this_ptr_conv.inner = untag_ptr(this_ptr);
34955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34957         this_ptr_conv.is_owned = false;
34958         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
34959 }
34960
34961 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
34962         LDKUnsignedChannelUpdate this_ptr_conv;
34963         this_ptr_conv.inner = untag_ptr(this_ptr);
34964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34966         this_ptr_conv.is_owned = false;
34967         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
34968         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34969         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34970         CVec_u8Z_free(ret_var);
34971         return ret_arr;
34972 }
34973
34974 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
34975         LDKUnsignedChannelUpdate this_ptr_conv;
34976         this_ptr_conv.inner = untag_ptr(this_ptr);
34977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34979         this_ptr_conv.is_owned = false;
34980         LDKCVec_u8Z val_ref;
34981         val_ref.datalen = val->arr_len;
34982         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
34983         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
34984         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
34985 }
34986
34987 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) {
34988         LDKThirtyTwoBytes chain_hash_arg_ref;
34989         CHECK(chain_hash_arg->arr_len == 32);
34990         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
34991         LDKCVec_u8Z excess_data_arg_ref;
34992         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
34993         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
34994         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
34995         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);
34996         uint64_t ret_ref = 0;
34997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34999         return ret_ref;
35000 }
35001
35002 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
35003         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
35004         uint64_t ret_ref = 0;
35005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35007         return ret_ref;
35008 }
35009 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
35010         LDKUnsignedChannelUpdate arg_conv;
35011         arg_conv.inner = untag_ptr(arg);
35012         arg_conv.is_owned = ptr_is_owned(arg);
35013         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35014         arg_conv.is_owned = false;
35015         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
35016         return ret_conv;
35017 }
35018
35019 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
35020         LDKUnsignedChannelUpdate orig_conv;
35021         orig_conv.inner = untag_ptr(orig);
35022         orig_conv.is_owned = ptr_is_owned(orig);
35023         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35024         orig_conv.is_owned = false;
35025         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
35026         uint64_t ret_ref = 0;
35027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35029         return ret_ref;
35030 }
35031
35032 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
35033         LDKUnsignedChannelUpdate a_conv;
35034         a_conv.inner = untag_ptr(a);
35035         a_conv.is_owned = ptr_is_owned(a);
35036         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35037         a_conv.is_owned = false;
35038         LDKUnsignedChannelUpdate b_conv;
35039         b_conv.inner = untag_ptr(b);
35040         b_conv.is_owned = ptr_is_owned(b);
35041         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35042         b_conv.is_owned = false;
35043         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
35044         return ret_conv;
35045 }
35046
35047 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
35048         LDKChannelUpdate this_obj_conv;
35049         this_obj_conv.inner = untag_ptr(this_obj);
35050         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35052         ChannelUpdate_free(this_obj_conv);
35053 }
35054
35055 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
35056         LDKChannelUpdate this_ptr_conv;
35057         this_ptr_conv.inner = untag_ptr(this_ptr);
35058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35060         this_ptr_conv.is_owned = false;
35061         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
35062         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
35063         return ret_arr;
35064 }
35065
35066 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
35067         LDKChannelUpdate this_ptr_conv;
35068         this_ptr_conv.inner = untag_ptr(this_ptr);
35069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35071         this_ptr_conv.is_owned = false;
35072         LDKSignature val_ref;
35073         CHECK(val->arr_len == 64);
35074         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
35075         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
35076 }
35077
35078 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
35079         LDKChannelUpdate this_ptr_conv;
35080         this_ptr_conv.inner = untag_ptr(this_ptr);
35081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35083         this_ptr_conv.is_owned = false;
35084         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
35085         uint64_t ret_ref = 0;
35086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35088         return ret_ref;
35089 }
35090
35091 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
35092         LDKChannelUpdate this_ptr_conv;
35093         this_ptr_conv.inner = untag_ptr(this_ptr);
35094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35096         this_ptr_conv.is_owned = false;
35097         LDKUnsignedChannelUpdate val_conv;
35098         val_conv.inner = untag_ptr(val);
35099         val_conv.is_owned = ptr_is_owned(val);
35100         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35101         val_conv = UnsignedChannelUpdate_clone(&val_conv);
35102         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
35103 }
35104
35105 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
35106         LDKSignature signature_arg_ref;
35107         CHECK(signature_arg->arr_len == 64);
35108         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
35109         LDKUnsignedChannelUpdate contents_arg_conv;
35110         contents_arg_conv.inner = untag_ptr(contents_arg);
35111         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
35112         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
35113         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
35114         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
35115         uint64_t ret_ref = 0;
35116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35118         return ret_ref;
35119 }
35120
35121 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
35122         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
35123         uint64_t ret_ref = 0;
35124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35126         return ret_ref;
35127 }
35128 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
35129         LDKChannelUpdate arg_conv;
35130         arg_conv.inner = untag_ptr(arg);
35131         arg_conv.is_owned = ptr_is_owned(arg);
35132         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35133         arg_conv.is_owned = false;
35134         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
35135         return ret_conv;
35136 }
35137
35138 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
35139         LDKChannelUpdate orig_conv;
35140         orig_conv.inner = untag_ptr(orig);
35141         orig_conv.is_owned = ptr_is_owned(orig);
35142         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35143         orig_conv.is_owned = false;
35144         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
35145         uint64_t ret_ref = 0;
35146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35148         return ret_ref;
35149 }
35150
35151 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
35152         LDKChannelUpdate a_conv;
35153         a_conv.inner = untag_ptr(a);
35154         a_conv.is_owned = ptr_is_owned(a);
35155         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35156         a_conv.is_owned = false;
35157         LDKChannelUpdate b_conv;
35158         b_conv.inner = untag_ptr(b);
35159         b_conv.is_owned = ptr_is_owned(b);
35160         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35161         b_conv.is_owned = false;
35162         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
35163         return ret_conv;
35164 }
35165
35166 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
35167         LDKQueryChannelRange this_obj_conv;
35168         this_obj_conv.inner = untag_ptr(this_obj);
35169         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35171         QueryChannelRange_free(this_obj_conv);
35172 }
35173
35174 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
35175         LDKQueryChannelRange this_ptr_conv;
35176         this_ptr_conv.inner = untag_ptr(this_ptr);
35177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35179         this_ptr_conv.is_owned = false;
35180         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35181         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
35182         return ret_arr;
35183 }
35184
35185 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35186         LDKQueryChannelRange this_ptr_conv;
35187         this_ptr_conv.inner = untag_ptr(this_ptr);
35188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35190         this_ptr_conv.is_owned = false;
35191         LDKThirtyTwoBytes val_ref;
35192         CHECK(val->arr_len == 32);
35193         memcpy(val_ref.data, val->elems, 32); FREE(val);
35194         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
35195 }
35196
35197 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
35198         LDKQueryChannelRange this_ptr_conv;
35199         this_ptr_conv.inner = untag_ptr(this_ptr);
35200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35202         this_ptr_conv.is_owned = false;
35203         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
35204         return ret_conv;
35205 }
35206
35207 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
35208         LDKQueryChannelRange this_ptr_conv;
35209         this_ptr_conv.inner = untag_ptr(this_ptr);
35210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35212         this_ptr_conv.is_owned = false;
35213         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
35214 }
35215
35216 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
35217         LDKQueryChannelRange this_ptr_conv;
35218         this_ptr_conv.inner = untag_ptr(this_ptr);
35219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35221         this_ptr_conv.is_owned = false;
35222         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
35223         return ret_conv;
35224 }
35225
35226 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
35227         LDKQueryChannelRange this_ptr_conv;
35228         this_ptr_conv.inner = untag_ptr(this_ptr);
35229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35231         this_ptr_conv.is_owned = false;
35232         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
35233 }
35234
35235 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) {
35236         LDKThirtyTwoBytes chain_hash_arg_ref;
35237         CHECK(chain_hash_arg->arr_len == 32);
35238         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35239         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
35240         uint64_t ret_ref = 0;
35241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35243         return ret_ref;
35244 }
35245
35246 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
35247         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
35248         uint64_t ret_ref = 0;
35249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35251         return ret_ref;
35252 }
35253 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
35254         LDKQueryChannelRange arg_conv;
35255         arg_conv.inner = untag_ptr(arg);
35256         arg_conv.is_owned = ptr_is_owned(arg);
35257         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35258         arg_conv.is_owned = false;
35259         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
35260         return ret_conv;
35261 }
35262
35263 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
35264         LDKQueryChannelRange orig_conv;
35265         orig_conv.inner = untag_ptr(orig);
35266         orig_conv.is_owned = ptr_is_owned(orig);
35267         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35268         orig_conv.is_owned = false;
35269         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
35270         uint64_t ret_ref = 0;
35271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35273         return ret_ref;
35274 }
35275
35276 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
35277         LDKQueryChannelRange a_conv;
35278         a_conv.inner = untag_ptr(a);
35279         a_conv.is_owned = ptr_is_owned(a);
35280         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35281         a_conv.is_owned = false;
35282         LDKQueryChannelRange b_conv;
35283         b_conv.inner = untag_ptr(b);
35284         b_conv.is_owned = ptr_is_owned(b);
35285         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35286         b_conv.is_owned = false;
35287         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
35288         return ret_conv;
35289 }
35290
35291 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
35292         LDKReplyChannelRange this_obj_conv;
35293         this_obj_conv.inner = untag_ptr(this_obj);
35294         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35296         ReplyChannelRange_free(this_obj_conv);
35297 }
35298
35299 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
35300         LDKReplyChannelRange this_ptr_conv;
35301         this_ptr_conv.inner = untag_ptr(this_ptr);
35302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35304         this_ptr_conv.is_owned = false;
35305         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35306         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
35307         return ret_arr;
35308 }
35309
35310 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35311         LDKReplyChannelRange this_ptr_conv;
35312         this_ptr_conv.inner = untag_ptr(this_ptr);
35313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35315         this_ptr_conv.is_owned = false;
35316         LDKThirtyTwoBytes val_ref;
35317         CHECK(val->arr_len == 32);
35318         memcpy(val_ref.data, val->elems, 32); FREE(val);
35319         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
35320 }
35321
35322 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
35323         LDKReplyChannelRange this_ptr_conv;
35324         this_ptr_conv.inner = untag_ptr(this_ptr);
35325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35327         this_ptr_conv.is_owned = false;
35328         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
35329         return ret_conv;
35330 }
35331
35332 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
35333         LDKReplyChannelRange this_ptr_conv;
35334         this_ptr_conv.inner = untag_ptr(this_ptr);
35335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35337         this_ptr_conv.is_owned = false;
35338         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
35339 }
35340
35341 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
35342         LDKReplyChannelRange this_ptr_conv;
35343         this_ptr_conv.inner = untag_ptr(this_ptr);
35344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35346         this_ptr_conv.is_owned = false;
35347         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
35348         return ret_conv;
35349 }
35350
35351 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
35352         LDKReplyChannelRange this_ptr_conv;
35353         this_ptr_conv.inner = untag_ptr(this_ptr);
35354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35356         this_ptr_conv.is_owned = false;
35357         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
35358 }
35359
35360 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
35361         LDKReplyChannelRange this_ptr_conv;
35362         this_ptr_conv.inner = untag_ptr(this_ptr);
35363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35365         this_ptr_conv.is_owned = false;
35366         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
35367         return ret_conv;
35368 }
35369
35370 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
35371         LDKReplyChannelRange this_ptr_conv;
35372         this_ptr_conv.inner = untag_ptr(this_ptr);
35373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35375         this_ptr_conv.is_owned = false;
35376         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
35377 }
35378
35379 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
35380         LDKReplyChannelRange this_ptr_conv;
35381         this_ptr_conv.inner = untag_ptr(this_ptr);
35382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35384         this_ptr_conv.is_owned = false;
35385         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
35386         int64_tArray ret_arr = NULL;
35387         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35388         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35389         for (size_t i = 0; i < ret_var.datalen; i++) {
35390                 int64_t ret_conv_8_conv = ret_var.data[i];
35391                 ret_arr_ptr[i] = ret_conv_8_conv;
35392         }
35393         
35394         FREE(ret_var.data);
35395         return ret_arr;
35396 }
35397
35398 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
35399         LDKReplyChannelRange this_ptr_conv;
35400         this_ptr_conv.inner = untag_ptr(this_ptr);
35401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35403         this_ptr_conv.is_owned = false;
35404         LDKCVec_u64Z val_constr;
35405         val_constr.datalen = val->arr_len;
35406         if (val_constr.datalen > 0)
35407                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35408         else
35409                 val_constr.data = NULL;
35410         int64_t* val_vals = val->elems;
35411         for (size_t i = 0; i < val_constr.datalen; i++) {
35412                 int64_t val_conv_8 = val_vals[i];
35413                 val_constr.data[i] = val_conv_8;
35414         }
35415         FREE(val);
35416         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
35417 }
35418
35419 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) {
35420         LDKThirtyTwoBytes chain_hash_arg_ref;
35421         CHECK(chain_hash_arg->arr_len == 32);
35422         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35423         LDKCVec_u64Z short_channel_ids_arg_constr;
35424         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
35425         if (short_channel_ids_arg_constr.datalen > 0)
35426                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35427         else
35428                 short_channel_ids_arg_constr.data = NULL;
35429         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
35430         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
35431                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
35432                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
35433         }
35434         FREE(short_channel_ids_arg);
35435         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
35436         uint64_t ret_ref = 0;
35437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35439         return ret_ref;
35440 }
35441
35442 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
35443         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
35444         uint64_t ret_ref = 0;
35445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35447         return ret_ref;
35448 }
35449 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
35450         LDKReplyChannelRange arg_conv;
35451         arg_conv.inner = untag_ptr(arg);
35452         arg_conv.is_owned = ptr_is_owned(arg);
35453         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35454         arg_conv.is_owned = false;
35455         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
35456         return ret_conv;
35457 }
35458
35459 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
35460         LDKReplyChannelRange orig_conv;
35461         orig_conv.inner = untag_ptr(orig);
35462         orig_conv.is_owned = ptr_is_owned(orig);
35463         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35464         orig_conv.is_owned = false;
35465         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
35466         uint64_t ret_ref = 0;
35467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35469         return ret_ref;
35470 }
35471
35472 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
35473         LDKReplyChannelRange a_conv;
35474         a_conv.inner = untag_ptr(a);
35475         a_conv.is_owned = ptr_is_owned(a);
35476         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35477         a_conv.is_owned = false;
35478         LDKReplyChannelRange b_conv;
35479         b_conv.inner = untag_ptr(b);
35480         b_conv.is_owned = ptr_is_owned(b);
35481         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35482         b_conv.is_owned = false;
35483         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
35484         return ret_conv;
35485 }
35486
35487 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
35488         LDKQueryShortChannelIds this_obj_conv;
35489         this_obj_conv.inner = untag_ptr(this_obj);
35490         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35492         QueryShortChannelIds_free(this_obj_conv);
35493 }
35494
35495 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
35496         LDKQueryShortChannelIds this_ptr_conv;
35497         this_ptr_conv.inner = untag_ptr(this_ptr);
35498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35500         this_ptr_conv.is_owned = false;
35501         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35502         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
35503         return ret_arr;
35504 }
35505
35506 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35507         LDKQueryShortChannelIds this_ptr_conv;
35508         this_ptr_conv.inner = untag_ptr(this_ptr);
35509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35511         this_ptr_conv.is_owned = false;
35512         LDKThirtyTwoBytes val_ref;
35513         CHECK(val->arr_len == 32);
35514         memcpy(val_ref.data, val->elems, 32); FREE(val);
35515         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
35516 }
35517
35518 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
35519         LDKQueryShortChannelIds this_ptr_conv;
35520         this_ptr_conv.inner = untag_ptr(this_ptr);
35521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35523         this_ptr_conv.is_owned = false;
35524         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
35525         int64_tArray ret_arr = NULL;
35526         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35527         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35528         for (size_t i = 0; i < ret_var.datalen; i++) {
35529                 int64_t ret_conv_8_conv = ret_var.data[i];
35530                 ret_arr_ptr[i] = ret_conv_8_conv;
35531         }
35532         
35533         FREE(ret_var.data);
35534         return ret_arr;
35535 }
35536
35537 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
35538         LDKQueryShortChannelIds this_ptr_conv;
35539         this_ptr_conv.inner = untag_ptr(this_ptr);
35540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35542         this_ptr_conv.is_owned = false;
35543         LDKCVec_u64Z val_constr;
35544         val_constr.datalen = val->arr_len;
35545         if (val_constr.datalen > 0)
35546                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35547         else
35548                 val_constr.data = NULL;
35549         int64_t* val_vals = val->elems;
35550         for (size_t i = 0; i < val_constr.datalen; i++) {
35551                 int64_t val_conv_8 = val_vals[i];
35552                 val_constr.data[i] = val_conv_8;
35553         }
35554         FREE(val);
35555         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
35556 }
35557
35558 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
35559         LDKThirtyTwoBytes chain_hash_arg_ref;
35560         CHECK(chain_hash_arg->arr_len == 32);
35561         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35562         LDKCVec_u64Z short_channel_ids_arg_constr;
35563         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
35564         if (short_channel_ids_arg_constr.datalen > 0)
35565                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35566         else
35567                 short_channel_ids_arg_constr.data = NULL;
35568         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
35569         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
35570                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
35571                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
35572         }
35573         FREE(short_channel_ids_arg);
35574         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
35575         uint64_t ret_ref = 0;
35576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35578         return ret_ref;
35579 }
35580
35581 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
35582         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
35583         uint64_t ret_ref = 0;
35584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35586         return ret_ref;
35587 }
35588 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
35589         LDKQueryShortChannelIds arg_conv;
35590         arg_conv.inner = untag_ptr(arg);
35591         arg_conv.is_owned = ptr_is_owned(arg);
35592         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35593         arg_conv.is_owned = false;
35594         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
35595         return ret_conv;
35596 }
35597
35598 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
35599         LDKQueryShortChannelIds orig_conv;
35600         orig_conv.inner = untag_ptr(orig);
35601         orig_conv.is_owned = ptr_is_owned(orig);
35602         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35603         orig_conv.is_owned = false;
35604         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
35605         uint64_t ret_ref = 0;
35606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35608         return ret_ref;
35609 }
35610
35611 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
35612         LDKQueryShortChannelIds a_conv;
35613         a_conv.inner = untag_ptr(a);
35614         a_conv.is_owned = ptr_is_owned(a);
35615         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35616         a_conv.is_owned = false;
35617         LDKQueryShortChannelIds b_conv;
35618         b_conv.inner = untag_ptr(b);
35619         b_conv.is_owned = ptr_is_owned(b);
35620         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35621         b_conv.is_owned = false;
35622         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
35623         return ret_conv;
35624 }
35625
35626 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
35627         LDKReplyShortChannelIdsEnd this_obj_conv;
35628         this_obj_conv.inner = untag_ptr(this_obj);
35629         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35631         ReplyShortChannelIdsEnd_free(this_obj_conv);
35632 }
35633
35634 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
35635         LDKReplyShortChannelIdsEnd this_ptr_conv;
35636         this_ptr_conv.inner = untag_ptr(this_ptr);
35637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35639         this_ptr_conv.is_owned = false;
35640         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35641         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
35642         return ret_arr;
35643 }
35644
35645 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35646         LDKReplyShortChannelIdsEnd this_ptr_conv;
35647         this_ptr_conv.inner = untag_ptr(this_ptr);
35648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35650         this_ptr_conv.is_owned = false;
35651         LDKThirtyTwoBytes val_ref;
35652         CHECK(val->arr_len == 32);
35653         memcpy(val_ref.data, val->elems, 32); FREE(val);
35654         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
35655 }
35656
35657 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
35658         LDKReplyShortChannelIdsEnd this_ptr_conv;
35659         this_ptr_conv.inner = untag_ptr(this_ptr);
35660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35662         this_ptr_conv.is_owned = false;
35663         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
35664         return ret_conv;
35665 }
35666
35667 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
35668         LDKReplyShortChannelIdsEnd this_ptr_conv;
35669         this_ptr_conv.inner = untag_ptr(this_ptr);
35670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35672         this_ptr_conv.is_owned = false;
35673         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
35674 }
35675
35676 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
35677         LDKThirtyTwoBytes chain_hash_arg_ref;
35678         CHECK(chain_hash_arg->arr_len == 32);
35679         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35680         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
35681         uint64_t ret_ref = 0;
35682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35684         return ret_ref;
35685 }
35686
35687 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
35688         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
35689         uint64_t ret_ref = 0;
35690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35692         return ret_ref;
35693 }
35694 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
35695         LDKReplyShortChannelIdsEnd arg_conv;
35696         arg_conv.inner = untag_ptr(arg);
35697         arg_conv.is_owned = ptr_is_owned(arg);
35698         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35699         arg_conv.is_owned = false;
35700         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
35701         return ret_conv;
35702 }
35703
35704 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
35705         LDKReplyShortChannelIdsEnd orig_conv;
35706         orig_conv.inner = untag_ptr(orig);
35707         orig_conv.is_owned = ptr_is_owned(orig);
35708         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35709         orig_conv.is_owned = false;
35710         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
35711         uint64_t ret_ref = 0;
35712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35714         return ret_ref;
35715 }
35716
35717 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
35718         LDKReplyShortChannelIdsEnd a_conv;
35719         a_conv.inner = untag_ptr(a);
35720         a_conv.is_owned = ptr_is_owned(a);
35721         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35722         a_conv.is_owned = false;
35723         LDKReplyShortChannelIdsEnd b_conv;
35724         b_conv.inner = untag_ptr(b);
35725         b_conv.is_owned = ptr_is_owned(b);
35726         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35727         b_conv.is_owned = false;
35728         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
35729         return ret_conv;
35730 }
35731
35732 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
35733         LDKGossipTimestampFilter this_obj_conv;
35734         this_obj_conv.inner = untag_ptr(this_obj);
35735         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35737         GossipTimestampFilter_free(this_obj_conv);
35738 }
35739
35740 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
35741         LDKGossipTimestampFilter this_ptr_conv;
35742         this_ptr_conv.inner = untag_ptr(this_ptr);
35743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35745         this_ptr_conv.is_owned = false;
35746         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35747         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
35748         return ret_arr;
35749 }
35750
35751 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35752         LDKGossipTimestampFilter this_ptr_conv;
35753         this_ptr_conv.inner = untag_ptr(this_ptr);
35754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35756         this_ptr_conv.is_owned = false;
35757         LDKThirtyTwoBytes val_ref;
35758         CHECK(val->arr_len == 32);
35759         memcpy(val_ref.data, val->elems, 32); FREE(val);
35760         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
35761 }
35762
35763 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
35764         LDKGossipTimestampFilter this_ptr_conv;
35765         this_ptr_conv.inner = untag_ptr(this_ptr);
35766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35768         this_ptr_conv.is_owned = false;
35769         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
35770         return ret_conv;
35771 }
35772
35773 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
35774         LDKGossipTimestampFilter this_ptr_conv;
35775         this_ptr_conv.inner = untag_ptr(this_ptr);
35776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35778         this_ptr_conv.is_owned = false;
35779         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
35780 }
35781
35782 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
35783         LDKGossipTimestampFilter this_ptr_conv;
35784         this_ptr_conv.inner = untag_ptr(this_ptr);
35785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35787         this_ptr_conv.is_owned = false;
35788         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
35789         return ret_conv;
35790 }
35791
35792 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
35793         LDKGossipTimestampFilter this_ptr_conv;
35794         this_ptr_conv.inner = untag_ptr(this_ptr);
35795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35797         this_ptr_conv.is_owned = false;
35798         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
35799 }
35800
35801 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) {
35802         LDKThirtyTwoBytes chain_hash_arg_ref;
35803         CHECK(chain_hash_arg->arr_len == 32);
35804         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35805         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
35806         uint64_t ret_ref = 0;
35807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35809         return ret_ref;
35810 }
35811
35812 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
35813         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
35814         uint64_t ret_ref = 0;
35815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35817         return ret_ref;
35818 }
35819 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
35820         LDKGossipTimestampFilter arg_conv;
35821         arg_conv.inner = untag_ptr(arg);
35822         arg_conv.is_owned = ptr_is_owned(arg);
35823         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35824         arg_conv.is_owned = false;
35825         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
35826         return ret_conv;
35827 }
35828
35829 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
35830         LDKGossipTimestampFilter orig_conv;
35831         orig_conv.inner = untag_ptr(orig);
35832         orig_conv.is_owned = ptr_is_owned(orig);
35833         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35834         orig_conv.is_owned = false;
35835         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
35836         uint64_t ret_ref = 0;
35837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35839         return ret_ref;
35840 }
35841
35842 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
35843         LDKGossipTimestampFilter a_conv;
35844         a_conv.inner = untag_ptr(a);
35845         a_conv.is_owned = ptr_is_owned(a);
35846         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35847         a_conv.is_owned = false;
35848         LDKGossipTimestampFilter b_conv;
35849         b_conv.inner = untag_ptr(b);
35850         b_conv.is_owned = ptr_is_owned(b);
35851         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35852         b_conv.is_owned = false;
35853         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
35854         return ret_conv;
35855 }
35856
35857 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
35858         if (!ptr_is_owned(this_ptr)) return;
35859         void* this_ptr_ptr = untag_ptr(this_ptr);
35860         CHECK_ACCESS(this_ptr_ptr);
35861         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
35862         FREE(untag_ptr(this_ptr));
35863         ErrorAction_free(this_ptr_conv);
35864 }
35865
35866 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
35867         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35868         *ret_copy = ErrorAction_clone(arg);
35869         uint64_t ret_ref = tag_ptr(ret_copy, true);
35870         return ret_ref;
35871 }
35872 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
35873         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
35874         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
35875         return ret_conv;
35876 }
35877
35878 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
35879         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
35880         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35881         *ret_copy = ErrorAction_clone(orig_conv);
35882         uint64_t ret_ref = tag_ptr(ret_copy, true);
35883         return ret_ref;
35884 }
35885
35886 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
35887         LDKErrorMessage msg_conv;
35888         msg_conv.inner = untag_ptr(msg);
35889         msg_conv.is_owned = ptr_is_owned(msg);
35890         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35891         msg_conv = ErrorMessage_clone(&msg_conv);
35892         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35893         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
35894         uint64_t ret_ref = tag_ptr(ret_copy, true);
35895         return ret_ref;
35896 }
35897
35898 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
35899         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35900         *ret_copy = ErrorAction_ignore_error();
35901         uint64_t ret_ref = tag_ptr(ret_copy, true);
35902         return ret_ref;
35903 }
35904
35905 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
35906         LDKLevel a_conv = LDKLevel_from_js(a);
35907         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35908         *ret_copy = ErrorAction_ignore_and_log(a_conv);
35909         uint64_t ret_ref = tag_ptr(ret_copy, true);
35910         return ret_ref;
35911 }
35912
35913 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
35914         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35915         *ret_copy = ErrorAction_ignore_duplicate_gossip();
35916         uint64_t ret_ref = tag_ptr(ret_copy, true);
35917         return ret_ref;
35918 }
35919
35920 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
35921         LDKErrorMessage msg_conv;
35922         msg_conv.inner = untag_ptr(msg);
35923         msg_conv.is_owned = ptr_is_owned(msg);
35924         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35925         msg_conv = ErrorMessage_clone(&msg_conv);
35926         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35927         *ret_copy = ErrorAction_send_error_message(msg_conv);
35928         uint64_t ret_ref = tag_ptr(ret_copy, true);
35929         return ret_ref;
35930 }
35931
35932 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
35933         LDKWarningMessage msg_conv;
35934         msg_conv.inner = untag_ptr(msg);
35935         msg_conv.is_owned = ptr_is_owned(msg);
35936         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35937         msg_conv = WarningMessage_clone(&msg_conv);
35938         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
35939         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35940         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
35941         uint64_t ret_ref = tag_ptr(ret_copy, true);
35942         return ret_ref;
35943 }
35944
35945 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
35946         LDKLightningError this_obj_conv;
35947         this_obj_conv.inner = untag_ptr(this_obj);
35948         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35950         LightningError_free(this_obj_conv);
35951 }
35952
35953 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
35954         LDKLightningError this_ptr_conv;
35955         this_ptr_conv.inner = untag_ptr(this_ptr);
35956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35958         this_ptr_conv.is_owned = false;
35959         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
35960         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
35961         Str_free(ret_str);
35962         return ret_conv;
35963 }
35964
35965 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
35966         LDKLightningError this_ptr_conv;
35967         this_ptr_conv.inner = untag_ptr(this_ptr);
35968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35970         this_ptr_conv.is_owned = false;
35971         LDKStr val_conv = str_ref_to_owned_c(val);
35972         LightningError_set_err(&this_ptr_conv, val_conv);
35973 }
35974
35975 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
35976         LDKLightningError this_ptr_conv;
35977         this_ptr_conv.inner = untag_ptr(this_ptr);
35978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35980         this_ptr_conv.is_owned = false;
35981         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35982         *ret_copy = LightningError_get_action(&this_ptr_conv);
35983         uint64_t ret_ref = tag_ptr(ret_copy, true);
35984         return ret_ref;
35985 }
35986
35987 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
35988         LDKLightningError this_ptr_conv;
35989         this_ptr_conv.inner = untag_ptr(this_ptr);
35990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35992         this_ptr_conv.is_owned = false;
35993         void* val_ptr = untag_ptr(val);
35994         CHECK_ACCESS(val_ptr);
35995         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
35996         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
35997         LightningError_set_action(&this_ptr_conv, val_conv);
35998 }
35999
36000 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
36001         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
36002         void* action_arg_ptr = untag_ptr(action_arg);
36003         CHECK_ACCESS(action_arg_ptr);
36004         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
36005         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
36006         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
36007         uint64_t ret_ref = 0;
36008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36010         return ret_ref;
36011 }
36012
36013 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
36014         LDKLightningError ret_var = LightningError_clone(arg);
36015         uint64_t ret_ref = 0;
36016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36018         return ret_ref;
36019 }
36020 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
36021         LDKLightningError arg_conv;
36022         arg_conv.inner = untag_ptr(arg);
36023         arg_conv.is_owned = ptr_is_owned(arg);
36024         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36025         arg_conv.is_owned = false;
36026         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
36027         return ret_conv;
36028 }
36029
36030 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
36031         LDKLightningError orig_conv;
36032         orig_conv.inner = untag_ptr(orig);
36033         orig_conv.is_owned = ptr_is_owned(orig);
36034         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36035         orig_conv.is_owned = false;
36036         LDKLightningError ret_var = LightningError_clone(&orig_conv);
36037         uint64_t ret_ref = 0;
36038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36040         return ret_ref;
36041 }
36042
36043 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
36044         LDKCommitmentUpdate this_obj_conv;
36045         this_obj_conv.inner = untag_ptr(this_obj);
36046         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36048         CommitmentUpdate_free(this_obj_conv);
36049 }
36050
36051 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
36052         LDKCommitmentUpdate this_ptr_conv;
36053         this_ptr_conv.inner = untag_ptr(this_ptr);
36054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36056         this_ptr_conv.is_owned = false;
36057         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
36058         uint64_tArray ret_arr = NULL;
36059         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36060         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36061         for (size_t p = 0; p < ret_var.datalen; p++) {
36062                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
36063                 uint64_t ret_conv_15_ref = 0;
36064                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
36065                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
36066                 ret_arr_ptr[p] = ret_conv_15_ref;
36067         }
36068         
36069         FREE(ret_var.data);
36070         return ret_arr;
36071 }
36072
36073 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
36074         LDKCommitmentUpdate this_ptr_conv;
36075         this_ptr_conv.inner = untag_ptr(this_ptr);
36076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36078         this_ptr_conv.is_owned = false;
36079         LDKCVec_UpdateAddHTLCZ val_constr;
36080         val_constr.datalen = val->arr_len;
36081         if (val_constr.datalen > 0)
36082                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
36083         else
36084                 val_constr.data = NULL;
36085         uint64_t* val_vals = val->elems;
36086         for (size_t p = 0; p < val_constr.datalen; p++) {
36087                 uint64_t val_conv_15 = val_vals[p];
36088                 LDKUpdateAddHTLC val_conv_15_conv;
36089                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
36090                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
36091                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
36092                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
36093                 val_constr.data[p] = val_conv_15_conv;
36094         }
36095         FREE(val);
36096         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
36097 }
36098
36099 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
36100         LDKCommitmentUpdate this_ptr_conv;
36101         this_ptr_conv.inner = untag_ptr(this_ptr);
36102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36104         this_ptr_conv.is_owned = false;
36105         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
36106         uint64_tArray ret_arr = NULL;
36107         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36108         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36109         for (size_t t = 0; t < ret_var.datalen; t++) {
36110                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
36111                 uint64_t ret_conv_19_ref = 0;
36112                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
36113                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
36114                 ret_arr_ptr[t] = ret_conv_19_ref;
36115         }
36116         
36117         FREE(ret_var.data);
36118         return ret_arr;
36119 }
36120
36121 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
36122         LDKCommitmentUpdate this_ptr_conv;
36123         this_ptr_conv.inner = untag_ptr(this_ptr);
36124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36126         this_ptr_conv.is_owned = false;
36127         LDKCVec_UpdateFulfillHTLCZ val_constr;
36128         val_constr.datalen = val->arr_len;
36129         if (val_constr.datalen > 0)
36130                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
36131         else
36132                 val_constr.data = NULL;
36133         uint64_t* val_vals = val->elems;
36134         for (size_t t = 0; t < val_constr.datalen; t++) {
36135                 uint64_t val_conv_19 = val_vals[t];
36136                 LDKUpdateFulfillHTLC val_conv_19_conv;
36137                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
36138                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
36139                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
36140                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
36141                 val_constr.data[t] = val_conv_19_conv;
36142         }
36143         FREE(val);
36144         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
36145 }
36146
36147 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
36148         LDKCommitmentUpdate this_ptr_conv;
36149         this_ptr_conv.inner = untag_ptr(this_ptr);
36150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36152         this_ptr_conv.is_owned = false;
36153         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
36154         uint64_tArray ret_arr = NULL;
36155         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36156         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36157         for (size_t q = 0; q < ret_var.datalen; q++) {
36158                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
36159                 uint64_t ret_conv_16_ref = 0;
36160                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
36161                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
36162                 ret_arr_ptr[q] = ret_conv_16_ref;
36163         }
36164         
36165         FREE(ret_var.data);
36166         return ret_arr;
36167 }
36168
36169 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
36170         LDKCommitmentUpdate this_ptr_conv;
36171         this_ptr_conv.inner = untag_ptr(this_ptr);
36172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36174         this_ptr_conv.is_owned = false;
36175         LDKCVec_UpdateFailHTLCZ val_constr;
36176         val_constr.datalen = val->arr_len;
36177         if (val_constr.datalen > 0)
36178                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
36179         else
36180                 val_constr.data = NULL;
36181         uint64_t* val_vals = val->elems;
36182         for (size_t q = 0; q < val_constr.datalen; q++) {
36183                 uint64_t val_conv_16 = val_vals[q];
36184                 LDKUpdateFailHTLC val_conv_16_conv;
36185                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
36186                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
36187                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
36188                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
36189                 val_constr.data[q] = val_conv_16_conv;
36190         }
36191         FREE(val);
36192         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
36193 }
36194
36195 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
36196         LDKCommitmentUpdate this_ptr_conv;
36197         this_ptr_conv.inner = untag_ptr(this_ptr);
36198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36200         this_ptr_conv.is_owned = false;
36201         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
36202         uint64_tArray ret_arr = NULL;
36203         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36204         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36205         for (size_t z = 0; z < ret_var.datalen; z++) {
36206                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
36207                 uint64_t ret_conv_25_ref = 0;
36208                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
36209                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
36210                 ret_arr_ptr[z] = ret_conv_25_ref;
36211         }
36212         
36213         FREE(ret_var.data);
36214         return ret_arr;
36215 }
36216
36217 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) {
36218         LDKCommitmentUpdate this_ptr_conv;
36219         this_ptr_conv.inner = untag_ptr(this_ptr);
36220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36222         this_ptr_conv.is_owned = false;
36223         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
36224         val_constr.datalen = val->arr_len;
36225         if (val_constr.datalen > 0)
36226                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
36227         else
36228                 val_constr.data = NULL;
36229         uint64_t* val_vals = val->elems;
36230         for (size_t z = 0; z < val_constr.datalen; z++) {
36231                 uint64_t val_conv_25 = val_vals[z];
36232                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
36233                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
36234                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
36235                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
36236                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
36237                 val_constr.data[z] = val_conv_25_conv;
36238         }
36239         FREE(val);
36240         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
36241 }
36242
36243 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
36244         LDKCommitmentUpdate this_ptr_conv;
36245         this_ptr_conv.inner = untag_ptr(this_ptr);
36246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36248         this_ptr_conv.is_owned = false;
36249         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
36250         uint64_t ret_ref = 0;
36251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36253         return ret_ref;
36254 }
36255
36256 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
36257         LDKCommitmentUpdate this_ptr_conv;
36258         this_ptr_conv.inner = untag_ptr(this_ptr);
36259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36261         this_ptr_conv.is_owned = false;
36262         LDKUpdateFee val_conv;
36263         val_conv.inner = untag_ptr(val);
36264         val_conv.is_owned = ptr_is_owned(val);
36265         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36266         val_conv = UpdateFee_clone(&val_conv);
36267         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
36268 }
36269
36270 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
36271         LDKCommitmentUpdate this_ptr_conv;
36272         this_ptr_conv.inner = untag_ptr(this_ptr);
36273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36275         this_ptr_conv.is_owned = false;
36276         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
36277         uint64_t ret_ref = 0;
36278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36280         return ret_ref;
36281 }
36282
36283 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
36284         LDKCommitmentUpdate this_ptr_conv;
36285         this_ptr_conv.inner = untag_ptr(this_ptr);
36286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36288         this_ptr_conv.is_owned = false;
36289         LDKCommitmentSigned val_conv;
36290         val_conv.inner = untag_ptr(val);
36291         val_conv.is_owned = ptr_is_owned(val);
36292         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36293         val_conv = CommitmentSigned_clone(&val_conv);
36294         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
36295 }
36296
36297 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) {
36298         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
36299         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
36300         if (update_add_htlcs_arg_constr.datalen > 0)
36301                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
36302         else
36303                 update_add_htlcs_arg_constr.data = NULL;
36304         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
36305         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
36306                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
36307                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
36308                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
36309                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
36310                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
36311                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
36312                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
36313         }
36314         FREE(update_add_htlcs_arg);
36315         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
36316         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
36317         if (update_fulfill_htlcs_arg_constr.datalen > 0)
36318                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
36319         else
36320                 update_fulfill_htlcs_arg_constr.data = NULL;
36321         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
36322         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
36323                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
36324                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
36325                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
36326                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
36327                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
36328                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
36329                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
36330         }
36331         FREE(update_fulfill_htlcs_arg);
36332         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
36333         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
36334         if (update_fail_htlcs_arg_constr.datalen > 0)
36335                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
36336         else
36337                 update_fail_htlcs_arg_constr.data = NULL;
36338         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
36339         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
36340                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
36341                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
36342                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
36343                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
36344                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
36345                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
36346                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
36347         }
36348         FREE(update_fail_htlcs_arg);
36349         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
36350         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
36351         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
36352                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
36353         else
36354                 update_fail_malformed_htlcs_arg_constr.data = NULL;
36355         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
36356         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
36357                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
36358                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
36359                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
36360                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
36361                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
36362                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
36363                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
36364         }
36365         FREE(update_fail_malformed_htlcs_arg);
36366         LDKUpdateFee update_fee_arg_conv;
36367         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
36368         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
36369         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
36370         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
36371         LDKCommitmentSigned commitment_signed_arg_conv;
36372         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
36373         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
36374         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
36375         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
36376         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);
36377         uint64_t ret_ref = 0;
36378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36380         return ret_ref;
36381 }
36382
36383 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
36384         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
36385         uint64_t ret_ref = 0;
36386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36388         return ret_ref;
36389 }
36390 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
36391         LDKCommitmentUpdate arg_conv;
36392         arg_conv.inner = untag_ptr(arg);
36393         arg_conv.is_owned = ptr_is_owned(arg);
36394         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36395         arg_conv.is_owned = false;
36396         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
36397         return ret_conv;
36398 }
36399
36400 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
36401         LDKCommitmentUpdate orig_conv;
36402         orig_conv.inner = untag_ptr(orig);
36403         orig_conv.is_owned = ptr_is_owned(orig);
36404         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36405         orig_conv.is_owned = false;
36406         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
36407         uint64_t ret_ref = 0;
36408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36410         return ret_ref;
36411 }
36412
36413 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
36414         LDKCommitmentUpdate a_conv;
36415         a_conv.inner = untag_ptr(a);
36416         a_conv.is_owned = ptr_is_owned(a);
36417         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36418         a_conv.is_owned = false;
36419         LDKCommitmentUpdate b_conv;
36420         b_conv.inner = untag_ptr(b);
36421         b_conv.is_owned = ptr_is_owned(b);
36422         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36423         b_conv.is_owned = false;
36424         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
36425         return ret_conv;
36426 }
36427
36428 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
36429         if (!ptr_is_owned(this_ptr)) return;
36430         void* this_ptr_ptr = untag_ptr(this_ptr);
36431         CHECK_ACCESS(this_ptr_ptr);
36432         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
36433         FREE(untag_ptr(this_ptr));
36434         ChannelMessageHandler_free(this_ptr_conv);
36435 }
36436
36437 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
36438         if (!ptr_is_owned(this_ptr)) return;
36439         void* this_ptr_ptr = untag_ptr(this_ptr);
36440         CHECK_ACCESS(this_ptr_ptr);
36441         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
36442         FREE(untag_ptr(this_ptr));
36443         RoutingMessageHandler_free(this_ptr_conv);
36444 }
36445
36446 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
36447         if (!ptr_is_owned(this_ptr)) return;
36448         void* this_ptr_ptr = untag_ptr(this_ptr);
36449         CHECK_ACCESS(this_ptr_ptr);
36450         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
36451         FREE(untag_ptr(this_ptr));
36452         OnionMessageHandler_free(this_ptr_conv);
36453 }
36454
36455 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
36456         LDKAcceptChannel obj_conv;
36457         obj_conv.inner = untag_ptr(obj);
36458         obj_conv.is_owned = ptr_is_owned(obj);
36459         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36460         obj_conv.is_owned = false;
36461         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
36462         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36463         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36464         CVec_u8Z_free(ret_var);
36465         return ret_arr;
36466 }
36467
36468 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
36469         LDKu8slice ser_ref;
36470         ser_ref.datalen = ser->arr_len;
36471         ser_ref.data = ser->elems;
36472         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
36473         *ret_conv = AcceptChannel_read(ser_ref);
36474         FREE(ser);
36475         return tag_ptr(ret_conv, true);
36476 }
36477
36478 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
36479         LDKAnnouncementSignatures obj_conv;
36480         obj_conv.inner = untag_ptr(obj);
36481         obj_conv.is_owned = ptr_is_owned(obj);
36482         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36483         obj_conv.is_owned = false;
36484         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
36485         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36486         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36487         CVec_u8Z_free(ret_var);
36488         return ret_arr;
36489 }
36490
36491 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
36492         LDKu8slice ser_ref;
36493         ser_ref.datalen = ser->arr_len;
36494         ser_ref.data = ser->elems;
36495         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
36496         *ret_conv = AnnouncementSignatures_read(ser_ref);
36497         FREE(ser);
36498         return tag_ptr(ret_conv, true);
36499 }
36500
36501 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
36502         LDKChannelReestablish obj_conv;
36503         obj_conv.inner = untag_ptr(obj);
36504         obj_conv.is_owned = ptr_is_owned(obj);
36505         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36506         obj_conv.is_owned = false;
36507         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
36508         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36509         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36510         CVec_u8Z_free(ret_var);
36511         return ret_arr;
36512 }
36513
36514 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
36515         LDKu8slice ser_ref;
36516         ser_ref.datalen = ser->arr_len;
36517         ser_ref.data = ser->elems;
36518         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
36519         *ret_conv = ChannelReestablish_read(ser_ref);
36520         FREE(ser);
36521         return tag_ptr(ret_conv, true);
36522 }
36523
36524 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
36525         LDKClosingSigned obj_conv;
36526         obj_conv.inner = untag_ptr(obj);
36527         obj_conv.is_owned = ptr_is_owned(obj);
36528         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36529         obj_conv.is_owned = false;
36530         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
36531         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36532         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36533         CVec_u8Z_free(ret_var);
36534         return ret_arr;
36535 }
36536
36537 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
36538         LDKu8slice ser_ref;
36539         ser_ref.datalen = ser->arr_len;
36540         ser_ref.data = ser->elems;
36541         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
36542         *ret_conv = ClosingSigned_read(ser_ref);
36543         FREE(ser);
36544         return tag_ptr(ret_conv, true);
36545 }
36546
36547 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
36548         LDKClosingSignedFeeRange obj_conv;
36549         obj_conv.inner = untag_ptr(obj);
36550         obj_conv.is_owned = ptr_is_owned(obj);
36551         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36552         obj_conv.is_owned = false;
36553         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
36554         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36555         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36556         CVec_u8Z_free(ret_var);
36557         return ret_arr;
36558 }
36559
36560 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
36561         LDKu8slice ser_ref;
36562         ser_ref.datalen = ser->arr_len;
36563         ser_ref.data = ser->elems;
36564         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
36565         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
36566         FREE(ser);
36567         return tag_ptr(ret_conv, true);
36568 }
36569
36570 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
36571         LDKCommitmentSigned obj_conv;
36572         obj_conv.inner = untag_ptr(obj);
36573         obj_conv.is_owned = ptr_is_owned(obj);
36574         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36575         obj_conv.is_owned = false;
36576         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
36577         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36578         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36579         CVec_u8Z_free(ret_var);
36580         return ret_arr;
36581 }
36582
36583 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
36584         LDKu8slice ser_ref;
36585         ser_ref.datalen = ser->arr_len;
36586         ser_ref.data = ser->elems;
36587         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
36588         *ret_conv = CommitmentSigned_read(ser_ref);
36589         FREE(ser);
36590         return tag_ptr(ret_conv, true);
36591 }
36592
36593 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
36594         LDKFundingCreated obj_conv;
36595         obj_conv.inner = untag_ptr(obj);
36596         obj_conv.is_owned = ptr_is_owned(obj);
36597         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36598         obj_conv.is_owned = false;
36599         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
36600         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36601         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36602         CVec_u8Z_free(ret_var);
36603         return ret_arr;
36604 }
36605
36606 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
36607         LDKu8slice ser_ref;
36608         ser_ref.datalen = ser->arr_len;
36609         ser_ref.data = ser->elems;
36610         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
36611         *ret_conv = FundingCreated_read(ser_ref);
36612         FREE(ser);
36613         return tag_ptr(ret_conv, true);
36614 }
36615
36616 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
36617         LDKFundingSigned obj_conv;
36618         obj_conv.inner = untag_ptr(obj);
36619         obj_conv.is_owned = ptr_is_owned(obj);
36620         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36621         obj_conv.is_owned = false;
36622         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
36623         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36624         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36625         CVec_u8Z_free(ret_var);
36626         return ret_arr;
36627 }
36628
36629 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
36630         LDKu8slice ser_ref;
36631         ser_ref.datalen = ser->arr_len;
36632         ser_ref.data = ser->elems;
36633         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
36634         *ret_conv = FundingSigned_read(ser_ref);
36635         FREE(ser);
36636         return tag_ptr(ret_conv, true);
36637 }
36638
36639 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
36640         LDKChannelReady obj_conv;
36641         obj_conv.inner = untag_ptr(obj);
36642         obj_conv.is_owned = ptr_is_owned(obj);
36643         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36644         obj_conv.is_owned = false;
36645         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
36646         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36647         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36648         CVec_u8Z_free(ret_var);
36649         return ret_arr;
36650 }
36651
36652 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
36653         LDKu8slice ser_ref;
36654         ser_ref.datalen = ser->arr_len;
36655         ser_ref.data = ser->elems;
36656         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
36657         *ret_conv = ChannelReady_read(ser_ref);
36658         FREE(ser);
36659         return tag_ptr(ret_conv, true);
36660 }
36661
36662 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
36663         LDKInit obj_conv;
36664         obj_conv.inner = untag_ptr(obj);
36665         obj_conv.is_owned = ptr_is_owned(obj);
36666         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36667         obj_conv.is_owned = false;
36668         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
36669         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36670         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36671         CVec_u8Z_free(ret_var);
36672         return ret_arr;
36673 }
36674
36675 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
36676         LDKu8slice ser_ref;
36677         ser_ref.datalen = ser->arr_len;
36678         ser_ref.data = ser->elems;
36679         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
36680         *ret_conv = Init_read(ser_ref);
36681         FREE(ser);
36682         return tag_ptr(ret_conv, true);
36683 }
36684
36685 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
36686         LDKOpenChannel obj_conv;
36687         obj_conv.inner = untag_ptr(obj);
36688         obj_conv.is_owned = ptr_is_owned(obj);
36689         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36690         obj_conv.is_owned = false;
36691         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
36692         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36693         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36694         CVec_u8Z_free(ret_var);
36695         return ret_arr;
36696 }
36697
36698 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
36699         LDKu8slice ser_ref;
36700         ser_ref.datalen = ser->arr_len;
36701         ser_ref.data = ser->elems;
36702         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
36703         *ret_conv = OpenChannel_read(ser_ref);
36704         FREE(ser);
36705         return tag_ptr(ret_conv, true);
36706 }
36707
36708 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
36709         LDKRevokeAndACK obj_conv;
36710         obj_conv.inner = untag_ptr(obj);
36711         obj_conv.is_owned = ptr_is_owned(obj);
36712         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36713         obj_conv.is_owned = false;
36714         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
36715         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36716         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36717         CVec_u8Z_free(ret_var);
36718         return ret_arr;
36719 }
36720
36721 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
36722         LDKu8slice ser_ref;
36723         ser_ref.datalen = ser->arr_len;
36724         ser_ref.data = ser->elems;
36725         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
36726         *ret_conv = RevokeAndACK_read(ser_ref);
36727         FREE(ser);
36728         return tag_ptr(ret_conv, true);
36729 }
36730
36731 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
36732         LDKShutdown obj_conv;
36733         obj_conv.inner = untag_ptr(obj);
36734         obj_conv.is_owned = ptr_is_owned(obj);
36735         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36736         obj_conv.is_owned = false;
36737         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
36738         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36739         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36740         CVec_u8Z_free(ret_var);
36741         return ret_arr;
36742 }
36743
36744 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
36745         LDKu8slice ser_ref;
36746         ser_ref.datalen = ser->arr_len;
36747         ser_ref.data = ser->elems;
36748         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
36749         *ret_conv = Shutdown_read(ser_ref);
36750         FREE(ser);
36751         return tag_ptr(ret_conv, true);
36752 }
36753
36754 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
36755         LDKUpdateFailHTLC obj_conv;
36756         obj_conv.inner = untag_ptr(obj);
36757         obj_conv.is_owned = ptr_is_owned(obj);
36758         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36759         obj_conv.is_owned = false;
36760         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
36761         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36762         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36763         CVec_u8Z_free(ret_var);
36764         return ret_arr;
36765 }
36766
36767 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
36768         LDKu8slice ser_ref;
36769         ser_ref.datalen = ser->arr_len;
36770         ser_ref.data = ser->elems;
36771         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
36772         *ret_conv = UpdateFailHTLC_read(ser_ref);
36773         FREE(ser);
36774         return tag_ptr(ret_conv, true);
36775 }
36776
36777 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
36778         LDKUpdateFailMalformedHTLC obj_conv;
36779         obj_conv.inner = untag_ptr(obj);
36780         obj_conv.is_owned = ptr_is_owned(obj);
36781         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36782         obj_conv.is_owned = false;
36783         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
36784         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36785         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36786         CVec_u8Z_free(ret_var);
36787         return ret_arr;
36788 }
36789
36790 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
36791         LDKu8slice ser_ref;
36792         ser_ref.datalen = ser->arr_len;
36793         ser_ref.data = ser->elems;
36794         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
36795         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
36796         FREE(ser);
36797         return tag_ptr(ret_conv, true);
36798 }
36799
36800 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
36801         LDKUpdateFee obj_conv;
36802         obj_conv.inner = untag_ptr(obj);
36803         obj_conv.is_owned = ptr_is_owned(obj);
36804         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36805         obj_conv.is_owned = false;
36806         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
36807         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36808         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36809         CVec_u8Z_free(ret_var);
36810         return ret_arr;
36811 }
36812
36813 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
36814         LDKu8slice ser_ref;
36815         ser_ref.datalen = ser->arr_len;
36816         ser_ref.data = ser->elems;
36817         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
36818         *ret_conv = UpdateFee_read(ser_ref);
36819         FREE(ser);
36820         return tag_ptr(ret_conv, true);
36821 }
36822
36823 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
36824         LDKUpdateFulfillHTLC obj_conv;
36825         obj_conv.inner = untag_ptr(obj);
36826         obj_conv.is_owned = ptr_is_owned(obj);
36827         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36828         obj_conv.is_owned = false;
36829         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
36830         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36831         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36832         CVec_u8Z_free(ret_var);
36833         return ret_arr;
36834 }
36835
36836 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
36837         LDKu8slice ser_ref;
36838         ser_ref.datalen = ser->arr_len;
36839         ser_ref.data = ser->elems;
36840         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
36841         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
36842         FREE(ser);
36843         return tag_ptr(ret_conv, true);
36844 }
36845
36846 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
36847         LDKUpdateAddHTLC obj_conv;
36848         obj_conv.inner = untag_ptr(obj);
36849         obj_conv.is_owned = ptr_is_owned(obj);
36850         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36851         obj_conv.is_owned = false;
36852         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
36853         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36854         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36855         CVec_u8Z_free(ret_var);
36856         return ret_arr;
36857 }
36858
36859 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
36860         LDKu8slice ser_ref;
36861         ser_ref.datalen = ser->arr_len;
36862         ser_ref.data = ser->elems;
36863         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
36864         *ret_conv = UpdateAddHTLC_read(ser_ref);
36865         FREE(ser);
36866         return tag_ptr(ret_conv, true);
36867 }
36868
36869 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
36870         LDKu8slice ser_ref;
36871         ser_ref.datalen = ser->arr_len;
36872         ser_ref.data = ser->elems;
36873         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
36874         *ret_conv = OnionMessage_read(ser_ref);
36875         FREE(ser);
36876         return tag_ptr(ret_conv, true);
36877 }
36878
36879 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
36880         LDKOnionMessage obj_conv;
36881         obj_conv.inner = untag_ptr(obj);
36882         obj_conv.is_owned = ptr_is_owned(obj);
36883         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36884         obj_conv.is_owned = false;
36885         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
36886         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36887         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36888         CVec_u8Z_free(ret_var);
36889         return ret_arr;
36890 }
36891
36892 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
36893         LDKPing obj_conv;
36894         obj_conv.inner = untag_ptr(obj);
36895         obj_conv.is_owned = ptr_is_owned(obj);
36896         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36897         obj_conv.is_owned = false;
36898         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
36899         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36900         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36901         CVec_u8Z_free(ret_var);
36902         return ret_arr;
36903 }
36904
36905 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
36906         LDKu8slice ser_ref;
36907         ser_ref.datalen = ser->arr_len;
36908         ser_ref.data = ser->elems;
36909         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
36910         *ret_conv = Ping_read(ser_ref);
36911         FREE(ser);
36912         return tag_ptr(ret_conv, true);
36913 }
36914
36915 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
36916         LDKPong obj_conv;
36917         obj_conv.inner = untag_ptr(obj);
36918         obj_conv.is_owned = ptr_is_owned(obj);
36919         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36920         obj_conv.is_owned = false;
36921         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
36922         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36923         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36924         CVec_u8Z_free(ret_var);
36925         return ret_arr;
36926 }
36927
36928 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
36929         LDKu8slice ser_ref;
36930         ser_ref.datalen = ser->arr_len;
36931         ser_ref.data = ser->elems;
36932         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
36933         *ret_conv = Pong_read(ser_ref);
36934         FREE(ser);
36935         return tag_ptr(ret_conv, true);
36936 }
36937
36938 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
36939         LDKUnsignedChannelAnnouncement obj_conv;
36940         obj_conv.inner = untag_ptr(obj);
36941         obj_conv.is_owned = ptr_is_owned(obj);
36942         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36943         obj_conv.is_owned = false;
36944         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
36945         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36946         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36947         CVec_u8Z_free(ret_var);
36948         return ret_arr;
36949 }
36950
36951 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
36952         LDKu8slice ser_ref;
36953         ser_ref.datalen = ser->arr_len;
36954         ser_ref.data = ser->elems;
36955         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
36956         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
36957         FREE(ser);
36958         return tag_ptr(ret_conv, true);
36959 }
36960
36961 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
36962         LDKChannelAnnouncement obj_conv;
36963         obj_conv.inner = untag_ptr(obj);
36964         obj_conv.is_owned = ptr_is_owned(obj);
36965         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36966         obj_conv.is_owned = false;
36967         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
36968         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36969         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36970         CVec_u8Z_free(ret_var);
36971         return ret_arr;
36972 }
36973
36974 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
36975         LDKu8slice ser_ref;
36976         ser_ref.datalen = ser->arr_len;
36977         ser_ref.data = ser->elems;
36978         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
36979         *ret_conv = ChannelAnnouncement_read(ser_ref);
36980         FREE(ser);
36981         return tag_ptr(ret_conv, true);
36982 }
36983
36984 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
36985         LDKUnsignedChannelUpdate obj_conv;
36986         obj_conv.inner = untag_ptr(obj);
36987         obj_conv.is_owned = ptr_is_owned(obj);
36988         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36989         obj_conv.is_owned = false;
36990         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
36991         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36992         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36993         CVec_u8Z_free(ret_var);
36994         return ret_arr;
36995 }
36996
36997 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
36998         LDKu8slice ser_ref;
36999         ser_ref.datalen = ser->arr_len;
37000         ser_ref.data = ser->elems;
37001         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
37002         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
37003         FREE(ser);
37004         return tag_ptr(ret_conv, true);
37005 }
37006
37007 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
37008         LDKChannelUpdate obj_conv;
37009         obj_conv.inner = untag_ptr(obj);
37010         obj_conv.is_owned = ptr_is_owned(obj);
37011         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37012         obj_conv.is_owned = false;
37013         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
37014         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37015         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37016         CVec_u8Z_free(ret_var);
37017         return ret_arr;
37018 }
37019
37020 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
37021         LDKu8slice ser_ref;
37022         ser_ref.datalen = ser->arr_len;
37023         ser_ref.data = ser->elems;
37024         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
37025         *ret_conv = ChannelUpdate_read(ser_ref);
37026         FREE(ser);
37027         return tag_ptr(ret_conv, true);
37028 }
37029
37030 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
37031         LDKErrorMessage obj_conv;
37032         obj_conv.inner = untag_ptr(obj);
37033         obj_conv.is_owned = ptr_is_owned(obj);
37034         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37035         obj_conv.is_owned = false;
37036         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
37037         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37038         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37039         CVec_u8Z_free(ret_var);
37040         return ret_arr;
37041 }
37042
37043 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
37044         LDKu8slice ser_ref;
37045         ser_ref.datalen = ser->arr_len;
37046         ser_ref.data = ser->elems;
37047         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
37048         *ret_conv = ErrorMessage_read(ser_ref);
37049         FREE(ser);
37050         return tag_ptr(ret_conv, true);
37051 }
37052
37053 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
37054         LDKWarningMessage obj_conv;
37055         obj_conv.inner = untag_ptr(obj);
37056         obj_conv.is_owned = ptr_is_owned(obj);
37057         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37058         obj_conv.is_owned = false;
37059         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
37060         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37061         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37062         CVec_u8Z_free(ret_var);
37063         return ret_arr;
37064 }
37065
37066 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
37067         LDKu8slice ser_ref;
37068         ser_ref.datalen = ser->arr_len;
37069         ser_ref.data = ser->elems;
37070         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
37071         *ret_conv = WarningMessage_read(ser_ref);
37072         FREE(ser);
37073         return tag_ptr(ret_conv, true);
37074 }
37075
37076 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
37077         LDKUnsignedNodeAnnouncement obj_conv;
37078         obj_conv.inner = untag_ptr(obj);
37079         obj_conv.is_owned = ptr_is_owned(obj);
37080         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37081         obj_conv.is_owned = false;
37082         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
37083         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37084         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37085         CVec_u8Z_free(ret_var);
37086         return ret_arr;
37087 }
37088
37089 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
37090         LDKu8slice ser_ref;
37091         ser_ref.datalen = ser->arr_len;
37092         ser_ref.data = ser->elems;
37093         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
37094         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
37095         FREE(ser);
37096         return tag_ptr(ret_conv, true);
37097 }
37098
37099 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
37100         LDKNodeAnnouncement obj_conv;
37101         obj_conv.inner = untag_ptr(obj);
37102         obj_conv.is_owned = ptr_is_owned(obj);
37103         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37104         obj_conv.is_owned = false;
37105         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
37106         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37107         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37108         CVec_u8Z_free(ret_var);
37109         return ret_arr;
37110 }
37111
37112 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
37113         LDKu8slice ser_ref;
37114         ser_ref.datalen = ser->arr_len;
37115         ser_ref.data = ser->elems;
37116         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
37117         *ret_conv = NodeAnnouncement_read(ser_ref);
37118         FREE(ser);
37119         return tag_ptr(ret_conv, true);
37120 }
37121
37122 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
37123         LDKu8slice ser_ref;
37124         ser_ref.datalen = ser->arr_len;
37125         ser_ref.data = ser->elems;
37126         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
37127         *ret_conv = QueryShortChannelIds_read(ser_ref);
37128         FREE(ser);
37129         return tag_ptr(ret_conv, true);
37130 }
37131
37132 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
37133         LDKQueryShortChannelIds obj_conv;
37134         obj_conv.inner = untag_ptr(obj);
37135         obj_conv.is_owned = ptr_is_owned(obj);
37136         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37137         obj_conv.is_owned = false;
37138         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
37139         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37140         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37141         CVec_u8Z_free(ret_var);
37142         return ret_arr;
37143 }
37144
37145 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
37146         LDKReplyShortChannelIdsEnd obj_conv;
37147         obj_conv.inner = untag_ptr(obj);
37148         obj_conv.is_owned = ptr_is_owned(obj);
37149         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37150         obj_conv.is_owned = false;
37151         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
37152         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37153         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37154         CVec_u8Z_free(ret_var);
37155         return ret_arr;
37156 }
37157
37158 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
37159         LDKu8slice ser_ref;
37160         ser_ref.datalen = ser->arr_len;
37161         ser_ref.data = ser->elems;
37162         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
37163         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
37164         FREE(ser);
37165         return tag_ptr(ret_conv, true);
37166 }
37167
37168 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
37169         LDKQueryChannelRange this_arg_conv;
37170         this_arg_conv.inner = untag_ptr(this_arg);
37171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37173         this_arg_conv.is_owned = false;
37174         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
37175         return ret_conv;
37176 }
37177
37178 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
37179         LDKQueryChannelRange obj_conv;
37180         obj_conv.inner = untag_ptr(obj);
37181         obj_conv.is_owned = ptr_is_owned(obj);
37182         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37183         obj_conv.is_owned = false;
37184         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
37185         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37186         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37187         CVec_u8Z_free(ret_var);
37188         return ret_arr;
37189 }
37190
37191 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
37192         LDKu8slice ser_ref;
37193         ser_ref.datalen = ser->arr_len;
37194         ser_ref.data = ser->elems;
37195         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
37196         *ret_conv = QueryChannelRange_read(ser_ref);
37197         FREE(ser);
37198         return tag_ptr(ret_conv, true);
37199 }
37200
37201 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
37202         LDKu8slice ser_ref;
37203         ser_ref.datalen = ser->arr_len;
37204         ser_ref.data = ser->elems;
37205         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
37206         *ret_conv = ReplyChannelRange_read(ser_ref);
37207         FREE(ser);
37208         return tag_ptr(ret_conv, true);
37209 }
37210
37211 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
37212         LDKReplyChannelRange obj_conv;
37213         obj_conv.inner = untag_ptr(obj);
37214         obj_conv.is_owned = ptr_is_owned(obj);
37215         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37216         obj_conv.is_owned = false;
37217         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
37218         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37219         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37220         CVec_u8Z_free(ret_var);
37221         return ret_arr;
37222 }
37223
37224 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
37225         LDKGossipTimestampFilter obj_conv;
37226         obj_conv.inner = untag_ptr(obj);
37227         obj_conv.is_owned = ptr_is_owned(obj);
37228         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37229         obj_conv.is_owned = false;
37230         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
37231         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37232         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37233         CVec_u8Z_free(ret_var);
37234         return ret_arr;
37235 }
37236
37237 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
37238         LDKu8slice ser_ref;
37239         ser_ref.datalen = ser->arr_len;
37240         ser_ref.data = ser->elems;
37241         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
37242         *ret_conv = GossipTimestampFilter_read(ser_ref);
37243         FREE(ser);
37244         return tag_ptr(ret_conv, true);
37245 }
37246
37247 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
37248         if (!ptr_is_owned(this_ptr)) return;
37249         void* this_ptr_ptr = untag_ptr(this_ptr);
37250         CHECK_ACCESS(this_ptr_ptr);
37251         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
37252         FREE(untag_ptr(this_ptr));
37253         CustomMessageHandler_free(this_ptr_conv);
37254 }
37255
37256 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
37257         LDKIgnoringMessageHandler this_obj_conv;
37258         this_obj_conv.inner = untag_ptr(this_obj);
37259         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37261         IgnoringMessageHandler_free(this_obj_conv);
37262 }
37263
37264 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
37265         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
37266         uint64_t ret_ref = 0;
37267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37269         return ret_ref;
37270 }
37271
37272 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
37273         LDKIgnoringMessageHandler this_arg_conv;
37274         this_arg_conv.inner = untag_ptr(this_arg);
37275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37277         this_arg_conv.is_owned = false;
37278         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
37279         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
37280         return tag_ptr(ret_ret, true);
37281 }
37282
37283 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
37284         LDKIgnoringMessageHandler this_arg_conv;
37285         this_arg_conv.inner = untag_ptr(this_arg);
37286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37288         this_arg_conv.is_owned = false;
37289         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
37290         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
37291         return tag_ptr(ret_ret, true);
37292 }
37293
37294 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageProvider"))) TS_IgnoringMessageHandler_as_OnionMessageProvider(uint64_t this_arg) {
37295         LDKIgnoringMessageHandler this_arg_conv;
37296         this_arg_conv.inner = untag_ptr(this_arg);
37297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37299         this_arg_conv.is_owned = false;
37300         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
37301         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
37302         return tag_ptr(ret_ret, true);
37303 }
37304
37305 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
37306         LDKIgnoringMessageHandler this_arg_conv;
37307         this_arg_conv.inner = untag_ptr(this_arg);
37308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37310         this_arg_conv.is_owned = false;
37311         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
37312         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
37313         return tag_ptr(ret_ret, true);
37314 }
37315
37316 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
37317         LDKIgnoringMessageHandler this_arg_conv;
37318         this_arg_conv.inner = untag_ptr(this_arg);
37319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37321         this_arg_conv.is_owned = false;
37322         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
37323         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
37324         return tag_ptr(ret_ret, true);
37325 }
37326
37327 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
37328         LDKIgnoringMessageHandler this_arg_conv;
37329         this_arg_conv.inner = untag_ptr(this_arg);
37330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37332         this_arg_conv.is_owned = false;
37333         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
37334         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
37335         return tag_ptr(ret_ret, true);
37336 }
37337
37338 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
37339         LDKIgnoringMessageHandler this_arg_conv;
37340         this_arg_conv.inner = untag_ptr(this_arg);
37341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37343         this_arg_conv.is_owned = false;
37344         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
37345         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
37346         return tag_ptr(ret_ret, true);
37347 }
37348
37349 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
37350         LDKErroringMessageHandler this_obj_conv;
37351         this_obj_conv.inner = untag_ptr(this_obj);
37352         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37354         ErroringMessageHandler_free(this_obj_conv);
37355 }
37356
37357 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
37358         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
37359         uint64_t ret_ref = 0;
37360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37362         return ret_ref;
37363 }
37364
37365 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
37366         LDKErroringMessageHandler this_arg_conv;
37367         this_arg_conv.inner = untag_ptr(this_arg);
37368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37370         this_arg_conv.is_owned = false;
37371         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
37372         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
37373         return tag_ptr(ret_ret, true);
37374 }
37375
37376 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
37377         LDKErroringMessageHandler this_arg_conv;
37378         this_arg_conv.inner = untag_ptr(this_arg);
37379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37381         this_arg_conv.is_owned = false;
37382         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
37383         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
37384         return tag_ptr(ret_ret, true);
37385 }
37386
37387 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
37388         LDKMessageHandler this_obj_conv;
37389         this_obj_conv.inner = untag_ptr(this_obj);
37390         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37392         MessageHandler_free(this_obj_conv);
37393 }
37394
37395 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
37396         LDKMessageHandler this_ptr_conv;
37397         this_ptr_conv.inner = untag_ptr(this_ptr);
37398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37400         this_ptr_conv.is_owned = false;
37401         // WARNING: This object doesn't live past this scope, needs clone!
37402         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
37403         return ret_ret;
37404 }
37405
37406 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
37407         LDKMessageHandler this_ptr_conv;
37408         this_ptr_conv.inner = untag_ptr(this_ptr);
37409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37411         this_ptr_conv.is_owned = false;
37412         void* val_ptr = untag_ptr(val);
37413         CHECK_ACCESS(val_ptr);
37414         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
37415         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
37416                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37417                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
37418         }
37419         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
37420 }
37421
37422 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
37423         LDKMessageHandler this_ptr_conv;
37424         this_ptr_conv.inner = untag_ptr(this_ptr);
37425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37427         this_ptr_conv.is_owned = false;
37428         // WARNING: This object doesn't live past this scope, needs clone!
37429         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
37430         return ret_ret;
37431 }
37432
37433 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
37434         LDKMessageHandler this_ptr_conv;
37435         this_ptr_conv.inner = untag_ptr(this_ptr);
37436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37438         this_ptr_conv.is_owned = false;
37439         void* val_ptr = untag_ptr(val);
37440         CHECK_ACCESS(val_ptr);
37441         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
37442         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
37443                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37444                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
37445         }
37446         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
37447 }
37448
37449 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
37450         LDKMessageHandler this_ptr_conv;
37451         this_ptr_conv.inner = untag_ptr(this_ptr);
37452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37454         this_ptr_conv.is_owned = false;
37455         // WARNING: This object doesn't live past this scope, needs clone!
37456         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
37457         return ret_ret;
37458 }
37459
37460 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
37461         LDKMessageHandler this_ptr_conv;
37462         this_ptr_conv.inner = untag_ptr(this_ptr);
37463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37465         this_ptr_conv.is_owned = false;
37466         void* val_ptr = untag_ptr(val);
37467         CHECK_ACCESS(val_ptr);
37468         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
37469         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
37470                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37471                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
37472         }
37473         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
37474 }
37475
37476 uint64_t  __attribute__((export_name("TS_MessageHandler_new"))) TS_MessageHandler_new(uint64_t chan_handler_arg, uint64_t route_handler_arg, uint64_t onion_message_handler_arg) {
37477         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
37478         CHECK_ACCESS(chan_handler_arg_ptr);
37479         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
37480         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
37481                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37482                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
37483         }
37484         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
37485         CHECK_ACCESS(route_handler_arg_ptr);
37486         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
37487         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
37488                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37489                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
37490         }
37491         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
37492         CHECK_ACCESS(onion_message_handler_arg_ptr);
37493         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
37494         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
37495                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37496                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
37497         }
37498         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv);
37499         uint64_t ret_ref = 0;
37500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37502         return ret_ref;
37503 }
37504
37505 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
37506         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37507         *ret_ret = SocketDescriptor_clone(arg);
37508         return tag_ptr(ret_ret, true);
37509 }
37510 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
37511         void* arg_ptr = untag_ptr(arg);
37512         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
37513         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
37514         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
37515         return ret_conv;
37516 }
37517
37518 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
37519         void* orig_ptr = untag_ptr(orig);
37520         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
37521         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
37522         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37523         *ret_ret = SocketDescriptor_clone(orig_conv);
37524         return tag_ptr(ret_ret, true);
37525 }
37526
37527 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_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         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
37532         FREE(untag_ptr(this_ptr));
37533         SocketDescriptor_free(this_ptr_conv);
37534 }
37535
37536 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
37537         LDKPeerHandleError 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         PeerHandleError_free(this_obj_conv);
37542 }
37543
37544 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new() {
37545         LDKPeerHandleError ret_var = PeerHandleError_new();
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
37552 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
37553         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
37554         uint64_t ret_ref = 0;
37555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37557         return ret_ref;
37558 }
37559 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
37560         LDKPeerHandleError arg_conv;
37561         arg_conv.inner = untag_ptr(arg);
37562         arg_conv.is_owned = ptr_is_owned(arg);
37563         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37564         arg_conv.is_owned = false;
37565         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
37566         return ret_conv;
37567 }
37568
37569 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
37570         LDKPeerHandleError orig_conv;
37571         orig_conv.inner = untag_ptr(orig);
37572         orig_conv.is_owned = ptr_is_owned(orig);
37573         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37574         orig_conv.is_owned = false;
37575         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
37576         uint64_t ret_ref = 0;
37577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37579         return ret_ref;
37580 }
37581
37582 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
37583         LDKPeerManager this_obj_conv;
37584         this_obj_conv.inner = untag_ptr(this_obj);
37585         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37587         PeerManager_free(this_obj_conv);
37588 }
37589
37590 uint64_t  __attribute__((export_name("TS_PeerManager_new"))) TS_PeerManager_new(uint64_t message_handler, int32_t current_time, int8_tArray ephemeral_random_data, uint64_t logger, uint64_t custom_message_handler, uint64_t node_signer) {
37591         LDKMessageHandler message_handler_conv;
37592         message_handler_conv.inner = untag_ptr(message_handler);
37593         message_handler_conv.is_owned = ptr_is_owned(message_handler);
37594         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
37595         // WARNING: we need a move here but no clone is available for LDKMessageHandler
37596         
37597         uint8_t ephemeral_random_data_arr[32];
37598         CHECK(ephemeral_random_data->arr_len == 32);
37599         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
37600         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
37601         void* logger_ptr = untag_ptr(logger);
37602         CHECK_ACCESS(logger_ptr);
37603         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37604         if (logger_conv.free == LDKLogger_JCalls_free) {
37605                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37606                 LDKLogger_JCalls_cloned(&logger_conv);
37607         }
37608         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
37609         CHECK_ACCESS(custom_message_handler_ptr);
37610         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
37611         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
37612                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37613                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
37614         }
37615         void* node_signer_ptr = untag_ptr(node_signer);
37616         CHECK_ACCESS(node_signer_ptr);
37617         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
37618         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
37619                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37620                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
37621         }
37622         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv, node_signer_conv);
37623         uint64_t ret_ref = 0;
37624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37626         return ret_ref;
37627 }
37628
37629 uint64_tArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
37630         LDKPeerManager this_arg_conv;
37631         this_arg_conv.inner = untag_ptr(this_arg);
37632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37634         this_arg_conv.is_owned = false;
37635         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
37636         uint64_tArray ret_arr = NULL;
37637         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
37638         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
37639         for (size_t o = 0; o < ret_var.datalen; o++) {
37640                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
37641                 *ret_conv_40_conv = ret_var.data[o];
37642                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
37643         }
37644         
37645         FREE(ret_var.data);
37646         return ret_arr;
37647 }
37648
37649 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) {
37650         LDKPeerManager this_arg_conv;
37651         this_arg_conv.inner = untag_ptr(this_arg);
37652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37654         this_arg_conv.is_owned = false;
37655         LDKPublicKey their_node_id_ref;
37656         CHECK(their_node_id->arr_len == 33);
37657         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
37658         void* descriptor_ptr = untag_ptr(descriptor);
37659         CHECK_ACCESS(descriptor_ptr);
37660         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37661         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37662                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37663                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37664         }
37665         void* remote_network_address_ptr = untag_ptr(remote_network_address);
37666         CHECK_ACCESS(remote_network_address_ptr);
37667         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37668         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
37669         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
37670         return tag_ptr(ret_conv, true);
37671 }
37672
37673 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) {
37674         LDKPeerManager this_arg_conv;
37675         this_arg_conv.inner = untag_ptr(this_arg);
37676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37678         this_arg_conv.is_owned = false;
37679         void* descriptor_ptr = untag_ptr(descriptor);
37680         CHECK_ACCESS(descriptor_ptr);
37681         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37682         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37683                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37684                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37685         }
37686         void* remote_network_address_ptr = untag_ptr(remote_network_address);
37687         CHECK_ACCESS(remote_network_address_ptr);
37688         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37689         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37690         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
37691         return tag_ptr(ret_conv, true);
37692 }
37693
37694 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
37695         LDKPeerManager this_arg_conv;
37696         this_arg_conv.inner = untag_ptr(this_arg);
37697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37699         this_arg_conv.is_owned = false;
37700         void* descriptor_ptr = untag_ptr(descriptor);
37701         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
37702         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37703         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37704         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
37705         return tag_ptr(ret_conv, true);
37706 }
37707
37708 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
37709         LDKPeerManager this_arg_conv;
37710         this_arg_conv.inner = untag_ptr(this_arg);
37711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37713         this_arg_conv.is_owned = false;
37714         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
37715         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
37716         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
37717         LDKu8slice data_ref;
37718         data_ref.datalen = data->arr_len;
37719         data_ref.data = data->elems;
37720         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
37721         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
37722         FREE(data);
37723         return tag_ptr(ret_conv, true);
37724 }
37725
37726 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
37727         LDKPeerManager this_arg_conv;
37728         this_arg_conv.inner = untag_ptr(this_arg);
37729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37731         this_arg_conv.is_owned = false;
37732         PeerManager_process_events(&this_arg_conv);
37733 }
37734
37735 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
37736         LDKPeerManager this_arg_conv;
37737         this_arg_conv.inner = untag_ptr(this_arg);
37738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37740         this_arg_conv.is_owned = false;
37741         void* descriptor_ptr = untag_ptr(descriptor);
37742         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
37743         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37744         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
37745 }
37746
37747 void  __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id) {
37748         LDKPeerManager this_arg_conv;
37749         this_arg_conv.inner = untag_ptr(this_arg);
37750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37752         this_arg_conv.is_owned = false;
37753         LDKPublicKey node_id_ref;
37754         CHECK(node_id->arr_len == 33);
37755         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
37756         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
37757 }
37758
37759 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
37760         LDKPeerManager this_arg_conv;
37761         this_arg_conv.inner = untag_ptr(this_arg);
37762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37764         this_arg_conv.is_owned = false;
37765         PeerManager_disconnect_all_peers(&this_arg_conv);
37766 }
37767
37768 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
37769         LDKPeerManager this_arg_conv;
37770         this_arg_conv.inner = untag_ptr(this_arg);
37771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37773         this_arg_conv.is_owned = false;
37774         PeerManager_timer_tick_occurred(&this_arg_conv);
37775 }
37776
37777 void  __attribute__((export_name("TS_PeerManager_broadcast_node_announcement"))) TS_PeerManager_broadcast_node_announcement(uint64_t this_arg, int8_tArray rgb, int8_tArray alias, uint64_tArray addresses) {
37778         LDKPeerManager this_arg_conv;
37779         this_arg_conv.inner = untag_ptr(this_arg);
37780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37782         this_arg_conv.is_owned = false;
37783         LDKThreeBytes rgb_ref;
37784         CHECK(rgb->arr_len == 3);
37785         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
37786         LDKThirtyTwoBytes alias_ref;
37787         CHECK(alias->arr_len == 32);
37788         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
37789         LDKCVec_NetAddressZ addresses_constr;
37790         addresses_constr.datalen = addresses->arr_len;
37791         if (addresses_constr.datalen > 0)
37792                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
37793         else
37794                 addresses_constr.data = NULL;
37795         uint64_t* addresses_vals = addresses->elems;
37796         for (size_t m = 0; m < addresses_constr.datalen; m++) {
37797                 uint64_t addresses_conv_12 = addresses_vals[m];
37798                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
37799                 CHECK_ACCESS(addresses_conv_12_ptr);
37800                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
37801                 addresses_constr.data[m] = addresses_conv_12_conv;
37802         }
37803         FREE(addresses);
37804         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
37805 }
37806
37807 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
37808         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
37809         return ret_conv;
37810 }
37811
37812 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
37813         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
37814         return ret_conv;
37815 }
37816
37817 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
37818         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
37819         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
37820         return ret_conv;
37821 }
37822
37823 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
37824         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
37825         return ret_conv;
37826 }
37827
37828 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
37829         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
37830         return ret_conv;
37831 }
37832
37833 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
37834         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
37835         return ret_conv;
37836 }
37837
37838 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
37839         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
37840         return ret_conv;
37841 }
37842
37843 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
37844         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
37845         return ret_conv;
37846 }
37847
37848 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
37849         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
37850         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
37851         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
37852         return ret_conv;
37853 }
37854
37855 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
37856         LDKWitness witness_ref;
37857         witness_ref.datalen = witness->arr_len;
37858         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
37859         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
37860         witness_ref.data_is_owned = true;
37861         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
37862         *ret_copy = HTLCClaim_from_witness(witness_ref);
37863         uint64_t ret_ref = tag_ptr(ret_copy, true);
37864         return ret_ref;
37865 }
37866
37867 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
37868         uint8_t commitment_seed_arr[32];
37869         CHECK(commitment_seed->arr_len == 32);
37870         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
37871         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
37872         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37873         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
37874         return ret_arr;
37875 }
37876
37877 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) {
37878         LDKCVec_u8Z to_holder_script_ref;
37879         to_holder_script_ref.datalen = to_holder_script->arr_len;
37880         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
37881         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
37882         LDKCVec_u8Z to_counterparty_script_ref;
37883         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
37884         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
37885         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
37886         LDKOutPoint funding_outpoint_conv;
37887         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
37888         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
37889         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37890         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37891         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);
37892         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37893         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37894         Transaction_free(ret_var);
37895         return ret_arr;
37896 }
37897
37898 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
37899         LDKCounterpartyCommitmentSecrets this_obj_conv;
37900         this_obj_conv.inner = untag_ptr(this_obj);
37901         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37903         CounterpartyCommitmentSecrets_free(this_obj_conv);
37904 }
37905
37906 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
37907         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
37908         uint64_t ret_ref = 0;
37909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37911         return ret_ref;
37912 }
37913 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
37914         LDKCounterpartyCommitmentSecrets arg_conv;
37915         arg_conv.inner = untag_ptr(arg);
37916         arg_conv.is_owned = ptr_is_owned(arg);
37917         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37918         arg_conv.is_owned = false;
37919         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
37920         return ret_conv;
37921 }
37922
37923 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
37924         LDKCounterpartyCommitmentSecrets orig_conv;
37925         orig_conv.inner = untag_ptr(orig);
37926         orig_conv.is_owned = ptr_is_owned(orig);
37927         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37928         orig_conv.is_owned = false;
37929         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
37930         uint64_t ret_ref = 0;
37931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37933         return ret_ref;
37934 }
37935
37936 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
37937         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
37938         uint64_t ret_ref = 0;
37939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37941         return ret_ref;
37942 }
37943
37944 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
37945         LDKCounterpartyCommitmentSecrets this_arg_conv;
37946         this_arg_conv.inner = untag_ptr(this_arg);
37947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37949         this_arg_conv.is_owned = false;
37950         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
37951         return ret_conv;
37952 }
37953
37954 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
37955         LDKCounterpartyCommitmentSecrets this_arg_conv;
37956         this_arg_conv.inner = untag_ptr(this_arg);
37957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37959         this_arg_conv.is_owned = false;
37960         LDKThirtyTwoBytes secret_ref;
37961         CHECK(secret->arr_len == 32);
37962         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
37963         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
37964         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
37965         return tag_ptr(ret_conv, true);
37966 }
37967
37968 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
37969         LDKCounterpartyCommitmentSecrets this_arg_conv;
37970         this_arg_conv.inner = untag_ptr(this_arg);
37971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37973         this_arg_conv.is_owned = false;
37974         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37975         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
37976         return ret_arr;
37977 }
37978
37979 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
37980         LDKCounterpartyCommitmentSecrets obj_conv;
37981         obj_conv.inner = untag_ptr(obj);
37982         obj_conv.is_owned = ptr_is_owned(obj);
37983         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37984         obj_conv.is_owned = false;
37985         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
37986         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37987         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37988         CVec_u8Z_free(ret_var);
37989         return ret_arr;
37990 }
37991
37992 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
37993         LDKu8slice ser_ref;
37994         ser_ref.datalen = ser->arr_len;
37995         ser_ref.data = ser->elems;
37996         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
37997         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
37998         FREE(ser);
37999         return tag_ptr(ret_conv, true);
38000 }
38001
38002 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
38003         LDKPublicKey per_commitment_point_ref;
38004         CHECK(per_commitment_point->arr_len == 33);
38005         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
38006         uint8_t base_secret_arr[32];
38007         CHECK(base_secret->arr_len == 32);
38008         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
38009         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
38010         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38011         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
38012         return ret_arr;
38013 }
38014
38015 int8_tArray  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
38016         LDKPublicKey per_commitment_point_ref;
38017         CHECK(per_commitment_point->arr_len == 33);
38018         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
38019         LDKPublicKey base_point_ref;
38020         CHECK(base_point->arr_len == 33);
38021         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
38022         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38023         memcpy(ret_arr->elems, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form, 33);
38024         return ret_arr;
38025 }
38026
38027 int8_tArray  __attribute__((export_name("TS_derive_private_revocation_key"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
38028         uint8_t per_commitment_secret_arr[32];
38029         CHECK(per_commitment_secret->arr_len == 32);
38030         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
38031         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
38032         uint8_t countersignatory_revocation_base_secret_arr[32];
38033         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
38034         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
38035         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
38036         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38037         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
38038         return ret_arr;
38039 }
38040
38041 int8_tArray  __attribute__((export_name("TS_derive_public_revocation_key"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
38042         LDKPublicKey per_commitment_point_ref;
38043         CHECK(per_commitment_point->arr_len == 33);
38044         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
38045         LDKPublicKey countersignatory_revocation_base_point_ref;
38046         CHECK(countersignatory_revocation_base_point->arr_len == 33);
38047         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
38048         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38049         memcpy(ret_arr->elems, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form, 33);
38050         return ret_arr;
38051 }
38052
38053 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
38054         LDKTxCreationKeys this_obj_conv;
38055         this_obj_conv.inner = untag_ptr(this_obj);
38056         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38058         TxCreationKeys_free(this_obj_conv);
38059 }
38060
38061 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
38062         LDKTxCreationKeys this_ptr_conv;
38063         this_ptr_conv.inner = untag_ptr(this_ptr);
38064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38066         this_ptr_conv.is_owned = false;
38067         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38068         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
38069         return ret_arr;
38070 }
38071
38072 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
38073         LDKTxCreationKeys this_ptr_conv;
38074         this_ptr_conv.inner = untag_ptr(this_ptr);
38075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38077         this_ptr_conv.is_owned = false;
38078         LDKPublicKey val_ref;
38079         CHECK(val->arr_len == 33);
38080         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38081         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
38082 }
38083
38084 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
38085         LDKTxCreationKeys this_ptr_conv;
38086         this_ptr_conv.inner = untag_ptr(this_ptr);
38087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38089         this_ptr_conv.is_owned = false;
38090         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38091         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
38092         return ret_arr;
38093 }
38094
38095 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
38096         LDKTxCreationKeys this_ptr_conv;
38097         this_ptr_conv.inner = untag_ptr(this_ptr);
38098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38100         this_ptr_conv.is_owned = false;
38101         LDKPublicKey val_ref;
38102         CHECK(val->arr_len == 33);
38103         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38104         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
38105 }
38106
38107 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
38108         LDKTxCreationKeys this_ptr_conv;
38109         this_ptr_conv.inner = untag_ptr(this_ptr);
38110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38112         this_ptr_conv.is_owned = false;
38113         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38114         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
38115         return ret_arr;
38116 }
38117
38118 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
38119         LDKTxCreationKeys 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         LDKPublicKey val_ref;
38125         CHECK(val->arr_len == 33);
38126         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38127         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
38128 }
38129
38130 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
38131         LDKTxCreationKeys this_ptr_conv;
38132         this_ptr_conv.inner = untag_ptr(this_ptr);
38133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38135         this_ptr_conv.is_owned = false;
38136         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38137         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
38138         return ret_arr;
38139 }
38140
38141 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
38142         LDKTxCreationKeys this_ptr_conv;
38143         this_ptr_conv.inner = untag_ptr(this_ptr);
38144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38146         this_ptr_conv.is_owned = false;
38147         LDKPublicKey val_ref;
38148         CHECK(val->arr_len == 33);
38149         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38150         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
38151 }
38152
38153 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
38154         LDKTxCreationKeys this_ptr_conv;
38155         this_ptr_conv.inner = untag_ptr(this_ptr);
38156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38158         this_ptr_conv.is_owned = false;
38159         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38160         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
38161         return ret_arr;
38162 }
38163
38164 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) {
38165         LDKTxCreationKeys this_ptr_conv;
38166         this_ptr_conv.inner = untag_ptr(this_ptr);
38167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38169         this_ptr_conv.is_owned = false;
38170         LDKPublicKey val_ref;
38171         CHECK(val->arr_len == 33);
38172         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38173         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
38174 }
38175
38176 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) {
38177         LDKPublicKey per_commitment_point_arg_ref;
38178         CHECK(per_commitment_point_arg->arr_len == 33);
38179         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
38180         LDKPublicKey revocation_key_arg_ref;
38181         CHECK(revocation_key_arg->arr_len == 33);
38182         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
38183         LDKPublicKey broadcaster_htlc_key_arg_ref;
38184         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
38185         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
38186         LDKPublicKey countersignatory_htlc_key_arg_ref;
38187         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
38188         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
38189         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
38190         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
38191         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
38192         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);
38193         uint64_t ret_ref = 0;
38194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38196         return ret_ref;
38197 }
38198
38199 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
38200         LDKTxCreationKeys a_conv;
38201         a_conv.inner = untag_ptr(a);
38202         a_conv.is_owned = ptr_is_owned(a);
38203         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38204         a_conv.is_owned = false;
38205         LDKTxCreationKeys b_conv;
38206         b_conv.inner = untag_ptr(b);
38207         b_conv.is_owned = ptr_is_owned(b);
38208         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38209         b_conv.is_owned = false;
38210         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
38211         return ret_conv;
38212 }
38213
38214 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
38215         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
38216         uint64_t ret_ref = 0;
38217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38219         return ret_ref;
38220 }
38221 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
38222         LDKTxCreationKeys arg_conv;
38223         arg_conv.inner = untag_ptr(arg);
38224         arg_conv.is_owned = ptr_is_owned(arg);
38225         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38226         arg_conv.is_owned = false;
38227         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
38228         return ret_conv;
38229 }
38230
38231 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
38232         LDKTxCreationKeys orig_conv;
38233         orig_conv.inner = untag_ptr(orig);
38234         orig_conv.is_owned = ptr_is_owned(orig);
38235         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38236         orig_conv.is_owned = false;
38237         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
38238         uint64_t ret_ref = 0;
38239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38241         return ret_ref;
38242 }
38243
38244 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
38245         LDKTxCreationKeys obj_conv;
38246         obj_conv.inner = untag_ptr(obj);
38247         obj_conv.is_owned = ptr_is_owned(obj);
38248         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38249         obj_conv.is_owned = false;
38250         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
38251         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38252         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38253         CVec_u8Z_free(ret_var);
38254         return ret_arr;
38255 }
38256
38257 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
38258         LDKu8slice ser_ref;
38259         ser_ref.datalen = ser->arr_len;
38260         ser_ref.data = ser->elems;
38261         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
38262         *ret_conv = TxCreationKeys_read(ser_ref);
38263         FREE(ser);
38264         return tag_ptr(ret_conv, true);
38265 }
38266
38267 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
38268         LDKChannelPublicKeys this_obj_conv;
38269         this_obj_conv.inner = untag_ptr(this_obj);
38270         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38272         ChannelPublicKeys_free(this_obj_conv);
38273 }
38274
38275 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
38276         LDKChannelPublicKeys this_ptr_conv;
38277         this_ptr_conv.inner = untag_ptr(this_ptr);
38278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38280         this_ptr_conv.is_owned = false;
38281         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38282         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
38283         return ret_arr;
38284 }
38285
38286 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
38287         LDKChannelPublicKeys this_ptr_conv;
38288         this_ptr_conv.inner = untag_ptr(this_ptr);
38289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38291         this_ptr_conv.is_owned = false;
38292         LDKPublicKey val_ref;
38293         CHECK(val->arr_len == 33);
38294         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38295         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
38296 }
38297
38298 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
38299         LDKChannelPublicKeys this_ptr_conv;
38300         this_ptr_conv.inner = untag_ptr(this_ptr);
38301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38303         this_ptr_conv.is_owned = false;
38304         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38305         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
38306         return ret_arr;
38307 }
38308
38309 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
38310         LDKChannelPublicKeys this_ptr_conv;
38311         this_ptr_conv.inner = untag_ptr(this_ptr);
38312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38314         this_ptr_conv.is_owned = false;
38315         LDKPublicKey val_ref;
38316         CHECK(val->arr_len == 33);
38317         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38318         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
38319 }
38320
38321 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
38322         LDKChannelPublicKeys this_ptr_conv;
38323         this_ptr_conv.inner = untag_ptr(this_ptr);
38324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38326         this_ptr_conv.is_owned = false;
38327         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38328         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
38329         return ret_arr;
38330 }
38331
38332 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
38333         LDKChannelPublicKeys this_ptr_conv;
38334         this_ptr_conv.inner = untag_ptr(this_ptr);
38335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38337         this_ptr_conv.is_owned = false;
38338         LDKPublicKey val_ref;
38339         CHECK(val->arr_len == 33);
38340         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38341         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
38342 }
38343
38344 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
38345         LDKChannelPublicKeys this_ptr_conv;
38346         this_ptr_conv.inner = untag_ptr(this_ptr);
38347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38349         this_ptr_conv.is_owned = false;
38350         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38351         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
38352         return ret_arr;
38353 }
38354
38355 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
38356         LDKChannelPublicKeys this_ptr_conv;
38357         this_ptr_conv.inner = untag_ptr(this_ptr);
38358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38360         this_ptr_conv.is_owned = false;
38361         LDKPublicKey val_ref;
38362         CHECK(val->arr_len == 33);
38363         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38364         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
38365 }
38366
38367 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
38368         LDKChannelPublicKeys this_ptr_conv;
38369         this_ptr_conv.inner = untag_ptr(this_ptr);
38370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38372         this_ptr_conv.is_owned = false;
38373         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38374         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
38375         return ret_arr;
38376 }
38377
38378 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
38379         LDKChannelPublicKeys this_ptr_conv;
38380         this_ptr_conv.inner = untag_ptr(this_ptr);
38381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38383         this_ptr_conv.is_owned = false;
38384         LDKPublicKey val_ref;
38385         CHECK(val->arr_len == 33);
38386         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38387         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
38388 }
38389
38390 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) {
38391         LDKPublicKey funding_pubkey_arg_ref;
38392         CHECK(funding_pubkey_arg->arr_len == 33);
38393         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
38394         LDKPublicKey revocation_basepoint_arg_ref;
38395         CHECK(revocation_basepoint_arg->arr_len == 33);
38396         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
38397         LDKPublicKey payment_point_arg_ref;
38398         CHECK(payment_point_arg->arr_len == 33);
38399         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
38400         LDKPublicKey delayed_payment_basepoint_arg_ref;
38401         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
38402         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
38403         LDKPublicKey htlc_basepoint_arg_ref;
38404         CHECK(htlc_basepoint_arg->arr_len == 33);
38405         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
38406         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);
38407         uint64_t ret_ref = 0;
38408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38410         return ret_ref;
38411 }
38412
38413 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
38414         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
38415         uint64_t ret_ref = 0;
38416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38418         return ret_ref;
38419 }
38420 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
38421         LDKChannelPublicKeys arg_conv;
38422         arg_conv.inner = untag_ptr(arg);
38423         arg_conv.is_owned = ptr_is_owned(arg);
38424         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38425         arg_conv.is_owned = false;
38426         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
38427         return ret_conv;
38428 }
38429
38430 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
38431         LDKChannelPublicKeys orig_conv;
38432         orig_conv.inner = untag_ptr(orig);
38433         orig_conv.is_owned = ptr_is_owned(orig);
38434         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38435         orig_conv.is_owned = false;
38436         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
38437         uint64_t ret_ref = 0;
38438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38440         return ret_ref;
38441 }
38442
38443 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
38444         LDKChannelPublicKeys a_conv;
38445         a_conv.inner = untag_ptr(a);
38446         a_conv.is_owned = ptr_is_owned(a);
38447         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38448         a_conv.is_owned = false;
38449         LDKChannelPublicKeys b_conv;
38450         b_conv.inner = untag_ptr(b);
38451         b_conv.is_owned = ptr_is_owned(b);
38452         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38453         b_conv.is_owned = false;
38454         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
38455         return ret_conv;
38456 }
38457
38458 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
38459         LDKChannelPublicKeys obj_conv;
38460         obj_conv.inner = untag_ptr(obj);
38461         obj_conv.is_owned = ptr_is_owned(obj);
38462         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38463         obj_conv.is_owned = false;
38464         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
38465         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38466         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38467         CVec_u8Z_free(ret_var);
38468         return ret_arr;
38469 }
38470
38471 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
38472         LDKu8slice ser_ref;
38473         ser_ref.datalen = ser->arr_len;
38474         ser_ref.data = ser->elems;
38475         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
38476         *ret_conv = ChannelPublicKeys_read(ser_ref);
38477         FREE(ser);
38478         return tag_ptr(ret_conv, true);
38479 }
38480
38481 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) {
38482         LDKPublicKey per_commitment_point_ref;
38483         CHECK(per_commitment_point->arr_len == 33);
38484         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
38485         LDKPublicKey broadcaster_delayed_payment_base_ref;
38486         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
38487         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
38488         LDKPublicKey broadcaster_htlc_base_ref;
38489         CHECK(broadcaster_htlc_base->arr_len == 33);
38490         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
38491         LDKPublicKey countersignatory_revocation_base_ref;
38492         CHECK(countersignatory_revocation_base->arr_len == 33);
38493         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
38494         LDKPublicKey countersignatory_htlc_base_ref;
38495         CHECK(countersignatory_htlc_base->arr_len == 33);
38496         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
38497         LDKTxCreationKeys ret_var = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref);
38498         uint64_t ret_ref = 0;
38499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38501         return ret_ref;
38502 }
38503
38504 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) {
38505         LDKPublicKey per_commitment_point_ref;
38506         CHECK(per_commitment_point->arr_len == 33);
38507         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
38508         LDKChannelPublicKeys broadcaster_keys_conv;
38509         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
38510         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
38511         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
38512         broadcaster_keys_conv.is_owned = false;
38513         LDKChannelPublicKeys countersignatory_keys_conv;
38514         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
38515         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
38516         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
38517         countersignatory_keys_conv.is_owned = false;
38518         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
38519         uint64_t ret_ref = 0;
38520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38522         return ret_ref;
38523 }
38524
38525 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) {
38526         LDKPublicKey revocation_key_ref;
38527         CHECK(revocation_key->arr_len == 33);
38528         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
38529         LDKPublicKey broadcaster_delayed_payment_key_ref;
38530         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
38531         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
38532         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
38533         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38534         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38535         CVec_u8Z_free(ret_var);
38536         return ret_arr;
38537 }
38538
38539 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
38540         LDKHTLCOutputInCommitment this_obj_conv;
38541         this_obj_conv.inner = untag_ptr(this_obj);
38542         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38544         HTLCOutputInCommitment_free(this_obj_conv);
38545 }
38546
38547 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
38548         LDKHTLCOutputInCommitment this_ptr_conv;
38549         this_ptr_conv.inner = untag_ptr(this_ptr);
38550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38552         this_ptr_conv.is_owned = false;
38553         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
38554         return ret_conv;
38555 }
38556
38557 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
38558         LDKHTLCOutputInCommitment this_ptr_conv;
38559         this_ptr_conv.inner = untag_ptr(this_ptr);
38560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38562         this_ptr_conv.is_owned = false;
38563         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
38564 }
38565
38566 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
38567         LDKHTLCOutputInCommitment this_ptr_conv;
38568         this_ptr_conv.inner = untag_ptr(this_ptr);
38569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38571         this_ptr_conv.is_owned = false;
38572         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
38573         return ret_conv;
38574 }
38575
38576 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
38577         LDKHTLCOutputInCommitment this_ptr_conv;
38578         this_ptr_conv.inner = untag_ptr(this_ptr);
38579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38581         this_ptr_conv.is_owned = false;
38582         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
38583 }
38584
38585 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
38586         LDKHTLCOutputInCommitment this_ptr_conv;
38587         this_ptr_conv.inner = untag_ptr(this_ptr);
38588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38590         this_ptr_conv.is_owned = false;
38591         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
38592         return ret_conv;
38593 }
38594
38595 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
38596         LDKHTLCOutputInCommitment this_ptr_conv;
38597         this_ptr_conv.inner = untag_ptr(this_ptr);
38598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38600         this_ptr_conv.is_owned = false;
38601         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
38602 }
38603
38604 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
38605         LDKHTLCOutputInCommitment 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38611         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
38612         return ret_arr;
38613 }
38614
38615 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
38616         LDKHTLCOutputInCommitment this_ptr_conv;
38617         this_ptr_conv.inner = untag_ptr(this_ptr);
38618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38620         this_ptr_conv.is_owned = false;
38621         LDKThirtyTwoBytes val_ref;
38622         CHECK(val->arr_len == 32);
38623         memcpy(val_ref.data, val->elems, 32); FREE(val);
38624         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
38625 }
38626
38627 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
38628         LDKHTLCOutputInCommitment this_ptr_conv;
38629         this_ptr_conv.inner = untag_ptr(this_ptr);
38630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38632         this_ptr_conv.is_owned = false;
38633         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
38634         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
38635         uint64_t ret_ref = tag_ptr(ret_copy, true);
38636         return ret_ref;
38637 }
38638
38639 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
38640         LDKHTLCOutputInCommitment this_ptr_conv;
38641         this_ptr_conv.inner = untag_ptr(this_ptr);
38642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38644         this_ptr_conv.is_owned = false;
38645         void* val_ptr = untag_ptr(val);
38646         CHECK_ACCESS(val_ptr);
38647         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
38648         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
38649         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
38650 }
38651
38652 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) {
38653         LDKThirtyTwoBytes payment_hash_arg_ref;
38654         CHECK(payment_hash_arg->arr_len == 32);
38655         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
38656         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
38657         CHECK_ACCESS(transaction_output_index_arg_ptr);
38658         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
38659         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
38660         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
38661         uint64_t ret_ref = 0;
38662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38664         return ret_ref;
38665 }
38666
38667 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
38668         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
38669         uint64_t ret_ref = 0;
38670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38672         return ret_ref;
38673 }
38674 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
38675         LDKHTLCOutputInCommitment arg_conv;
38676         arg_conv.inner = untag_ptr(arg);
38677         arg_conv.is_owned = ptr_is_owned(arg);
38678         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38679         arg_conv.is_owned = false;
38680         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
38681         return ret_conv;
38682 }
38683
38684 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
38685         LDKHTLCOutputInCommitment orig_conv;
38686         orig_conv.inner = untag_ptr(orig);
38687         orig_conv.is_owned = ptr_is_owned(orig);
38688         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38689         orig_conv.is_owned = false;
38690         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
38691         uint64_t ret_ref = 0;
38692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38694         return ret_ref;
38695 }
38696
38697 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
38698         LDKHTLCOutputInCommitment a_conv;
38699         a_conv.inner = untag_ptr(a);
38700         a_conv.is_owned = ptr_is_owned(a);
38701         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38702         a_conv.is_owned = false;
38703         LDKHTLCOutputInCommitment b_conv;
38704         b_conv.inner = untag_ptr(b);
38705         b_conv.is_owned = ptr_is_owned(b);
38706         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38707         b_conv.is_owned = false;
38708         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
38709         return ret_conv;
38710 }
38711
38712 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
38713         LDKHTLCOutputInCommitment obj_conv;
38714         obj_conv.inner = untag_ptr(obj);
38715         obj_conv.is_owned = ptr_is_owned(obj);
38716         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38717         obj_conv.is_owned = false;
38718         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
38719         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38720         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38721         CVec_u8Z_free(ret_var);
38722         return ret_arr;
38723 }
38724
38725 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
38726         LDKu8slice ser_ref;
38727         ser_ref.datalen = ser->arr_len;
38728         ser_ref.data = ser->elems;
38729         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
38730         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
38731         FREE(ser);
38732         return tag_ptr(ret_conv, true);
38733 }
38734
38735 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, jboolean opt_anchors, uint64_t keys) {
38736         LDKHTLCOutputInCommitment htlc_conv;
38737         htlc_conv.inner = untag_ptr(htlc);
38738         htlc_conv.is_owned = ptr_is_owned(htlc);
38739         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38740         htlc_conv.is_owned = false;
38741         LDKTxCreationKeys keys_conv;
38742         keys_conv.inner = untag_ptr(keys);
38743         keys_conv.is_owned = ptr_is_owned(keys);
38744         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
38745         keys_conv.is_owned = false;
38746         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
38747         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38748         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38749         CVec_u8Z_free(ret_var);
38750         return ret_arr;
38751 }
38752
38753 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
38754         LDKPublicKey broadcaster_ref;
38755         CHECK(broadcaster->arr_len == 33);
38756         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
38757         LDKPublicKey countersignatory_ref;
38758         CHECK(countersignatory->arr_len == 33);
38759         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
38760         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
38761         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38762         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38763         CVec_u8Z_free(ret_var);
38764         return ret_arr;
38765 }
38766
38767 int8_tArray  __attribute__((export_name("TS_build_htlc_transaction"))) TS_build_htlc_transaction(int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, uint64_t htlc, jboolean opt_anchors, jboolean use_non_zero_fee_anchors, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
38768         uint8_t commitment_txid_arr[32];
38769         CHECK(commitment_txid->arr_len == 32);
38770         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
38771         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
38772         LDKHTLCOutputInCommitment htlc_conv;
38773         htlc_conv.inner = untag_ptr(htlc);
38774         htlc_conv.is_owned = ptr_is_owned(htlc);
38775         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38776         htlc_conv.is_owned = false;
38777         LDKPublicKey broadcaster_delayed_payment_key_ref;
38778         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
38779         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
38780         LDKPublicKey revocation_key_ref;
38781         CHECK(revocation_key->arr_len == 33);
38782         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
38783         LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, opt_anchors, use_non_zero_fee_anchors, broadcaster_delayed_payment_key_ref, revocation_key_ref);
38784         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38785         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38786         Transaction_free(ret_var);
38787         return ret_arr;
38788 }
38789
38790 int8_tArray  __attribute__((export_name("TS_build_htlc_input_witness"))) TS_build_htlc_input_witness(int8_tArray local_sig, int8_tArray remote_sig, int8_tArray preimage, int8_tArray redeem_script, jboolean opt_anchors) {
38791         LDKSignature local_sig_ref;
38792         CHECK(local_sig->arr_len == 64);
38793         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
38794         LDKSignature remote_sig_ref;
38795         CHECK(remote_sig->arr_len == 64);
38796         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
38797         LDKThirtyTwoBytes preimage_ref;
38798         CHECK(preimage->arr_len == 32);
38799         memcpy(preimage_ref.data, preimage->elems, 32); FREE(preimage);
38800         LDKu8slice redeem_script_ref;
38801         redeem_script_ref.datalen = redeem_script->arr_len;
38802         redeem_script_ref.data = redeem_script->elems;
38803         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_ref, redeem_script_ref, opt_anchors);
38804         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38805         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38806         Witness_free(ret_var);
38807         FREE(redeem_script);
38808         return ret_arr;
38809 }
38810
38811 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
38812         LDKPublicKey payment_point_ref;
38813         CHECK(payment_point->arr_len == 33);
38814         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
38815         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
38816         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38817         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38818         CVec_u8Z_free(ret_var);
38819         return ret_arr;
38820 }
38821
38822 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
38823         LDKPublicKey funding_pubkey_ref;
38824         CHECK(funding_pubkey->arr_len == 33);
38825         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
38826         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
38827         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38828         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38829         CVec_u8Z_free(ret_var);
38830         return ret_arr;
38831 }
38832
38833 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
38834         LDKPublicKey funding_key_ref;
38835         CHECK(funding_key->arr_len == 33);
38836         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
38837         LDKSignature funding_sig_ref;
38838         CHECK(funding_sig->arr_len == 64);
38839         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
38840         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
38841         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38842         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38843         Witness_free(ret_var);
38844         return ret_arr;
38845 }
38846
38847 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
38848         LDKChannelTransactionParameters this_obj_conv;
38849         this_obj_conv.inner = untag_ptr(this_obj);
38850         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38852         ChannelTransactionParameters_free(this_obj_conv);
38853 }
38854
38855 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
38856         LDKChannelTransactionParameters this_ptr_conv;
38857         this_ptr_conv.inner = untag_ptr(this_ptr);
38858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38860         this_ptr_conv.is_owned = false;
38861         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
38862         uint64_t ret_ref = 0;
38863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38865         return ret_ref;
38866 }
38867
38868 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
38869         LDKChannelTransactionParameters this_ptr_conv;
38870         this_ptr_conv.inner = untag_ptr(this_ptr);
38871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38873         this_ptr_conv.is_owned = false;
38874         LDKChannelPublicKeys val_conv;
38875         val_conv.inner = untag_ptr(val);
38876         val_conv.is_owned = ptr_is_owned(val);
38877         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38878         val_conv = ChannelPublicKeys_clone(&val_conv);
38879         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
38880 }
38881
38882 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
38883         LDKChannelTransactionParameters this_ptr_conv;
38884         this_ptr_conv.inner = untag_ptr(this_ptr);
38885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38887         this_ptr_conv.is_owned = false;
38888         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
38889         return ret_conv;
38890 }
38891
38892 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) {
38893         LDKChannelTransactionParameters this_ptr_conv;
38894         this_ptr_conv.inner = untag_ptr(this_ptr);
38895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38897         this_ptr_conv.is_owned = false;
38898         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
38899 }
38900
38901 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
38902         LDKChannelTransactionParameters this_ptr_conv;
38903         this_ptr_conv.inner = untag_ptr(this_ptr);
38904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38906         this_ptr_conv.is_owned = false;
38907         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
38908         return ret_conv;
38909 }
38910
38911 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
38912         LDKChannelTransactionParameters this_ptr_conv;
38913         this_ptr_conv.inner = untag_ptr(this_ptr);
38914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38916         this_ptr_conv.is_owned = false;
38917         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
38918 }
38919
38920 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
38921         LDKChannelTransactionParameters this_ptr_conv;
38922         this_ptr_conv.inner = untag_ptr(this_ptr);
38923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38925         this_ptr_conv.is_owned = false;
38926         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
38927         uint64_t ret_ref = 0;
38928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38930         return ret_ref;
38931 }
38932
38933 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
38934         LDKChannelTransactionParameters this_ptr_conv;
38935         this_ptr_conv.inner = untag_ptr(this_ptr);
38936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38938         this_ptr_conv.is_owned = false;
38939         LDKCounterpartyChannelTransactionParameters val_conv;
38940         val_conv.inner = untag_ptr(val);
38941         val_conv.is_owned = ptr_is_owned(val);
38942         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38943         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
38944         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
38945 }
38946
38947 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
38948         LDKChannelTransactionParameters this_ptr_conv;
38949         this_ptr_conv.inner = untag_ptr(this_ptr);
38950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38952         this_ptr_conv.is_owned = false;
38953         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
38954         uint64_t ret_ref = 0;
38955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38957         return ret_ref;
38958 }
38959
38960 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
38961         LDKChannelTransactionParameters this_ptr_conv;
38962         this_ptr_conv.inner = untag_ptr(this_ptr);
38963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38965         this_ptr_conv.is_owned = false;
38966         LDKOutPoint val_conv;
38967         val_conv.inner = untag_ptr(val);
38968         val_conv.is_owned = ptr_is_owned(val);
38969         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38970         val_conv = OutPoint_clone(&val_conv);
38971         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
38972 }
38973
38974 uint32_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint64_t this_ptr) {
38975         LDKChannelTransactionParameters this_ptr_conv;
38976         this_ptr_conv.inner = untag_ptr(this_ptr);
38977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38979         this_ptr_conv.is_owned = false;
38980         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
38981         return ret_conv;
38982 }
38983
38984 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint64_t this_ptr, uint32_t val) {
38985         LDKChannelTransactionParameters this_ptr_conv;
38986         this_ptr_conv.inner = untag_ptr(this_ptr);
38987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38989         this_ptr_conv.is_owned = false;
38990         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
38991         ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
38992 }
38993
38994 uint32_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_non_zero_fee_anchors"))) TS_ChannelTransactionParameters_get_opt_non_zero_fee_anchors(uint64_t this_ptr) {
38995         LDKChannelTransactionParameters this_ptr_conv;
38996         this_ptr_conv.inner = untag_ptr(this_ptr);
38997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38999         this_ptr_conv.is_owned = false;
39000         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_non_zero_fee_anchors(&this_ptr_conv));
39001         return ret_conv;
39002 }
39003
39004 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_non_zero_fee_anchors"))) TS_ChannelTransactionParameters_set_opt_non_zero_fee_anchors(uint64_t this_ptr, uint32_t val) {
39005         LDKChannelTransactionParameters this_ptr_conv;
39006         this_ptr_conv.inner = untag_ptr(this_ptr);
39007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39009         this_ptr_conv.is_owned = false;
39010         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
39011         ChannelTransactionParameters_set_opt_non_zero_fee_anchors(&this_ptr_conv, val_conv);
39012 }
39013
39014 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_new"))) TS_ChannelTransactionParameters_new(uint64_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, uint64_t counterparty_parameters_arg, uint64_t funding_outpoint_arg, uint32_t opt_anchors_arg, uint32_t opt_non_zero_fee_anchors_arg) {
39015         LDKChannelPublicKeys holder_pubkeys_arg_conv;
39016         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
39017         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
39018         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
39019         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
39020         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
39021         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
39022         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
39023         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
39024         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
39025         LDKOutPoint funding_outpoint_arg_conv;
39026         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
39027         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
39028         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
39029         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
39030         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
39031         LDKCOption_NoneZ opt_non_zero_fee_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_non_zero_fee_anchors_arg);
39032         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_new(holder_pubkeys_arg_conv, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg_conv, funding_outpoint_arg_conv, opt_anchors_arg_conv, opt_non_zero_fee_anchors_arg_conv);
39033         uint64_t ret_ref = 0;
39034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39036         return ret_ref;
39037 }
39038
39039 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
39040         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
39041         uint64_t ret_ref = 0;
39042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39044         return ret_ref;
39045 }
39046 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
39047         LDKChannelTransactionParameters arg_conv;
39048         arg_conv.inner = untag_ptr(arg);
39049         arg_conv.is_owned = ptr_is_owned(arg);
39050         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39051         arg_conv.is_owned = false;
39052         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
39053         return ret_conv;
39054 }
39055
39056 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
39057         LDKChannelTransactionParameters orig_conv;
39058         orig_conv.inner = untag_ptr(orig);
39059         orig_conv.is_owned = ptr_is_owned(orig);
39060         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39061         orig_conv.is_owned = false;
39062         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
39063         uint64_t ret_ref = 0;
39064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39066         return ret_ref;
39067 }
39068
39069 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
39070         LDKCounterpartyChannelTransactionParameters this_obj_conv;
39071         this_obj_conv.inner = untag_ptr(this_obj);
39072         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39074         CounterpartyChannelTransactionParameters_free(this_obj_conv);
39075 }
39076
39077 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
39078         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39079         this_ptr_conv.inner = untag_ptr(this_ptr);
39080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39082         this_ptr_conv.is_owned = false;
39083         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
39084         uint64_t ret_ref = 0;
39085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39087         return ret_ref;
39088 }
39089
39090 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
39091         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39092         this_ptr_conv.inner = untag_ptr(this_ptr);
39093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39095         this_ptr_conv.is_owned = false;
39096         LDKChannelPublicKeys val_conv;
39097         val_conv.inner = untag_ptr(val);
39098         val_conv.is_owned = ptr_is_owned(val);
39099         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39100         val_conv = ChannelPublicKeys_clone(&val_conv);
39101         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
39102 }
39103
39104 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
39105         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39106         this_ptr_conv.inner = untag_ptr(this_ptr);
39107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39109         this_ptr_conv.is_owned = false;
39110         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
39111         return ret_conv;
39112 }
39113
39114 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
39115         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39116         this_ptr_conv.inner = untag_ptr(this_ptr);
39117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39119         this_ptr_conv.is_owned = false;
39120         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
39121 }
39122
39123 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
39124         LDKChannelPublicKeys pubkeys_arg_conv;
39125         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
39126         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
39127         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
39128         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
39129         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
39130         uint64_t ret_ref = 0;
39131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39133         return ret_ref;
39134 }
39135
39136 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
39137         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
39138         uint64_t ret_ref = 0;
39139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39141         return ret_ref;
39142 }
39143 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
39144         LDKCounterpartyChannelTransactionParameters arg_conv;
39145         arg_conv.inner = untag_ptr(arg);
39146         arg_conv.is_owned = ptr_is_owned(arg);
39147         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39148         arg_conv.is_owned = false;
39149         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
39150         return ret_conv;
39151 }
39152
39153 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
39154         LDKCounterpartyChannelTransactionParameters orig_conv;
39155         orig_conv.inner = untag_ptr(orig);
39156         orig_conv.is_owned = ptr_is_owned(orig);
39157         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39158         orig_conv.is_owned = false;
39159         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
39160         uint64_t ret_ref = 0;
39161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39163         return ret_ref;
39164 }
39165
39166 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
39167         LDKChannelTransactionParameters this_arg_conv;
39168         this_arg_conv.inner = untag_ptr(this_arg);
39169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39171         this_arg_conv.is_owned = false;
39172         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
39173         return ret_conv;
39174 }
39175
39176 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
39177         LDKChannelTransactionParameters this_arg_conv;
39178         this_arg_conv.inner = untag_ptr(this_arg);
39179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39181         this_arg_conv.is_owned = false;
39182         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
39183         uint64_t ret_ref = 0;
39184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39186         return ret_ref;
39187 }
39188
39189 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
39190         LDKChannelTransactionParameters this_arg_conv;
39191         this_arg_conv.inner = untag_ptr(this_arg);
39192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39194         this_arg_conv.is_owned = false;
39195         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
39196         uint64_t ret_ref = 0;
39197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39199         return ret_ref;
39200 }
39201
39202 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
39203         LDKCounterpartyChannelTransactionParameters obj_conv;
39204         obj_conv.inner = untag_ptr(obj);
39205         obj_conv.is_owned = ptr_is_owned(obj);
39206         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39207         obj_conv.is_owned = false;
39208         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
39209         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39210         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39211         CVec_u8Z_free(ret_var);
39212         return ret_arr;
39213 }
39214
39215 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
39216         LDKu8slice ser_ref;
39217         ser_ref.datalen = ser->arr_len;
39218         ser_ref.data = ser->elems;
39219         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
39220         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
39221         FREE(ser);
39222         return tag_ptr(ret_conv, true);
39223 }
39224
39225 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
39226         LDKChannelTransactionParameters obj_conv;
39227         obj_conv.inner = untag_ptr(obj);
39228         obj_conv.is_owned = ptr_is_owned(obj);
39229         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39230         obj_conv.is_owned = false;
39231         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
39232         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39233         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39234         CVec_u8Z_free(ret_var);
39235         return ret_arr;
39236 }
39237
39238 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
39239         LDKu8slice ser_ref;
39240         ser_ref.datalen = ser->arr_len;
39241         ser_ref.data = ser->elems;
39242         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
39243         *ret_conv = ChannelTransactionParameters_read(ser_ref);
39244         FREE(ser);
39245         return tag_ptr(ret_conv, true);
39246 }
39247
39248 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
39249         LDKDirectedChannelTransactionParameters this_obj_conv;
39250         this_obj_conv.inner = untag_ptr(this_obj);
39251         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39253         DirectedChannelTransactionParameters_free(this_obj_conv);
39254 }
39255
39256 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
39257         LDKDirectedChannelTransactionParameters this_arg_conv;
39258         this_arg_conv.inner = untag_ptr(this_arg);
39259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39261         this_arg_conv.is_owned = false;
39262         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
39263         uint64_t ret_ref = 0;
39264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39266         return ret_ref;
39267 }
39268
39269 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
39270         LDKDirectedChannelTransactionParameters this_arg_conv;
39271         this_arg_conv.inner = untag_ptr(this_arg);
39272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39274         this_arg_conv.is_owned = false;
39275         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
39276         uint64_t ret_ref = 0;
39277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39279         return ret_ref;
39280 }
39281
39282 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
39283         LDKDirectedChannelTransactionParameters this_arg_conv;
39284         this_arg_conv.inner = untag_ptr(this_arg);
39285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39287         this_arg_conv.is_owned = false;
39288         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
39289         return ret_conv;
39290 }
39291
39292 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
39293         LDKDirectedChannelTransactionParameters this_arg_conv;
39294         this_arg_conv.inner = untag_ptr(this_arg);
39295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39297         this_arg_conv.is_owned = false;
39298         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
39299         return ret_conv;
39300 }
39301
39302 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
39303         LDKDirectedChannelTransactionParameters this_arg_conv;
39304         this_arg_conv.inner = untag_ptr(this_arg);
39305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39307         this_arg_conv.is_owned = false;
39308         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
39309         uint64_t ret_ref = 0;
39310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39312         return ret_ref;
39313 }
39314
39315 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint64_t this_arg) {
39316         LDKDirectedChannelTransactionParameters 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         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
39322         return ret_conv;
39323 }
39324
39325 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
39326         LDKHolderCommitmentTransaction this_obj_conv;
39327         this_obj_conv.inner = untag_ptr(this_obj);
39328         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39330         HolderCommitmentTransaction_free(this_obj_conv);
39331 }
39332
39333 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
39334         LDKHolderCommitmentTransaction this_ptr_conv;
39335         this_ptr_conv.inner = untag_ptr(this_ptr);
39336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39338         this_ptr_conv.is_owned = false;
39339         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39340         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
39341         return ret_arr;
39342 }
39343
39344 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
39345         LDKHolderCommitmentTransaction this_ptr_conv;
39346         this_ptr_conv.inner = untag_ptr(this_ptr);
39347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39349         this_ptr_conv.is_owned = false;
39350         LDKSignature val_ref;
39351         CHECK(val->arr_len == 64);
39352         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
39353         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
39354 }
39355
39356 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
39357         LDKHolderCommitmentTransaction this_ptr_conv;
39358         this_ptr_conv.inner = untag_ptr(this_ptr);
39359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39361         this_ptr_conv.is_owned = false;
39362         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
39363         ptrArray ret_arr = NULL;
39364         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
39365         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
39366         for (size_t m = 0; m < ret_var.datalen; m++) {
39367                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
39368                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
39369                 ret_arr_ptr[m] = ret_conv_12_arr;
39370         }
39371         
39372         FREE(ret_var.data);
39373         return ret_arr;
39374 }
39375
39376 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
39377         LDKHolderCommitmentTransaction this_ptr_conv;
39378         this_ptr_conv.inner = untag_ptr(this_ptr);
39379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39381         this_ptr_conv.is_owned = false;
39382         LDKCVec_SignatureZ val_constr;
39383         val_constr.datalen = val->arr_len;
39384         if (val_constr.datalen > 0)
39385                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39386         else
39387                 val_constr.data = NULL;
39388         int8_tArray* val_vals = (void*) val->elems;
39389         for (size_t m = 0; m < val_constr.datalen; m++) {
39390                 int8_tArray val_conv_12 = val_vals[m];
39391                 LDKSignature val_conv_12_ref;
39392                 CHECK(val_conv_12->arr_len == 64);
39393                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
39394                 val_constr.data[m] = val_conv_12_ref;
39395         }
39396         FREE(val);
39397         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
39398 }
39399
39400 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
39401         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
39402         uint64_t ret_ref = 0;
39403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39405         return ret_ref;
39406 }
39407 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
39408         LDKHolderCommitmentTransaction arg_conv;
39409         arg_conv.inner = untag_ptr(arg);
39410         arg_conv.is_owned = ptr_is_owned(arg);
39411         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39412         arg_conv.is_owned = false;
39413         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
39414         return ret_conv;
39415 }
39416
39417 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
39418         LDKHolderCommitmentTransaction orig_conv;
39419         orig_conv.inner = untag_ptr(orig);
39420         orig_conv.is_owned = ptr_is_owned(orig);
39421         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39422         orig_conv.is_owned = false;
39423         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
39424         uint64_t ret_ref = 0;
39425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39427         return ret_ref;
39428 }
39429
39430 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
39431         LDKHolderCommitmentTransaction obj_conv;
39432         obj_conv.inner = untag_ptr(obj);
39433         obj_conv.is_owned = ptr_is_owned(obj);
39434         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39435         obj_conv.is_owned = false;
39436         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
39437         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39438         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39439         CVec_u8Z_free(ret_var);
39440         return ret_arr;
39441 }
39442
39443 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
39444         LDKu8slice ser_ref;
39445         ser_ref.datalen = ser->arr_len;
39446         ser_ref.data = ser->elems;
39447         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
39448         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
39449         FREE(ser);
39450         return tag_ptr(ret_conv, true);
39451 }
39452
39453 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) {
39454         LDKCommitmentTransaction commitment_tx_conv;
39455         commitment_tx_conv.inner = untag_ptr(commitment_tx);
39456         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
39457         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
39458         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
39459         LDKSignature counterparty_sig_ref;
39460         CHECK(counterparty_sig->arr_len == 64);
39461         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
39462         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
39463         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
39464         if (counterparty_htlc_sigs_constr.datalen > 0)
39465                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39466         else
39467                 counterparty_htlc_sigs_constr.data = NULL;
39468         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
39469         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
39470                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
39471                 LDKSignature counterparty_htlc_sigs_conv_12_ref;
39472                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
39473                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
39474                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
39475         }
39476         FREE(counterparty_htlc_sigs);
39477         LDKPublicKey holder_funding_key_ref;
39478         CHECK(holder_funding_key->arr_len == 33);
39479         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
39480         LDKPublicKey counterparty_funding_key_ref;
39481         CHECK(counterparty_funding_key->arr_len == 33);
39482         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
39483         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
39484         uint64_t ret_ref = 0;
39485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39487         return ret_ref;
39488 }
39489
39490 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
39491         LDKBuiltCommitmentTransaction this_obj_conv;
39492         this_obj_conv.inner = untag_ptr(this_obj);
39493         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39495         BuiltCommitmentTransaction_free(this_obj_conv);
39496 }
39497
39498 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
39499         LDKBuiltCommitmentTransaction this_ptr_conv;
39500         this_ptr_conv.inner = untag_ptr(this_ptr);
39501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39503         this_ptr_conv.is_owned = false;
39504         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
39505         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39506         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39507         Transaction_free(ret_var);
39508         return ret_arr;
39509 }
39510
39511 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
39512         LDKBuiltCommitmentTransaction this_ptr_conv;
39513         this_ptr_conv.inner = untag_ptr(this_ptr);
39514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39516         this_ptr_conv.is_owned = false;
39517         LDKTransaction val_ref;
39518         val_ref.datalen = val->arr_len;
39519         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
39520         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
39521         val_ref.data_is_owned = true;
39522         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
39523 }
39524
39525 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
39526         LDKBuiltCommitmentTransaction this_ptr_conv;
39527         this_ptr_conv.inner = untag_ptr(this_ptr);
39528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39530         this_ptr_conv.is_owned = false;
39531         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39532         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
39533         return ret_arr;
39534 }
39535
39536 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
39537         LDKBuiltCommitmentTransaction this_ptr_conv;
39538         this_ptr_conv.inner = untag_ptr(this_ptr);
39539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39541         this_ptr_conv.is_owned = false;
39542         LDKThirtyTwoBytes val_ref;
39543         CHECK(val->arr_len == 32);
39544         memcpy(val_ref.data, val->elems, 32); FREE(val);
39545         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
39546 }
39547
39548 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
39549         LDKTransaction transaction_arg_ref;
39550         transaction_arg_ref.datalen = transaction_arg->arr_len;
39551         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
39552         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
39553         transaction_arg_ref.data_is_owned = true;
39554         LDKThirtyTwoBytes txid_arg_ref;
39555         CHECK(txid_arg->arr_len == 32);
39556         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
39557         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
39558         uint64_t ret_ref = 0;
39559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39561         return ret_ref;
39562 }
39563
39564 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
39565         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
39566         uint64_t ret_ref = 0;
39567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39569         return ret_ref;
39570 }
39571 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
39572         LDKBuiltCommitmentTransaction arg_conv;
39573         arg_conv.inner = untag_ptr(arg);
39574         arg_conv.is_owned = ptr_is_owned(arg);
39575         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39576         arg_conv.is_owned = false;
39577         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
39578         return ret_conv;
39579 }
39580
39581 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
39582         LDKBuiltCommitmentTransaction orig_conv;
39583         orig_conv.inner = untag_ptr(orig);
39584         orig_conv.is_owned = ptr_is_owned(orig);
39585         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39586         orig_conv.is_owned = false;
39587         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
39588         uint64_t ret_ref = 0;
39589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39591         return ret_ref;
39592 }
39593
39594 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
39595         LDKBuiltCommitmentTransaction obj_conv;
39596         obj_conv.inner = untag_ptr(obj);
39597         obj_conv.is_owned = ptr_is_owned(obj);
39598         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39599         obj_conv.is_owned = false;
39600         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
39601         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39602         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39603         CVec_u8Z_free(ret_var);
39604         return ret_arr;
39605 }
39606
39607 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
39608         LDKu8slice ser_ref;
39609         ser_ref.datalen = ser->arr_len;
39610         ser_ref.data = ser->elems;
39611         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
39612         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
39613         FREE(ser);
39614         return tag_ptr(ret_conv, true);
39615 }
39616
39617 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) {
39618         LDKBuiltCommitmentTransaction this_arg_conv;
39619         this_arg_conv.inner = untag_ptr(this_arg);
39620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39622         this_arg_conv.is_owned = false;
39623         LDKu8slice funding_redeemscript_ref;
39624         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39625         funding_redeemscript_ref.data = funding_redeemscript->elems;
39626         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39627         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
39628         FREE(funding_redeemscript);
39629         return ret_arr;
39630 }
39631
39632 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) {
39633         LDKBuiltCommitmentTransaction this_arg_conv;
39634         this_arg_conv.inner = untag_ptr(this_arg);
39635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39637         this_arg_conv.is_owned = false;
39638         uint8_t funding_key_arr[32];
39639         CHECK(funding_key->arr_len == 32);
39640         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
39641         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
39642         LDKu8slice funding_redeemscript_ref;
39643         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39644         funding_redeemscript_ref.data = funding_redeemscript->elems;
39645         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39646         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
39647         FREE(funding_redeemscript);
39648         return ret_arr;
39649 }
39650
39651 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
39652         LDKClosingTransaction this_obj_conv;
39653         this_obj_conv.inner = untag_ptr(this_obj);
39654         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39656         ClosingTransaction_free(this_obj_conv);
39657 }
39658
39659 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
39660         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
39661         uint64_t ret_ref = 0;
39662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39664         return ret_ref;
39665 }
39666 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
39667         LDKClosingTransaction arg_conv;
39668         arg_conv.inner = untag_ptr(arg);
39669         arg_conv.is_owned = ptr_is_owned(arg);
39670         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39671         arg_conv.is_owned = false;
39672         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
39673         return ret_conv;
39674 }
39675
39676 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
39677         LDKClosingTransaction orig_conv;
39678         orig_conv.inner = untag_ptr(orig);
39679         orig_conv.is_owned = ptr_is_owned(orig);
39680         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39681         orig_conv.is_owned = false;
39682         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
39683         uint64_t ret_ref = 0;
39684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39686         return ret_ref;
39687 }
39688
39689 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
39690         LDKClosingTransaction o_conv;
39691         o_conv.inner = untag_ptr(o);
39692         o_conv.is_owned = ptr_is_owned(o);
39693         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39694         o_conv.is_owned = false;
39695         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
39696         return ret_conv;
39697 }
39698
39699 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
39700         LDKClosingTransaction a_conv;
39701         a_conv.inner = untag_ptr(a);
39702         a_conv.is_owned = ptr_is_owned(a);
39703         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39704         a_conv.is_owned = false;
39705         LDKClosingTransaction b_conv;
39706         b_conv.inner = untag_ptr(b);
39707         b_conv.is_owned = ptr_is_owned(b);
39708         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39709         b_conv.is_owned = false;
39710         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
39711         return ret_conv;
39712 }
39713
39714 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) {
39715         LDKCVec_u8Z to_holder_script_ref;
39716         to_holder_script_ref.datalen = to_holder_script->arr_len;
39717         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
39718         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
39719         LDKCVec_u8Z to_counterparty_script_ref;
39720         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
39721         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
39722         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
39723         LDKOutPoint funding_outpoint_conv;
39724         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
39725         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
39726         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39727         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39728         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
39729         uint64_t ret_ref = 0;
39730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39732         return ret_ref;
39733 }
39734
39735 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
39736         LDKClosingTransaction this_arg_conv;
39737         this_arg_conv.inner = untag_ptr(this_arg);
39738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39740         this_arg_conv.is_owned = false;
39741         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
39742         uint64_t ret_ref = 0;
39743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39745         return ret_ref;
39746 }
39747
39748 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
39749         LDKClosingTransaction this_arg_conv;
39750         this_arg_conv.inner = untag_ptr(this_arg);
39751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39753         this_arg_conv.is_owned = false;
39754         LDKOutPoint funding_outpoint_conv;
39755         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
39756         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
39757         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39758         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39759         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
39760         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
39761         return tag_ptr(ret_conv, true);
39762 }
39763
39764 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
39765         LDKClosingTransaction this_arg_conv;
39766         this_arg_conv.inner = untag_ptr(this_arg);
39767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39769         this_arg_conv.is_owned = false;
39770         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
39771         return ret_conv;
39772 }
39773
39774 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
39775         LDKClosingTransaction this_arg_conv;
39776         this_arg_conv.inner = untag_ptr(this_arg);
39777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39779         this_arg_conv.is_owned = false;
39780         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
39781         return ret_conv;
39782 }
39783
39784 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
39785         LDKClosingTransaction this_arg_conv;
39786         this_arg_conv.inner = untag_ptr(this_arg);
39787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39789         this_arg_conv.is_owned = false;
39790         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
39791         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39792         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39793         return ret_arr;
39794 }
39795
39796 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
39797         LDKClosingTransaction this_arg_conv;
39798         this_arg_conv.inner = untag_ptr(this_arg);
39799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39801         this_arg_conv.is_owned = false;
39802         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
39803         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39804         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39805         return ret_arr;
39806 }
39807
39808 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
39809         LDKTrustedClosingTransaction this_obj_conv;
39810         this_obj_conv.inner = untag_ptr(this_obj);
39811         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39813         TrustedClosingTransaction_free(this_obj_conv);
39814 }
39815
39816 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
39817         LDKTrustedClosingTransaction this_arg_conv;
39818         this_arg_conv.inner = untag_ptr(this_arg);
39819         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39821         this_arg_conv.is_owned = false;
39822         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
39823         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39824         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39825         Transaction_free(ret_var);
39826         return ret_arr;
39827 }
39828
39829 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) {
39830         LDKTrustedClosingTransaction this_arg_conv;
39831         this_arg_conv.inner = untag_ptr(this_arg);
39832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39834         this_arg_conv.is_owned = false;
39835         LDKu8slice funding_redeemscript_ref;
39836         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39837         funding_redeemscript_ref.data = funding_redeemscript->elems;
39838         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39839         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
39840         FREE(funding_redeemscript);
39841         return ret_arr;
39842 }
39843
39844 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) {
39845         LDKTrustedClosingTransaction this_arg_conv;
39846         this_arg_conv.inner = untag_ptr(this_arg);
39847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39849         this_arg_conv.is_owned = false;
39850         uint8_t funding_key_arr[32];
39851         CHECK(funding_key->arr_len == 32);
39852         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
39853         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
39854         LDKu8slice funding_redeemscript_ref;
39855         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39856         funding_redeemscript_ref.data = funding_redeemscript->elems;
39857         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39858         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
39859         FREE(funding_redeemscript);
39860         return ret_arr;
39861 }
39862
39863 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
39864         LDKCommitmentTransaction this_obj_conv;
39865         this_obj_conv.inner = untag_ptr(this_obj);
39866         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39868         CommitmentTransaction_free(this_obj_conv);
39869 }
39870
39871 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
39872         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
39873         uint64_t ret_ref = 0;
39874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39876         return ret_ref;
39877 }
39878 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
39879         LDKCommitmentTransaction arg_conv;
39880         arg_conv.inner = untag_ptr(arg);
39881         arg_conv.is_owned = ptr_is_owned(arg);
39882         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39883         arg_conv.is_owned = false;
39884         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
39885         return ret_conv;
39886 }
39887
39888 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
39889         LDKCommitmentTransaction orig_conv;
39890         orig_conv.inner = untag_ptr(orig);
39891         orig_conv.is_owned = ptr_is_owned(orig);
39892         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39893         orig_conv.is_owned = false;
39894         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
39895         uint64_t ret_ref = 0;
39896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39898         return ret_ref;
39899 }
39900
39901 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
39902         LDKCommitmentTransaction obj_conv;
39903         obj_conv.inner = untag_ptr(obj);
39904         obj_conv.is_owned = ptr_is_owned(obj);
39905         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39906         obj_conv.is_owned = false;
39907         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
39908         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39909         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39910         CVec_u8Z_free(ret_var);
39911         return ret_arr;
39912 }
39913
39914 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
39915         LDKu8slice ser_ref;
39916         ser_ref.datalen = ser->arr_len;
39917         ser_ref.data = ser->elems;
39918         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
39919         *ret_conv = CommitmentTransaction_read(ser_ref);
39920         FREE(ser);
39921         return tag_ptr(ret_conv, true);
39922 }
39923
39924 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
39925         LDKCommitmentTransaction this_arg_conv;
39926         this_arg_conv.inner = untag_ptr(this_arg);
39927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39929         this_arg_conv.is_owned = false;
39930         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
39931         return ret_conv;
39932 }
39933
39934 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
39935         LDKCommitmentTransaction this_arg_conv;
39936         this_arg_conv.inner = untag_ptr(this_arg);
39937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39939         this_arg_conv.is_owned = false;
39940         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
39941         return ret_conv;
39942 }
39943
39944 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
39945         LDKCommitmentTransaction this_arg_conv;
39946         this_arg_conv.inner = untag_ptr(this_arg);
39947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39949         this_arg_conv.is_owned = false;
39950         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
39951         return ret_conv;
39952 }
39953
39954 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
39955         LDKCommitmentTransaction this_arg_conv;
39956         this_arg_conv.inner = untag_ptr(this_arg);
39957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39959         this_arg_conv.is_owned = false;
39960         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
39961         return ret_conv;
39962 }
39963
39964 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
39965         LDKCommitmentTransaction this_arg_conv;
39966         this_arg_conv.inner = untag_ptr(this_arg);
39967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39969         this_arg_conv.is_owned = false;
39970         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
39971         uint64_t ret_ref = 0;
39972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39974         return ret_ref;
39975 }
39976
39977 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) {
39978         LDKCommitmentTransaction this_arg_conv;
39979         this_arg_conv.inner = untag_ptr(this_arg);
39980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39982         this_arg_conv.is_owned = false;
39983         LDKDirectedChannelTransactionParameters channel_parameters_conv;
39984         channel_parameters_conv.inner = untag_ptr(channel_parameters);
39985         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
39986         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39987         channel_parameters_conv.is_owned = false;
39988         LDKChannelPublicKeys broadcaster_keys_conv;
39989         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
39990         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
39991         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
39992         broadcaster_keys_conv.is_owned = false;
39993         LDKChannelPublicKeys countersignatory_keys_conv;
39994         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
39995         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
39996         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
39997         countersignatory_keys_conv.is_owned = false;
39998         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
39999         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
40000         return tag_ptr(ret_conv, true);
40001 }
40002
40003 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
40004         LDKTrustedCommitmentTransaction this_obj_conv;
40005         this_obj_conv.inner = untag_ptr(this_obj);
40006         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40008         TrustedCommitmentTransaction_free(this_obj_conv);
40009 }
40010
40011 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
40012         LDKTrustedCommitmentTransaction this_arg_conv;
40013         this_arg_conv.inner = untag_ptr(this_arg);
40014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40016         this_arg_conv.is_owned = false;
40017         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40018         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
40019         return ret_arr;
40020 }
40021
40022 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
40023         LDKTrustedCommitmentTransaction this_arg_conv;
40024         this_arg_conv.inner = untag_ptr(this_arg);
40025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40027         this_arg_conv.is_owned = false;
40028         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
40029         uint64_t ret_ref = 0;
40030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40032         return ret_ref;
40033 }
40034
40035 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
40036         LDKTrustedCommitmentTransaction this_arg_conv;
40037         this_arg_conv.inner = untag_ptr(this_arg);
40038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40040         this_arg_conv.is_owned = false;
40041         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
40042         uint64_t ret_ref = 0;
40043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40045         return ret_ref;
40046 }
40047
40048 jboolean  __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint64_t this_arg) {
40049         LDKTrustedCommitmentTransaction this_arg_conv;
40050         this_arg_conv.inner = untag_ptr(this_arg);
40051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40053         this_arg_conv.is_owned = false;
40054         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
40055         return ret_conv;
40056 }
40057
40058 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) {
40059         LDKTrustedCommitmentTransaction this_arg_conv;
40060         this_arg_conv.inner = untag_ptr(this_arg);
40061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40063         this_arg_conv.is_owned = false;
40064         uint8_t htlc_base_key_arr[32];
40065         CHECK(htlc_base_key->arr_len == 32);
40066         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
40067         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
40068         LDKDirectedChannelTransactionParameters channel_parameters_conv;
40069         channel_parameters_conv.inner = untag_ptr(channel_parameters);
40070         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
40071         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
40072         channel_parameters_conv.is_owned = false;
40073         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
40074         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
40075         return tag_ptr(ret_conv, true);
40076 }
40077
40078 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) {
40079         LDKPublicKey broadcaster_payment_basepoint_ref;
40080         CHECK(broadcaster_payment_basepoint->arr_len == 33);
40081         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
40082         LDKPublicKey countersignatory_payment_basepoint_ref;
40083         CHECK(countersignatory_payment_basepoint->arr_len == 33);
40084         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
40085         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
40086         return ret_conv;
40087 }
40088
40089 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
40090         LDKInitFeatures a_conv;
40091         a_conv.inner = untag_ptr(a);
40092         a_conv.is_owned = ptr_is_owned(a);
40093         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40094         a_conv.is_owned = false;
40095         LDKInitFeatures b_conv;
40096         b_conv.inner = untag_ptr(b);
40097         b_conv.is_owned = ptr_is_owned(b);
40098         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40099         b_conv.is_owned = false;
40100         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
40101         return ret_conv;
40102 }
40103
40104 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
40105         LDKNodeFeatures a_conv;
40106         a_conv.inner = untag_ptr(a);
40107         a_conv.is_owned = ptr_is_owned(a);
40108         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40109         a_conv.is_owned = false;
40110         LDKNodeFeatures b_conv;
40111         b_conv.inner = untag_ptr(b);
40112         b_conv.is_owned = ptr_is_owned(b);
40113         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40114         b_conv.is_owned = false;
40115         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
40116         return ret_conv;
40117 }
40118
40119 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
40120         LDKChannelFeatures a_conv;
40121         a_conv.inner = untag_ptr(a);
40122         a_conv.is_owned = ptr_is_owned(a);
40123         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40124         a_conv.is_owned = false;
40125         LDKChannelFeatures b_conv;
40126         b_conv.inner = untag_ptr(b);
40127         b_conv.is_owned = ptr_is_owned(b);
40128         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40129         b_conv.is_owned = false;
40130         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
40131         return ret_conv;
40132 }
40133
40134 jboolean  __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint64_t a, uint64_t b) {
40135         LDKInvoiceFeatures a_conv;
40136         a_conv.inner = untag_ptr(a);
40137         a_conv.is_owned = ptr_is_owned(a);
40138         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40139         a_conv.is_owned = false;
40140         LDKInvoiceFeatures b_conv;
40141         b_conv.inner = untag_ptr(b);
40142         b_conv.is_owned = ptr_is_owned(b);
40143         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40144         b_conv.is_owned = false;
40145         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
40146         return ret_conv;
40147 }
40148
40149 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
40150         LDKOfferFeatures a_conv;
40151         a_conv.inner = untag_ptr(a);
40152         a_conv.is_owned = ptr_is_owned(a);
40153         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40154         a_conv.is_owned = false;
40155         LDKOfferFeatures b_conv;
40156         b_conv.inner = untag_ptr(b);
40157         b_conv.is_owned = ptr_is_owned(b);
40158         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40159         b_conv.is_owned = false;
40160         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
40161         return ret_conv;
40162 }
40163
40164 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
40165         LDKInvoiceRequestFeatures a_conv;
40166         a_conv.inner = untag_ptr(a);
40167         a_conv.is_owned = ptr_is_owned(a);
40168         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40169         a_conv.is_owned = false;
40170         LDKInvoiceRequestFeatures b_conv;
40171         b_conv.inner = untag_ptr(b);
40172         b_conv.is_owned = ptr_is_owned(b);
40173         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40174         b_conv.is_owned = false;
40175         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
40176         return ret_conv;
40177 }
40178
40179 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_eq"))) TS_Bolt12InvoiceFeatures_eq(uint64_t a, uint64_t b) {
40180         LDKBolt12InvoiceFeatures a_conv;
40181         a_conv.inner = untag_ptr(a);
40182         a_conv.is_owned = ptr_is_owned(a);
40183         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40184         a_conv.is_owned = false;
40185         LDKBolt12InvoiceFeatures b_conv;
40186         b_conv.inner = untag_ptr(b);
40187         b_conv.is_owned = ptr_is_owned(b);
40188         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40189         b_conv.is_owned = false;
40190         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
40191         return ret_conv;
40192 }
40193
40194 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_eq"))) TS_BlindedHopFeatures_eq(uint64_t a, uint64_t b) {
40195         LDKBlindedHopFeatures a_conv;
40196         a_conv.inner = untag_ptr(a);
40197         a_conv.is_owned = ptr_is_owned(a);
40198         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40199         a_conv.is_owned = false;
40200         LDKBlindedHopFeatures b_conv;
40201         b_conv.inner = untag_ptr(b);
40202         b_conv.is_owned = ptr_is_owned(b);
40203         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40204         b_conv.is_owned = false;
40205         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
40206         return ret_conv;
40207 }
40208
40209 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
40210         LDKChannelTypeFeatures a_conv;
40211         a_conv.inner = untag_ptr(a);
40212         a_conv.is_owned = ptr_is_owned(a);
40213         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40214         a_conv.is_owned = false;
40215         LDKChannelTypeFeatures b_conv;
40216         b_conv.inner = untag_ptr(b);
40217         b_conv.is_owned = ptr_is_owned(b);
40218         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40219         b_conv.is_owned = false;
40220         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
40221         return ret_conv;
40222 }
40223
40224 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
40225         LDKInitFeatures ret_var = InitFeatures_clone(arg);
40226         uint64_t ret_ref = 0;
40227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40229         return ret_ref;
40230 }
40231 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
40232         LDKInitFeatures arg_conv;
40233         arg_conv.inner = untag_ptr(arg);
40234         arg_conv.is_owned = ptr_is_owned(arg);
40235         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40236         arg_conv.is_owned = false;
40237         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
40238         return ret_conv;
40239 }
40240
40241 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
40242         LDKInitFeatures orig_conv;
40243         orig_conv.inner = untag_ptr(orig);
40244         orig_conv.is_owned = ptr_is_owned(orig);
40245         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40246         orig_conv.is_owned = false;
40247         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
40248         uint64_t ret_ref = 0;
40249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40251         return ret_ref;
40252 }
40253
40254 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
40255         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
40256         uint64_t ret_ref = 0;
40257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40259         return ret_ref;
40260 }
40261 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
40262         LDKNodeFeatures arg_conv;
40263         arg_conv.inner = untag_ptr(arg);
40264         arg_conv.is_owned = ptr_is_owned(arg);
40265         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40266         arg_conv.is_owned = false;
40267         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
40268         return ret_conv;
40269 }
40270
40271 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
40272         LDKNodeFeatures orig_conv;
40273         orig_conv.inner = untag_ptr(orig);
40274         orig_conv.is_owned = ptr_is_owned(orig);
40275         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40276         orig_conv.is_owned = false;
40277         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
40278         uint64_t ret_ref = 0;
40279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40281         return ret_ref;
40282 }
40283
40284 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
40285         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
40286         uint64_t ret_ref = 0;
40287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40289         return ret_ref;
40290 }
40291 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
40292         LDKChannelFeatures arg_conv;
40293         arg_conv.inner = untag_ptr(arg);
40294         arg_conv.is_owned = ptr_is_owned(arg);
40295         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40296         arg_conv.is_owned = false;
40297         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
40298         return ret_conv;
40299 }
40300
40301 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
40302         LDKChannelFeatures orig_conv;
40303         orig_conv.inner = untag_ptr(orig);
40304         orig_conv.is_owned = ptr_is_owned(orig);
40305         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40306         orig_conv.is_owned = false;
40307         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
40308         uint64_t ret_ref = 0;
40309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40311         return ret_ref;
40312 }
40313
40314 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
40315         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
40316         uint64_t ret_ref = 0;
40317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40319         return ret_ref;
40320 }
40321 int64_t  __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint64_t arg) {
40322         LDKInvoiceFeatures arg_conv;
40323         arg_conv.inner = untag_ptr(arg);
40324         arg_conv.is_owned = ptr_is_owned(arg);
40325         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40326         arg_conv.is_owned = false;
40327         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
40328         return ret_conv;
40329 }
40330
40331 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint64_t orig) {
40332         LDKInvoiceFeatures orig_conv;
40333         orig_conv.inner = untag_ptr(orig);
40334         orig_conv.is_owned = ptr_is_owned(orig);
40335         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40336         orig_conv.is_owned = false;
40337         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
40338         uint64_t ret_ref = 0;
40339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40341         return ret_ref;
40342 }
40343
40344 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
40345         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
40346         uint64_t ret_ref = 0;
40347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40349         return ret_ref;
40350 }
40351 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
40352         LDKOfferFeatures arg_conv;
40353         arg_conv.inner = untag_ptr(arg);
40354         arg_conv.is_owned = ptr_is_owned(arg);
40355         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40356         arg_conv.is_owned = false;
40357         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
40358         return ret_conv;
40359 }
40360
40361 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
40362         LDKOfferFeatures orig_conv;
40363         orig_conv.inner = untag_ptr(orig);
40364         orig_conv.is_owned = ptr_is_owned(orig);
40365         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40366         orig_conv.is_owned = false;
40367         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
40368         uint64_t ret_ref = 0;
40369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40371         return ret_ref;
40372 }
40373
40374 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
40375         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
40376         uint64_t ret_ref = 0;
40377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40379         return ret_ref;
40380 }
40381 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
40382         LDKInvoiceRequestFeatures arg_conv;
40383         arg_conv.inner = untag_ptr(arg);
40384         arg_conv.is_owned = ptr_is_owned(arg);
40385         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40386         arg_conv.is_owned = false;
40387         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
40388         return ret_conv;
40389 }
40390
40391 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
40392         LDKInvoiceRequestFeatures orig_conv;
40393         orig_conv.inner = untag_ptr(orig);
40394         orig_conv.is_owned = ptr_is_owned(orig);
40395         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40396         orig_conv.is_owned = false;
40397         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
40398         uint64_t ret_ref = 0;
40399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40401         return ret_ref;
40402 }
40403
40404 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
40405         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
40406         uint64_t ret_ref = 0;
40407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40409         return ret_ref;
40410 }
40411 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone_ptr"))) TS_Bolt12InvoiceFeatures_clone_ptr(uint64_t arg) {
40412         LDKBolt12InvoiceFeatures arg_conv;
40413         arg_conv.inner = untag_ptr(arg);
40414         arg_conv.is_owned = ptr_is_owned(arg);
40415         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40416         arg_conv.is_owned = false;
40417         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
40418         return ret_conv;
40419 }
40420
40421 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone"))) TS_Bolt12InvoiceFeatures_clone(uint64_t orig) {
40422         LDKBolt12InvoiceFeatures orig_conv;
40423         orig_conv.inner = untag_ptr(orig);
40424         orig_conv.is_owned = ptr_is_owned(orig);
40425         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40426         orig_conv.is_owned = false;
40427         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
40428         uint64_t ret_ref = 0;
40429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40431         return ret_ref;
40432 }
40433
40434 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
40435         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
40436         uint64_t ret_ref = 0;
40437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40439         return ret_ref;
40440 }
40441 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone_ptr"))) TS_BlindedHopFeatures_clone_ptr(uint64_t arg) {
40442         LDKBlindedHopFeatures arg_conv;
40443         arg_conv.inner = untag_ptr(arg);
40444         arg_conv.is_owned = ptr_is_owned(arg);
40445         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40446         arg_conv.is_owned = false;
40447         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
40448         return ret_conv;
40449 }
40450
40451 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone"))) TS_BlindedHopFeatures_clone(uint64_t orig) {
40452         LDKBlindedHopFeatures orig_conv;
40453         orig_conv.inner = untag_ptr(orig);
40454         orig_conv.is_owned = ptr_is_owned(orig);
40455         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40456         orig_conv.is_owned = false;
40457         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
40458         uint64_t ret_ref = 0;
40459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40461         return ret_ref;
40462 }
40463
40464 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
40465         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
40466         uint64_t ret_ref = 0;
40467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40469         return ret_ref;
40470 }
40471 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
40472         LDKChannelTypeFeatures arg_conv;
40473         arg_conv.inner = untag_ptr(arg);
40474         arg_conv.is_owned = ptr_is_owned(arg);
40475         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40476         arg_conv.is_owned = false;
40477         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
40478         return ret_conv;
40479 }
40480
40481 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
40482         LDKChannelTypeFeatures orig_conv;
40483         orig_conv.inner = untag_ptr(orig);
40484         orig_conv.is_owned = ptr_is_owned(orig);
40485         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40486         orig_conv.is_owned = false;
40487         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
40488         uint64_t ret_ref = 0;
40489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40491         return ret_ref;
40492 }
40493
40494 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
40495         LDKInitFeatures this_obj_conv;
40496         this_obj_conv.inner = untag_ptr(this_obj);
40497         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40499         InitFeatures_free(this_obj_conv);
40500 }
40501
40502 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
40503         LDKNodeFeatures this_obj_conv;
40504         this_obj_conv.inner = untag_ptr(this_obj);
40505         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40507         NodeFeatures_free(this_obj_conv);
40508 }
40509
40510 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
40511         LDKChannelFeatures this_obj_conv;
40512         this_obj_conv.inner = untag_ptr(this_obj);
40513         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40515         ChannelFeatures_free(this_obj_conv);
40516 }
40517
40518 void  __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint64_t this_obj) {
40519         LDKInvoiceFeatures this_obj_conv;
40520         this_obj_conv.inner = untag_ptr(this_obj);
40521         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40523         InvoiceFeatures_free(this_obj_conv);
40524 }
40525
40526 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
40527         LDKOfferFeatures this_obj_conv;
40528         this_obj_conv.inner = untag_ptr(this_obj);
40529         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40531         OfferFeatures_free(this_obj_conv);
40532 }
40533
40534 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
40535         LDKInvoiceRequestFeatures this_obj_conv;
40536         this_obj_conv.inner = untag_ptr(this_obj);
40537         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40539         InvoiceRequestFeatures_free(this_obj_conv);
40540 }
40541
40542 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_free"))) TS_Bolt12InvoiceFeatures_free(uint64_t this_obj) {
40543         LDKBolt12InvoiceFeatures this_obj_conv;
40544         this_obj_conv.inner = untag_ptr(this_obj);
40545         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40547         Bolt12InvoiceFeatures_free(this_obj_conv);
40548 }
40549
40550 void  __attribute__((export_name("TS_BlindedHopFeatures_free"))) TS_BlindedHopFeatures_free(uint64_t this_obj) {
40551         LDKBlindedHopFeatures this_obj_conv;
40552         this_obj_conv.inner = untag_ptr(this_obj);
40553         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40555         BlindedHopFeatures_free(this_obj_conv);
40556 }
40557
40558 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
40559         LDKChannelTypeFeatures this_obj_conv;
40560         this_obj_conv.inner = untag_ptr(this_obj);
40561         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40563         ChannelTypeFeatures_free(this_obj_conv);
40564 }
40565
40566 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
40567         LDKInitFeatures ret_var = InitFeatures_empty();
40568         uint64_t ret_ref = 0;
40569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40571         return ret_ref;
40572 }
40573
40574 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
40575         LDKInitFeatures this_arg_conv;
40576         this_arg_conv.inner = untag_ptr(this_arg);
40577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40579         this_arg_conv.is_owned = false;
40580         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
40581         return ret_conv;
40582 }
40583
40584 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
40585         LDKNodeFeatures ret_var = NodeFeatures_empty();
40586         uint64_t ret_ref = 0;
40587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40589         return ret_ref;
40590 }
40591
40592 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
40593         LDKNodeFeatures this_arg_conv;
40594         this_arg_conv.inner = untag_ptr(this_arg);
40595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40597         this_arg_conv.is_owned = false;
40598         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
40599         return ret_conv;
40600 }
40601
40602 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
40603         LDKChannelFeatures ret_var = ChannelFeatures_empty();
40604         uint64_t ret_ref = 0;
40605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40607         return ret_ref;
40608 }
40609
40610 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
40611         LDKChannelFeatures this_arg_conv;
40612         this_arg_conv.inner = untag_ptr(this_arg);
40613         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40615         this_arg_conv.is_owned = false;
40616         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
40617         return ret_conv;
40618 }
40619
40620 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
40621         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
40622         uint64_t ret_ref = 0;
40623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40625         return ret_ref;
40626 }
40627
40628 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
40629         LDKInvoiceFeatures this_arg_conv;
40630         this_arg_conv.inner = untag_ptr(this_arg);
40631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40633         this_arg_conv.is_owned = false;
40634         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
40635         return ret_conv;
40636 }
40637
40638 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
40639         LDKOfferFeatures ret_var = OfferFeatures_empty();
40640         uint64_t ret_ref = 0;
40641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40643         return ret_ref;
40644 }
40645
40646 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
40647         LDKOfferFeatures this_arg_conv;
40648         this_arg_conv.inner = untag_ptr(this_arg);
40649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40651         this_arg_conv.is_owned = false;
40652         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
40653         return ret_conv;
40654 }
40655
40656 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
40657         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
40658         uint64_t ret_ref = 0;
40659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40661         return ret_ref;
40662 }
40663
40664 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
40665         LDKInvoiceRequestFeatures this_arg_conv;
40666         this_arg_conv.inner = untag_ptr(this_arg);
40667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40669         this_arg_conv.is_owned = false;
40670         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
40671         return ret_conv;
40672 }
40673
40674 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_empty"))) TS_Bolt12InvoiceFeatures_empty() {
40675         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
40676         uint64_t ret_ref = 0;
40677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40679         return ret_ref;
40680 }
40681
40682 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
40683         LDKBolt12InvoiceFeatures this_arg_conv;
40684         this_arg_conv.inner = untag_ptr(this_arg);
40685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40687         this_arg_conv.is_owned = false;
40688         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
40689         return ret_conv;
40690 }
40691
40692 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_empty"))) TS_BlindedHopFeatures_empty() {
40693         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
40694         uint64_t ret_ref = 0;
40695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40697         return ret_ref;
40698 }
40699
40700 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits"))) TS_BlindedHopFeatures_requires_unknown_bits(uint64_t this_arg) {
40701         LDKBlindedHopFeatures this_arg_conv;
40702         this_arg_conv.inner = untag_ptr(this_arg);
40703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40705         this_arg_conv.is_owned = false;
40706         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
40707         return ret_conv;
40708 }
40709
40710 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
40711         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
40712         uint64_t ret_ref = 0;
40713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40715         return ret_ref;
40716 }
40717
40718 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
40719         LDKChannelTypeFeatures this_arg_conv;
40720         this_arg_conv.inner = untag_ptr(this_arg);
40721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40723         this_arg_conv.is_owned = false;
40724         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
40725         return ret_conv;
40726 }
40727
40728 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
40729         LDKInitFeatures obj_conv;
40730         obj_conv.inner = untag_ptr(obj);
40731         obj_conv.is_owned = ptr_is_owned(obj);
40732         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40733         obj_conv.is_owned = false;
40734         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
40735         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40736         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40737         CVec_u8Z_free(ret_var);
40738         return ret_arr;
40739 }
40740
40741 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
40742         LDKu8slice ser_ref;
40743         ser_ref.datalen = ser->arr_len;
40744         ser_ref.data = ser->elems;
40745         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
40746         *ret_conv = InitFeatures_read(ser_ref);
40747         FREE(ser);
40748         return tag_ptr(ret_conv, true);
40749 }
40750
40751 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
40752         LDKChannelFeatures obj_conv;
40753         obj_conv.inner = untag_ptr(obj);
40754         obj_conv.is_owned = ptr_is_owned(obj);
40755         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40756         obj_conv.is_owned = false;
40757         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
40758         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40759         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40760         CVec_u8Z_free(ret_var);
40761         return ret_arr;
40762 }
40763
40764 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
40765         LDKu8slice ser_ref;
40766         ser_ref.datalen = ser->arr_len;
40767         ser_ref.data = ser->elems;
40768         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
40769         *ret_conv = ChannelFeatures_read(ser_ref);
40770         FREE(ser);
40771         return tag_ptr(ret_conv, true);
40772 }
40773
40774 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
40775         LDKNodeFeatures obj_conv;
40776         obj_conv.inner = untag_ptr(obj);
40777         obj_conv.is_owned = ptr_is_owned(obj);
40778         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40779         obj_conv.is_owned = false;
40780         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
40781         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40782         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40783         CVec_u8Z_free(ret_var);
40784         return ret_arr;
40785 }
40786
40787 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
40788         LDKu8slice ser_ref;
40789         ser_ref.datalen = ser->arr_len;
40790         ser_ref.data = ser->elems;
40791         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
40792         *ret_conv = NodeFeatures_read(ser_ref);
40793         FREE(ser);
40794         return tag_ptr(ret_conv, true);
40795 }
40796
40797 int8_tArray  __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint64_t obj) {
40798         LDKInvoiceFeatures obj_conv;
40799         obj_conv.inner = untag_ptr(obj);
40800         obj_conv.is_owned = ptr_is_owned(obj);
40801         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40802         obj_conv.is_owned = false;
40803         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
40804         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40805         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40806         CVec_u8Z_free(ret_var);
40807         return ret_arr;
40808 }
40809
40810 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
40811         LDKu8slice ser_ref;
40812         ser_ref.datalen = ser->arr_len;
40813         ser_ref.data = ser->elems;
40814         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
40815         *ret_conv = InvoiceFeatures_read(ser_ref);
40816         FREE(ser);
40817         return tag_ptr(ret_conv, true);
40818 }
40819
40820 int8_tArray  __attribute__((export_name("TS_BlindedHopFeatures_write"))) TS_BlindedHopFeatures_write(uint64_t obj) {
40821         LDKBlindedHopFeatures obj_conv;
40822         obj_conv.inner = untag_ptr(obj);
40823         obj_conv.is_owned = ptr_is_owned(obj);
40824         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40825         obj_conv.is_owned = false;
40826         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
40827         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40828         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40829         CVec_u8Z_free(ret_var);
40830         return ret_arr;
40831 }
40832
40833 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_read"))) TS_BlindedHopFeatures_read(int8_tArray ser) {
40834         LDKu8slice ser_ref;
40835         ser_ref.datalen = ser->arr_len;
40836         ser_ref.data = ser->elems;
40837         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
40838         *ret_conv = BlindedHopFeatures_read(ser_ref);
40839         FREE(ser);
40840         return tag_ptr(ret_conv, true);
40841 }
40842
40843 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
40844         LDKChannelTypeFeatures obj_conv;
40845         obj_conv.inner = untag_ptr(obj);
40846         obj_conv.is_owned = ptr_is_owned(obj);
40847         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40848         obj_conv.is_owned = false;
40849         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
40850         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40851         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40852         CVec_u8Z_free(ret_var);
40853         return ret_arr;
40854 }
40855
40856 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
40857         LDKu8slice ser_ref;
40858         ser_ref.datalen = ser->arr_len;
40859         ser_ref.data = ser->elems;
40860         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
40861         *ret_conv = ChannelTypeFeatures_read(ser_ref);
40862         FREE(ser);
40863         return tag_ptr(ret_conv, true);
40864 }
40865
40866 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
40867         LDKInitFeatures this_arg_conv;
40868         this_arg_conv.inner = untag_ptr(this_arg);
40869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40871         this_arg_conv.is_owned = false;
40872         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
40873 }
40874
40875 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
40876         LDKInitFeatures this_arg_conv;
40877         this_arg_conv.inner = untag_ptr(this_arg);
40878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40880         this_arg_conv.is_owned = false;
40881         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
40882 }
40883
40884 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
40885         LDKInitFeatures this_arg_conv;
40886         this_arg_conv.inner = untag_ptr(this_arg);
40887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40889         this_arg_conv.is_owned = false;
40890         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
40891         return ret_conv;
40892 }
40893
40894 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
40895         LDKNodeFeatures this_arg_conv;
40896         this_arg_conv.inner = untag_ptr(this_arg);
40897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40899         this_arg_conv.is_owned = false;
40900         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
40901 }
40902
40903 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
40904         LDKNodeFeatures this_arg_conv;
40905         this_arg_conv.inner = untag_ptr(this_arg);
40906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40908         this_arg_conv.is_owned = false;
40909         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
40910 }
40911
40912 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
40913         LDKNodeFeatures this_arg_conv;
40914         this_arg_conv.inner = untag_ptr(this_arg);
40915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40917         this_arg_conv.is_owned = false;
40918         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
40919         return ret_conv;
40920 }
40921
40922 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
40923         LDKInitFeatures this_arg_conv;
40924         this_arg_conv.inner = untag_ptr(this_arg);
40925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40927         this_arg_conv.is_owned = false;
40928         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
40929         return ret_conv;
40930 }
40931
40932 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
40933         LDKNodeFeatures this_arg_conv;
40934         this_arg_conv.inner = untag_ptr(this_arg);
40935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40937         this_arg_conv.is_owned = false;
40938         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
40939         return ret_conv;
40940 }
40941
40942 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
40943         LDKInitFeatures this_arg_conv;
40944         this_arg_conv.inner = untag_ptr(this_arg);
40945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40947         this_arg_conv.is_owned = false;
40948         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
40949 }
40950
40951 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
40952         LDKInitFeatures this_arg_conv;
40953         this_arg_conv.inner = untag_ptr(this_arg);
40954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40956         this_arg_conv.is_owned = false;
40957         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
40958 }
40959
40960 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
40961         LDKInitFeatures this_arg_conv;
40962         this_arg_conv.inner = untag_ptr(this_arg);
40963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40965         this_arg_conv.is_owned = false;
40966         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
40967         return ret_conv;
40968 }
40969
40970 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
40971         LDKInitFeatures this_arg_conv;
40972         this_arg_conv.inner = untag_ptr(this_arg);
40973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40975         this_arg_conv.is_owned = false;
40976         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40977 }
40978
40979 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
40980         LDKInitFeatures this_arg_conv;
40981         this_arg_conv.inner = untag_ptr(this_arg);
40982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40984         this_arg_conv.is_owned = false;
40985         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40986 }
40987
40988 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
40989         LDKInitFeatures this_arg_conv;
40990         this_arg_conv.inner = untag_ptr(this_arg);
40991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40993         this_arg_conv.is_owned = false;
40994         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40995         return ret_conv;
40996 }
40997
40998 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
40999         LDKNodeFeatures this_arg_conv;
41000         this_arg_conv.inner = untag_ptr(this_arg);
41001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41003         this_arg_conv.is_owned = false;
41004         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
41005 }
41006
41007 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
41008         LDKNodeFeatures this_arg_conv;
41009         this_arg_conv.inner = untag_ptr(this_arg);
41010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41012         this_arg_conv.is_owned = false;
41013         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
41014 }
41015
41016 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
41017         LDKNodeFeatures this_arg_conv;
41018         this_arg_conv.inner = untag_ptr(this_arg);
41019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41021         this_arg_conv.is_owned = false;
41022         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
41023         return ret_conv;
41024 }
41025
41026 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
41027         LDKInitFeatures this_arg_conv;
41028         this_arg_conv.inner = untag_ptr(this_arg);
41029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41031         this_arg_conv.is_owned = false;
41032         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
41033         return ret_conv;
41034 }
41035
41036 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
41037         LDKNodeFeatures this_arg_conv;
41038         this_arg_conv.inner = untag_ptr(this_arg);
41039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41041         this_arg_conv.is_owned = false;
41042         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
41043         return ret_conv;
41044 }
41045
41046 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
41047         LDKInitFeatures this_arg_conv;
41048         this_arg_conv.inner = untag_ptr(this_arg);
41049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41051         this_arg_conv.is_owned = false;
41052         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
41053 }
41054
41055 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
41056         LDKInitFeatures this_arg_conv;
41057         this_arg_conv.inner = untag_ptr(this_arg);
41058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41060         this_arg_conv.is_owned = false;
41061         InitFeatures_set_gossip_queries_required(&this_arg_conv);
41062 }
41063
41064 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
41065         LDKInitFeatures this_arg_conv;
41066         this_arg_conv.inner = untag_ptr(this_arg);
41067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41069         this_arg_conv.is_owned = false;
41070         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
41071         return ret_conv;
41072 }
41073
41074 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
41075         LDKNodeFeatures this_arg_conv;
41076         this_arg_conv.inner = untag_ptr(this_arg);
41077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41079         this_arg_conv.is_owned = false;
41080         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
41081 }
41082
41083 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
41084         LDKNodeFeatures this_arg_conv;
41085         this_arg_conv.inner = untag_ptr(this_arg);
41086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41088         this_arg_conv.is_owned = false;
41089         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
41090 }
41091
41092 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
41093         LDKNodeFeatures this_arg_conv;
41094         this_arg_conv.inner = untag_ptr(this_arg);
41095         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41097         this_arg_conv.is_owned = false;
41098         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
41099         return ret_conv;
41100 }
41101
41102 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
41103         LDKInitFeatures this_arg_conv;
41104         this_arg_conv.inner = untag_ptr(this_arg);
41105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41107         this_arg_conv.is_owned = false;
41108         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
41109         return ret_conv;
41110 }
41111
41112 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
41113         LDKNodeFeatures this_arg_conv;
41114         this_arg_conv.inner = untag_ptr(this_arg);
41115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41117         this_arg_conv.is_owned = false;
41118         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
41119         return ret_conv;
41120 }
41121
41122 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
41123         LDKInitFeatures this_arg_conv;
41124         this_arg_conv.inner = untag_ptr(this_arg);
41125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41127         this_arg_conv.is_owned = false;
41128         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
41129 }
41130
41131 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
41132         LDKInitFeatures this_arg_conv;
41133         this_arg_conv.inner = untag_ptr(this_arg);
41134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41136         this_arg_conv.is_owned = false;
41137         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
41138 }
41139
41140 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
41141         LDKInitFeatures this_arg_conv;
41142         this_arg_conv.inner = untag_ptr(this_arg);
41143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41145         this_arg_conv.is_owned = false;
41146         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
41147         return ret_conv;
41148 }
41149
41150 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
41151         LDKNodeFeatures this_arg_conv;
41152         this_arg_conv.inner = untag_ptr(this_arg);
41153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41155         this_arg_conv.is_owned = false;
41156         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
41157 }
41158
41159 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
41160         LDKNodeFeatures this_arg_conv;
41161         this_arg_conv.inner = untag_ptr(this_arg);
41162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41164         this_arg_conv.is_owned = false;
41165         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
41166 }
41167
41168 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
41169         LDKNodeFeatures this_arg_conv;
41170         this_arg_conv.inner = untag_ptr(this_arg);
41171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41173         this_arg_conv.is_owned = false;
41174         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
41175         return ret_conv;
41176 }
41177
41178 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_optional"))) TS_InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
41179         LDKInvoiceFeatures this_arg_conv;
41180         this_arg_conv.inner = untag_ptr(this_arg);
41181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41183         this_arg_conv.is_owned = false;
41184         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
41185 }
41186
41187 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_required"))) TS_InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
41188         LDKInvoiceFeatures this_arg_conv;
41189         this_arg_conv.inner = untag_ptr(this_arg);
41190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41192         this_arg_conv.is_owned = false;
41193         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
41194 }
41195
41196 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_variable_length_onion"))) TS_InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
41197         LDKInvoiceFeatures this_arg_conv;
41198         this_arg_conv.inner = untag_ptr(this_arg);
41199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41201         this_arg_conv.is_owned = false;
41202         jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
41203         return ret_conv;
41204 }
41205
41206 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
41207         LDKInitFeatures this_arg_conv;
41208         this_arg_conv.inner = untag_ptr(this_arg);
41209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41211         this_arg_conv.is_owned = false;
41212         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
41213         return ret_conv;
41214 }
41215
41216 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
41217         LDKNodeFeatures this_arg_conv;
41218         this_arg_conv.inner = untag_ptr(this_arg);
41219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41221         this_arg_conv.is_owned = false;
41222         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
41223         return ret_conv;
41224 }
41225
41226 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_variable_length_onion"))) TS_InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
41227         LDKInvoiceFeatures this_arg_conv;
41228         this_arg_conv.inner = untag_ptr(this_arg);
41229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41231         this_arg_conv.is_owned = false;
41232         jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
41233         return ret_conv;
41234 }
41235
41236 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
41237         LDKInitFeatures this_arg_conv;
41238         this_arg_conv.inner = untag_ptr(this_arg);
41239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41241         this_arg_conv.is_owned = false;
41242         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
41243 }
41244
41245 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
41246         LDKInitFeatures this_arg_conv;
41247         this_arg_conv.inner = untag_ptr(this_arg);
41248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41250         this_arg_conv.is_owned = false;
41251         InitFeatures_set_static_remote_key_required(&this_arg_conv);
41252 }
41253
41254 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
41255         LDKInitFeatures this_arg_conv;
41256         this_arg_conv.inner = untag_ptr(this_arg);
41257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41259         this_arg_conv.is_owned = false;
41260         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
41261         return ret_conv;
41262 }
41263
41264 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
41265         LDKNodeFeatures this_arg_conv;
41266         this_arg_conv.inner = untag_ptr(this_arg);
41267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41269         this_arg_conv.is_owned = false;
41270         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
41271 }
41272
41273 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
41274         LDKNodeFeatures this_arg_conv;
41275         this_arg_conv.inner = untag_ptr(this_arg);
41276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41278         this_arg_conv.is_owned = false;
41279         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
41280 }
41281
41282 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
41283         LDKNodeFeatures this_arg_conv;
41284         this_arg_conv.inner = untag_ptr(this_arg);
41285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41287         this_arg_conv.is_owned = false;
41288         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
41289         return ret_conv;
41290 }
41291
41292 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
41293         LDKChannelTypeFeatures this_arg_conv;
41294         this_arg_conv.inner = untag_ptr(this_arg);
41295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41297         this_arg_conv.is_owned = false;
41298         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
41299 }
41300
41301 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
41302         LDKChannelTypeFeatures this_arg_conv;
41303         this_arg_conv.inner = untag_ptr(this_arg);
41304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41306         this_arg_conv.is_owned = false;
41307         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
41308 }
41309
41310 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
41311         LDKChannelTypeFeatures this_arg_conv;
41312         this_arg_conv.inner = untag_ptr(this_arg);
41313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41315         this_arg_conv.is_owned = false;
41316         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
41317         return ret_conv;
41318 }
41319
41320 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
41321         LDKInitFeatures this_arg_conv;
41322         this_arg_conv.inner = untag_ptr(this_arg);
41323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41325         this_arg_conv.is_owned = false;
41326         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
41327         return ret_conv;
41328 }
41329
41330 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
41331         LDKNodeFeatures this_arg_conv;
41332         this_arg_conv.inner = untag_ptr(this_arg);
41333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41335         this_arg_conv.is_owned = false;
41336         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
41337         return ret_conv;
41338 }
41339
41340 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
41341         LDKChannelTypeFeatures this_arg_conv;
41342         this_arg_conv.inner = untag_ptr(this_arg);
41343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41345         this_arg_conv.is_owned = false;
41346         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
41347         return ret_conv;
41348 }
41349
41350 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
41351         LDKInitFeatures this_arg_conv;
41352         this_arg_conv.inner = untag_ptr(this_arg);
41353         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41355         this_arg_conv.is_owned = false;
41356         InitFeatures_set_payment_secret_optional(&this_arg_conv);
41357 }
41358
41359 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
41360         LDKInitFeatures this_arg_conv;
41361         this_arg_conv.inner = untag_ptr(this_arg);
41362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41364         this_arg_conv.is_owned = false;
41365         InitFeatures_set_payment_secret_required(&this_arg_conv);
41366 }
41367
41368 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
41369         LDKInitFeatures this_arg_conv;
41370         this_arg_conv.inner = untag_ptr(this_arg);
41371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41373         this_arg_conv.is_owned = false;
41374         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
41375         return ret_conv;
41376 }
41377
41378 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
41379         LDKNodeFeatures this_arg_conv;
41380         this_arg_conv.inner = untag_ptr(this_arg);
41381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41383         this_arg_conv.is_owned = false;
41384         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
41385 }
41386
41387 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
41388         LDKNodeFeatures this_arg_conv;
41389         this_arg_conv.inner = untag_ptr(this_arg);
41390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41392         this_arg_conv.is_owned = false;
41393         NodeFeatures_set_payment_secret_required(&this_arg_conv);
41394 }
41395
41396 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
41397         LDKNodeFeatures this_arg_conv;
41398         this_arg_conv.inner = untag_ptr(this_arg);
41399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41401         this_arg_conv.is_owned = false;
41402         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
41403         return ret_conv;
41404 }
41405
41406 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_optional"))) TS_InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
41407         LDKInvoiceFeatures this_arg_conv;
41408         this_arg_conv.inner = untag_ptr(this_arg);
41409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41411         this_arg_conv.is_owned = false;
41412         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
41413 }
41414
41415 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_required"))) TS_InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
41416         LDKInvoiceFeatures this_arg_conv;
41417         this_arg_conv.inner = untag_ptr(this_arg);
41418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41420         this_arg_conv.is_owned = false;
41421         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
41422 }
41423
41424 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_payment_secret"))) TS_InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
41425         LDKInvoiceFeatures this_arg_conv;
41426         this_arg_conv.inner = untag_ptr(this_arg);
41427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41429         this_arg_conv.is_owned = false;
41430         jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
41431         return ret_conv;
41432 }
41433
41434 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
41435         LDKInitFeatures this_arg_conv;
41436         this_arg_conv.inner = untag_ptr(this_arg);
41437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41439         this_arg_conv.is_owned = false;
41440         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
41441         return ret_conv;
41442 }
41443
41444 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
41445         LDKNodeFeatures this_arg_conv;
41446         this_arg_conv.inner = untag_ptr(this_arg);
41447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41449         this_arg_conv.is_owned = false;
41450         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
41451         return ret_conv;
41452 }
41453
41454 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_payment_secret"))) TS_InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
41455         LDKInvoiceFeatures 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         jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
41461         return ret_conv;
41462 }
41463
41464 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41465         LDKInitFeatures this_arg_conv;
41466         this_arg_conv.inner = untag_ptr(this_arg);
41467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41469         this_arg_conv.is_owned = false;
41470         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
41471 }
41472
41473 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
41474         LDKInitFeatures this_arg_conv;
41475         this_arg_conv.inner = untag_ptr(this_arg);
41476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41478         this_arg_conv.is_owned = false;
41479         InitFeatures_set_basic_mpp_required(&this_arg_conv);
41480 }
41481
41482 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
41483         LDKInitFeatures this_arg_conv;
41484         this_arg_conv.inner = untag_ptr(this_arg);
41485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41487         this_arg_conv.is_owned = false;
41488         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
41489         return ret_conv;
41490 }
41491
41492 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41493         LDKNodeFeatures this_arg_conv;
41494         this_arg_conv.inner = untag_ptr(this_arg);
41495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41497         this_arg_conv.is_owned = false;
41498         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
41499 }
41500
41501 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
41502         LDKNodeFeatures this_arg_conv;
41503         this_arg_conv.inner = untag_ptr(this_arg);
41504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41506         this_arg_conv.is_owned = false;
41507         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
41508 }
41509
41510 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
41511         LDKNodeFeatures this_arg_conv;
41512         this_arg_conv.inner = untag_ptr(this_arg);
41513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41515         this_arg_conv.is_owned = false;
41516         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
41517         return ret_conv;
41518 }
41519
41520 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_optional"))) TS_InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41521         LDKInvoiceFeatures this_arg_conv;
41522         this_arg_conv.inner = untag_ptr(this_arg);
41523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41525         this_arg_conv.is_owned = false;
41526         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
41527 }
41528
41529 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_required"))) TS_InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
41530         LDKInvoiceFeatures this_arg_conv;
41531         this_arg_conv.inner = untag_ptr(this_arg);
41532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41534         this_arg_conv.is_owned = false;
41535         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
41536 }
41537
41538 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) TS_InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
41539         LDKInvoiceFeatures this_arg_conv;
41540         this_arg_conv.inner = untag_ptr(this_arg);
41541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41543         this_arg_conv.is_owned = false;
41544         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
41545         return ret_conv;
41546 }
41547
41548 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41549         LDKBolt12InvoiceFeatures this_arg_conv;
41550         this_arg_conv.inner = untag_ptr(this_arg);
41551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41553         this_arg_conv.is_owned = false;
41554         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
41555 }
41556
41557 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
41558         LDKBolt12InvoiceFeatures this_arg_conv;
41559         this_arg_conv.inner = untag_ptr(this_arg);
41560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41562         this_arg_conv.is_owned = false;
41563         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
41564 }
41565
41566 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_supports_basic_mpp"))) TS_Bolt12InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
41567         LDKBolt12InvoiceFeatures this_arg_conv;
41568         this_arg_conv.inner = untag_ptr(this_arg);
41569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41571         this_arg_conv.is_owned = false;
41572         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
41573         return ret_conv;
41574 }
41575
41576 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
41577         LDKInitFeatures this_arg_conv;
41578         this_arg_conv.inner = untag_ptr(this_arg);
41579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41581         this_arg_conv.is_owned = false;
41582         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
41583         return ret_conv;
41584 }
41585
41586 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
41587         LDKNodeFeatures this_arg_conv;
41588         this_arg_conv.inner = untag_ptr(this_arg);
41589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41591         this_arg_conv.is_owned = false;
41592         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
41593         return ret_conv;
41594 }
41595
41596 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) TS_InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
41597         LDKInvoiceFeatures this_arg_conv;
41598         this_arg_conv.inner = untag_ptr(this_arg);
41599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41601         this_arg_conv.is_owned = false;
41602         jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
41603         return ret_conv;
41604 }
41605
41606 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_basic_mpp"))) TS_Bolt12InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
41607         LDKBolt12InvoiceFeatures this_arg_conv;
41608         this_arg_conv.inner = untag_ptr(this_arg);
41609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41611         this_arg_conv.is_owned = false;
41612         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
41613         return ret_conv;
41614 }
41615
41616 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
41617         LDKInitFeatures this_arg_conv;
41618         this_arg_conv.inner = untag_ptr(this_arg);
41619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41621         this_arg_conv.is_owned = false;
41622         InitFeatures_set_wumbo_optional(&this_arg_conv);
41623 }
41624
41625 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
41626         LDKInitFeatures this_arg_conv;
41627         this_arg_conv.inner = untag_ptr(this_arg);
41628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41630         this_arg_conv.is_owned = false;
41631         InitFeatures_set_wumbo_required(&this_arg_conv);
41632 }
41633
41634 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
41635         LDKInitFeatures this_arg_conv;
41636         this_arg_conv.inner = untag_ptr(this_arg);
41637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41639         this_arg_conv.is_owned = false;
41640         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
41641         return ret_conv;
41642 }
41643
41644 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
41645         LDKNodeFeatures this_arg_conv;
41646         this_arg_conv.inner = untag_ptr(this_arg);
41647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41649         this_arg_conv.is_owned = false;
41650         NodeFeatures_set_wumbo_optional(&this_arg_conv);
41651 }
41652
41653 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
41654         LDKNodeFeatures this_arg_conv;
41655         this_arg_conv.inner = untag_ptr(this_arg);
41656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41658         this_arg_conv.is_owned = false;
41659         NodeFeatures_set_wumbo_required(&this_arg_conv);
41660 }
41661
41662 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
41663         LDKNodeFeatures this_arg_conv;
41664         this_arg_conv.inner = untag_ptr(this_arg);
41665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41667         this_arg_conv.is_owned = false;
41668         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
41669         return ret_conv;
41670 }
41671
41672 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
41673         LDKInitFeatures this_arg_conv;
41674         this_arg_conv.inner = untag_ptr(this_arg);
41675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41677         this_arg_conv.is_owned = false;
41678         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
41679         return ret_conv;
41680 }
41681
41682 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
41683         LDKNodeFeatures this_arg_conv;
41684         this_arg_conv.inner = untag_ptr(this_arg);
41685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41687         this_arg_conv.is_owned = false;
41688         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
41689         return ret_conv;
41690 }
41691
41692 void  __attribute__((export_name("TS_InitFeatures_set_anchors_zero_fee_htlc_tx_optional"))) TS_InitFeatures_set_anchors_zero_fee_htlc_tx_optional(uint64_t this_arg) {
41693         LDKInitFeatures this_arg_conv;
41694         this_arg_conv.inner = untag_ptr(this_arg);
41695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41697         this_arg_conv.is_owned = false;
41698         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
41699 }
41700
41701 void  __attribute__((export_name("TS_InitFeatures_set_anchors_zero_fee_htlc_tx_required"))) TS_InitFeatures_set_anchors_zero_fee_htlc_tx_required(uint64_t this_arg) {
41702         LDKInitFeatures this_arg_conv;
41703         this_arg_conv.inner = untag_ptr(this_arg);
41704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41706         this_arg_conv.is_owned = false;
41707         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
41708 }
41709
41710 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41711         LDKInitFeatures this_arg_conv;
41712         this_arg_conv.inner = untag_ptr(this_arg);
41713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41715         this_arg_conv.is_owned = false;
41716         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
41717         return ret_conv;
41718 }
41719
41720 void  __attribute__((export_name("TS_NodeFeatures_set_anchors_zero_fee_htlc_tx_optional"))) TS_NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(uint64_t this_arg) {
41721         LDKNodeFeatures this_arg_conv;
41722         this_arg_conv.inner = untag_ptr(this_arg);
41723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41725         this_arg_conv.is_owned = false;
41726         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
41727 }
41728
41729 void  __attribute__((export_name("TS_NodeFeatures_set_anchors_zero_fee_htlc_tx_required"))) TS_NodeFeatures_set_anchors_zero_fee_htlc_tx_required(uint64_t this_arg) {
41730         LDKNodeFeatures this_arg_conv;
41731         this_arg_conv.inner = untag_ptr(this_arg);
41732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41734         this_arg_conv.is_owned = false;
41735         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
41736 }
41737
41738 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41739         LDKNodeFeatures this_arg_conv;
41740         this_arg_conv.inner = untag_ptr(this_arg);
41741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41743         this_arg_conv.is_owned = false;
41744         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
41745         return ret_conv;
41746 }
41747
41748 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional"))) TS_ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(uint64_t this_arg) {
41749         LDKChannelTypeFeatures this_arg_conv;
41750         this_arg_conv.inner = untag_ptr(this_arg);
41751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41753         this_arg_conv.is_owned = false;
41754         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
41755 }
41756
41757 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required"))) TS_ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(uint64_t this_arg) {
41758         LDKChannelTypeFeatures this_arg_conv;
41759         this_arg_conv.inner = untag_ptr(this_arg);
41760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41762         this_arg_conv.is_owned = false;
41763         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
41764 }
41765
41766 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41767         LDKChannelTypeFeatures this_arg_conv;
41768         this_arg_conv.inner = untag_ptr(this_arg);
41769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41771         this_arg_conv.is_owned = false;
41772         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
41773         return ret_conv;
41774 }
41775
41776 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41777         LDKInitFeatures this_arg_conv;
41778         this_arg_conv.inner = untag_ptr(this_arg);
41779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41781         this_arg_conv.is_owned = false;
41782         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
41783         return ret_conv;
41784 }
41785
41786 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41787         LDKNodeFeatures this_arg_conv;
41788         this_arg_conv.inner = untag_ptr(this_arg);
41789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41791         this_arg_conv.is_owned = false;
41792         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
41793         return ret_conv;
41794 }
41795
41796 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41797         LDKChannelTypeFeatures this_arg_conv;
41798         this_arg_conv.inner = untag_ptr(this_arg);
41799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41801         this_arg_conv.is_owned = false;
41802         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
41803         return ret_conv;
41804 }
41805
41806 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
41807         LDKInitFeatures this_arg_conv;
41808         this_arg_conv.inner = untag_ptr(this_arg);
41809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41811         this_arg_conv.is_owned = false;
41812         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
41813 }
41814
41815 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
41816         LDKInitFeatures this_arg_conv;
41817         this_arg_conv.inner = untag_ptr(this_arg);
41818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41820         this_arg_conv.is_owned = false;
41821         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
41822 }
41823
41824 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
41825         LDKInitFeatures this_arg_conv;
41826         this_arg_conv.inner = untag_ptr(this_arg);
41827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41829         this_arg_conv.is_owned = false;
41830         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
41831         return ret_conv;
41832 }
41833
41834 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
41835         LDKNodeFeatures this_arg_conv;
41836         this_arg_conv.inner = untag_ptr(this_arg);
41837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41839         this_arg_conv.is_owned = false;
41840         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
41841 }
41842
41843 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
41844         LDKNodeFeatures this_arg_conv;
41845         this_arg_conv.inner = untag_ptr(this_arg);
41846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41848         this_arg_conv.is_owned = false;
41849         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
41850 }
41851
41852 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
41853         LDKNodeFeatures this_arg_conv;
41854         this_arg_conv.inner = untag_ptr(this_arg);
41855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41857         this_arg_conv.is_owned = false;
41858         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
41859         return ret_conv;
41860 }
41861
41862 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
41863         LDKInitFeatures this_arg_conv;
41864         this_arg_conv.inner = untag_ptr(this_arg);
41865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41867         this_arg_conv.is_owned = false;
41868         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
41869         return ret_conv;
41870 }
41871
41872 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
41873         LDKNodeFeatures this_arg_conv;
41874         this_arg_conv.inner = untag_ptr(this_arg);
41875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41877         this_arg_conv.is_owned = false;
41878         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
41879         return ret_conv;
41880 }
41881
41882 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
41883         LDKInitFeatures this_arg_conv;
41884         this_arg_conv.inner = untag_ptr(this_arg);
41885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41887         this_arg_conv.is_owned = false;
41888         InitFeatures_set_onion_messages_optional(&this_arg_conv);
41889 }
41890
41891 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
41892         LDKInitFeatures this_arg_conv;
41893         this_arg_conv.inner = untag_ptr(this_arg);
41894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41896         this_arg_conv.is_owned = false;
41897         InitFeatures_set_onion_messages_required(&this_arg_conv);
41898 }
41899
41900 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
41901         LDKInitFeatures this_arg_conv;
41902         this_arg_conv.inner = untag_ptr(this_arg);
41903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41905         this_arg_conv.is_owned = false;
41906         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
41907         return ret_conv;
41908 }
41909
41910 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
41911         LDKNodeFeatures this_arg_conv;
41912         this_arg_conv.inner = untag_ptr(this_arg);
41913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41915         this_arg_conv.is_owned = false;
41916         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
41917 }
41918
41919 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
41920         LDKNodeFeatures this_arg_conv;
41921         this_arg_conv.inner = untag_ptr(this_arg);
41922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41924         this_arg_conv.is_owned = false;
41925         NodeFeatures_set_onion_messages_required(&this_arg_conv);
41926 }
41927
41928 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
41929         LDKNodeFeatures this_arg_conv;
41930         this_arg_conv.inner = untag_ptr(this_arg);
41931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41933         this_arg_conv.is_owned = false;
41934         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
41935         return ret_conv;
41936 }
41937
41938 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
41939         LDKInitFeatures this_arg_conv;
41940         this_arg_conv.inner = untag_ptr(this_arg);
41941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41943         this_arg_conv.is_owned = false;
41944         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
41945         return ret_conv;
41946 }
41947
41948 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
41949         LDKNodeFeatures this_arg_conv;
41950         this_arg_conv.inner = untag_ptr(this_arg);
41951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41953         this_arg_conv.is_owned = false;
41954         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
41955         return ret_conv;
41956 }
41957
41958 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
41959         LDKInitFeatures this_arg_conv;
41960         this_arg_conv.inner = untag_ptr(this_arg);
41961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41963         this_arg_conv.is_owned = false;
41964         InitFeatures_set_channel_type_optional(&this_arg_conv);
41965 }
41966
41967 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
41968         LDKInitFeatures this_arg_conv;
41969         this_arg_conv.inner = untag_ptr(this_arg);
41970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41972         this_arg_conv.is_owned = false;
41973         InitFeatures_set_channel_type_required(&this_arg_conv);
41974 }
41975
41976 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
41977         LDKInitFeatures this_arg_conv;
41978         this_arg_conv.inner = untag_ptr(this_arg);
41979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41981         this_arg_conv.is_owned = false;
41982         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
41983         return ret_conv;
41984 }
41985
41986 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
41987         LDKNodeFeatures this_arg_conv;
41988         this_arg_conv.inner = untag_ptr(this_arg);
41989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41991         this_arg_conv.is_owned = false;
41992         NodeFeatures_set_channel_type_optional(&this_arg_conv);
41993 }
41994
41995 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
41996         LDKNodeFeatures this_arg_conv;
41997         this_arg_conv.inner = untag_ptr(this_arg);
41998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42000         this_arg_conv.is_owned = false;
42001         NodeFeatures_set_channel_type_required(&this_arg_conv);
42002 }
42003
42004 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
42005         LDKNodeFeatures this_arg_conv;
42006         this_arg_conv.inner = untag_ptr(this_arg);
42007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42009         this_arg_conv.is_owned = false;
42010         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
42011         return ret_conv;
42012 }
42013
42014 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
42015         LDKInitFeatures this_arg_conv;
42016         this_arg_conv.inner = untag_ptr(this_arg);
42017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42019         this_arg_conv.is_owned = false;
42020         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
42021         return ret_conv;
42022 }
42023
42024 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
42025         LDKNodeFeatures this_arg_conv;
42026         this_arg_conv.inner = untag_ptr(this_arg);
42027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42029         this_arg_conv.is_owned = false;
42030         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
42031         return ret_conv;
42032 }
42033
42034 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
42035         LDKInitFeatures this_arg_conv;
42036         this_arg_conv.inner = untag_ptr(this_arg);
42037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42039         this_arg_conv.is_owned = false;
42040         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
42041 }
42042
42043 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
42044         LDKInitFeatures this_arg_conv;
42045         this_arg_conv.inner = untag_ptr(this_arg);
42046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42048         this_arg_conv.is_owned = false;
42049         InitFeatures_set_scid_privacy_required(&this_arg_conv);
42050 }
42051
42052 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
42053         LDKInitFeatures this_arg_conv;
42054         this_arg_conv.inner = untag_ptr(this_arg);
42055         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42057         this_arg_conv.is_owned = false;
42058         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
42059         return ret_conv;
42060 }
42061
42062 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
42063         LDKNodeFeatures this_arg_conv;
42064         this_arg_conv.inner = untag_ptr(this_arg);
42065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42067         this_arg_conv.is_owned = false;
42068         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
42069 }
42070
42071 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
42072         LDKNodeFeatures this_arg_conv;
42073         this_arg_conv.inner = untag_ptr(this_arg);
42074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42076         this_arg_conv.is_owned = false;
42077         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
42078 }
42079
42080 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
42081         LDKNodeFeatures this_arg_conv;
42082         this_arg_conv.inner = untag_ptr(this_arg);
42083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42085         this_arg_conv.is_owned = false;
42086         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
42087         return ret_conv;
42088 }
42089
42090 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
42091         LDKChannelTypeFeatures this_arg_conv;
42092         this_arg_conv.inner = untag_ptr(this_arg);
42093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42095         this_arg_conv.is_owned = false;
42096         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
42097 }
42098
42099 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
42100         LDKChannelTypeFeatures this_arg_conv;
42101         this_arg_conv.inner = untag_ptr(this_arg);
42102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42104         this_arg_conv.is_owned = false;
42105         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
42106 }
42107
42108 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
42109         LDKChannelTypeFeatures this_arg_conv;
42110         this_arg_conv.inner = untag_ptr(this_arg);
42111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42113         this_arg_conv.is_owned = false;
42114         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
42115         return ret_conv;
42116 }
42117
42118 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
42119         LDKInitFeatures this_arg_conv;
42120         this_arg_conv.inner = untag_ptr(this_arg);
42121         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42123         this_arg_conv.is_owned = false;
42124         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
42125         return ret_conv;
42126 }
42127
42128 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
42129         LDKNodeFeatures this_arg_conv;
42130         this_arg_conv.inner = untag_ptr(this_arg);
42131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42133         this_arg_conv.is_owned = false;
42134         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
42135         return ret_conv;
42136 }
42137
42138 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
42139         LDKChannelTypeFeatures this_arg_conv;
42140         this_arg_conv.inner = untag_ptr(this_arg);
42141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42143         this_arg_conv.is_owned = false;
42144         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
42145         return ret_conv;
42146 }
42147
42148 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
42149         LDKInitFeatures this_arg_conv;
42150         this_arg_conv.inner = untag_ptr(this_arg);
42151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42153         this_arg_conv.is_owned = false;
42154         InitFeatures_set_zero_conf_optional(&this_arg_conv);
42155 }
42156
42157 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
42158         LDKInitFeatures this_arg_conv;
42159         this_arg_conv.inner = untag_ptr(this_arg);
42160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42162         this_arg_conv.is_owned = false;
42163         InitFeatures_set_zero_conf_required(&this_arg_conv);
42164 }
42165
42166 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
42167         LDKInitFeatures this_arg_conv;
42168         this_arg_conv.inner = untag_ptr(this_arg);
42169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42171         this_arg_conv.is_owned = false;
42172         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
42173         return ret_conv;
42174 }
42175
42176 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
42177         LDKNodeFeatures this_arg_conv;
42178         this_arg_conv.inner = untag_ptr(this_arg);
42179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42181         this_arg_conv.is_owned = false;
42182         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
42183 }
42184
42185 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
42186         LDKNodeFeatures this_arg_conv;
42187         this_arg_conv.inner = untag_ptr(this_arg);
42188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42190         this_arg_conv.is_owned = false;
42191         NodeFeatures_set_zero_conf_required(&this_arg_conv);
42192 }
42193
42194 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
42195         LDKNodeFeatures this_arg_conv;
42196         this_arg_conv.inner = untag_ptr(this_arg);
42197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42199         this_arg_conv.is_owned = false;
42200         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
42201         return ret_conv;
42202 }
42203
42204 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
42205         LDKChannelTypeFeatures this_arg_conv;
42206         this_arg_conv.inner = untag_ptr(this_arg);
42207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42209         this_arg_conv.is_owned = false;
42210         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
42211 }
42212
42213 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
42214         LDKChannelTypeFeatures this_arg_conv;
42215         this_arg_conv.inner = untag_ptr(this_arg);
42216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42218         this_arg_conv.is_owned = false;
42219         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
42220 }
42221
42222 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
42223         LDKChannelTypeFeatures this_arg_conv;
42224         this_arg_conv.inner = untag_ptr(this_arg);
42225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42227         this_arg_conv.is_owned = false;
42228         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
42229         return ret_conv;
42230 }
42231
42232 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
42233         LDKInitFeatures this_arg_conv;
42234         this_arg_conv.inner = untag_ptr(this_arg);
42235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42237         this_arg_conv.is_owned = false;
42238         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
42239         return ret_conv;
42240 }
42241
42242 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
42243         LDKNodeFeatures this_arg_conv;
42244         this_arg_conv.inner = untag_ptr(this_arg);
42245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42247         this_arg_conv.is_owned = false;
42248         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
42249         return ret_conv;
42250 }
42251
42252 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
42253         LDKChannelTypeFeatures this_arg_conv;
42254         this_arg_conv.inner = untag_ptr(this_arg);
42255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42257         this_arg_conv.is_owned = false;
42258         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
42259         return ret_conv;
42260 }
42261
42262 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
42263         LDKNodeFeatures this_arg_conv;
42264         this_arg_conv.inner = untag_ptr(this_arg);
42265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42267         this_arg_conv.is_owned = false;
42268         NodeFeatures_set_keysend_optional(&this_arg_conv);
42269 }
42270
42271 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
42272         LDKNodeFeatures this_arg_conv;
42273         this_arg_conv.inner = untag_ptr(this_arg);
42274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42276         this_arg_conv.is_owned = false;
42277         NodeFeatures_set_keysend_required(&this_arg_conv);
42278 }
42279
42280 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
42281         LDKNodeFeatures this_arg_conv;
42282         this_arg_conv.inner = untag_ptr(this_arg);
42283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42285         this_arg_conv.is_owned = false;
42286         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
42287         return ret_conv;
42288 }
42289
42290 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
42291         LDKNodeFeatures this_arg_conv;
42292         this_arg_conv.inner = untag_ptr(this_arg);
42293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42295         this_arg_conv.is_owned = false;
42296         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
42297         return ret_conv;
42298 }
42299
42300 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
42301         LDKShutdownScript this_obj_conv;
42302         this_obj_conv.inner = untag_ptr(this_obj);
42303         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42305         ShutdownScript_free(this_obj_conv);
42306 }
42307
42308 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
42309         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
42310         uint64_t ret_ref = 0;
42311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42313         return ret_ref;
42314 }
42315 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
42316         LDKShutdownScript arg_conv;
42317         arg_conv.inner = untag_ptr(arg);
42318         arg_conv.is_owned = ptr_is_owned(arg);
42319         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42320         arg_conv.is_owned = false;
42321         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
42322         return ret_conv;
42323 }
42324
42325 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
42326         LDKShutdownScript orig_conv;
42327         orig_conv.inner = untag_ptr(orig);
42328         orig_conv.is_owned = ptr_is_owned(orig);
42329         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42330         orig_conv.is_owned = false;
42331         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
42332         uint64_t ret_ref = 0;
42333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42335         return ret_ref;
42336 }
42337
42338 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
42339         LDKShutdownScript a_conv;
42340         a_conv.inner = untag_ptr(a);
42341         a_conv.is_owned = ptr_is_owned(a);
42342         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42343         a_conv.is_owned = false;
42344         LDKShutdownScript b_conv;
42345         b_conv.inner = untag_ptr(b);
42346         b_conv.is_owned = ptr_is_owned(b);
42347         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42348         b_conv.is_owned = false;
42349         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
42350         return ret_conv;
42351 }
42352
42353 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
42354         LDKInvalidShutdownScript this_obj_conv;
42355         this_obj_conv.inner = untag_ptr(this_obj);
42356         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42358         InvalidShutdownScript_free(this_obj_conv);
42359 }
42360
42361 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
42362         LDKInvalidShutdownScript this_ptr_conv;
42363         this_ptr_conv.inner = untag_ptr(this_ptr);
42364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42366         this_ptr_conv.is_owned = false;
42367         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
42368         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42369         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42370         return ret_arr;
42371 }
42372
42373 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
42374         LDKInvalidShutdownScript this_ptr_conv;
42375         this_ptr_conv.inner = untag_ptr(this_ptr);
42376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42378         this_ptr_conv.is_owned = false;
42379         LDKCVec_u8Z val_ref;
42380         val_ref.datalen = val->arr_len;
42381         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
42382         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
42383         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
42384 }
42385
42386 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
42387         LDKCVec_u8Z script_arg_ref;
42388         script_arg_ref.datalen = script_arg->arr_len;
42389         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
42390         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
42391         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
42392         uint64_t ret_ref = 0;
42393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42395         return ret_ref;
42396 }
42397
42398 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
42399         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
42400         uint64_t ret_ref = 0;
42401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42403         return ret_ref;
42404 }
42405 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
42406         LDKInvalidShutdownScript arg_conv;
42407         arg_conv.inner = untag_ptr(arg);
42408         arg_conv.is_owned = ptr_is_owned(arg);
42409         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42410         arg_conv.is_owned = false;
42411         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
42412         return ret_conv;
42413 }
42414
42415 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
42416         LDKInvalidShutdownScript orig_conv;
42417         orig_conv.inner = untag_ptr(orig);
42418         orig_conv.is_owned = ptr_is_owned(orig);
42419         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42420         orig_conv.is_owned = false;
42421         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
42422         uint64_t ret_ref = 0;
42423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42425         return ret_ref;
42426 }
42427
42428 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
42429         LDKShutdownScript obj_conv;
42430         obj_conv.inner = untag_ptr(obj);
42431         obj_conv.is_owned = ptr_is_owned(obj);
42432         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42433         obj_conv.is_owned = false;
42434         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
42435         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42436         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42437         CVec_u8Z_free(ret_var);
42438         return ret_arr;
42439 }
42440
42441 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
42442         LDKu8slice ser_ref;
42443         ser_ref.datalen = ser->arr_len;
42444         ser_ref.data = ser->elems;
42445         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
42446         *ret_conv = ShutdownScript_read(ser_ref);
42447         FREE(ser);
42448         return tag_ptr(ret_conv, true);
42449 }
42450
42451 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
42452         uint8_t pubkey_hash_arr[20];
42453         CHECK(pubkey_hash->arr_len == 20);
42454         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
42455         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
42456         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
42457         uint64_t ret_ref = 0;
42458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42460         return ret_ref;
42461 }
42462
42463 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
42464         uint8_t script_hash_arr[32];
42465         CHECK(script_hash->arr_len == 32);
42466         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
42467         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
42468         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
42469         uint64_t ret_ref = 0;
42470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42472         return ret_ref;
42473 }
42474
42475 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
42476         
42477         LDKu8slice program_ref;
42478         program_ref.datalen = program->arr_len;
42479         program_ref.data = program->elems;
42480         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
42481         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
42482         FREE(program);
42483         return tag_ptr(ret_conv, true);
42484 }
42485
42486 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
42487         LDKShutdownScript this_arg_conv;
42488         this_arg_conv.inner = untag_ptr(this_arg);
42489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42491         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
42492         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
42493         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42494         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42495         CVec_u8Z_free(ret_var);
42496         return ret_arr;
42497 }
42498
42499 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
42500         LDKShutdownScript this_arg_conv;
42501         this_arg_conv.inner = untag_ptr(this_arg);
42502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42504         this_arg_conv.is_owned = false;
42505         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42506         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
42507         return ret_arr;
42508 }
42509
42510 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
42511         LDKShutdownScript this_arg_conv;
42512         this_arg_conv.inner = untag_ptr(this_arg);
42513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42515         this_arg_conv.is_owned = false;
42516         LDKInitFeatures features_conv;
42517         features_conv.inner = untag_ptr(features);
42518         features_conv.is_owned = ptr_is_owned(features);
42519         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
42520         features_conv.is_owned = false;
42521         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
42522         return ret_conv;
42523 }
42524
42525 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
42526         if (!ptr_is_owned(this_ptr)) return;
42527         void* this_ptr_ptr = untag_ptr(this_ptr);
42528         CHECK_ACCESS(this_ptr_ptr);
42529         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
42530         FREE(untag_ptr(this_ptr));
42531         Retry_free(this_ptr_conv);
42532 }
42533
42534 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
42535         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
42536         *ret_copy = Retry_clone(arg);
42537         uint64_t ret_ref = tag_ptr(ret_copy, true);
42538         return ret_ref;
42539 }
42540 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
42541         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
42542         int64_t ret_conv = Retry_clone_ptr(arg_conv);
42543         return ret_conv;
42544 }
42545
42546 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
42547         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
42548         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
42549         *ret_copy = Retry_clone(orig_conv);
42550         uint64_t ret_ref = tag_ptr(ret_copy, true);
42551         return ret_ref;
42552 }
42553
42554 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
42555         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
42556         *ret_copy = Retry_attempts(a);
42557         uint64_t ret_ref = tag_ptr(ret_copy, true);
42558         return ret_ref;
42559 }
42560
42561 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
42562         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
42563         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
42564         jboolean ret_conv = Retry_eq(a_conv, b_conv);
42565         return ret_conv;
42566 }
42567
42568 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
42569         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
42570         int64_t ret_conv = Retry_hash(o_conv);
42571         return ret_conv;
42572 }
42573
42574 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_clone"))) TS_RetryableSendFailure_clone(uint64_t orig) {
42575         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
42576         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_clone(orig_conv));
42577         return ret_conv;
42578 }
42579
42580 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_payment_expired"))) TS_RetryableSendFailure_payment_expired() {
42581         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_payment_expired());
42582         return ret_conv;
42583 }
42584
42585 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_route_not_found"))) TS_RetryableSendFailure_route_not_found() {
42586         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_route_not_found());
42587         return ret_conv;
42588 }
42589
42590 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_duplicate_payment"))) TS_RetryableSendFailure_duplicate_payment() {
42591         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_duplicate_payment());
42592         return ret_conv;
42593 }
42594
42595 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
42596         if (!ptr_is_owned(this_ptr)) return;
42597         void* this_ptr_ptr = untag_ptr(this_ptr);
42598         CHECK_ACCESS(this_ptr_ptr);
42599         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
42600         FREE(untag_ptr(this_ptr));
42601         PaymentSendFailure_free(this_ptr_conv);
42602 }
42603
42604 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
42605         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42606         *ret_copy = PaymentSendFailure_clone(arg);
42607         uint64_t ret_ref = tag_ptr(ret_copy, true);
42608         return ret_ref;
42609 }
42610 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
42611         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
42612         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
42613         return ret_conv;
42614 }
42615
42616 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
42617         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
42618         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42619         *ret_copy = PaymentSendFailure_clone(orig_conv);
42620         uint64_t ret_ref = tag_ptr(ret_copy, true);
42621         return ret_ref;
42622 }
42623
42624 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
42625         void* a_ptr = untag_ptr(a);
42626         CHECK_ACCESS(a_ptr);
42627         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
42628         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
42629         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42630         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
42631         uint64_t ret_ref = tag_ptr(ret_copy, true);
42632         return ret_ref;
42633 }
42634
42635 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
42636         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
42637         a_constr.datalen = a->arr_len;
42638         if (a_constr.datalen > 0)
42639                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
42640         else
42641                 a_constr.data = NULL;
42642         uint64_t* a_vals = a->elems;
42643         for (size_t w = 0; w < a_constr.datalen; w++) {
42644                 uint64_t a_conv_22 = a_vals[w];
42645                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
42646                 CHECK_ACCESS(a_conv_22_ptr);
42647                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
42648                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
42649                 a_constr.data[w] = a_conv_22_conv;
42650         }
42651         FREE(a);
42652         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42653         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
42654         uint64_t ret_ref = tag_ptr(ret_copy, true);
42655         return ret_ref;
42656 }
42657
42658 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
42659         LDKCVec_APIErrorZ a_constr;
42660         a_constr.datalen = a->arr_len;
42661         if (a_constr.datalen > 0)
42662                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
42663         else
42664                 a_constr.data = NULL;
42665         uint64_t* a_vals = a->elems;
42666         for (size_t k = 0; k < a_constr.datalen; k++) {
42667                 uint64_t a_conv_10 = a_vals[k];
42668                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
42669                 CHECK_ACCESS(a_conv_10_ptr);
42670                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
42671                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
42672                 a_constr.data[k] = a_conv_10_conv;
42673         }
42674         FREE(a);
42675         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42676         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
42677         uint64_t ret_ref = tag_ptr(ret_copy, true);
42678         return ret_ref;
42679 }
42680
42681 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
42682         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42683         *ret_copy = PaymentSendFailure_duplicate_payment();
42684         uint64_t ret_ref = tag_ptr(ret_copy, true);
42685         return ret_ref;
42686 }
42687
42688 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) {
42689         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
42690         results_constr.datalen = results->arr_len;
42691         if (results_constr.datalen > 0)
42692                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
42693         else
42694                 results_constr.data = NULL;
42695         uint64_t* results_vals = results->elems;
42696         for (size_t w = 0; w < results_constr.datalen; w++) {
42697                 uint64_t results_conv_22 = results_vals[w];
42698                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
42699                 CHECK_ACCESS(results_conv_22_ptr);
42700                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
42701                 results_constr.data[w] = results_conv_22_conv;
42702         }
42703         FREE(results);
42704         LDKRouteParameters failed_paths_retry_conv;
42705         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
42706         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
42707         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
42708         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
42709         LDKThirtyTwoBytes payment_id_ref;
42710         CHECK(payment_id->arr_len == 32);
42711         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42712         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42713         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
42714         uint64_t ret_ref = tag_ptr(ret_copy, true);
42715         return ret_ref;
42716 }
42717
42718 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
42719         if (!ptr_is_owned(this_ptr)) return;
42720         void* this_ptr_ptr = untag_ptr(this_ptr);
42721         CHECK_ACCESS(this_ptr_ptr);
42722         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
42723         FREE(untag_ptr(this_ptr));
42724         CustomMessageReader_free(this_ptr_conv);
42725 }
42726
42727 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
42728         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
42729         *ret_ret = Type_clone(arg);
42730         return tag_ptr(ret_ret, true);
42731 }
42732 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
42733         void* arg_ptr = untag_ptr(arg);
42734         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
42735         LDKType* arg_conv = (LDKType*)arg_ptr;
42736         int64_t ret_conv = Type_clone_ptr(arg_conv);
42737         return ret_conv;
42738 }
42739
42740 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
42741         void* orig_ptr = untag_ptr(orig);
42742         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
42743         LDKType* orig_conv = (LDKType*)orig_ptr;
42744         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
42745         *ret_ret = Type_clone(orig_conv);
42746         return tag_ptr(ret_ret, true);
42747 }
42748
42749 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
42750         if (!ptr_is_owned(this_ptr)) return;
42751         void* this_ptr_ptr = untag_ptr(this_ptr);
42752         CHECK_ACCESS(this_ptr_ptr);
42753         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
42754         FREE(untag_ptr(this_ptr));
42755         Type_free(this_ptr_conv);
42756 }
42757
42758 uint32_t  __attribute__((export_name("TS_UtxoLookupError_clone"))) TS_UtxoLookupError_clone(uint64_t orig) {
42759         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
42760         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_clone(orig_conv));
42761         return ret_conv;
42762 }
42763
42764 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_chain"))) TS_UtxoLookupError_unknown_chain() {
42765         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_chain());
42766         return ret_conv;
42767 }
42768
42769 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_tx"))) TS_UtxoLookupError_unknown_tx() {
42770         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_tx());
42771         return ret_conv;
42772 }
42773
42774 void  __attribute__((export_name("TS_UtxoResult_free"))) TS_UtxoResult_free(uint64_t this_ptr) {
42775         if (!ptr_is_owned(this_ptr)) return;
42776         void* this_ptr_ptr = untag_ptr(this_ptr);
42777         CHECK_ACCESS(this_ptr_ptr);
42778         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
42779         FREE(untag_ptr(this_ptr));
42780         UtxoResult_free(this_ptr_conv);
42781 }
42782
42783 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
42784         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
42785         *ret_copy = UtxoResult_clone(arg);
42786         uint64_t ret_ref = tag_ptr(ret_copy, true);
42787         return ret_ref;
42788 }
42789 int64_t  __attribute__((export_name("TS_UtxoResult_clone_ptr"))) TS_UtxoResult_clone_ptr(uint64_t arg) {
42790         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
42791         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
42792         return ret_conv;
42793 }
42794
42795 uint64_t  __attribute__((export_name("TS_UtxoResult_clone"))) TS_UtxoResult_clone(uint64_t orig) {
42796         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
42797         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
42798         *ret_copy = UtxoResult_clone(orig_conv);
42799         uint64_t ret_ref = tag_ptr(ret_copy, true);
42800         return ret_ref;
42801 }
42802
42803 uint64_t  __attribute__((export_name("TS_UtxoResult_sync"))) TS_UtxoResult_sync(uint64_t a) {
42804         void* a_ptr = untag_ptr(a);
42805         CHECK_ACCESS(a_ptr);
42806         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
42807         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
42808         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
42809         *ret_copy = UtxoResult_sync(a_conv);
42810         uint64_t ret_ref = tag_ptr(ret_copy, true);
42811         return ret_ref;
42812 }
42813
42814 uint64_t  __attribute__((export_name("TS_UtxoResult_async"))) TS_UtxoResult_async(uint64_t a) {
42815         LDKUtxoFuture a_conv;
42816         a_conv.inner = untag_ptr(a);
42817         a_conv.is_owned = ptr_is_owned(a);
42818         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42819         a_conv = UtxoFuture_clone(&a_conv);
42820         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
42821         *ret_copy = UtxoResult_async(a_conv);
42822         uint64_t ret_ref = tag_ptr(ret_copy, true);
42823         return ret_ref;
42824 }
42825
42826 void  __attribute__((export_name("TS_UtxoLookup_free"))) TS_UtxoLookup_free(uint64_t this_ptr) {
42827         if (!ptr_is_owned(this_ptr)) return;
42828         void* this_ptr_ptr = untag_ptr(this_ptr);
42829         CHECK_ACCESS(this_ptr_ptr);
42830         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
42831         FREE(untag_ptr(this_ptr));
42832         UtxoLookup_free(this_ptr_conv);
42833 }
42834
42835 void  __attribute__((export_name("TS_UtxoFuture_free"))) TS_UtxoFuture_free(uint64_t this_obj) {
42836         LDKUtxoFuture this_obj_conv;
42837         this_obj_conv.inner = untag_ptr(this_obj);
42838         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42840         UtxoFuture_free(this_obj_conv);
42841 }
42842
42843 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
42844         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
42845         uint64_t ret_ref = 0;
42846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42848         return ret_ref;
42849 }
42850 int64_t  __attribute__((export_name("TS_UtxoFuture_clone_ptr"))) TS_UtxoFuture_clone_ptr(uint64_t arg) {
42851         LDKUtxoFuture arg_conv;
42852         arg_conv.inner = untag_ptr(arg);
42853         arg_conv.is_owned = ptr_is_owned(arg);
42854         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42855         arg_conv.is_owned = false;
42856         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
42857         return ret_conv;
42858 }
42859
42860 uint64_t  __attribute__((export_name("TS_UtxoFuture_clone"))) TS_UtxoFuture_clone(uint64_t orig) {
42861         LDKUtxoFuture orig_conv;
42862         orig_conv.inner = untag_ptr(orig);
42863         orig_conv.is_owned = ptr_is_owned(orig);
42864         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42865         orig_conv.is_owned = false;
42866         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
42867         uint64_t ret_ref = 0;
42868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42870         return ret_ref;
42871 }
42872
42873 uint64_t  __attribute__((export_name("TS_UtxoFuture_new"))) TS_UtxoFuture_new() {
42874         LDKUtxoFuture ret_var = UtxoFuture_new();
42875         uint64_t ret_ref = 0;
42876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42878         return ret_ref;
42879 }
42880
42881 void  __attribute__((export_name("TS_UtxoFuture_resolve_without_forwarding"))) TS_UtxoFuture_resolve_without_forwarding(uint64_t this_arg, uint64_t graph, uint64_t result) {
42882         LDKUtxoFuture this_arg_conv;
42883         this_arg_conv.inner = untag_ptr(this_arg);
42884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42886         this_arg_conv.is_owned = false;
42887         LDKNetworkGraph graph_conv;
42888         graph_conv.inner = untag_ptr(graph);
42889         graph_conv.is_owned = ptr_is_owned(graph);
42890         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
42891         graph_conv.is_owned = false;
42892         void* result_ptr = untag_ptr(result);
42893         CHECK_ACCESS(result_ptr);
42894         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
42895         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
42896 }
42897
42898 void  __attribute__((export_name("TS_UtxoFuture_resolve"))) TS_UtxoFuture_resolve(uint64_t this_arg, uint64_t graph, uint64_t gossip, uint64_t result) {
42899         LDKUtxoFuture this_arg_conv;
42900         this_arg_conv.inner = untag_ptr(this_arg);
42901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42903         this_arg_conv.is_owned = false;
42904         LDKNetworkGraph graph_conv;
42905         graph_conv.inner = untag_ptr(graph);
42906         graph_conv.is_owned = ptr_is_owned(graph);
42907         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
42908         graph_conv.is_owned = false;
42909         LDKP2PGossipSync gossip_conv;
42910         gossip_conv.inner = untag_ptr(gossip);
42911         gossip_conv.is_owned = ptr_is_owned(gossip);
42912         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
42913         gossip_conv.is_owned = false;
42914         void* result_ptr = untag_ptr(result);
42915         CHECK_ACCESS(result_ptr);
42916         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
42917         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
42918 }
42919
42920 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
42921         LDKNodeId this_obj_conv;
42922         this_obj_conv.inner = untag_ptr(this_obj);
42923         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42925         NodeId_free(this_obj_conv);
42926 }
42927
42928 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
42929         LDKNodeId ret_var = NodeId_clone(arg);
42930         uint64_t ret_ref = 0;
42931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42933         return ret_ref;
42934 }
42935 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
42936         LDKNodeId arg_conv;
42937         arg_conv.inner = untag_ptr(arg);
42938         arg_conv.is_owned = ptr_is_owned(arg);
42939         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42940         arg_conv.is_owned = false;
42941         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
42942         return ret_conv;
42943 }
42944
42945 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
42946         LDKNodeId orig_conv;
42947         orig_conv.inner = untag_ptr(orig);
42948         orig_conv.is_owned = ptr_is_owned(orig);
42949         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42950         orig_conv.is_owned = false;
42951         LDKNodeId ret_var = NodeId_clone(&orig_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 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
42959         LDKPublicKey pubkey_ref;
42960         CHECK(pubkey->arr_len == 33);
42961         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
42962         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
42963         uint64_t ret_ref = 0;
42964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42966         return ret_ref;
42967 }
42968
42969 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
42970         LDKNodeId 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         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
42976         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42977         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42978         return ret_arr;
42979 }
42980
42981 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
42982         LDKNodeId o_conv;
42983         o_conv.inner = untag_ptr(o);
42984         o_conv.is_owned = ptr_is_owned(o);
42985         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42986         o_conv.is_owned = false;
42987         int64_t ret_conv = NodeId_hash(&o_conv);
42988         return ret_conv;
42989 }
42990
42991 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
42992         LDKNodeId obj_conv;
42993         obj_conv.inner = untag_ptr(obj);
42994         obj_conv.is_owned = ptr_is_owned(obj);
42995         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42996         obj_conv.is_owned = false;
42997         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
42998         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42999         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43000         CVec_u8Z_free(ret_var);
43001         return ret_arr;
43002 }
43003
43004 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
43005         LDKu8slice ser_ref;
43006         ser_ref.datalen = ser->arr_len;
43007         ser_ref.data = ser->elems;
43008         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
43009         *ret_conv = NodeId_read(ser_ref);
43010         FREE(ser);
43011         return tag_ptr(ret_conv, true);
43012 }
43013
43014 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
43015         LDKNetworkGraph this_obj_conv;
43016         this_obj_conv.inner = untag_ptr(this_obj);
43017         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43019         NetworkGraph_free(this_obj_conv);
43020 }
43021
43022 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
43023         LDKReadOnlyNetworkGraph this_obj_conv;
43024         this_obj_conv.inner = untag_ptr(this_obj);
43025         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43027         ReadOnlyNetworkGraph_free(this_obj_conv);
43028 }
43029
43030 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
43031         if (!ptr_is_owned(this_ptr)) return;
43032         void* this_ptr_ptr = untag_ptr(this_ptr);
43033         CHECK_ACCESS(this_ptr_ptr);
43034         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
43035         FREE(untag_ptr(this_ptr));
43036         NetworkUpdate_free(this_ptr_conv);
43037 }
43038
43039 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
43040         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
43041         *ret_copy = NetworkUpdate_clone(arg);
43042         uint64_t ret_ref = tag_ptr(ret_copy, true);
43043         return ret_ref;
43044 }
43045 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
43046         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
43047         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
43048         return ret_conv;
43049 }
43050
43051 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
43052         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
43053         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
43054         *ret_copy = NetworkUpdate_clone(orig_conv);
43055         uint64_t ret_ref = tag_ptr(ret_copy, true);
43056         return ret_ref;
43057 }
43058
43059 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
43060         LDKChannelUpdate msg_conv;
43061         msg_conv.inner = untag_ptr(msg);
43062         msg_conv.is_owned = ptr_is_owned(msg);
43063         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43064         msg_conv = ChannelUpdate_clone(&msg_conv);
43065         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
43066         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
43067         uint64_t ret_ref = tag_ptr(ret_copy, true);
43068         return ret_ref;
43069 }
43070
43071 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
43072         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
43073         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
43074         uint64_t ret_ref = tag_ptr(ret_copy, true);
43075         return ret_ref;
43076 }
43077
43078 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
43079         LDKPublicKey node_id_ref;
43080         CHECK(node_id->arr_len == 33);
43081         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
43082         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
43083         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
43084         uint64_t ret_ref = tag_ptr(ret_copy, true);
43085         return ret_ref;
43086 }
43087
43088 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
43089         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
43090         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
43091         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
43092         return ret_conv;
43093 }
43094
43095 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
43096         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
43097         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
43098         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43099         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43100         CVec_u8Z_free(ret_var);
43101         return ret_arr;
43102 }
43103
43104 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
43105         LDKu8slice ser_ref;
43106         ser_ref.datalen = ser->arr_len;
43107         ser_ref.data = ser->elems;
43108         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
43109         *ret_conv = NetworkUpdate_read(ser_ref);
43110         FREE(ser);
43111         return tag_ptr(ret_conv, true);
43112 }
43113
43114 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
43115         LDKP2PGossipSync this_obj_conv;
43116         this_obj_conv.inner = untag_ptr(this_obj);
43117         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43119         P2PGossipSync_free(this_obj_conv);
43120 }
43121
43122 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t utxo_lookup, uint64_t logger) {
43123         LDKNetworkGraph network_graph_conv;
43124         network_graph_conv.inner = untag_ptr(network_graph);
43125         network_graph_conv.is_owned = ptr_is_owned(network_graph);
43126         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43127         network_graph_conv.is_owned = false;
43128         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
43129         CHECK_ACCESS(utxo_lookup_ptr);
43130         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
43131         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
43132         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
43133                 // Manually implement clone for Java trait instances
43134                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
43135                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43136                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
43137                 }
43138         }
43139         void* logger_ptr = untag_ptr(logger);
43140         CHECK_ACCESS(logger_ptr);
43141         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43142         if (logger_conv.free == LDKLogger_JCalls_free) {
43143                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43144                 LDKLogger_JCalls_cloned(&logger_conv);
43145         }
43146         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
43147         uint64_t ret_ref = 0;
43148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43150         return ret_ref;
43151 }
43152
43153 void  __attribute__((export_name("TS_P2PGossipSync_add_utxo_lookup"))) TS_P2PGossipSync_add_utxo_lookup(uint64_t this_arg, uint64_t utxo_lookup) {
43154         LDKP2PGossipSync this_arg_conv;
43155         this_arg_conv.inner = untag_ptr(this_arg);
43156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43158         this_arg_conv.is_owned = false;
43159         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
43160         CHECK_ACCESS(utxo_lookup_ptr);
43161         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
43162         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
43163         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
43164                 // Manually implement clone for Java trait instances
43165                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
43166                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43167                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
43168                 }
43169         }
43170         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
43171 }
43172
43173 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
43174         LDKNetworkGraph this_arg_conv;
43175         this_arg_conv.inner = untag_ptr(this_arg);
43176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43178         this_arg_conv.is_owned = false;
43179         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
43180         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
43181 }
43182
43183 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
43184         LDKP2PGossipSync this_arg_conv;
43185         this_arg_conv.inner = untag_ptr(this_arg);
43186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43188         this_arg_conv.is_owned = false;
43189         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
43190         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
43191         return tag_ptr(ret_ret, true);
43192 }
43193
43194 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
43195         LDKP2PGossipSync this_arg_conv;
43196         this_arg_conv.inner = untag_ptr(this_arg);
43197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43199         this_arg_conv.is_owned = false;
43200         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
43201         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
43202         return tag_ptr(ret_ret, true);
43203 }
43204
43205 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
43206         LDKChannelUpdateInfo this_obj_conv;
43207         this_obj_conv.inner = untag_ptr(this_obj);
43208         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43210         ChannelUpdateInfo_free(this_obj_conv);
43211 }
43212
43213 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
43214         LDKChannelUpdateInfo this_ptr_conv;
43215         this_ptr_conv.inner = untag_ptr(this_ptr);
43216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43218         this_ptr_conv.is_owned = false;
43219         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
43220         return ret_conv;
43221 }
43222
43223 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
43224         LDKChannelUpdateInfo this_ptr_conv;
43225         this_ptr_conv.inner = untag_ptr(this_ptr);
43226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43228         this_ptr_conv.is_owned = false;
43229         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
43230 }
43231
43232 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
43233         LDKChannelUpdateInfo this_ptr_conv;
43234         this_ptr_conv.inner = untag_ptr(this_ptr);
43235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43237         this_ptr_conv.is_owned = false;
43238         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
43239         return ret_conv;
43240 }
43241
43242 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
43243         LDKChannelUpdateInfo this_ptr_conv;
43244         this_ptr_conv.inner = untag_ptr(this_ptr);
43245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43247         this_ptr_conv.is_owned = false;
43248         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
43249 }
43250
43251 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
43252         LDKChannelUpdateInfo this_ptr_conv;
43253         this_ptr_conv.inner = untag_ptr(this_ptr);
43254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43256         this_ptr_conv.is_owned = false;
43257         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
43258         return ret_conv;
43259 }
43260
43261 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
43262         LDKChannelUpdateInfo this_ptr_conv;
43263         this_ptr_conv.inner = untag_ptr(this_ptr);
43264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43266         this_ptr_conv.is_owned = false;
43267         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
43268 }
43269
43270 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
43271         LDKChannelUpdateInfo this_ptr_conv;
43272         this_ptr_conv.inner = untag_ptr(this_ptr);
43273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43275         this_ptr_conv.is_owned = false;
43276         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
43277         return ret_conv;
43278 }
43279
43280 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
43281         LDKChannelUpdateInfo this_ptr_conv;
43282         this_ptr_conv.inner = untag_ptr(this_ptr);
43283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43285         this_ptr_conv.is_owned = false;
43286         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
43287 }
43288
43289 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
43290         LDKChannelUpdateInfo this_ptr_conv;
43291         this_ptr_conv.inner = untag_ptr(this_ptr);
43292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43294         this_ptr_conv.is_owned = false;
43295         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
43296         return ret_conv;
43297 }
43298
43299 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
43300         LDKChannelUpdateInfo this_ptr_conv;
43301         this_ptr_conv.inner = untag_ptr(this_ptr);
43302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43304         this_ptr_conv.is_owned = false;
43305         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
43306 }
43307
43308 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
43309         LDKChannelUpdateInfo this_ptr_conv;
43310         this_ptr_conv.inner = untag_ptr(this_ptr);
43311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43313         this_ptr_conv.is_owned = false;
43314         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
43315         uint64_t ret_ref = 0;
43316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43318         return ret_ref;
43319 }
43320
43321 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
43322         LDKChannelUpdateInfo this_ptr_conv;
43323         this_ptr_conv.inner = untag_ptr(this_ptr);
43324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43326         this_ptr_conv.is_owned = false;
43327         LDKRoutingFees val_conv;
43328         val_conv.inner = untag_ptr(val);
43329         val_conv.is_owned = ptr_is_owned(val);
43330         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43331         val_conv = RoutingFees_clone(&val_conv);
43332         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
43333 }
43334
43335 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
43336         LDKChannelUpdateInfo this_ptr_conv;
43337         this_ptr_conv.inner = untag_ptr(this_ptr);
43338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43340         this_ptr_conv.is_owned = false;
43341         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
43342         uint64_t ret_ref = 0;
43343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43345         return ret_ref;
43346 }
43347
43348 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
43349         LDKChannelUpdateInfo this_ptr_conv;
43350         this_ptr_conv.inner = untag_ptr(this_ptr);
43351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43353         this_ptr_conv.is_owned = false;
43354         LDKChannelUpdate val_conv;
43355         val_conv.inner = untag_ptr(val);
43356         val_conv.is_owned = ptr_is_owned(val);
43357         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43358         val_conv = ChannelUpdate_clone(&val_conv);
43359         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
43360 }
43361
43362 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) {
43363         LDKRoutingFees fees_arg_conv;
43364         fees_arg_conv.inner = untag_ptr(fees_arg);
43365         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
43366         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
43367         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
43368         LDKChannelUpdate last_update_message_arg_conv;
43369         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
43370         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
43371         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
43372         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
43373         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);
43374         uint64_t ret_ref = 0;
43375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43377         return ret_ref;
43378 }
43379
43380 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
43381         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
43382         uint64_t ret_ref = 0;
43383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43385         return ret_ref;
43386 }
43387 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
43388         LDKChannelUpdateInfo arg_conv;
43389         arg_conv.inner = untag_ptr(arg);
43390         arg_conv.is_owned = ptr_is_owned(arg);
43391         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43392         arg_conv.is_owned = false;
43393         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
43394         return ret_conv;
43395 }
43396
43397 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
43398         LDKChannelUpdateInfo orig_conv;
43399         orig_conv.inner = untag_ptr(orig);
43400         orig_conv.is_owned = ptr_is_owned(orig);
43401         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43402         orig_conv.is_owned = false;
43403         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
43404         uint64_t ret_ref = 0;
43405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43407         return ret_ref;
43408 }
43409
43410 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
43411         LDKChannelUpdateInfo a_conv;
43412         a_conv.inner = untag_ptr(a);
43413         a_conv.is_owned = ptr_is_owned(a);
43414         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43415         a_conv.is_owned = false;
43416         LDKChannelUpdateInfo b_conv;
43417         b_conv.inner = untag_ptr(b);
43418         b_conv.is_owned = ptr_is_owned(b);
43419         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43420         b_conv.is_owned = false;
43421         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
43422         return ret_conv;
43423 }
43424
43425 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
43426         LDKChannelUpdateInfo obj_conv;
43427         obj_conv.inner = untag_ptr(obj);
43428         obj_conv.is_owned = ptr_is_owned(obj);
43429         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43430         obj_conv.is_owned = false;
43431         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
43432         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43433         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43434         CVec_u8Z_free(ret_var);
43435         return ret_arr;
43436 }
43437
43438 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
43439         LDKu8slice ser_ref;
43440         ser_ref.datalen = ser->arr_len;
43441         ser_ref.data = ser->elems;
43442         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
43443         *ret_conv = ChannelUpdateInfo_read(ser_ref);
43444         FREE(ser);
43445         return tag_ptr(ret_conv, true);
43446 }
43447
43448 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
43449         LDKChannelInfo this_obj_conv;
43450         this_obj_conv.inner = untag_ptr(this_obj);
43451         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43453         ChannelInfo_free(this_obj_conv);
43454 }
43455
43456 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
43457         LDKChannelInfo this_ptr_conv;
43458         this_ptr_conv.inner = untag_ptr(this_ptr);
43459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43461         this_ptr_conv.is_owned = false;
43462         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
43463         uint64_t ret_ref = 0;
43464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43466         return ret_ref;
43467 }
43468
43469 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
43470         LDKChannelInfo this_ptr_conv;
43471         this_ptr_conv.inner = untag_ptr(this_ptr);
43472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43474         this_ptr_conv.is_owned = false;
43475         LDKChannelFeatures val_conv;
43476         val_conv.inner = untag_ptr(val);
43477         val_conv.is_owned = ptr_is_owned(val);
43478         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43479         val_conv = ChannelFeatures_clone(&val_conv);
43480         ChannelInfo_set_features(&this_ptr_conv, val_conv);
43481 }
43482
43483 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
43484         LDKChannelInfo this_ptr_conv;
43485         this_ptr_conv.inner = untag_ptr(this_ptr);
43486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43488         this_ptr_conv.is_owned = false;
43489         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
43490         uint64_t ret_ref = 0;
43491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43493         return ret_ref;
43494 }
43495
43496 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
43497         LDKChannelInfo this_ptr_conv;
43498         this_ptr_conv.inner = untag_ptr(this_ptr);
43499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43501         this_ptr_conv.is_owned = false;
43502         LDKNodeId val_conv;
43503         val_conv.inner = untag_ptr(val);
43504         val_conv.is_owned = ptr_is_owned(val);
43505         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43506         val_conv = NodeId_clone(&val_conv);
43507         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
43508 }
43509
43510 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
43511         LDKChannelInfo this_ptr_conv;
43512         this_ptr_conv.inner = untag_ptr(this_ptr);
43513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43515         this_ptr_conv.is_owned = false;
43516         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
43517         uint64_t ret_ref = 0;
43518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43520         return ret_ref;
43521 }
43522
43523 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
43524         LDKChannelInfo this_ptr_conv;
43525         this_ptr_conv.inner = untag_ptr(this_ptr);
43526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43528         this_ptr_conv.is_owned = false;
43529         LDKChannelUpdateInfo val_conv;
43530         val_conv.inner = untag_ptr(val);
43531         val_conv.is_owned = ptr_is_owned(val);
43532         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43533         val_conv = ChannelUpdateInfo_clone(&val_conv);
43534         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
43535 }
43536
43537 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
43538         LDKChannelInfo this_ptr_conv;
43539         this_ptr_conv.inner = untag_ptr(this_ptr);
43540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43542         this_ptr_conv.is_owned = false;
43543         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
43544         uint64_t ret_ref = 0;
43545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43547         return ret_ref;
43548 }
43549
43550 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
43551         LDKChannelInfo this_ptr_conv;
43552         this_ptr_conv.inner = untag_ptr(this_ptr);
43553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43555         this_ptr_conv.is_owned = false;
43556         LDKNodeId val_conv;
43557         val_conv.inner = untag_ptr(val);
43558         val_conv.is_owned = ptr_is_owned(val);
43559         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43560         val_conv = NodeId_clone(&val_conv);
43561         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
43562 }
43563
43564 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
43565         LDKChannelInfo this_ptr_conv;
43566         this_ptr_conv.inner = untag_ptr(this_ptr);
43567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43569         this_ptr_conv.is_owned = false;
43570         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
43571         uint64_t ret_ref = 0;
43572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43574         return ret_ref;
43575 }
43576
43577 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
43578         LDKChannelInfo this_ptr_conv;
43579         this_ptr_conv.inner = untag_ptr(this_ptr);
43580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43582         this_ptr_conv.is_owned = false;
43583         LDKChannelUpdateInfo val_conv;
43584         val_conv.inner = untag_ptr(val);
43585         val_conv.is_owned = ptr_is_owned(val);
43586         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43587         val_conv = ChannelUpdateInfo_clone(&val_conv);
43588         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
43589 }
43590
43591 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
43592         LDKChannelInfo this_ptr_conv;
43593         this_ptr_conv.inner = untag_ptr(this_ptr);
43594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43596         this_ptr_conv.is_owned = false;
43597         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43598         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
43599         uint64_t ret_ref = tag_ptr(ret_copy, true);
43600         return ret_ref;
43601 }
43602
43603 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
43604         LDKChannelInfo this_ptr_conv;
43605         this_ptr_conv.inner = untag_ptr(this_ptr);
43606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43608         this_ptr_conv.is_owned = false;
43609         void* val_ptr = untag_ptr(val);
43610         CHECK_ACCESS(val_ptr);
43611         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
43612         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
43613         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
43614 }
43615
43616 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
43617         LDKChannelInfo this_ptr_conv;
43618         this_ptr_conv.inner = untag_ptr(this_ptr);
43619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43621         this_ptr_conv.is_owned = false;
43622         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
43623         uint64_t ret_ref = 0;
43624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43626         return ret_ref;
43627 }
43628
43629 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
43630         LDKChannelInfo this_ptr_conv;
43631         this_ptr_conv.inner = untag_ptr(this_ptr);
43632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43634         this_ptr_conv.is_owned = false;
43635         LDKChannelAnnouncement val_conv;
43636         val_conv.inner = untag_ptr(val);
43637         val_conv.is_owned = ptr_is_owned(val);
43638         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43639         val_conv = ChannelAnnouncement_clone(&val_conv);
43640         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
43641 }
43642
43643 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
43644         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
43645         uint64_t ret_ref = 0;
43646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43648         return ret_ref;
43649 }
43650 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
43651         LDKChannelInfo arg_conv;
43652         arg_conv.inner = untag_ptr(arg);
43653         arg_conv.is_owned = ptr_is_owned(arg);
43654         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43655         arg_conv.is_owned = false;
43656         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
43657         return ret_conv;
43658 }
43659
43660 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
43661         LDKChannelInfo orig_conv;
43662         orig_conv.inner = untag_ptr(orig);
43663         orig_conv.is_owned = ptr_is_owned(orig);
43664         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43665         orig_conv.is_owned = false;
43666         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
43667         uint64_t ret_ref = 0;
43668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43670         return ret_ref;
43671 }
43672
43673 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
43674         LDKChannelInfo a_conv;
43675         a_conv.inner = untag_ptr(a);
43676         a_conv.is_owned = ptr_is_owned(a);
43677         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43678         a_conv.is_owned = false;
43679         LDKChannelInfo b_conv;
43680         b_conv.inner = untag_ptr(b);
43681         b_conv.is_owned = ptr_is_owned(b);
43682         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43683         b_conv.is_owned = false;
43684         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
43685         return ret_conv;
43686 }
43687
43688 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
43689         LDKChannelInfo this_arg_conv;
43690         this_arg_conv.inner = untag_ptr(this_arg);
43691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43693         this_arg_conv.is_owned = false;
43694         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
43695         uint64_t ret_ref = 0;
43696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43698         return ret_ref;
43699 }
43700
43701 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
43702         LDKChannelInfo obj_conv;
43703         obj_conv.inner = untag_ptr(obj);
43704         obj_conv.is_owned = ptr_is_owned(obj);
43705         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43706         obj_conv.is_owned = false;
43707         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
43708         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43709         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43710         CVec_u8Z_free(ret_var);
43711         return ret_arr;
43712 }
43713
43714 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
43715         LDKu8slice ser_ref;
43716         ser_ref.datalen = ser->arr_len;
43717         ser_ref.data = ser->elems;
43718         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
43719         *ret_conv = ChannelInfo_read(ser_ref);
43720         FREE(ser);
43721         return tag_ptr(ret_conv, true);
43722 }
43723
43724 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
43725         LDKDirectedChannelInfo this_obj_conv;
43726         this_obj_conv.inner = untag_ptr(this_obj);
43727         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43729         DirectedChannelInfo_free(this_obj_conv);
43730 }
43731
43732 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
43733         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
43734         uint64_t ret_ref = 0;
43735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43737         return ret_ref;
43738 }
43739 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
43740         LDKDirectedChannelInfo arg_conv;
43741         arg_conv.inner = untag_ptr(arg);
43742         arg_conv.is_owned = ptr_is_owned(arg);
43743         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43744         arg_conv.is_owned = false;
43745         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
43746         return ret_conv;
43747 }
43748
43749 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
43750         LDKDirectedChannelInfo orig_conv;
43751         orig_conv.inner = untag_ptr(orig);
43752         orig_conv.is_owned = ptr_is_owned(orig);
43753         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43754         orig_conv.is_owned = false;
43755         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
43756         uint64_t ret_ref = 0;
43757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43759         return ret_ref;
43760 }
43761
43762 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
43763         LDKDirectedChannelInfo this_arg_conv;
43764         this_arg_conv.inner = untag_ptr(this_arg);
43765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43767         this_arg_conv.is_owned = false;
43768         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
43769         uint64_t ret_ref = 0;
43770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43772         return ret_ref;
43773 }
43774
43775 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
43776         LDKDirectedChannelInfo this_arg_conv;
43777         this_arg_conv.inner = untag_ptr(this_arg);
43778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43780         this_arg_conv.is_owned = false;
43781         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
43782         return ret_conv;
43783 }
43784
43785 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
43786         LDKDirectedChannelInfo this_arg_conv;
43787         this_arg_conv.inner = untag_ptr(this_arg);
43788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43790         this_arg_conv.is_owned = false;
43791         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43792         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
43793         uint64_t ret_ref = tag_ptr(ret_copy, true);
43794         return ret_ref;
43795 }
43796
43797 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
43798         if (!ptr_is_owned(this_ptr)) return;
43799         void* this_ptr_ptr = untag_ptr(this_ptr);
43800         CHECK_ACCESS(this_ptr_ptr);
43801         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
43802         FREE(untag_ptr(this_ptr));
43803         EffectiveCapacity_free(this_ptr_conv);
43804 }
43805
43806 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
43807         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43808         *ret_copy = EffectiveCapacity_clone(arg);
43809         uint64_t ret_ref = tag_ptr(ret_copy, true);
43810         return ret_ref;
43811 }
43812 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
43813         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
43814         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
43815         return ret_conv;
43816 }
43817
43818 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
43819         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
43820         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43821         *ret_copy = EffectiveCapacity_clone(orig_conv);
43822         uint64_t ret_ref = tag_ptr(ret_copy, true);
43823         return ret_ref;
43824 }
43825
43826 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
43827         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43828         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
43829         uint64_t ret_ref = tag_ptr(ret_copy, true);
43830         return ret_ref;
43831 }
43832
43833 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
43834         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43835         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
43836         uint64_t ret_ref = tag_ptr(ret_copy, true);
43837         return ret_ref;
43838 }
43839
43840 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
43841         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43842         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
43843         uint64_t ret_ref = tag_ptr(ret_copy, true);
43844         return ret_ref;
43845 }
43846
43847 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
43848         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43849         *ret_copy = EffectiveCapacity_infinite();
43850         uint64_t ret_ref = tag_ptr(ret_copy, true);
43851         return ret_ref;
43852 }
43853
43854 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
43855         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43856         *ret_copy = EffectiveCapacity_unknown();
43857         uint64_t ret_ref = tag_ptr(ret_copy, true);
43858         return ret_ref;
43859 }
43860
43861 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
43862         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
43863         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
43864         return ret_conv;
43865 }
43866
43867 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
43868         LDKRoutingFees this_obj_conv;
43869         this_obj_conv.inner = untag_ptr(this_obj);
43870         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43872         RoutingFees_free(this_obj_conv);
43873 }
43874
43875 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
43876         LDKRoutingFees this_ptr_conv;
43877         this_ptr_conv.inner = untag_ptr(this_ptr);
43878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43880         this_ptr_conv.is_owned = false;
43881         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
43882         return ret_conv;
43883 }
43884
43885 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
43886         LDKRoutingFees this_ptr_conv;
43887         this_ptr_conv.inner = untag_ptr(this_ptr);
43888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43890         this_ptr_conv.is_owned = false;
43891         RoutingFees_set_base_msat(&this_ptr_conv, val);
43892 }
43893
43894 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
43895         LDKRoutingFees this_ptr_conv;
43896         this_ptr_conv.inner = untag_ptr(this_ptr);
43897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43899         this_ptr_conv.is_owned = false;
43900         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
43901         return ret_conv;
43902 }
43903
43904 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
43905         LDKRoutingFees this_ptr_conv;
43906         this_ptr_conv.inner = untag_ptr(this_ptr);
43907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43909         this_ptr_conv.is_owned = false;
43910         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
43911 }
43912
43913 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
43914         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
43915         uint64_t ret_ref = 0;
43916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43918         return ret_ref;
43919 }
43920
43921 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
43922         LDKRoutingFees a_conv;
43923         a_conv.inner = untag_ptr(a);
43924         a_conv.is_owned = ptr_is_owned(a);
43925         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43926         a_conv.is_owned = false;
43927         LDKRoutingFees b_conv;
43928         b_conv.inner = untag_ptr(b);
43929         b_conv.is_owned = ptr_is_owned(b);
43930         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43931         b_conv.is_owned = false;
43932         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
43933         return ret_conv;
43934 }
43935
43936 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
43937         LDKRoutingFees ret_var = RoutingFees_clone(arg);
43938         uint64_t ret_ref = 0;
43939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43941         return ret_ref;
43942 }
43943 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
43944         LDKRoutingFees arg_conv;
43945         arg_conv.inner = untag_ptr(arg);
43946         arg_conv.is_owned = ptr_is_owned(arg);
43947         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43948         arg_conv.is_owned = false;
43949         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
43950         return ret_conv;
43951 }
43952
43953 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
43954         LDKRoutingFees orig_conv;
43955         orig_conv.inner = untag_ptr(orig);
43956         orig_conv.is_owned = ptr_is_owned(orig);
43957         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43958         orig_conv.is_owned = false;
43959         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
43960         uint64_t ret_ref = 0;
43961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43963         return ret_ref;
43964 }
43965
43966 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
43967         LDKRoutingFees o_conv;
43968         o_conv.inner = untag_ptr(o);
43969         o_conv.is_owned = ptr_is_owned(o);
43970         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43971         o_conv.is_owned = false;
43972         int64_t ret_conv = RoutingFees_hash(&o_conv);
43973         return ret_conv;
43974 }
43975
43976 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
43977         LDKRoutingFees obj_conv;
43978         obj_conv.inner = untag_ptr(obj);
43979         obj_conv.is_owned = ptr_is_owned(obj);
43980         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43981         obj_conv.is_owned = false;
43982         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
43983         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43984         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43985         CVec_u8Z_free(ret_var);
43986         return ret_arr;
43987 }
43988
43989 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
43990         LDKu8slice ser_ref;
43991         ser_ref.datalen = ser->arr_len;
43992         ser_ref.data = ser->elems;
43993         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
43994         *ret_conv = RoutingFees_read(ser_ref);
43995         FREE(ser);
43996         return tag_ptr(ret_conv, true);
43997 }
43998
43999 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
44000         LDKNodeAnnouncementInfo this_obj_conv;
44001         this_obj_conv.inner = untag_ptr(this_obj);
44002         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44004         NodeAnnouncementInfo_free(this_obj_conv);
44005 }
44006
44007 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
44008         LDKNodeAnnouncementInfo this_ptr_conv;
44009         this_ptr_conv.inner = untag_ptr(this_ptr);
44010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44012         this_ptr_conv.is_owned = false;
44013         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
44014         uint64_t ret_ref = 0;
44015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44017         return ret_ref;
44018 }
44019
44020 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
44021         LDKNodeAnnouncementInfo this_ptr_conv;
44022         this_ptr_conv.inner = untag_ptr(this_ptr);
44023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44025         this_ptr_conv.is_owned = false;
44026         LDKNodeFeatures val_conv;
44027         val_conv.inner = untag_ptr(val);
44028         val_conv.is_owned = ptr_is_owned(val);
44029         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44030         val_conv = NodeFeatures_clone(&val_conv);
44031         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
44032 }
44033
44034 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
44035         LDKNodeAnnouncementInfo this_ptr_conv;
44036         this_ptr_conv.inner = untag_ptr(this_ptr);
44037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44039         this_ptr_conv.is_owned = false;
44040         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
44041         return ret_conv;
44042 }
44043
44044 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
44045         LDKNodeAnnouncementInfo this_ptr_conv;
44046         this_ptr_conv.inner = untag_ptr(this_ptr);
44047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44049         this_ptr_conv.is_owned = false;
44050         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
44051 }
44052
44053 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
44054         LDKNodeAnnouncementInfo this_ptr_conv;
44055         this_ptr_conv.inner = untag_ptr(this_ptr);
44056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44058         this_ptr_conv.is_owned = false;
44059         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
44060         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
44061         return ret_arr;
44062 }
44063
44064 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
44065         LDKNodeAnnouncementInfo this_ptr_conv;
44066         this_ptr_conv.inner = untag_ptr(this_ptr);
44067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44069         this_ptr_conv.is_owned = false;
44070         LDKThreeBytes val_ref;
44071         CHECK(val->arr_len == 3);
44072         memcpy(val_ref.data, val->elems, 3); FREE(val);
44073         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
44074 }
44075
44076 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
44077         LDKNodeAnnouncementInfo this_ptr_conv;
44078         this_ptr_conv.inner = untag_ptr(this_ptr);
44079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44081         this_ptr_conv.is_owned = false;
44082         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
44083         uint64_t ret_ref = 0;
44084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44086         return ret_ref;
44087 }
44088
44089 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
44090         LDKNodeAnnouncementInfo this_ptr_conv;
44091         this_ptr_conv.inner = untag_ptr(this_ptr);
44092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44094         this_ptr_conv.is_owned = false;
44095         LDKNodeAlias val_conv;
44096         val_conv.inner = untag_ptr(val);
44097         val_conv.is_owned = ptr_is_owned(val);
44098         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44099         val_conv = NodeAlias_clone(&val_conv);
44100         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
44101 }
44102
44103 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_addresses"))) TS_NodeAnnouncementInfo_get_addresses(uint64_t this_ptr) {
44104         LDKNodeAnnouncementInfo this_ptr_conv;
44105         this_ptr_conv.inner = untag_ptr(this_ptr);
44106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44108         this_ptr_conv.is_owned = false;
44109         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_get_addresses(&this_ptr_conv);
44110         uint64_tArray ret_arr = NULL;
44111         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
44112         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
44113         for (size_t m = 0; m < ret_var.datalen; m++) {
44114                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
44115                 *ret_conv_12_copy = ret_var.data[m];
44116                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
44117                 ret_arr_ptr[m] = ret_conv_12_ref;
44118         }
44119         
44120         FREE(ret_var.data);
44121         return ret_arr;
44122 }
44123
44124 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_addresses"))) TS_NodeAnnouncementInfo_set_addresses(uint64_t this_ptr, uint64_tArray val) {
44125         LDKNodeAnnouncementInfo this_ptr_conv;
44126         this_ptr_conv.inner = untag_ptr(this_ptr);
44127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44129         this_ptr_conv.is_owned = false;
44130         LDKCVec_NetAddressZ val_constr;
44131         val_constr.datalen = val->arr_len;
44132         if (val_constr.datalen > 0)
44133                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
44134         else
44135                 val_constr.data = NULL;
44136         uint64_t* val_vals = val->elems;
44137         for (size_t m = 0; m < val_constr.datalen; m++) {
44138                 uint64_t val_conv_12 = val_vals[m];
44139                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
44140                 CHECK_ACCESS(val_conv_12_ptr);
44141                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
44142                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
44143                 val_constr.data[m] = val_conv_12_conv;
44144         }
44145         FREE(val);
44146         NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
44147 }
44148
44149 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
44150         LDKNodeAnnouncementInfo this_ptr_conv;
44151         this_ptr_conv.inner = untag_ptr(this_ptr);
44152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44154         this_ptr_conv.is_owned = false;
44155         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
44156         uint64_t ret_ref = 0;
44157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44159         return ret_ref;
44160 }
44161
44162 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
44163         LDKNodeAnnouncementInfo this_ptr_conv;
44164         this_ptr_conv.inner = untag_ptr(this_ptr);
44165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44167         this_ptr_conv.is_owned = false;
44168         LDKNodeAnnouncement val_conv;
44169         val_conv.inner = untag_ptr(val);
44170         val_conv.is_owned = ptr_is_owned(val);
44171         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44172         val_conv = NodeAnnouncement_clone(&val_conv);
44173         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
44174 }
44175
44176 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) {
44177         LDKNodeFeatures features_arg_conv;
44178         features_arg_conv.inner = untag_ptr(features_arg);
44179         features_arg_conv.is_owned = ptr_is_owned(features_arg);
44180         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
44181         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
44182         LDKThreeBytes rgb_arg_ref;
44183         CHECK(rgb_arg->arr_len == 3);
44184         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
44185         LDKNodeAlias alias_arg_conv;
44186         alias_arg_conv.inner = untag_ptr(alias_arg);
44187         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
44188         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
44189         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
44190         LDKCVec_NetAddressZ addresses_arg_constr;
44191         addresses_arg_constr.datalen = addresses_arg->arr_len;
44192         if (addresses_arg_constr.datalen > 0)
44193                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
44194         else
44195                 addresses_arg_constr.data = NULL;
44196         uint64_t* addresses_arg_vals = addresses_arg->elems;
44197         for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
44198                 uint64_t addresses_arg_conv_12 = addresses_arg_vals[m];
44199                 void* addresses_arg_conv_12_ptr = untag_ptr(addresses_arg_conv_12);
44200                 CHECK_ACCESS(addresses_arg_conv_12_ptr);
44201                 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
44202                 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
44203         }
44204         FREE(addresses_arg);
44205         LDKNodeAnnouncement announcement_message_arg_conv;
44206         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
44207         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
44208         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
44209         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
44210         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
44211         uint64_t ret_ref = 0;
44212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44214         return ret_ref;
44215 }
44216
44217 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
44218         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
44219         uint64_t ret_ref = 0;
44220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44222         return ret_ref;
44223 }
44224 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
44225         LDKNodeAnnouncementInfo arg_conv;
44226         arg_conv.inner = untag_ptr(arg);
44227         arg_conv.is_owned = ptr_is_owned(arg);
44228         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44229         arg_conv.is_owned = false;
44230         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
44231         return ret_conv;
44232 }
44233
44234 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
44235         LDKNodeAnnouncementInfo orig_conv;
44236         orig_conv.inner = untag_ptr(orig);
44237         orig_conv.is_owned = ptr_is_owned(orig);
44238         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44239         orig_conv.is_owned = false;
44240         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
44241         uint64_t ret_ref = 0;
44242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44244         return ret_ref;
44245 }
44246
44247 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
44248         LDKNodeAnnouncementInfo a_conv;
44249         a_conv.inner = untag_ptr(a);
44250         a_conv.is_owned = ptr_is_owned(a);
44251         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44252         a_conv.is_owned = false;
44253         LDKNodeAnnouncementInfo b_conv;
44254         b_conv.inner = untag_ptr(b);
44255         b_conv.is_owned = ptr_is_owned(b);
44256         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44257         b_conv.is_owned = false;
44258         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
44259         return ret_conv;
44260 }
44261
44262 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
44263         LDKNodeAnnouncementInfo obj_conv;
44264         obj_conv.inner = untag_ptr(obj);
44265         obj_conv.is_owned = ptr_is_owned(obj);
44266         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44267         obj_conv.is_owned = false;
44268         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
44269         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44270         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44271         CVec_u8Z_free(ret_var);
44272         return ret_arr;
44273 }
44274
44275 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
44276         LDKu8slice ser_ref;
44277         ser_ref.datalen = ser->arr_len;
44278         ser_ref.data = ser->elems;
44279         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
44280         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
44281         FREE(ser);
44282         return tag_ptr(ret_conv, true);
44283 }
44284
44285 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
44286         LDKNodeAlias this_obj_conv;
44287         this_obj_conv.inner = untag_ptr(this_obj);
44288         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44290         NodeAlias_free(this_obj_conv);
44291 }
44292
44293 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
44294         LDKNodeAlias this_ptr_conv;
44295         this_ptr_conv.inner = untag_ptr(this_ptr);
44296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44298         this_ptr_conv.is_owned = false;
44299         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44300         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
44301         return ret_arr;
44302 }
44303
44304 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
44305         LDKNodeAlias this_ptr_conv;
44306         this_ptr_conv.inner = untag_ptr(this_ptr);
44307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44309         this_ptr_conv.is_owned = false;
44310         LDKThirtyTwoBytes val_ref;
44311         CHECK(val->arr_len == 32);
44312         memcpy(val_ref.data, val->elems, 32); FREE(val);
44313         NodeAlias_set_a(&this_ptr_conv, val_ref);
44314 }
44315
44316 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
44317         LDKThirtyTwoBytes a_arg_ref;
44318         CHECK(a_arg->arr_len == 32);
44319         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
44320         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
44321         uint64_t ret_ref = 0;
44322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44324         return ret_ref;
44325 }
44326
44327 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
44328         LDKNodeAlias ret_var = NodeAlias_clone(arg);
44329         uint64_t ret_ref = 0;
44330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44332         return ret_ref;
44333 }
44334 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
44335         LDKNodeAlias arg_conv;
44336         arg_conv.inner = untag_ptr(arg);
44337         arg_conv.is_owned = ptr_is_owned(arg);
44338         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44339         arg_conv.is_owned = false;
44340         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
44341         return ret_conv;
44342 }
44343
44344 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
44345         LDKNodeAlias orig_conv;
44346         orig_conv.inner = untag_ptr(orig);
44347         orig_conv.is_owned = ptr_is_owned(orig);
44348         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44349         orig_conv.is_owned = false;
44350         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
44351         uint64_t ret_ref = 0;
44352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44354         return ret_ref;
44355 }
44356
44357 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
44358         LDKNodeAlias a_conv;
44359         a_conv.inner = untag_ptr(a);
44360         a_conv.is_owned = ptr_is_owned(a);
44361         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44362         a_conv.is_owned = false;
44363         LDKNodeAlias b_conv;
44364         b_conv.inner = untag_ptr(b);
44365         b_conv.is_owned = ptr_is_owned(b);
44366         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44367         b_conv.is_owned = false;
44368         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
44369         return ret_conv;
44370 }
44371
44372 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
44373         LDKNodeAlias obj_conv;
44374         obj_conv.inner = untag_ptr(obj);
44375         obj_conv.is_owned = ptr_is_owned(obj);
44376         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44377         obj_conv.is_owned = false;
44378         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
44379         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44380         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44381         CVec_u8Z_free(ret_var);
44382         return ret_arr;
44383 }
44384
44385 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
44386         LDKu8slice ser_ref;
44387         ser_ref.datalen = ser->arr_len;
44388         ser_ref.data = ser->elems;
44389         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
44390         *ret_conv = NodeAlias_read(ser_ref);
44391         FREE(ser);
44392         return tag_ptr(ret_conv, true);
44393 }
44394
44395 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
44396         LDKNodeInfo this_obj_conv;
44397         this_obj_conv.inner = untag_ptr(this_obj);
44398         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44400         NodeInfo_free(this_obj_conv);
44401 }
44402
44403 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
44404         LDKNodeInfo this_ptr_conv;
44405         this_ptr_conv.inner = untag_ptr(this_ptr);
44406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44408         this_ptr_conv.is_owned = false;
44409         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
44410         int64_tArray ret_arr = NULL;
44411         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
44412         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
44413         for (size_t i = 0; i < ret_var.datalen; i++) {
44414                 int64_t ret_conv_8_conv = ret_var.data[i];
44415                 ret_arr_ptr[i] = ret_conv_8_conv;
44416         }
44417         
44418         FREE(ret_var.data);
44419         return ret_arr;
44420 }
44421
44422 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
44423         LDKNodeInfo this_ptr_conv;
44424         this_ptr_conv.inner = untag_ptr(this_ptr);
44425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44427         this_ptr_conv.is_owned = false;
44428         LDKCVec_u64Z val_constr;
44429         val_constr.datalen = val->arr_len;
44430         if (val_constr.datalen > 0)
44431                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44432         else
44433                 val_constr.data = NULL;
44434         int64_t* val_vals = val->elems;
44435         for (size_t i = 0; i < val_constr.datalen; i++) {
44436                 int64_t val_conv_8 = val_vals[i];
44437                 val_constr.data[i] = val_conv_8;
44438         }
44439         FREE(val);
44440         NodeInfo_set_channels(&this_ptr_conv, val_constr);
44441 }
44442
44443 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
44444         LDKNodeInfo this_ptr_conv;
44445         this_ptr_conv.inner = untag_ptr(this_ptr);
44446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44448         this_ptr_conv.is_owned = false;
44449         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
44450         uint64_t ret_ref = 0;
44451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44453         return ret_ref;
44454 }
44455
44456 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
44457         LDKNodeInfo this_ptr_conv;
44458         this_ptr_conv.inner = untag_ptr(this_ptr);
44459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44461         this_ptr_conv.is_owned = false;
44462         LDKNodeAnnouncementInfo val_conv;
44463         val_conv.inner = untag_ptr(val);
44464         val_conv.is_owned = ptr_is_owned(val);
44465         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44466         val_conv = NodeAnnouncementInfo_clone(&val_conv);
44467         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
44468 }
44469
44470 uint64_t  __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t announcement_info_arg) {
44471         LDKCVec_u64Z channels_arg_constr;
44472         channels_arg_constr.datalen = channels_arg->arr_len;
44473         if (channels_arg_constr.datalen > 0)
44474                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44475         else
44476                 channels_arg_constr.data = NULL;
44477         int64_t* channels_arg_vals = channels_arg->elems;
44478         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
44479                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
44480                 channels_arg_constr.data[i] = channels_arg_conv_8;
44481         }
44482         FREE(channels_arg);
44483         LDKNodeAnnouncementInfo announcement_info_arg_conv;
44484         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
44485         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
44486         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
44487         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
44488         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
44489         uint64_t ret_ref = 0;
44490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44492         return ret_ref;
44493 }
44494
44495 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
44496         LDKNodeInfo ret_var = NodeInfo_clone(arg);
44497         uint64_t ret_ref = 0;
44498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44500         return ret_ref;
44501 }
44502 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
44503         LDKNodeInfo arg_conv;
44504         arg_conv.inner = untag_ptr(arg);
44505         arg_conv.is_owned = ptr_is_owned(arg);
44506         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44507         arg_conv.is_owned = false;
44508         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
44509         return ret_conv;
44510 }
44511
44512 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
44513         LDKNodeInfo orig_conv;
44514         orig_conv.inner = untag_ptr(orig);
44515         orig_conv.is_owned = ptr_is_owned(orig);
44516         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44517         orig_conv.is_owned = false;
44518         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
44519         uint64_t ret_ref = 0;
44520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44522         return ret_ref;
44523 }
44524
44525 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
44526         LDKNodeInfo a_conv;
44527         a_conv.inner = untag_ptr(a);
44528         a_conv.is_owned = ptr_is_owned(a);
44529         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44530         a_conv.is_owned = false;
44531         LDKNodeInfo b_conv;
44532         b_conv.inner = untag_ptr(b);
44533         b_conv.is_owned = ptr_is_owned(b);
44534         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44535         b_conv.is_owned = false;
44536         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
44537         return ret_conv;
44538 }
44539
44540 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
44541         LDKNodeInfo obj_conv;
44542         obj_conv.inner = untag_ptr(obj);
44543         obj_conv.is_owned = ptr_is_owned(obj);
44544         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44545         obj_conv.is_owned = false;
44546         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
44547         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44548         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44549         CVec_u8Z_free(ret_var);
44550         return ret_arr;
44551 }
44552
44553 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
44554         LDKu8slice ser_ref;
44555         ser_ref.datalen = ser->arr_len;
44556         ser_ref.data = ser->elems;
44557         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
44558         *ret_conv = NodeInfo_read(ser_ref);
44559         FREE(ser);
44560         return tag_ptr(ret_conv, true);
44561 }
44562
44563 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
44564         LDKNetworkGraph obj_conv;
44565         obj_conv.inner = untag_ptr(obj);
44566         obj_conv.is_owned = ptr_is_owned(obj);
44567         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44568         obj_conv.is_owned = false;
44569         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
44570         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44571         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44572         CVec_u8Z_free(ret_var);
44573         return ret_arr;
44574 }
44575
44576 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
44577         LDKu8slice ser_ref;
44578         ser_ref.datalen = ser->arr_len;
44579         ser_ref.data = ser->elems;
44580         void* arg_ptr = untag_ptr(arg);
44581         CHECK_ACCESS(arg_ptr);
44582         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
44583         if (arg_conv.free == LDKLogger_JCalls_free) {
44584                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44585                 LDKLogger_JCalls_cloned(&arg_conv);
44586         }
44587         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
44588         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
44589         FREE(ser);
44590         return tag_ptr(ret_conv, true);
44591 }
44592
44593 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(uint32_t network, uint64_t logger) {
44594         LDKNetwork network_conv = LDKNetwork_from_js(network);
44595         void* logger_ptr = untag_ptr(logger);
44596         CHECK_ACCESS(logger_ptr);
44597         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44598         if (logger_conv.free == LDKLogger_JCalls_free) {
44599                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44600                 LDKLogger_JCalls_cloned(&logger_conv);
44601         }
44602         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
44603         uint64_t ret_ref = 0;
44604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44606         return ret_ref;
44607 }
44608
44609 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
44610         LDKNetworkGraph this_arg_conv;
44611         this_arg_conv.inner = untag_ptr(this_arg);
44612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44614         this_arg_conv.is_owned = false;
44615         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
44616         uint64_t ret_ref = 0;
44617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44619         return ret_ref;
44620 }
44621
44622 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) {
44623         LDKNetworkGraph this_arg_conv;
44624         this_arg_conv.inner = untag_ptr(this_arg);
44625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44627         this_arg_conv.is_owned = false;
44628         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
44629         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
44630         uint64_t ret_ref = tag_ptr(ret_copy, true);
44631         return ret_ref;
44632 }
44633
44634 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) {
44635         LDKNetworkGraph this_arg_conv;
44636         this_arg_conv.inner = untag_ptr(this_arg);
44637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44639         this_arg_conv.is_owned = false;
44640         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
44641 }
44642
44643 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
44644         LDKNetworkGraph this_arg_conv;
44645         this_arg_conv.inner = untag_ptr(this_arg);
44646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44648         this_arg_conv.is_owned = false;
44649         LDKNodeAnnouncement msg_conv;
44650         msg_conv.inner = untag_ptr(msg);
44651         msg_conv.is_owned = ptr_is_owned(msg);
44652         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44653         msg_conv.is_owned = false;
44654         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44655         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
44656         return tag_ptr(ret_conv, true);
44657 }
44658
44659 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) {
44660         LDKNetworkGraph this_arg_conv;
44661         this_arg_conv.inner = untag_ptr(this_arg);
44662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44664         this_arg_conv.is_owned = false;
44665         LDKUnsignedNodeAnnouncement msg_conv;
44666         msg_conv.inner = untag_ptr(msg);
44667         msg_conv.is_owned = ptr_is_owned(msg);
44668         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44669         msg_conv.is_owned = false;
44670         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44671         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
44672         return tag_ptr(ret_conv, true);
44673 }
44674
44675 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 utxo_lookup) {
44676         LDKNetworkGraph this_arg_conv;
44677         this_arg_conv.inner = untag_ptr(this_arg);
44678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44680         this_arg_conv.is_owned = false;
44681         LDKChannelAnnouncement msg_conv;
44682         msg_conv.inner = untag_ptr(msg);
44683         msg_conv.is_owned = ptr_is_owned(msg);
44684         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44685         msg_conv.is_owned = false;
44686         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
44687         CHECK_ACCESS(utxo_lookup_ptr);
44688         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
44689         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
44690         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
44691                 // Manually implement clone for Java trait instances
44692                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
44693                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44694                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
44695                 }
44696         }
44697         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44698         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
44699         return tag_ptr(ret_conv, true);
44700 }
44701
44702 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 utxo_lookup) {
44703         LDKNetworkGraph this_arg_conv;
44704         this_arg_conv.inner = untag_ptr(this_arg);
44705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44707         this_arg_conv.is_owned = false;
44708         LDKUnsignedChannelAnnouncement msg_conv;
44709         msg_conv.inner = untag_ptr(msg);
44710         msg_conv.is_owned = ptr_is_owned(msg);
44711         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44712         msg_conv.is_owned = false;
44713         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
44714         CHECK_ACCESS(utxo_lookup_ptr);
44715         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
44716         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
44717         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
44718                 // Manually implement clone for Java trait instances
44719                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
44720                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44721                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
44722                 }
44723         }
44724         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44725         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
44726         return tag_ptr(ret_conv, true);
44727 }
44728
44729 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) {
44730         LDKNetworkGraph this_arg_conv;
44731         this_arg_conv.inner = untag_ptr(this_arg);
44732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44734         this_arg_conv.is_owned = false;
44735         LDKChannelFeatures features_conv;
44736         features_conv.inner = untag_ptr(features);
44737         features_conv.is_owned = ptr_is_owned(features);
44738         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
44739         features_conv = ChannelFeatures_clone(&features_conv);
44740         LDKPublicKey node_id_1_ref;
44741         CHECK(node_id_1->arr_len == 33);
44742         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
44743         LDKPublicKey node_id_2_ref;
44744         CHECK(node_id_2->arr_len == 33);
44745         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
44746         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44747         *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);
44748         return tag_ptr(ret_conv, true);
44749 }
44750
44751 void  __attribute__((export_name("TS_NetworkGraph_channel_failed"))) TS_NetworkGraph_channel_failed(uint64_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
44752         LDKNetworkGraph this_arg_conv;
44753         this_arg_conv.inner = untag_ptr(this_arg);
44754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44756         this_arg_conv.is_owned = false;
44757         NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
44758 }
44759
44760 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
44761         LDKNetworkGraph this_arg_conv;
44762         this_arg_conv.inner = untag_ptr(this_arg);
44763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44765         this_arg_conv.is_owned = false;
44766         LDKPublicKey node_id_ref;
44767         CHECK(node_id->arr_len == 33);
44768         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
44769         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
44770 }
44771
44772 void  __attribute__((export_name("TS_NetworkGraph_remove_stale_channels_and_tracking_with_time"))) TS_NetworkGraph_remove_stale_channels_and_tracking_with_time(uint64_t this_arg, int64_t current_time_unix) {
44773         LDKNetworkGraph this_arg_conv;
44774         this_arg_conv.inner = untag_ptr(this_arg);
44775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44777         this_arg_conv.is_owned = false;
44778         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
44779 }
44780
44781 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
44782         LDKNetworkGraph this_arg_conv;
44783         this_arg_conv.inner = untag_ptr(this_arg);
44784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44786         this_arg_conv.is_owned = false;
44787         LDKChannelUpdate msg_conv;
44788         msg_conv.inner = untag_ptr(msg);
44789         msg_conv.is_owned = ptr_is_owned(msg);
44790         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44791         msg_conv.is_owned = false;
44792         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44793         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
44794         return tag_ptr(ret_conv, true);
44795 }
44796
44797 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
44798         LDKNetworkGraph this_arg_conv;
44799         this_arg_conv.inner = untag_ptr(this_arg);
44800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44802         this_arg_conv.is_owned = false;
44803         LDKUnsignedChannelUpdate msg_conv;
44804         msg_conv.inner = untag_ptr(msg);
44805         msg_conv.is_owned = ptr_is_owned(msg);
44806         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44807         msg_conv.is_owned = false;
44808         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44809         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
44810         return tag_ptr(ret_conv, true);
44811 }
44812
44813 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
44814         LDKReadOnlyNetworkGraph this_arg_conv;
44815         this_arg_conv.inner = untag_ptr(this_arg);
44816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44818         this_arg_conv.is_owned = false;
44819         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
44820         uint64_t ret_ref = 0;
44821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44823         return ret_ref;
44824 }
44825
44826 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
44827         LDKReadOnlyNetworkGraph this_arg_conv;
44828         this_arg_conv.inner = untag_ptr(this_arg);
44829         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44831         this_arg_conv.is_owned = false;
44832         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
44833         int64_tArray ret_arr = NULL;
44834         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
44835         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
44836         for (size_t i = 0; i < ret_var.datalen; i++) {
44837                 int64_t ret_conv_8_conv = ret_var.data[i];
44838                 ret_arr_ptr[i] = ret_conv_8_conv;
44839         }
44840         
44841         FREE(ret_var.data);
44842         return ret_arr;
44843 }
44844
44845 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
44846         LDKReadOnlyNetworkGraph this_arg_conv;
44847         this_arg_conv.inner = untag_ptr(this_arg);
44848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44850         this_arg_conv.is_owned = false;
44851         LDKNodeId node_id_conv;
44852         node_id_conv.inner = untag_ptr(node_id);
44853         node_id_conv.is_owned = ptr_is_owned(node_id);
44854         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
44855         node_id_conv.is_owned = false;
44856         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
44857         uint64_t ret_ref = 0;
44858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44860         return ret_ref;
44861 }
44862
44863 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
44864         LDKReadOnlyNetworkGraph this_arg_conv;
44865         this_arg_conv.inner = untag_ptr(this_arg);
44866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44868         this_arg_conv.is_owned = false;
44869         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
44870         uint64_tArray ret_arr = NULL;
44871         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
44872         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
44873         for (size_t i = 0; i < ret_var.datalen; i++) {
44874                 LDKNodeId ret_conv_8_var = ret_var.data[i];
44875                 uint64_t ret_conv_8_ref = 0;
44876                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
44877                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
44878                 ret_arr_ptr[i] = ret_conv_8_ref;
44879         }
44880         
44881         FREE(ret_var.data);
44882         return ret_arr;
44883 }
44884
44885 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
44886         LDKReadOnlyNetworkGraph this_arg_conv;
44887         this_arg_conv.inner = untag_ptr(this_arg);
44888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44890         this_arg_conv.is_owned = false;
44891         LDKPublicKey pubkey_ref;
44892         CHECK(pubkey->arr_len == 33);
44893         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
44894         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
44895         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
44896         uint64_t ret_ref = tag_ptr(ret_copy, true);
44897         return ret_ref;
44898 }
44899
44900 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
44901         LDKDefaultRouter this_obj_conv;
44902         this_obj_conv.inner = untag_ptr(this_obj);
44903         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44905         DefaultRouter_free(this_obj_conv);
44906 }
44907
44908 uint64_t  __attribute__((export_name("TS_DefaultRouter_new"))) TS_DefaultRouter_new(uint64_t network_graph, uint64_t logger, int8_tArray random_seed_bytes, uint64_t scorer) {
44909         LDKNetworkGraph network_graph_conv;
44910         network_graph_conv.inner = untag_ptr(network_graph);
44911         network_graph_conv.is_owned = ptr_is_owned(network_graph);
44912         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44913         network_graph_conv.is_owned = false;
44914         void* logger_ptr = untag_ptr(logger);
44915         CHECK_ACCESS(logger_ptr);
44916         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44917         if (logger_conv.free == LDKLogger_JCalls_free) {
44918                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44919                 LDKLogger_JCalls_cloned(&logger_conv);
44920         }
44921         LDKThirtyTwoBytes random_seed_bytes_ref;
44922         CHECK(random_seed_bytes->arr_len == 32);
44923         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
44924         void* scorer_ptr = untag_ptr(scorer);
44925         CHECK_ACCESS(scorer_ptr);
44926         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
44927         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
44928                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44929                 LDKLockableScore_JCalls_cloned(&scorer_conv);
44930         }
44931         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv);
44932         uint64_t ret_ref = 0;
44933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44935         return ret_ref;
44936 }
44937
44938 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
44939         LDKDefaultRouter this_arg_conv;
44940         this_arg_conv.inner = untag_ptr(this_arg);
44941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44943         this_arg_conv.is_owned = false;
44944         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
44945         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
44946         return tag_ptr(ret_ret, true);
44947 }
44948
44949 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
44950         if (!ptr_is_owned(this_ptr)) return;
44951         void* this_ptr_ptr = untag_ptr(this_ptr);
44952         CHECK_ACCESS(this_ptr_ptr);
44953         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
44954         FREE(untag_ptr(this_ptr));
44955         Router_free(this_ptr_conv);
44956 }
44957
44958 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
44959         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
44960         this_obj_conv.inner = untag_ptr(this_obj);
44961         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44963         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
44964 }
44965
44966 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
44967         void* scorer_ptr = untag_ptr(scorer);
44968         CHECK_ACCESS(scorer_ptr);
44969         LDKScore scorer_conv = *(LDKScore*)(scorer_ptr);
44970         if (scorer_conv.free == LDKScore_JCalls_free) {
44971                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44972                 LDKScore_JCalls_cloned(&scorer_conv);
44973         }
44974         LDKInFlightHtlcs inflight_htlcs_conv;
44975         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
44976         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
44977         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
44978         inflight_htlcs_conv.is_owned = false;
44979         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
44980         uint64_t ret_ref = 0;
44981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44983         return ret_ref;
44984 }
44985
44986 int8_tArray  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_write"))) TS_ScorerAccountingForInFlightHtlcs_write(uint64_t obj) {
44987         LDKScorerAccountingForInFlightHtlcs obj_conv;
44988         obj_conv.inner = untag_ptr(obj);
44989         obj_conv.is_owned = ptr_is_owned(obj);
44990         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44991         obj_conv.is_owned = false;
44992         LDKCVec_u8Z ret_var = ScorerAccountingForInFlightHtlcs_write(&obj_conv);
44993         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44994         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44995         CVec_u8Z_free(ret_var);
44996         return ret_arr;
44997 }
44998
44999 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_Score"))) TS_ScorerAccountingForInFlightHtlcs_as_Score(uint64_t this_arg) {
45000         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
45001         this_arg_conv.inner = untag_ptr(this_arg);
45002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45004         this_arg_conv.is_owned = false;
45005         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45006         *ret_ret = ScorerAccountingForInFlightHtlcs_as_Score(&this_arg_conv);
45007         return tag_ptr(ret_ret, true);
45008 }
45009
45010 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
45011         LDKInFlightHtlcs this_obj_conv;
45012         this_obj_conv.inner = untag_ptr(this_obj);
45013         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45015         InFlightHtlcs_free(this_obj_conv);
45016 }
45017
45018 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
45019         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
45020         uint64_t ret_ref = 0;
45021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45023         return ret_ref;
45024 }
45025 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
45026         LDKInFlightHtlcs arg_conv;
45027         arg_conv.inner = untag_ptr(arg);
45028         arg_conv.is_owned = ptr_is_owned(arg);
45029         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45030         arg_conv.is_owned = false;
45031         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
45032         return ret_conv;
45033 }
45034
45035 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
45036         LDKInFlightHtlcs orig_conv;
45037         orig_conv.inner = untag_ptr(orig);
45038         orig_conv.is_owned = ptr_is_owned(orig);
45039         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45040         orig_conv.is_owned = false;
45041         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
45042         uint64_t ret_ref = 0;
45043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45045         return ret_ref;
45046 }
45047
45048 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
45049         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
45050         uint64_t ret_ref = 0;
45051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45053         return ret_ref;
45054 }
45055
45056 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_used_liquidity_msat"))) TS_InFlightHtlcs_used_liquidity_msat(uint64_t this_arg, uint64_t source, uint64_t target, int64_t channel_scid) {
45057         LDKInFlightHtlcs this_arg_conv;
45058         this_arg_conv.inner = untag_ptr(this_arg);
45059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45061         this_arg_conv.is_owned = false;
45062         LDKNodeId source_conv;
45063         source_conv.inner = untag_ptr(source);
45064         source_conv.is_owned = ptr_is_owned(source);
45065         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
45066         source_conv.is_owned = false;
45067         LDKNodeId target_conv;
45068         target_conv.inner = untag_ptr(target);
45069         target_conv.is_owned = ptr_is_owned(target);
45070         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
45071         target_conv.is_owned = false;
45072         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45073         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
45074         uint64_t ret_ref = tag_ptr(ret_copy, true);
45075         return ret_ref;
45076 }
45077
45078 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
45079         LDKInFlightHtlcs obj_conv;
45080         obj_conv.inner = untag_ptr(obj);
45081         obj_conv.is_owned = ptr_is_owned(obj);
45082         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45083         obj_conv.is_owned = false;
45084         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
45085         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45086         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45087         CVec_u8Z_free(ret_var);
45088         return ret_arr;
45089 }
45090
45091 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
45092         LDKu8slice ser_ref;
45093         ser_ref.datalen = ser->arr_len;
45094         ser_ref.data = ser->elems;
45095         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
45096         *ret_conv = InFlightHtlcs_read(ser_ref);
45097         FREE(ser);
45098         return tag_ptr(ret_conv, true);
45099 }
45100
45101 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
45102         LDKRouteHop this_obj_conv;
45103         this_obj_conv.inner = untag_ptr(this_obj);
45104         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45106         RouteHop_free(this_obj_conv);
45107 }
45108
45109 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
45110         LDKRouteHop this_ptr_conv;
45111         this_ptr_conv.inner = untag_ptr(this_ptr);
45112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45114         this_ptr_conv.is_owned = false;
45115         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45116         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
45117         return ret_arr;
45118 }
45119
45120 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
45121         LDKRouteHop this_ptr_conv;
45122         this_ptr_conv.inner = untag_ptr(this_ptr);
45123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45125         this_ptr_conv.is_owned = false;
45126         LDKPublicKey val_ref;
45127         CHECK(val->arr_len == 33);
45128         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45129         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
45130 }
45131
45132 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
45133         LDKRouteHop this_ptr_conv;
45134         this_ptr_conv.inner = untag_ptr(this_ptr);
45135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45137         this_ptr_conv.is_owned = false;
45138         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
45139         uint64_t ret_ref = 0;
45140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45142         return ret_ref;
45143 }
45144
45145 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
45146         LDKRouteHop this_ptr_conv;
45147         this_ptr_conv.inner = untag_ptr(this_ptr);
45148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45150         this_ptr_conv.is_owned = false;
45151         LDKNodeFeatures val_conv;
45152         val_conv.inner = untag_ptr(val);
45153         val_conv.is_owned = ptr_is_owned(val);
45154         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45155         val_conv = NodeFeatures_clone(&val_conv);
45156         RouteHop_set_node_features(&this_ptr_conv, val_conv);
45157 }
45158
45159 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
45160         LDKRouteHop this_ptr_conv;
45161         this_ptr_conv.inner = untag_ptr(this_ptr);
45162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45164         this_ptr_conv.is_owned = false;
45165         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
45166         return ret_conv;
45167 }
45168
45169 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
45170         LDKRouteHop this_ptr_conv;
45171         this_ptr_conv.inner = untag_ptr(this_ptr);
45172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45174         this_ptr_conv.is_owned = false;
45175         RouteHop_set_short_channel_id(&this_ptr_conv, val);
45176 }
45177
45178 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
45179         LDKRouteHop this_ptr_conv;
45180         this_ptr_conv.inner = untag_ptr(this_ptr);
45181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45183         this_ptr_conv.is_owned = false;
45184         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
45185         uint64_t ret_ref = 0;
45186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45188         return ret_ref;
45189 }
45190
45191 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
45192         LDKRouteHop this_ptr_conv;
45193         this_ptr_conv.inner = untag_ptr(this_ptr);
45194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45196         this_ptr_conv.is_owned = false;
45197         LDKChannelFeatures val_conv;
45198         val_conv.inner = untag_ptr(val);
45199         val_conv.is_owned = ptr_is_owned(val);
45200         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45201         val_conv = ChannelFeatures_clone(&val_conv);
45202         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
45203 }
45204
45205 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
45206         LDKRouteHop this_ptr_conv;
45207         this_ptr_conv.inner = untag_ptr(this_ptr);
45208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45210         this_ptr_conv.is_owned = false;
45211         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
45212         return ret_conv;
45213 }
45214
45215 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
45216         LDKRouteHop this_ptr_conv;
45217         this_ptr_conv.inner = untag_ptr(this_ptr);
45218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45220         this_ptr_conv.is_owned = false;
45221         RouteHop_set_fee_msat(&this_ptr_conv, val);
45222 }
45223
45224 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
45225         LDKRouteHop this_ptr_conv;
45226         this_ptr_conv.inner = untag_ptr(this_ptr);
45227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45229         this_ptr_conv.is_owned = false;
45230         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
45231         return ret_conv;
45232 }
45233
45234 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
45235         LDKRouteHop this_ptr_conv;
45236         this_ptr_conv.inner = untag_ptr(this_ptr);
45237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45239         this_ptr_conv.is_owned = false;
45240         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
45241 }
45242
45243 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) {
45244         LDKPublicKey pubkey_arg_ref;
45245         CHECK(pubkey_arg->arr_len == 33);
45246         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
45247         LDKNodeFeatures node_features_arg_conv;
45248         node_features_arg_conv.inner = untag_ptr(node_features_arg);
45249         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
45250         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
45251         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
45252         LDKChannelFeatures channel_features_arg_conv;
45253         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
45254         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
45255         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
45256         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
45257         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);
45258         uint64_t ret_ref = 0;
45259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45261         return ret_ref;
45262 }
45263
45264 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
45265         LDKRouteHop ret_var = RouteHop_clone(arg);
45266         uint64_t ret_ref = 0;
45267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45269         return ret_ref;
45270 }
45271 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
45272         LDKRouteHop arg_conv;
45273         arg_conv.inner = untag_ptr(arg);
45274         arg_conv.is_owned = ptr_is_owned(arg);
45275         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45276         arg_conv.is_owned = false;
45277         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
45278         return ret_conv;
45279 }
45280
45281 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
45282         LDKRouteHop orig_conv;
45283         orig_conv.inner = untag_ptr(orig);
45284         orig_conv.is_owned = ptr_is_owned(orig);
45285         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45286         orig_conv.is_owned = false;
45287         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
45288         uint64_t ret_ref = 0;
45289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45291         return ret_ref;
45292 }
45293
45294 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
45295         LDKRouteHop o_conv;
45296         o_conv.inner = untag_ptr(o);
45297         o_conv.is_owned = ptr_is_owned(o);
45298         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45299         o_conv.is_owned = false;
45300         int64_t ret_conv = RouteHop_hash(&o_conv);
45301         return ret_conv;
45302 }
45303
45304 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
45305         LDKRouteHop a_conv;
45306         a_conv.inner = untag_ptr(a);
45307         a_conv.is_owned = ptr_is_owned(a);
45308         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45309         a_conv.is_owned = false;
45310         LDKRouteHop b_conv;
45311         b_conv.inner = untag_ptr(b);
45312         b_conv.is_owned = ptr_is_owned(b);
45313         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45314         b_conv.is_owned = false;
45315         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
45316         return ret_conv;
45317 }
45318
45319 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
45320         LDKRouteHop obj_conv;
45321         obj_conv.inner = untag_ptr(obj);
45322         obj_conv.is_owned = ptr_is_owned(obj);
45323         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45324         obj_conv.is_owned = false;
45325         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
45326         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45327         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45328         CVec_u8Z_free(ret_var);
45329         return ret_arr;
45330 }
45331
45332 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
45333         LDKu8slice ser_ref;
45334         ser_ref.datalen = ser->arr_len;
45335         ser_ref.data = ser->elems;
45336         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
45337         *ret_conv = RouteHop_read(ser_ref);
45338         FREE(ser);
45339         return tag_ptr(ret_conv, true);
45340 }
45341
45342 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
45343         LDKRoute this_obj_conv;
45344         this_obj_conv.inner = untag_ptr(this_obj);
45345         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45347         Route_free(this_obj_conv);
45348 }
45349
45350 ptrArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
45351         LDKRoute this_ptr_conv;
45352         this_ptr_conv.inner = untag_ptr(this_ptr);
45353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45355         this_ptr_conv.is_owned = false;
45356         LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
45357         ptrArray ret_arr = NULL;
45358         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
45359         uint64_tArray *ret_arr_ptr = (uint64_tArray*)(((uint8_t*)ret_arr) + 8);
45360         for (size_t m = 0; m < ret_var.datalen; m++) {
45361                 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
45362                 uint64_tArray ret_conv_12_arr = NULL;
45363                 ret_conv_12_arr = init_uint64_tArray(ret_conv_12_var.datalen, __LINE__);
45364                 uint64_t *ret_conv_12_arr_ptr = (uint64_t*)(((uint8_t*)ret_conv_12_arr) + 8);
45365                 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
45366                         LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
45367                         uint64_t ret_conv_12_conv_10_ref = 0;
45368                         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
45369                         ret_conv_12_conv_10_ref = tag_ptr(ret_conv_12_conv_10_var.inner, ret_conv_12_conv_10_var.is_owned);
45370                         ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
45371                 }
45372                 
45373                 FREE(ret_conv_12_var.data);
45374                 ret_arr_ptr[m] = ret_conv_12_arr;
45375         }
45376         
45377         FREE(ret_var.data);
45378         return ret_arr;
45379 }
45380
45381 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, ptrArray val) {
45382         LDKRoute this_ptr_conv;
45383         this_ptr_conv.inner = untag_ptr(this_ptr);
45384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45386         this_ptr_conv.is_owned = false;
45387         LDKCVec_CVec_RouteHopZZ val_constr;
45388         val_constr.datalen = val->arr_len;
45389         if (val_constr.datalen > 0)
45390                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
45391         else
45392                 val_constr.data = NULL;
45393         uint64_tArray* val_vals = (void*) val->elems;
45394         for (size_t m = 0; m < val_constr.datalen; m++) {
45395                 uint64_tArray val_conv_12 = val_vals[m];
45396                 LDKCVec_RouteHopZ val_conv_12_constr;
45397                 val_conv_12_constr.datalen = val_conv_12->arr_len;
45398                 if (val_conv_12_constr.datalen > 0)
45399                         val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
45400                 else
45401                         val_conv_12_constr.data = NULL;
45402                 uint64_t* val_conv_12_vals = val_conv_12->elems;
45403                 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
45404                         uint64_t val_conv_12_conv_10 = val_conv_12_vals[k];
45405                         LDKRouteHop val_conv_12_conv_10_conv;
45406                         val_conv_12_conv_10_conv.inner = untag_ptr(val_conv_12_conv_10);
45407                         val_conv_12_conv_10_conv.is_owned = ptr_is_owned(val_conv_12_conv_10);
45408                         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
45409                         val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
45410                         val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
45411                 }
45412                 FREE(val_conv_12);
45413                 val_constr.data[m] = val_conv_12_constr;
45414         }
45415         FREE(val);
45416         Route_set_paths(&this_ptr_conv, val_constr);
45417 }
45418
45419 uint64_t  __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint64_t this_ptr) {
45420         LDKRoute this_ptr_conv;
45421         this_ptr_conv.inner = untag_ptr(this_ptr);
45422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45424         this_ptr_conv.is_owned = false;
45425         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
45426         uint64_t ret_ref = 0;
45427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45429         return ret_ref;
45430 }
45431
45432 void  __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint64_t this_ptr, uint64_t val) {
45433         LDKRoute this_ptr_conv;
45434         this_ptr_conv.inner = untag_ptr(this_ptr);
45435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45437         this_ptr_conv.is_owned = false;
45438         LDKPaymentParameters val_conv;
45439         val_conv.inner = untag_ptr(val);
45440         val_conv.is_owned = ptr_is_owned(val);
45441         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45442         val_conv = PaymentParameters_clone(&val_conv);
45443         Route_set_payment_params(&this_ptr_conv, val_conv);
45444 }
45445
45446 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(ptrArray paths_arg, uint64_t payment_params_arg) {
45447         LDKCVec_CVec_RouteHopZZ paths_arg_constr;
45448         paths_arg_constr.datalen = paths_arg->arr_len;
45449         if (paths_arg_constr.datalen > 0)
45450                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
45451         else
45452                 paths_arg_constr.data = NULL;
45453         uint64_tArray* paths_arg_vals = (void*) paths_arg->elems;
45454         for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
45455                 uint64_tArray paths_arg_conv_12 = paths_arg_vals[m];
45456                 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
45457                 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
45458                 if (paths_arg_conv_12_constr.datalen > 0)
45459                         paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
45460                 else
45461                         paths_arg_conv_12_constr.data = NULL;
45462                 uint64_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems;
45463                 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
45464                         uint64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
45465                         LDKRouteHop paths_arg_conv_12_conv_10_conv;
45466                         paths_arg_conv_12_conv_10_conv.inner = untag_ptr(paths_arg_conv_12_conv_10);
45467                         paths_arg_conv_12_conv_10_conv.is_owned = ptr_is_owned(paths_arg_conv_12_conv_10);
45468                         CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
45469                         paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
45470                         paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
45471                 }
45472                 FREE(paths_arg_conv_12);
45473                 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
45474         }
45475         FREE(paths_arg);
45476         LDKPaymentParameters payment_params_arg_conv;
45477         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
45478         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
45479         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
45480         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
45481         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
45482         uint64_t ret_ref = 0;
45483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45485         return ret_ref;
45486 }
45487
45488 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
45489         LDKRoute ret_var = Route_clone(arg);
45490         uint64_t ret_ref = 0;
45491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45493         return ret_ref;
45494 }
45495 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
45496         LDKRoute arg_conv;
45497         arg_conv.inner = untag_ptr(arg);
45498         arg_conv.is_owned = ptr_is_owned(arg);
45499         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45500         arg_conv.is_owned = false;
45501         int64_t ret_conv = Route_clone_ptr(&arg_conv);
45502         return ret_conv;
45503 }
45504
45505 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
45506         LDKRoute orig_conv;
45507         orig_conv.inner = untag_ptr(orig);
45508         orig_conv.is_owned = ptr_is_owned(orig);
45509         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45510         orig_conv.is_owned = false;
45511         LDKRoute ret_var = Route_clone(&orig_conv);
45512         uint64_t ret_ref = 0;
45513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45515         return ret_ref;
45516 }
45517
45518 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
45519         LDKRoute o_conv;
45520         o_conv.inner = untag_ptr(o);
45521         o_conv.is_owned = ptr_is_owned(o);
45522         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45523         o_conv.is_owned = false;
45524         int64_t ret_conv = Route_hash(&o_conv);
45525         return ret_conv;
45526 }
45527
45528 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
45529         LDKRoute a_conv;
45530         a_conv.inner = untag_ptr(a);
45531         a_conv.is_owned = ptr_is_owned(a);
45532         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45533         a_conv.is_owned = false;
45534         LDKRoute b_conv;
45535         b_conv.inner = untag_ptr(b);
45536         b_conv.is_owned = ptr_is_owned(b);
45537         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45538         b_conv.is_owned = false;
45539         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
45540         return ret_conv;
45541 }
45542
45543 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
45544         LDKRoute this_arg_conv;
45545         this_arg_conv.inner = untag_ptr(this_arg);
45546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45548         this_arg_conv.is_owned = false;
45549         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
45550         return ret_conv;
45551 }
45552
45553 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
45554         LDKRoute this_arg_conv;
45555         this_arg_conv.inner = untag_ptr(this_arg);
45556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45558         this_arg_conv.is_owned = false;
45559         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
45560         return ret_conv;
45561 }
45562
45563 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
45564         LDKRoute obj_conv;
45565         obj_conv.inner = untag_ptr(obj);
45566         obj_conv.is_owned = ptr_is_owned(obj);
45567         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45568         obj_conv.is_owned = false;
45569         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
45570         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45571         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45572         CVec_u8Z_free(ret_var);
45573         return ret_arr;
45574 }
45575
45576 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
45577         LDKu8slice ser_ref;
45578         ser_ref.datalen = ser->arr_len;
45579         ser_ref.data = ser->elems;
45580         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
45581         *ret_conv = Route_read(ser_ref);
45582         FREE(ser);
45583         return tag_ptr(ret_conv, true);
45584 }
45585
45586 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
45587         LDKRouteParameters this_obj_conv;
45588         this_obj_conv.inner = untag_ptr(this_obj);
45589         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45591         RouteParameters_free(this_obj_conv);
45592 }
45593
45594 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
45595         LDKRouteParameters this_ptr_conv;
45596         this_ptr_conv.inner = untag_ptr(this_ptr);
45597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45599         this_ptr_conv.is_owned = false;
45600         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
45601         uint64_t ret_ref = 0;
45602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45604         return ret_ref;
45605 }
45606
45607 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
45608         LDKRouteParameters this_ptr_conv;
45609         this_ptr_conv.inner = untag_ptr(this_ptr);
45610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45612         this_ptr_conv.is_owned = false;
45613         LDKPaymentParameters val_conv;
45614         val_conv.inner = untag_ptr(val);
45615         val_conv.is_owned = ptr_is_owned(val);
45616         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45617         val_conv = PaymentParameters_clone(&val_conv);
45618         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
45619 }
45620
45621 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
45622         LDKRouteParameters this_ptr_conv;
45623         this_ptr_conv.inner = untag_ptr(this_ptr);
45624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45626         this_ptr_conv.is_owned = false;
45627         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
45628         return ret_conv;
45629 }
45630
45631 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
45632         LDKRouteParameters this_ptr_conv;
45633         this_ptr_conv.inner = untag_ptr(this_ptr);
45634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45636         this_ptr_conv.is_owned = false;
45637         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
45638 }
45639
45640 uint64_t  __attribute__((export_name("TS_RouteParameters_new"))) TS_RouteParameters_new(uint64_t payment_params_arg, int64_t final_value_msat_arg) {
45641         LDKPaymentParameters payment_params_arg_conv;
45642         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
45643         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
45644         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
45645         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
45646         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg);
45647         uint64_t ret_ref = 0;
45648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45650         return ret_ref;
45651 }
45652
45653 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
45654         LDKRouteParameters ret_var = RouteParameters_clone(arg);
45655         uint64_t ret_ref = 0;
45656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45658         return ret_ref;
45659 }
45660 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
45661         LDKRouteParameters arg_conv;
45662         arg_conv.inner = untag_ptr(arg);
45663         arg_conv.is_owned = ptr_is_owned(arg);
45664         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45665         arg_conv.is_owned = false;
45666         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
45667         return ret_conv;
45668 }
45669
45670 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
45671         LDKRouteParameters orig_conv;
45672         orig_conv.inner = untag_ptr(orig);
45673         orig_conv.is_owned = ptr_is_owned(orig);
45674         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45675         orig_conv.is_owned = false;
45676         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
45677         uint64_t ret_ref = 0;
45678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45680         return ret_ref;
45681 }
45682
45683 jboolean  __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) {
45684         LDKRouteParameters a_conv;
45685         a_conv.inner = untag_ptr(a);
45686         a_conv.is_owned = ptr_is_owned(a);
45687         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45688         a_conv.is_owned = false;
45689         LDKRouteParameters b_conv;
45690         b_conv.inner = untag_ptr(b);
45691         b_conv.is_owned = ptr_is_owned(b);
45692         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45693         b_conv.is_owned = false;
45694         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
45695         return ret_conv;
45696 }
45697
45698 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
45699         LDKRouteParameters obj_conv;
45700         obj_conv.inner = untag_ptr(obj);
45701         obj_conv.is_owned = ptr_is_owned(obj);
45702         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45703         obj_conv.is_owned = false;
45704         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
45705         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45706         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45707         CVec_u8Z_free(ret_var);
45708         return ret_arr;
45709 }
45710
45711 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
45712         LDKu8slice ser_ref;
45713         ser_ref.datalen = ser->arr_len;
45714         ser_ref.data = ser->elems;
45715         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
45716         *ret_conv = RouteParameters_read(ser_ref);
45717         FREE(ser);
45718         return tag_ptr(ret_conv, true);
45719 }
45720
45721 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
45722         LDKPaymentParameters this_obj_conv;
45723         this_obj_conv.inner = untag_ptr(this_obj);
45724         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45726         PaymentParameters_free(this_obj_conv);
45727 }
45728
45729 int8_tArray  __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint64_t this_ptr) {
45730         LDKPaymentParameters this_ptr_conv;
45731         this_ptr_conv.inner = untag_ptr(this_ptr);
45732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45734         this_ptr_conv.is_owned = false;
45735         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45736         memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
45737         return ret_arr;
45738 }
45739
45740 void  __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint64_t this_ptr, int8_tArray val) {
45741         LDKPaymentParameters this_ptr_conv;
45742         this_ptr_conv.inner = untag_ptr(this_ptr);
45743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45745         this_ptr_conv.is_owned = false;
45746         LDKPublicKey val_ref;
45747         CHECK(val->arr_len == 33);
45748         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45749         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
45750 }
45751
45752 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint64_t this_ptr) {
45753         LDKPaymentParameters this_ptr_conv;
45754         this_ptr_conv.inner = untag_ptr(this_ptr);
45755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45757         this_ptr_conv.is_owned = false;
45758         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
45759         uint64_t ret_ref = 0;
45760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45762         return ret_ref;
45763 }
45764
45765 void  __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint64_t this_ptr, uint64_t val) {
45766         LDKPaymentParameters this_ptr_conv;
45767         this_ptr_conv.inner = untag_ptr(this_ptr);
45768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45770         this_ptr_conv.is_owned = false;
45771         LDKInvoiceFeatures val_conv;
45772         val_conv.inner = untag_ptr(val);
45773         val_conv.is_owned = ptr_is_owned(val);
45774         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45775         val_conv = InvoiceFeatures_clone(&val_conv);
45776         PaymentParameters_set_features(&this_ptr_conv, val_conv);
45777 }
45778
45779 uint64_tArray  __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint64_t this_ptr) {
45780         LDKPaymentParameters this_ptr_conv;
45781         this_ptr_conv.inner = untag_ptr(this_ptr);
45782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45784         this_ptr_conv.is_owned = false;
45785         LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
45786         uint64_tArray ret_arr = NULL;
45787         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45788         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45789         for (size_t l = 0; l < ret_var.datalen; l++) {
45790                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
45791                 uint64_t ret_conv_11_ref = 0;
45792                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
45793                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
45794                 ret_arr_ptr[l] = ret_conv_11_ref;
45795         }
45796         
45797         FREE(ret_var.data);
45798         return ret_arr;
45799 }
45800
45801 void  __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint64_t this_ptr, uint64_tArray val) {
45802         LDKPaymentParameters this_ptr_conv;
45803         this_ptr_conv.inner = untag_ptr(this_ptr);
45804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45806         this_ptr_conv.is_owned = false;
45807         LDKCVec_RouteHintZ val_constr;
45808         val_constr.datalen = val->arr_len;
45809         if (val_constr.datalen > 0)
45810                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
45811         else
45812                 val_constr.data = NULL;
45813         uint64_t* val_vals = val->elems;
45814         for (size_t l = 0; l < val_constr.datalen; l++) {
45815                 uint64_t val_conv_11 = val_vals[l];
45816                 LDKRouteHint val_conv_11_conv;
45817                 val_conv_11_conv.inner = untag_ptr(val_conv_11);
45818                 val_conv_11_conv.is_owned = ptr_is_owned(val_conv_11);
45819                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
45820                 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
45821                 val_constr.data[l] = val_conv_11_conv;
45822         }
45823         FREE(val);
45824         PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
45825 }
45826
45827 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
45828         LDKPaymentParameters this_ptr_conv;
45829         this_ptr_conv.inner = untag_ptr(this_ptr);
45830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45832         this_ptr_conv.is_owned = false;
45833         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45834         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
45835         uint64_t ret_ref = tag_ptr(ret_copy, true);
45836         return ret_ref;
45837 }
45838
45839 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
45840         LDKPaymentParameters this_ptr_conv;
45841         this_ptr_conv.inner = untag_ptr(this_ptr);
45842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45844         this_ptr_conv.is_owned = false;
45845         void* val_ptr = untag_ptr(val);
45846         CHECK_ACCESS(val_ptr);
45847         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45848         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
45849         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
45850 }
45851
45852 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) {
45853         LDKPaymentParameters this_ptr_conv;
45854         this_ptr_conv.inner = untag_ptr(this_ptr);
45855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45857         this_ptr_conv.is_owned = false;
45858         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
45859         return ret_conv;
45860 }
45861
45862 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) {
45863         LDKPaymentParameters this_ptr_conv;
45864         this_ptr_conv.inner = untag_ptr(this_ptr);
45865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45867         this_ptr_conv.is_owned = false;
45868         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
45869 }
45870
45871 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
45872         LDKPaymentParameters this_ptr_conv;
45873         this_ptr_conv.inner = untag_ptr(this_ptr);
45874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45876         this_ptr_conv.is_owned = false;
45877         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
45878         return ret_conv;
45879 }
45880
45881 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
45882         LDKPaymentParameters this_ptr_conv;
45883         this_ptr_conv.inner = untag_ptr(this_ptr);
45884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45886         this_ptr_conv.is_owned = false;
45887         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
45888 }
45889
45890 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) {
45891         LDKPaymentParameters this_ptr_conv;
45892         this_ptr_conv.inner = untag_ptr(this_ptr);
45893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45895         this_ptr_conv.is_owned = false;
45896         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
45897         return ret_conv;
45898 }
45899
45900 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) {
45901         LDKPaymentParameters this_ptr_conv;
45902         this_ptr_conv.inner = untag_ptr(this_ptr);
45903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45905         this_ptr_conv.is_owned = false;
45906         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
45907 }
45908
45909 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
45910         LDKPaymentParameters this_ptr_conv;
45911         this_ptr_conv.inner = untag_ptr(this_ptr);
45912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45914         this_ptr_conv.is_owned = false;
45915         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
45916         int64_tArray ret_arr = NULL;
45917         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
45918         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
45919         for (size_t i = 0; i < ret_var.datalen; i++) {
45920                 int64_t ret_conv_8_conv = ret_var.data[i];
45921                 ret_arr_ptr[i] = ret_conv_8_conv;
45922         }
45923         
45924         FREE(ret_var.data);
45925         return ret_arr;
45926 }
45927
45928 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
45929         LDKPaymentParameters this_ptr_conv;
45930         this_ptr_conv.inner = untag_ptr(this_ptr);
45931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45933         this_ptr_conv.is_owned = false;
45934         LDKCVec_u64Z val_constr;
45935         val_constr.datalen = val->arr_len;
45936         if (val_constr.datalen > 0)
45937                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
45938         else
45939                 val_constr.data = NULL;
45940         int64_t* val_vals = val->elems;
45941         for (size_t i = 0; i < val_constr.datalen; i++) {
45942                 int64_t val_conv_8 = val_vals[i];
45943                 val_constr.data[i] = val_conv_8;
45944         }
45945         FREE(val);
45946         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
45947 }
45948
45949 int32_t  __attribute__((export_name("TS_PaymentParameters_get_final_cltv_expiry_delta"))) TS_PaymentParameters_get_final_cltv_expiry_delta(uint64_t this_ptr) {
45950         LDKPaymentParameters this_ptr_conv;
45951         this_ptr_conv.inner = untag_ptr(this_ptr);
45952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45954         this_ptr_conv.is_owned = false;
45955         int32_t ret_conv = PaymentParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
45956         return ret_conv;
45957 }
45958
45959 void  __attribute__((export_name("TS_PaymentParameters_set_final_cltv_expiry_delta"))) TS_PaymentParameters_set_final_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
45960         LDKPaymentParameters this_ptr_conv;
45961         this_ptr_conv.inner = untag_ptr(this_ptr);
45962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45964         this_ptr_conv.is_owned = false;
45965         PaymentParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
45966 }
45967
45968 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, int32_t final_cltv_expiry_delta_arg) {
45969         LDKPublicKey payee_pubkey_arg_ref;
45970         CHECK(payee_pubkey_arg->arr_len == 33);
45971         memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
45972         LDKInvoiceFeatures features_arg_conv;
45973         features_arg_conv.inner = untag_ptr(features_arg);
45974         features_arg_conv.is_owned = ptr_is_owned(features_arg);
45975         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
45976         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
45977         LDKCVec_RouteHintZ route_hints_arg_constr;
45978         route_hints_arg_constr.datalen = route_hints_arg->arr_len;
45979         if (route_hints_arg_constr.datalen > 0)
45980                 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
45981         else
45982                 route_hints_arg_constr.data = NULL;
45983         uint64_t* route_hints_arg_vals = route_hints_arg->elems;
45984         for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
45985                 uint64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
45986                 LDKRouteHint route_hints_arg_conv_11_conv;
45987                 route_hints_arg_conv_11_conv.inner = untag_ptr(route_hints_arg_conv_11);
45988                 route_hints_arg_conv_11_conv.is_owned = ptr_is_owned(route_hints_arg_conv_11);
45989                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
45990                 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
45991                 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
45992         }
45993         FREE(route_hints_arg);
45994         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
45995         CHECK_ACCESS(expiry_time_arg_ptr);
45996         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
45997         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
45998         LDKCVec_u64Z previously_failed_channels_arg_constr;
45999         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
46000         if (previously_failed_channels_arg_constr.datalen > 0)
46001                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
46002         else
46003                 previously_failed_channels_arg_constr.data = NULL;
46004         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
46005         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
46006                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
46007                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
46008         }
46009         FREE(previously_failed_channels_arg);
46010         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, final_cltv_expiry_delta_arg);
46011         uint64_t ret_ref = 0;
46012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46014         return ret_ref;
46015 }
46016
46017 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
46018         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
46019         uint64_t ret_ref = 0;
46020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46022         return ret_ref;
46023 }
46024 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
46025         LDKPaymentParameters arg_conv;
46026         arg_conv.inner = untag_ptr(arg);
46027         arg_conv.is_owned = ptr_is_owned(arg);
46028         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46029         arg_conv.is_owned = false;
46030         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
46031         return ret_conv;
46032 }
46033
46034 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
46035         LDKPaymentParameters orig_conv;
46036         orig_conv.inner = untag_ptr(orig);
46037         orig_conv.is_owned = ptr_is_owned(orig);
46038         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46039         orig_conv.is_owned = false;
46040         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
46041         uint64_t ret_ref = 0;
46042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46044         return ret_ref;
46045 }
46046
46047 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
46048         LDKPaymentParameters o_conv;
46049         o_conv.inner = untag_ptr(o);
46050         o_conv.is_owned = ptr_is_owned(o);
46051         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46052         o_conv.is_owned = false;
46053         int64_t ret_conv = PaymentParameters_hash(&o_conv);
46054         return ret_conv;
46055 }
46056
46057 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
46058         LDKPaymentParameters a_conv;
46059         a_conv.inner = untag_ptr(a);
46060         a_conv.is_owned = ptr_is_owned(a);
46061         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46062         a_conv.is_owned = false;
46063         LDKPaymentParameters b_conv;
46064         b_conv.inner = untag_ptr(b);
46065         b_conv.is_owned = ptr_is_owned(b);
46066         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46067         b_conv.is_owned = false;
46068         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
46069         return ret_conv;
46070 }
46071
46072 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
46073         LDKPaymentParameters obj_conv;
46074         obj_conv.inner = untag_ptr(obj);
46075         obj_conv.is_owned = ptr_is_owned(obj);
46076         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46077         obj_conv.is_owned = false;
46078         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
46079         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46080         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46081         CVec_u8Z_free(ret_var);
46082         return ret_arr;
46083 }
46084
46085 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) {
46086         LDKu8slice ser_ref;
46087         ser_ref.datalen = ser->arr_len;
46088         ser_ref.data = ser->elems;
46089         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
46090         *ret_conv = PaymentParameters_read(ser_ref, arg);
46091         FREE(ser);
46092         return tag_ptr(ret_conv, true);
46093 }
46094
46095 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_node_id"))) TS_PaymentParameters_from_node_id(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) {
46096         LDKPublicKey payee_pubkey_ref;
46097         CHECK(payee_pubkey->arr_len == 33);
46098         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
46099         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
46100         uint64_t ret_ref = 0;
46101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46103         return ret_ref;
46104 }
46105
46106 uint64_t  __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) {
46107         LDKPublicKey payee_pubkey_ref;
46108         CHECK(payee_pubkey->arr_len == 33);
46109         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
46110         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta);
46111         uint64_t ret_ref = 0;
46112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46114         return ret_ref;
46115 }
46116
46117 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
46118         LDKRouteHint this_obj_conv;
46119         this_obj_conv.inner = untag_ptr(this_obj);
46120         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46122         RouteHint_free(this_obj_conv);
46123 }
46124
46125 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
46126         LDKRouteHint this_ptr_conv;
46127         this_ptr_conv.inner = untag_ptr(this_ptr);
46128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46130         this_ptr_conv.is_owned = false;
46131         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
46132         uint64_tArray ret_arr = NULL;
46133         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46134         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46135         for (size_t o = 0; o < ret_var.datalen; o++) {
46136                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
46137                 uint64_t ret_conv_14_ref = 0;
46138                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
46139                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
46140                 ret_arr_ptr[o] = ret_conv_14_ref;
46141         }
46142         
46143         FREE(ret_var.data);
46144         return ret_arr;
46145 }
46146
46147 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
46148         LDKRouteHint this_ptr_conv;
46149         this_ptr_conv.inner = untag_ptr(this_ptr);
46150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46152         this_ptr_conv.is_owned = false;
46153         LDKCVec_RouteHintHopZ val_constr;
46154         val_constr.datalen = val->arr_len;
46155         if (val_constr.datalen > 0)
46156                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
46157         else
46158                 val_constr.data = NULL;
46159         uint64_t* val_vals = val->elems;
46160         for (size_t o = 0; o < val_constr.datalen; o++) {
46161                 uint64_t val_conv_14 = val_vals[o];
46162                 LDKRouteHintHop val_conv_14_conv;
46163                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
46164                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
46165                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
46166                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
46167                 val_constr.data[o] = val_conv_14_conv;
46168         }
46169         FREE(val);
46170         RouteHint_set_a(&this_ptr_conv, val_constr);
46171 }
46172
46173 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
46174         LDKCVec_RouteHintHopZ a_arg_constr;
46175         a_arg_constr.datalen = a_arg->arr_len;
46176         if (a_arg_constr.datalen > 0)
46177                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
46178         else
46179                 a_arg_constr.data = NULL;
46180         uint64_t* a_arg_vals = a_arg->elems;
46181         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
46182                 uint64_t a_arg_conv_14 = a_arg_vals[o];
46183                 LDKRouteHintHop a_arg_conv_14_conv;
46184                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
46185                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
46186                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
46187                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
46188                 a_arg_constr.data[o] = a_arg_conv_14_conv;
46189         }
46190         FREE(a_arg);
46191         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
46192         uint64_t ret_ref = 0;
46193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46195         return ret_ref;
46196 }
46197
46198 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
46199         LDKRouteHint ret_var = RouteHint_clone(arg);
46200         uint64_t ret_ref = 0;
46201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46203         return ret_ref;
46204 }
46205 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
46206         LDKRouteHint arg_conv;
46207         arg_conv.inner = untag_ptr(arg);
46208         arg_conv.is_owned = ptr_is_owned(arg);
46209         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46210         arg_conv.is_owned = false;
46211         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
46212         return ret_conv;
46213 }
46214
46215 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
46216         LDKRouteHint orig_conv;
46217         orig_conv.inner = untag_ptr(orig);
46218         orig_conv.is_owned = ptr_is_owned(orig);
46219         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46220         orig_conv.is_owned = false;
46221         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
46222         uint64_t ret_ref = 0;
46223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46225         return ret_ref;
46226 }
46227
46228 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
46229         LDKRouteHint o_conv;
46230         o_conv.inner = untag_ptr(o);
46231         o_conv.is_owned = ptr_is_owned(o);
46232         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46233         o_conv.is_owned = false;
46234         int64_t ret_conv = RouteHint_hash(&o_conv);
46235         return ret_conv;
46236 }
46237
46238 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
46239         LDKRouteHint a_conv;
46240         a_conv.inner = untag_ptr(a);
46241         a_conv.is_owned = ptr_is_owned(a);
46242         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46243         a_conv.is_owned = false;
46244         LDKRouteHint b_conv;
46245         b_conv.inner = untag_ptr(b);
46246         b_conv.is_owned = ptr_is_owned(b);
46247         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46248         b_conv.is_owned = false;
46249         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
46250         return ret_conv;
46251 }
46252
46253 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
46254         LDKRouteHint obj_conv;
46255         obj_conv.inner = untag_ptr(obj);
46256         obj_conv.is_owned = ptr_is_owned(obj);
46257         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46258         obj_conv.is_owned = false;
46259         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
46260         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46261         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46262         CVec_u8Z_free(ret_var);
46263         return ret_arr;
46264 }
46265
46266 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
46267         LDKu8slice ser_ref;
46268         ser_ref.datalen = ser->arr_len;
46269         ser_ref.data = ser->elems;
46270         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
46271         *ret_conv = RouteHint_read(ser_ref);
46272         FREE(ser);
46273         return tag_ptr(ret_conv, true);
46274 }
46275
46276 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
46277         LDKRouteHintHop this_obj_conv;
46278         this_obj_conv.inner = untag_ptr(this_obj);
46279         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46281         RouteHintHop_free(this_obj_conv);
46282 }
46283
46284 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
46285         LDKRouteHintHop this_ptr_conv;
46286         this_ptr_conv.inner = untag_ptr(this_ptr);
46287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46289         this_ptr_conv.is_owned = false;
46290         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46291         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
46292         return ret_arr;
46293 }
46294
46295 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
46296         LDKRouteHintHop this_ptr_conv;
46297         this_ptr_conv.inner = untag_ptr(this_ptr);
46298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46300         this_ptr_conv.is_owned = false;
46301         LDKPublicKey val_ref;
46302         CHECK(val->arr_len == 33);
46303         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46304         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
46305 }
46306
46307 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
46308         LDKRouteHintHop this_ptr_conv;
46309         this_ptr_conv.inner = untag_ptr(this_ptr);
46310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46312         this_ptr_conv.is_owned = false;
46313         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
46314         return ret_conv;
46315 }
46316
46317 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
46318         LDKRouteHintHop this_ptr_conv;
46319         this_ptr_conv.inner = untag_ptr(this_ptr);
46320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46322         this_ptr_conv.is_owned = false;
46323         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
46324 }
46325
46326 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
46327         LDKRouteHintHop this_ptr_conv;
46328         this_ptr_conv.inner = untag_ptr(this_ptr);
46329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46331         this_ptr_conv.is_owned = false;
46332         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
46333         uint64_t ret_ref = 0;
46334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46336         return ret_ref;
46337 }
46338
46339 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
46340         LDKRouteHintHop this_ptr_conv;
46341         this_ptr_conv.inner = untag_ptr(this_ptr);
46342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46344         this_ptr_conv.is_owned = false;
46345         LDKRoutingFees val_conv;
46346         val_conv.inner = untag_ptr(val);
46347         val_conv.is_owned = ptr_is_owned(val);
46348         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46349         val_conv = RoutingFees_clone(&val_conv);
46350         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
46351 }
46352
46353 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
46354         LDKRouteHintHop this_ptr_conv;
46355         this_ptr_conv.inner = untag_ptr(this_ptr);
46356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46358         this_ptr_conv.is_owned = false;
46359         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
46360         return ret_conv;
46361 }
46362
46363 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
46364         LDKRouteHintHop this_ptr_conv;
46365         this_ptr_conv.inner = untag_ptr(this_ptr);
46366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46368         this_ptr_conv.is_owned = false;
46369         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
46370 }
46371
46372 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
46373         LDKRouteHintHop this_ptr_conv;
46374         this_ptr_conv.inner = untag_ptr(this_ptr);
46375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46377         this_ptr_conv.is_owned = false;
46378         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46379         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
46380         uint64_t ret_ref = tag_ptr(ret_copy, true);
46381         return ret_ref;
46382 }
46383
46384 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
46385         LDKRouteHintHop this_ptr_conv;
46386         this_ptr_conv.inner = untag_ptr(this_ptr);
46387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46389         this_ptr_conv.is_owned = false;
46390         void* val_ptr = untag_ptr(val);
46391         CHECK_ACCESS(val_ptr);
46392         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46393         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46394         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
46395 }
46396
46397 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
46398         LDKRouteHintHop this_ptr_conv;
46399         this_ptr_conv.inner = untag_ptr(this_ptr);
46400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46402         this_ptr_conv.is_owned = false;
46403         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46404         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
46405         uint64_t ret_ref = tag_ptr(ret_copy, true);
46406         return ret_ref;
46407 }
46408
46409 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
46410         LDKRouteHintHop this_ptr_conv;
46411         this_ptr_conv.inner = untag_ptr(this_ptr);
46412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46414         this_ptr_conv.is_owned = false;
46415         void* val_ptr = untag_ptr(val);
46416         CHECK_ACCESS(val_ptr);
46417         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46418         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46419         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
46420 }
46421
46422 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) {
46423         LDKPublicKey src_node_id_arg_ref;
46424         CHECK(src_node_id_arg->arr_len == 33);
46425         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
46426         LDKRoutingFees fees_arg_conv;
46427         fees_arg_conv.inner = untag_ptr(fees_arg);
46428         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
46429         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
46430         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
46431         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
46432         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
46433         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
46434         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
46435         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
46436         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
46437         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
46438         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
46439         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);
46440         uint64_t ret_ref = 0;
46441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46443         return ret_ref;
46444 }
46445
46446 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
46447         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
46448         uint64_t ret_ref = 0;
46449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46451         return ret_ref;
46452 }
46453 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
46454         LDKRouteHintHop arg_conv;
46455         arg_conv.inner = untag_ptr(arg);
46456         arg_conv.is_owned = ptr_is_owned(arg);
46457         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46458         arg_conv.is_owned = false;
46459         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
46460         return ret_conv;
46461 }
46462
46463 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
46464         LDKRouteHintHop orig_conv;
46465         orig_conv.inner = untag_ptr(orig);
46466         orig_conv.is_owned = ptr_is_owned(orig);
46467         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46468         orig_conv.is_owned = false;
46469         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
46470         uint64_t ret_ref = 0;
46471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46473         return ret_ref;
46474 }
46475
46476 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
46477         LDKRouteHintHop o_conv;
46478         o_conv.inner = untag_ptr(o);
46479         o_conv.is_owned = ptr_is_owned(o);
46480         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46481         o_conv.is_owned = false;
46482         int64_t ret_conv = RouteHintHop_hash(&o_conv);
46483         return ret_conv;
46484 }
46485
46486 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
46487         LDKRouteHintHop a_conv;
46488         a_conv.inner = untag_ptr(a);
46489         a_conv.is_owned = ptr_is_owned(a);
46490         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46491         a_conv.is_owned = false;
46492         LDKRouteHintHop b_conv;
46493         b_conv.inner = untag_ptr(b);
46494         b_conv.is_owned = ptr_is_owned(b);
46495         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46496         b_conv.is_owned = false;
46497         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
46498         return ret_conv;
46499 }
46500
46501 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
46502         LDKRouteHintHop obj_conv;
46503         obj_conv.inner = untag_ptr(obj);
46504         obj_conv.is_owned = ptr_is_owned(obj);
46505         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46506         obj_conv.is_owned = false;
46507         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
46508         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46509         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46510         CVec_u8Z_free(ret_var);
46511         return ret_arr;
46512 }
46513
46514 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
46515         LDKu8slice ser_ref;
46516         ser_ref.datalen = ser->arr_len;
46517         ser_ref.data = ser->elems;
46518         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
46519         *ret_conv = RouteHintHop_read(ser_ref);
46520         FREE(ser);
46521         return tag_ptr(ret_conv, true);
46522 }
46523
46524 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) {
46525         LDKPublicKey our_node_pubkey_ref;
46526         CHECK(our_node_pubkey->arr_len == 33);
46527         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
46528         LDKRouteParameters route_params_conv;
46529         route_params_conv.inner = untag_ptr(route_params);
46530         route_params_conv.is_owned = ptr_is_owned(route_params);
46531         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
46532         route_params_conv.is_owned = false;
46533         LDKNetworkGraph network_graph_conv;
46534         network_graph_conv.inner = untag_ptr(network_graph);
46535         network_graph_conv.is_owned = ptr_is_owned(network_graph);
46536         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
46537         network_graph_conv.is_owned = false;
46538         LDKCVec_ChannelDetailsZ first_hops_constr;
46539         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
46540         if (first_hops != 0) {
46541                 first_hops_constr.datalen = first_hops->arr_len;
46542                 if (first_hops_constr.datalen > 0)
46543                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
46544                 else
46545                         first_hops_constr.data = NULL;
46546                 uint64_t* first_hops_vals = first_hops->elems;
46547                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
46548                         uint64_t first_hops_conv_16 = first_hops_vals[q];
46549                         LDKChannelDetails first_hops_conv_16_conv;
46550                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
46551                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
46552                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
46553                         first_hops_conv_16_conv.is_owned = false;
46554                         first_hops_constr.data[q] = first_hops_conv_16_conv;
46555                 }
46556                 FREE(first_hops);
46557                 first_hops_ptr = &first_hops_constr;
46558         }
46559         void* logger_ptr = untag_ptr(logger);
46560         CHECK_ACCESS(logger_ptr);
46561         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46562         if (logger_conv.free == LDKLogger_JCalls_free) {
46563                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46564                 LDKLogger_JCalls_cloned(&logger_conv);
46565         }
46566         void* scorer_ptr = untag_ptr(scorer);
46567         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
46568         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
46569         uint8_t random_seed_bytes_arr[32];
46570         CHECK(random_seed_bytes->arr_len == 32);
46571         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
46572         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
46573         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
46574         *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);
46575         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
46576         return tag_ptr(ret_conv, true);
46577 }
46578
46579 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) {
46580         LDKPublicKey our_node_pubkey_ref;
46581         CHECK(our_node_pubkey->arr_len == 33);
46582         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
46583         LDKCVec_PublicKeyZ hops_constr;
46584         hops_constr.datalen = hops->arr_len;
46585         if (hops_constr.datalen > 0)
46586                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
46587         else
46588                 hops_constr.data = NULL;
46589         int8_tArray* hops_vals = (void*) hops->elems;
46590         for (size_t m = 0; m < hops_constr.datalen; m++) {
46591                 int8_tArray hops_conv_12 = hops_vals[m];
46592                 LDKPublicKey hops_conv_12_ref;
46593                 CHECK(hops_conv_12->arr_len == 33);
46594                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
46595                 hops_constr.data[m] = hops_conv_12_ref;
46596         }
46597         FREE(hops);
46598         LDKRouteParameters route_params_conv;
46599         route_params_conv.inner = untag_ptr(route_params);
46600         route_params_conv.is_owned = ptr_is_owned(route_params);
46601         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
46602         route_params_conv.is_owned = false;
46603         LDKNetworkGraph network_graph_conv;
46604         network_graph_conv.inner = untag_ptr(network_graph);
46605         network_graph_conv.is_owned = ptr_is_owned(network_graph);
46606         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
46607         network_graph_conv.is_owned = false;
46608         void* logger_ptr = untag_ptr(logger);
46609         CHECK_ACCESS(logger_ptr);
46610         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46611         if (logger_conv.free == LDKLogger_JCalls_free) {
46612                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46613                 LDKLogger_JCalls_cloned(&logger_conv);
46614         }
46615         uint8_t random_seed_bytes_arr[32];
46616         CHECK(random_seed_bytes->arr_len == 32);
46617         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
46618         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
46619         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
46620         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
46621         return tag_ptr(ret_conv, true);
46622 }
46623
46624 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
46625         if (!ptr_is_owned(this_ptr)) return;
46626         void* this_ptr_ptr = untag_ptr(this_ptr);
46627         CHECK_ACCESS(this_ptr_ptr);
46628         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
46629         FREE(untag_ptr(this_ptr));
46630         Score_free(this_ptr_conv);
46631 }
46632
46633 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
46634         if (!ptr_is_owned(this_ptr)) return;
46635         void* this_ptr_ptr = untag_ptr(this_ptr);
46636         CHECK_ACCESS(this_ptr_ptr);
46637         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
46638         FREE(untag_ptr(this_ptr));
46639         LockableScore_free(this_ptr_conv);
46640 }
46641
46642 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
46643         if (!ptr_is_owned(this_ptr)) return;
46644         void* this_ptr_ptr = untag_ptr(this_ptr);
46645         CHECK_ACCESS(this_ptr_ptr);
46646         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
46647         FREE(untag_ptr(this_ptr));
46648         WriteableScore_free(this_ptr_conv);
46649 }
46650
46651 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
46652         LDKMultiThreadedLockableScore this_obj_conv;
46653         this_obj_conv.inner = untag_ptr(this_obj);
46654         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46656         MultiThreadedLockableScore_free(this_obj_conv);
46657 }
46658
46659 void  __attribute__((export_name("TS_MultiThreadedScoreLock_free"))) TS_MultiThreadedScoreLock_free(uint64_t this_obj) {
46660         LDKMultiThreadedScoreLock this_obj_conv;
46661         this_obj_conv.inner = untag_ptr(this_obj);
46662         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46664         MultiThreadedScoreLock_free(this_obj_conv);
46665 }
46666
46667 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLock_as_Score"))) TS_MultiThreadedScoreLock_as_Score(uint64_t this_arg) {
46668         LDKMultiThreadedScoreLock this_arg_conv;
46669         this_arg_conv.inner = untag_ptr(this_arg);
46670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46672         this_arg_conv.is_owned = false;
46673         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
46674         *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
46675         return tag_ptr(ret_ret, true);
46676 }
46677
46678 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLock_write"))) TS_MultiThreadedScoreLock_write(uint64_t obj) {
46679         LDKMultiThreadedScoreLock obj_conv;
46680         obj_conv.inner = untag_ptr(obj);
46681         obj_conv.is_owned = ptr_is_owned(obj);
46682         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46683         obj_conv.is_owned = false;
46684         LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
46685         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46686         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46687         CVec_u8Z_free(ret_var);
46688         return ret_arr;
46689 }
46690
46691 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
46692         LDKMultiThreadedLockableScore this_arg_conv;
46693         this_arg_conv.inner = untag_ptr(this_arg);
46694         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46696         this_arg_conv.is_owned = false;
46697         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
46698         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
46699         return tag_ptr(ret_ret, true);
46700 }
46701
46702 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
46703         LDKMultiThreadedLockableScore obj_conv;
46704         obj_conv.inner = untag_ptr(obj);
46705         obj_conv.is_owned = ptr_is_owned(obj);
46706         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46707         obj_conv.is_owned = false;
46708         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
46709         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46710         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46711         CVec_u8Z_free(ret_var);
46712         return ret_arr;
46713 }
46714
46715 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
46716         LDKMultiThreadedLockableScore this_arg_conv;
46717         this_arg_conv.inner = untag_ptr(this_arg);
46718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46720         this_arg_conv.is_owned = false;
46721         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
46722         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
46723         return tag_ptr(ret_ret, true);
46724 }
46725
46726 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
46727         void* score_ptr = untag_ptr(score);
46728         CHECK_ACCESS(score_ptr);
46729         LDKScore score_conv = *(LDKScore*)(score_ptr);
46730         if (score_conv.free == LDKScore_JCalls_free) {
46731                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46732                 LDKScore_JCalls_cloned(&score_conv);
46733         }
46734         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
46735         uint64_t ret_ref = 0;
46736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46738         return ret_ref;
46739 }
46740
46741 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
46742         LDKChannelUsage this_obj_conv;
46743         this_obj_conv.inner = untag_ptr(this_obj);
46744         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46746         ChannelUsage_free(this_obj_conv);
46747 }
46748
46749 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
46750         LDKChannelUsage this_ptr_conv;
46751         this_ptr_conv.inner = untag_ptr(this_ptr);
46752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46754         this_ptr_conv.is_owned = false;
46755         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
46756         return ret_conv;
46757 }
46758
46759 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
46760         LDKChannelUsage this_ptr_conv;
46761         this_ptr_conv.inner = untag_ptr(this_ptr);
46762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46764         this_ptr_conv.is_owned = false;
46765         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
46766 }
46767
46768 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
46769         LDKChannelUsage this_ptr_conv;
46770         this_ptr_conv.inner = untag_ptr(this_ptr);
46771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46773         this_ptr_conv.is_owned = false;
46774         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
46775         return ret_conv;
46776 }
46777
46778 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
46779         LDKChannelUsage this_ptr_conv;
46780         this_ptr_conv.inner = untag_ptr(this_ptr);
46781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46783         this_ptr_conv.is_owned = false;
46784         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
46785 }
46786
46787 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
46788         LDKChannelUsage this_ptr_conv;
46789         this_ptr_conv.inner = untag_ptr(this_ptr);
46790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46792         this_ptr_conv.is_owned = false;
46793         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
46794         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
46795         uint64_t ret_ref = tag_ptr(ret_copy, true);
46796         return ret_ref;
46797 }
46798
46799 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
46800         LDKChannelUsage this_ptr_conv;
46801         this_ptr_conv.inner = untag_ptr(this_ptr);
46802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46804         this_ptr_conv.is_owned = false;
46805         void* val_ptr = untag_ptr(val);
46806         CHECK_ACCESS(val_ptr);
46807         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
46808         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
46809         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
46810 }
46811
46812 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) {
46813         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
46814         CHECK_ACCESS(effective_capacity_arg_ptr);
46815         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
46816         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
46817         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
46818         uint64_t ret_ref = 0;
46819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46821         return ret_ref;
46822 }
46823
46824 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
46825         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
46826         uint64_t ret_ref = 0;
46827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46829         return ret_ref;
46830 }
46831 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
46832         LDKChannelUsage arg_conv;
46833         arg_conv.inner = untag_ptr(arg);
46834         arg_conv.is_owned = ptr_is_owned(arg);
46835         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46836         arg_conv.is_owned = false;
46837         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
46838         return ret_conv;
46839 }
46840
46841 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
46842         LDKChannelUsage orig_conv;
46843         orig_conv.inner = untag_ptr(orig);
46844         orig_conv.is_owned = ptr_is_owned(orig);
46845         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46846         orig_conv.is_owned = false;
46847         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
46848         uint64_t ret_ref = 0;
46849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46851         return ret_ref;
46852 }
46853
46854 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
46855         LDKFixedPenaltyScorer this_obj_conv;
46856         this_obj_conv.inner = untag_ptr(this_obj);
46857         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46859         FixedPenaltyScorer_free(this_obj_conv);
46860 }
46861
46862 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
46863         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
46864         uint64_t ret_ref = 0;
46865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46867         return ret_ref;
46868 }
46869 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
46870         LDKFixedPenaltyScorer arg_conv;
46871         arg_conv.inner = untag_ptr(arg);
46872         arg_conv.is_owned = ptr_is_owned(arg);
46873         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46874         arg_conv.is_owned = false;
46875         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
46876         return ret_conv;
46877 }
46878
46879 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
46880         LDKFixedPenaltyScorer orig_conv;
46881         orig_conv.inner = untag_ptr(orig);
46882         orig_conv.is_owned = ptr_is_owned(orig);
46883         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46884         orig_conv.is_owned = false;
46885         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
46886         uint64_t ret_ref = 0;
46887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46889         return ret_ref;
46890 }
46891
46892 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
46893         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
46894         uint64_t ret_ref = 0;
46895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46897         return ret_ref;
46898 }
46899
46900 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint64_t this_arg) {
46901         LDKFixedPenaltyScorer this_arg_conv;
46902         this_arg_conv.inner = untag_ptr(this_arg);
46903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46905         this_arg_conv.is_owned = false;
46906         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
46907         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
46908         return tag_ptr(ret_ret, true);
46909 }
46910
46911 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
46912         LDKFixedPenaltyScorer obj_conv;
46913         obj_conv.inner = untag_ptr(obj);
46914         obj_conv.is_owned = ptr_is_owned(obj);
46915         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46916         obj_conv.is_owned = false;
46917         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
46918         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46919         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46920         CVec_u8Z_free(ret_var);
46921         return ret_arr;
46922 }
46923
46924 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
46925         LDKu8slice ser_ref;
46926         ser_ref.datalen = ser->arr_len;
46927         ser_ref.data = ser->elems;
46928         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
46929         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
46930         FREE(ser);
46931         return tag_ptr(ret_conv, true);
46932 }
46933
46934 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
46935         LDKProbabilisticScorer this_obj_conv;
46936         this_obj_conv.inner = untag_ptr(this_obj);
46937         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46939         ProbabilisticScorer_free(this_obj_conv);
46940 }
46941
46942 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint64_t this_obj) {
46943         LDKProbabilisticScoringParameters this_obj_conv;
46944         this_obj_conv.inner = untag_ptr(this_obj);
46945         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46947         ProbabilisticScoringParameters_free(this_obj_conv);
46948 }
46949
46950 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint64_t this_ptr) {
46951         LDKProbabilisticScoringParameters this_ptr_conv;
46952         this_ptr_conv.inner = untag_ptr(this_ptr);
46953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46955         this_ptr_conv.is_owned = false;
46956         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
46957         return ret_conv;
46958 }
46959
46960 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
46961         LDKProbabilisticScoringParameters this_ptr_conv;
46962         this_ptr_conv.inner = untag_ptr(this_ptr);
46963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46965         this_ptr_conv.is_owned = false;
46966         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
46967 }
46968
46969 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) {
46970         LDKProbabilisticScoringParameters this_ptr_conv;
46971         this_ptr_conv.inner = untag_ptr(this_ptr);
46972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46974         this_ptr_conv.is_owned = false;
46975         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
46976         return ret_conv;
46977 }
46978
46979 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) {
46980         LDKProbabilisticScoringParameters this_ptr_conv;
46981         this_ptr_conv.inner = untag_ptr(this_ptr);
46982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46984         this_ptr_conv.is_owned = false;
46985         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
46986 }
46987
46988 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
46989         LDKProbabilisticScoringParameters this_ptr_conv;
46990         this_ptr_conv.inner = untag_ptr(this_ptr);
46991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46993         this_ptr_conv.is_owned = false;
46994         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
46995         return ret_conv;
46996 }
46997
46998 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) {
46999         LDKProbabilisticScoringParameters this_ptr_conv;
47000         this_ptr_conv.inner = untag_ptr(this_ptr);
47001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47003         this_ptr_conv.is_owned = false;
47004         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
47005 }
47006
47007 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
47008         LDKProbabilisticScoringParameters this_ptr_conv;
47009         this_ptr_conv.inner = untag_ptr(this_ptr);
47010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47012         this_ptr_conv.is_owned = false;
47013         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
47014         return ret_conv;
47015 }
47016
47017 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) {
47018         LDKProbabilisticScoringParameters this_ptr_conv;
47019         this_ptr_conv.inner = untag_ptr(this_ptr);
47020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47022         this_ptr_conv.is_owned = false;
47023         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
47024 }
47025
47026 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) {
47027         LDKProbabilisticScoringParameters this_ptr_conv;
47028         this_ptr_conv.inner = untag_ptr(this_ptr);
47029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47031         this_ptr_conv.is_owned = false;
47032         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
47033         return ret_conv;
47034 }
47035
47036 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) {
47037         LDKProbabilisticScoringParameters this_ptr_conv;
47038         this_ptr_conv.inner = untag_ptr(this_ptr);
47039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47041         this_ptr_conv.is_owned = false;
47042         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
47043 }
47044
47045 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
47046         LDKProbabilisticScoringParameters this_ptr_conv;
47047         this_ptr_conv.inner = untag_ptr(this_ptr);
47048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47050         this_ptr_conv.is_owned = false;
47051         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
47052         return ret_conv;
47053 }
47054
47055 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(uint64_t this_ptr, int64_t val) {
47056         LDKProbabilisticScoringParameters this_ptr_conv;
47057         this_ptr_conv.inner = untag_ptr(this_ptr);
47058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47060         this_ptr_conv.is_owned = false;
47061         ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
47062 }
47063
47064 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(uint64_t this_ptr) {
47065         LDKProbabilisticScoringParameters this_ptr_conv;
47066         this_ptr_conv.inner = untag_ptr(this_ptr);
47067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47069         this_ptr_conv.is_owned = false;
47070         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
47071         return ret_conv;
47072 }
47073
47074 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(uint64_t this_ptr, int64_t val) {
47075         LDKProbabilisticScoringParameters this_ptr_conv;
47076         this_ptr_conv.inner = untag_ptr(this_ptr);
47077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47079         this_ptr_conv.is_owned = false;
47080         ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
47081 }
47082
47083 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_historical_no_updates_half_life"))) TS_ProbabilisticScoringParameters_get_historical_no_updates_half_life(uint64_t this_ptr) {
47084         LDKProbabilisticScoringParameters this_ptr_conv;
47085         this_ptr_conv.inner = untag_ptr(this_ptr);
47086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47088         this_ptr_conv.is_owned = false;
47089         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_no_updates_half_life(&this_ptr_conv);
47090         return ret_conv;
47091 }
47092
47093 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_historical_no_updates_half_life"))) TS_ProbabilisticScoringParameters_set_historical_no_updates_half_life(uint64_t this_ptr, int64_t val) {
47094         LDKProbabilisticScoringParameters this_ptr_conv;
47095         this_ptr_conv.inner = untag_ptr(this_ptr);
47096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47098         this_ptr_conv.is_owned = false;
47099         ProbabilisticScoringParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
47100 }
47101
47102 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
47103         LDKProbabilisticScoringParameters this_ptr_conv;
47104         this_ptr_conv.inner = untag_ptr(this_ptr);
47105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47107         this_ptr_conv.is_owned = false;
47108         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
47109         return ret_conv;
47110 }
47111
47112 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) {
47113         LDKProbabilisticScoringParameters this_ptr_conv;
47114         this_ptr_conv.inner = untag_ptr(this_ptr);
47115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47117         this_ptr_conv.is_owned = false;
47118         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
47119 }
47120
47121 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
47122         LDKProbabilisticScoringParameters this_ptr_conv;
47123         this_ptr_conv.inner = untag_ptr(this_ptr);
47124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47126         this_ptr_conv.is_owned = false;
47127         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
47128         return ret_conv;
47129 }
47130
47131 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) {
47132         LDKProbabilisticScoringParameters this_ptr_conv;
47133         this_ptr_conv.inner = untag_ptr(this_ptr);
47134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47136         this_ptr_conv.is_owned = false;
47137         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
47138 }
47139
47140 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
47141         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
47142         uint64_t ret_ref = 0;
47143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47145         return ret_ref;
47146 }
47147 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint64_t arg) {
47148         LDKProbabilisticScoringParameters arg_conv;
47149         arg_conv.inner = untag_ptr(arg);
47150         arg_conv.is_owned = ptr_is_owned(arg);
47151         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47152         arg_conv.is_owned = false;
47153         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
47154         return ret_conv;
47155 }
47156
47157 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint64_t orig) {
47158         LDKProbabilisticScoringParameters orig_conv;
47159         orig_conv.inner = untag_ptr(orig);
47160         orig_conv.is_owned = ptr_is_owned(orig);
47161         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47162         orig_conv.is_owned = false;
47163         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
47164         uint64_t ret_ref = 0;
47165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47167         return ret_ref;
47168 }
47169
47170 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t params, uint64_t network_graph, uint64_t logger) {
47171         LDKProbabilisticScoringParameters params_conv;
47172         params_conv.inner = untag_ptr(params);
47173         params_conv.is_owned = ptr_is_owned(params);
47174         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
47175         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
47176         LDKNetworkGraph network_graph_conv;
47177         network_graph_conv.inner = untag_ptr(network_graph);
47178         network_graph_conv.is_owned = ptr_is_owned(network_graph);
47179         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
47180         network_graph_conv.is_owned = false;
47181         void* logger_ptr = untag_ptr(logger);
47182         CHECK_ACCESS(logger_ptr);
47183         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47184         if (logger_conv.free == LDKLogger_JCalls_free) {
47185                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47186                 LDKLogger_JCalls_cloned(&logger_conv);
47187         }
47188         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
47189         uint64_t ret_ref = 0;
47190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47192         return ret_ref;
47193 }
47194
47195 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
47196         LDKProbabilisticScorer this_arg_conv;
47197         this_arg_conv.inner = untag_ptr(this_arg);
47198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47200         this_arg_conv.is_owned = false;
47201         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
47202 }
47203
47204 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) {
47205         LDKProbabilisticScorer this_arg_conv;
47206         this_arg_conv.inner = untag_ptr(this_arg);
47207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47209         this_arg_conv.is_owned = false;
47210         LDKNodeId target_conv;
47211         target_conv.inner = untag_ptr(target);
47212         target_conv.is_owned = ptr_is_owned(target);
47213         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
47214         target_conv.is_owned = false;
47215         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
47216         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
47217         uint64_t ret_ref = tag_ptr(ret_copy, true);
47218         return ret_ref;
47219 }
47220
47221 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities"))) TS_ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(uint64_t this_arg, int64_t scid, uint64_t target) {
47222         LDKProbabilisticScorer this_arg_conv;
47223         this_arg_conv.inner = untag_ptr(this_arg);
47224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47226         this_arg_conv.is_owned = false;
47227         LDKNodeId target_conv;
47228         target_conv.inner = untag_ptr(target);
47229         target_conv.is_owned = ptr_is_owned(target);
47230         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
47231         target_conv.is_owned = false;
47232         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
47233         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
47234         uint64_t ret_ref = tag_ptr(ret_copy, true);
47235         return ret_ref;
47236 }
47237
47238 void  __attribute__((export_name("TS_ProbabilisticScorer_add_banned"))) TS_ProbabilisticScorer_add_banned(uint64_t this_arg, uint64_t node_id) {
47239         LDKProbabilisticScorer this_arg_conv;
47240         this_arg_conv.inner = untag_ptr(this_arg);
47241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47243         this_arg_conv.is_owned = false;
47244         LDKNodeId node_id_conv;
47245         node_id_conv.inner = untag_ptr(node_id);
47246         node_id_conv.is_owned = ptr_is_owned(node_id);
47247         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
47248         node_id_conv.is_owned = false;
47249         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
47250 }
47251
47252 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_banned"))) TS_ProbabilisticScorer_remove_banned(uint64_t this_arg, uint64_t node_id) {
47253         LDKProbabilisticScorer this_arg_conv;
47254         this_arg_conv.inner = untag_ptr(this_arg);
47255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47257         this_arg_conv.is_owned = false;
47258         LDKNodeId node_id_conv;
47259         node_id_conv.inner = untag_ptr(node_id);
47260         node_id_conv.is_owned = ptr_is_owned(node_id);
47261         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
47262         node_id_conv.is_owned = false;
47263         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
47264 }
47265
47266 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) {
47267         LDKProbabilisticScorer this_arg_conv;
47268         this_arg_conv.inner = untag_ptr(this_arg);
47269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47271         this_arg_conv.is_owned = false;
47272         LDKNodeId node_id_conv;
47273         node_id_conv.inner = untag_ptr(node_id);
47274         node_id_conv.is_owned = ptr_is_owned(node_id);
47275         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
47276         node_id_conv.is_owned = false;
47277         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
47278 }
47279
47280 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_manual_penalty"))) TS_ProbabilisticScorer_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
47281         LDKProbabilisticScorer this_arg_conv;
47282         this_arg_conv.inner = untag_ptr(this_arg);
47283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47285         this_arg_conv.is_owned = false;
47286         LDKNodeId node_id_conv;
47287         node_id_conv.inner = untag_ptr(node_id);
47288         node_id_conv.is_owned = ptr_is_owned(node_id);
47289         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
47290         node_id_conv.is_owned = false;
47291         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
47292 }
47293
47294 void  __attribute__((export_name("TS_ProbabilisticScorer_clear_manual_penalties"))) TS_ProbabilisticScorer_clear_manual_penalties(uint64_t this_arg) {
47295         LDKProbabilisticScorer this_arg_conv;
47296         this_arg_conv.inner = untag_ptr(this_arg);
47297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47299         this_arg_conv.is_owned = false;
47300         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
47301 }
47302
47303 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_add_banned_from_list"))) TS_ProbabilisticScoringParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
47304         LDKProbabilisticScoringParameters this_arg_conv;
47305         this_arg_conv.inner = untag_ptr(this_arg);
47306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47308         this_arg_conv.is_owned = false;
47309         LDKCVec_NodeIdZ node_ids_constr;
47310         node_ids_constr.datalen = node_ids->arr_len;
47311         if (node_ids_constr.datalen > 0)
47312                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
47313         else
47314                 node_ids_constr.data = NULL;
47315         uint64_t* node_ids_vals = node_ids->elems;
47316         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
47317                 uint64_t node_ids_conv_8 = node_ids_vals[i];
47318                 LDKNodeId node_ids_conv_8_conv;
47319                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
47320                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
47321                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
47322                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
47323                 node_ids_constr.data[i] = node_ids_conv_8_conv;
47324         }
47325         FREE(node_ids);
47326         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
47327 }
47328
47329 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
47330         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
47331         uint64_t ret_ref = 0;
47332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47334         return ret_ref;
47335 }
47336
47337 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
47338         LDKProbabilisticScorer this_arg_conv;
47339         this_arg_conv.inner = untag_ptr(this_arg);
47340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47342         this_arg_conv.is_owned = false;
47343         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
47344         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
47345         return tag_ptr(ret_ret, true);
47346 }
47347
47348 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
47349         LDKProbabilisticScorer obj_conv;
47350         obj_conv.inner = untag_ptr(obj);
47351         obj_conv.is_owned = ptr_is_owned(obj);
47352         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47353         obj_conv.is_owned = false;
47354         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
47355         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47356         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47357         CVec_u8Z_free(ret_var);
47358         return ret_arr;
47359 }
47360
47361 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) {
47362         LDKu8slice ser_ref;
47363         ser_ref.datalen = ser->arr_len;
47364         ser_ref.data = ser->elems;
47365         LDKProbabilisticScoringParameters arg_a_conv;
47366         arg_a_conv.inner = untag_ptr(arg_a);
47367         arg_a_conv.is_owned = ptr_is_owned(arg_a);
47368         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
47369         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
47370         LDKNetworkGraph arg_b_conv;
47371         arg_b_conv.inner = untag_ptr(arg_b);
47372         arg_b_conv.is_owned = ptr_is_owned(arg_b);
47373         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
47374         arg_b_conv.is_owned = false;
47375         void* arg_c_ptr = untag_ptr(arg_c);
47376         CHECK_ACCESS(arg_c_ptr);
47377         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
47378         if (arg_c_conv.free == LDKLogger_JCalls_free) {
47379                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47380                 LDKLogger_JCalls_cloned(&arg_c_conv);
47381         }
47382         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
47383         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
47384         FREE(ser);
47385         return tag_ptr(ret_conv, true);
47386 }
47387
47388 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
47389         LDKBlindedPath this_obj_conv;
47390         this_obj_conv.inner = untag_ptr(this_obj);
47391         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47393         BlindedPath_free(this_obj_conv);
47394 }
47395
47396 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
47397         LDKBlindedPath ret_var = BlindedPath_clone(arg);
47398         uint64_t ret_ref = 0;
47399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47401         return ret_ref;
47402 }
47403 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
47404         LDKBlindedPath arg_conv;
47405         arg_conv.inner = untag_ptr(arg);
47406         arg_conv.is_owned = ptr_is_owned(arg);
47407         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47408         arg_conv.is_owned = false;
47409         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
47410         return ret_conv;
47411 }
47412
47413 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
47414         LDKBlindedPath orig_conv;
47415         orig_conv.inner = untag_ptr(orig);
47416         orig_conv.is_owned = ptr_is_owned(orig);
47417         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47418         orig_conv.is_owned = false;
47419         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
47420         uint64_t ret_ref = 0;
47421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47423         return ret_ref;
47424 }
47425
47426 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
47427         LDKBlindedHop this_obj_conv;
47428         this_obj_conv.inner = untag_ptr(this_obj);
47429         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47431         BlindedHop_free(this_obj_conv);
47432 }
47433
47434 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
47435         LDKBlindedHop ret_var = BlindedHop_clone(arg);
47436         uint64_t ret_ref = 0;
47437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47439         return ret_ref;
47440 }
47441 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
47442         LDKBlindedHop arg_conv;
47443         arg_conv.inner = untag_ptr(arg);
47444         arg_conv.is_owned = ptr_is_owned(arg);
47445         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47446         arg_conv.is_owned = false;
47447         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
47448         return ret_conv;
47449 }
47450
47451 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
47452         LDKBlindedHop orig_conv;
47453         orig_conv.inner = untag_ptr(orig);
47454         orig_conv.is_owned = ptr_is_owned(orig);
47455         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47456         orig_conv.is_owned = false;
47457         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
47458         uint64_t ret_ref = 0;
47459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47461         return ret_ref;
47462 }
47463
47464 uint64_t  __attribute__((export_name("TS_BlindedPath_new"))) TS_BlindedPath_new(ptrArray node_pks, uint64_t entropy_source) {
47465         LDKCVec_PublicKeyZ node_pks_constr;
47466         node_pks_constr.datalen = node_pks->arr_len;
47467         if (node_pks_constr.datalen > 0)
47468                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
47469         else
47470                 node_pks_constr.data = NULL;
47471         int8_tArray* node_pks_vals = (void*) node_pks->elems;
47472         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
47473                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
47474                 LDKPublicKey node_pks_conv_12_ref;
47475                 CHECK(node_pks_conv_12->arr_len == 33);
47476                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
47477                 node_pks_constr.data[m] = node_pks_conv_12_ref;
47478         }
47479         FREE(node_pks);
47480         void* entropy_source_ptr = untag_ptr(entropy_source);
47481         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
47482         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
47483         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
47484         *ret_conv = BlindedPath_new(node_pks_constr, entropy_source_conv);
47485         return tag_ptr(ret_conv, true);
47486 }
47487
47488 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
47489         LDKBlindedPath obj_conv;
47490         obj_conv.inner = untag_ptr(obj);
47491         obj_conv.is_owned = ptr_is_owned(obj);
47492         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47493         obj_conv.is_owned = false;
47494         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
47495         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47496         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47497         CVec_u8Z_free(ret_var);
47498         return ret_arr;
47499 }
47500
47501 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
47502         LDKu8slice ser_ref;
47503         ser_ref.datalen = ser->arr_len;
47504         ser_ref.data = ser->elems;
47505         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
47506         *ret_conv = BlindedPath_read(ser_ref);
47507         FREE(ser);
47508         return tag_ptr(ret_conv, true);
47509 }
47510
47511 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
47512         LDKBlindedHop obj_conv;
47513         obj_conv.inner = untag_ptr(obj);
47514         obj_conv.is_owned = ptr_is_owned(obj);
47515         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47516         obj_conv.is_owned = false;
47517         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
47518         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47519         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47520         CVec_u8Z_free(ret_var);
47521         return ret_arr;
47522 }
47523
47524 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
47525         LDKu8slice ser_ref;
47526         ser_ref.datalen = ser->arr_len;
47527         ser_ref.data = ser->elems;
47528         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
47529         *ret_conv = BlindedHop_read(ser_ref);
47530         FREE(ser);
47531         return tag_ptr(ret_conv, true);
47532 }
47533
47534 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
47535         LDKOnionMessenger this_obj_conv;
47536         this_obj_conv.inner = untag_ptr(this_obj);
47537         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47539         OnionMessenger_free(this_obj_conv);
47540 }
47541
47542 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
47543         if (!ptr_is_owned(this_ptr)) return;
47544         void* this_ptr_ptr = untag_ptr(this_ptr);
47545         CHECK_ACCESS(this_ptr_ptr);
47546         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
47547         FREE(untag_ptr(this_ptr));
47548         Destination_free(this_ptr_conv);
47549 }
47550
47551 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
47552         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
47553         *ret_copy = Destination_clone(arg);
47554         uint64_t ret_ref = tag_ptr(ret_copy, true);
47555         return ret_ref;
47556 }
47557 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
47558         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
47559         int64_t ret_conv = Destination_clone_ptr(arg_conv);
47560         return ret_conv;
47561 }
47562
47563 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
47564         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
47565         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
47566         *ret_copy = Destination_clone(orig_conv);
47567         uint64_t ret_ref = tag_ptr(ret_copy, true);
47568         return ret_ref;
47569 }
47570
47571 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
47572         LDKPublicKey a_ref;
47573         CHECK(a->arr_len == 33);
47574         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
47575         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
47576         *ret_copy = Destination_node(a_ref);
47577         uint64_t ret_ref = tag_ptr(ret_copy, true);
47578         return ret_ref;
47579 }
47580
47581 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
47582         LDKBlindedPath a_conv;
47583         a_conv.inner = untag_ptr(a);
47584         a_conv.is_owned = ptr_is_owned(a);
47585         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47586         a_conv = BlindedPath_clone(&a_conv);
47587         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
47588         *ret_copy = Destination_blinded_path(a_conv);
47589         uint64_t ret_ref = tag_ptr(ret_copy, true);
47590         return ret_ref;
47591 }
47592
47593 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
47594         if (!ptr_is_owned(this_ptr)) return;
47595         void* this_ptr_ptr = untag_ptr(this_ptr);
47596         CHECK_ACCESS(this_ptr_ptr);
47597         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
47598         FREE(untag_ptr(this_ptr));
47599         SendError_free(this_ptr_conv);
47600 }
47601
47602 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
47603         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47604         *ret_copy = SendError_clone(arg);
47605         uint64_t ret_ref = tag_ptr(ret_copy, true);
47606         return ret_ref;
47607 }
47608 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
47609         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
47610         int64_t ret_conv = SendError_clone_ptr(arg_conv);
47611         return ret_conv;
47612 }
47613
47614 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
47615         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
47616         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47617         *ret_copy = SendError_clone(orig_conv);
47618         uint64_t ret_ref = tag_ptr(ret_copy, true);
47619         return ret_ref;
47620 }
47621
47622 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
47623         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
47624         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47625         *ret_copy = SendError_secp256k1(a_conv);
47626         uint64_t ret_ref = tag_ptr(ret_copy, true);
47627         return ret_ref;
47628 }
47629
47630 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
47631         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47632         *ret_copy = SendError_too_big_packet();
47633         uint64_t ret_ref = tag_ptr(ret_copy, true);
47634         return ret_ref;
47635 }
47636
47637 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
47638         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47639         *ret_copy = SendError_too_few_blinded_hops();
47640         uint64_t ret_ref = tag_ptr(ret_copy, true);
47641         return ret_ref;
47642 }
47643
47644 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
47645         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47646         *ret_copy = SendError_invalid_first_hop();
47647         uint64_t ret_ref = tag_ptr(ret_copy, true);
47648         return ret_ref;
47649 }
47650
47651 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
47652         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47653         *ret_copy = SendError_invalid_message();
47654         uint64_t ret_ref = tag_ptr(ret_copy, true);
47655         return ret_ref;
47656 }
47657
47658 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
47659         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47660         *ret_copy = SendError_buffer_full();
47661         uint64_t ret_ref = tag_ptr(ret_copy, true);
47662         return ret_ref;
47663 }
47664
47665 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
47666         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47667         *ret_copy = SendError_get_node_id_failed();
47668         uint64_t ret_ref = tag_ptr(ret_copy, true);
47669         return ret_ref;
47670 }
47671
47672 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
47673         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47674         *ret_copy = SendError_blinded_path_advance_failed();
47675         uint64_t ret_ref = tag_ptr(ret_copy, true);
47676         return ret_ref;
47677 }
47678
47679 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
47680         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
47681         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
47682         jboolean ret_conv = SendError_eq(a_conv, b_conv);
47683         return ret_conv;
47684 }
47685
47686 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
47687         if (!ptr_is_owned(this_ptr)) return;
47688         void* this_ptr_ptr = untag_ptr(this_ptr);
47689         CHECK_ACCESS(this_ptr_ptr);
47690         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
47691         FREE(untag_ptr(this_ptr));
47692         CustomOnionMessageHandler_free(this_ptr_conv);
47693 }
47694
47695 uint64_t  __attribute__((export_name("TS_OnionMessenger_new"))) TS_OnionMessenger_new(uint64_t entropy_source, uint64_t node_signer, uint64_t logger, uint64_t custom_handler) {
47696         void* entropy_source_ptr = untag_ptr(entropy_source);
47697         CHECK_ACCESS(entropy_source_ptr);
47698         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
47699         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
47700                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47701                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
47702         }
47703         void* node_signer_ptr = untag_ptr(node_signer);
47704         CHECK_ACCESS(node_signer_ptr);
47705         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
47706         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
47707                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47708                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
47709         }
47710         void* logger_ptr = untag_ptr(logger);
47711         CHECK_ACCESS(logger_ptr);
47712         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47713         if (logger_conv.free == LDKLogger_JCalls_free) {
47714                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47715                 LDKLogger_JCalls_cloned(&logger_conv);
47716         }
47717         void* custom_handler_ptr = untag_ptr(custom_handler);
47718         CHECK_ACCESS(custom_handler_ptr);
47719         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
47720         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
47721                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47722                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
47723         }
47724         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, custom_handler_conv);
47725         uint64_t ret_ref = 0;
47726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47728         return ret_ref;
47729 }
47730
47731 uint64_t  __attribute__((export_name("TS_OnionMessenger_send_onion_message"))) TS_OnionMessenger_send_onion_message(uint64_t this_arg, ptrArray intermediate_nodes, uint64_t destination, uint64_t message, uint64_t reply_path) {
47732         LDKOnionMessenger this_arg_conv;
47733         this_arg_conv.inner = untag_ptr(this_arg);
47734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47736         this_arg_conv.is_owned = false;
47737         LDKCVec_PublicKeyZ intermediate_nodes_constr;
47738         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
47739         if (intermediate_nodes_constr.datalen > 0)
47740                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
47741         else
47742                 intermediate_nodes_constr.data = NULL;
47743         int8_tArray* intermediate_nodes_vals = (void*) intermediate_nodes->elems;
47744         for (size_t m = 0; m < intermediate_nodes_constr.datalen; m++) {
47745                 int8_tArray intermediate_nodes_conv_12 = intermediate_nodes_vals[m];
47746                 LDKPublicKey intermediate_nodes_conv_12_ref;
47747                 CHECK(intermediate_nodes_conv_12->arr_len == 33);
47748                 memcpy(intermediate_nodes_conv_12_ref.compressed_form, intermediate_nodes_conv_12->elems, 33); FREE(intermediate_nodes_conv_12);
47749                 intermediate_nodes_constr.data[m] = intermediate_nodes_conv_12_ref;
47750         }
47751         FREE(intermediate_nodes);
47752         void* destination_ptr = untag_ptr(destination);
47753         CHECK_ACCESS(destination_ptr);
47754         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
47755         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
47756         void* message_ptr = untag_ptr(message);
47757         CHECK_ACCESS(message_ptr);
47758         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
47759         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
47760         LDKBlindedPath reply_path_conv;
47761         reply_path_conv.inner = untag_ptr(reply_path);
47762         reply_path_conv.is_owned = ptr_is_owned(reply_path);
47763         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
47764         reply_path_conv = BlindedPath_clone(&reply_path_conv);
47765         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
47766         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, intermediate_nodes_constr, destination_conv, message_conv, reply_path_conv);
47767         return tag_ptr(ret_conv, true);
47768 }
47769
47770 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
47771         LDKOnionMessenger this_arg_conv;
47772         this_arg_conv.inner = untag_ptr(this_arg);
47773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47775         this_arg_conv.is_owned = false;
47776         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
47777         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
47778         return tag_ptr(ret_ret, true);
47779 }
47780
47781 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageProvider"))) TS_OnionMessenger_as_OnionMessageProvider(uint64_t this_arg) {
47782         LDKOnionMessenger this_arg_conv;
47783         this_arg_conv.inner = untag_ptr(this_arg);
47784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47786         this_arg_conv.is_owned = false;
47787         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
47788         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
47789         return tag_ptr(ret_ret, true);
47790 }
47791
47792 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
47793         if (!ptr_is_owned(this_ptr)) return;
47794         void* this_ptr_ptr = untag_ptr(this_ptr);
47795         CHECK_ACCESS(this_ptr_ptr);
47796         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
47797         FREE(untag_ptr(this_ptr));
47798         OnionMessageContents_free(this_ptr_conv);
47799 }
47800
47801 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
47802         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
47803         *ret_copy = OnionMessageContents_clone(arg);
47804         uint64_t ret_ref = tag_ptr(ret_copy, true);
47805         return ret_ref;
47806 }
47807 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
47808         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg);
47809         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
47810         return ret_conv;
47811 }
47812
47813 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
47814         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig);
47815         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
47816         *ret_copy = OnionMessageContents_clone(orig_conv);
47817         uint64_t ret_ref = tag_ptr(ret_copy, true);
47818         return ret_ref;
47819 }
47820
47821 uint64_t  __attribute__((export_name("TS_OnionMessageContents_custom"))) TS_OnionMessageContents_custom(uint64_t a) {
47822         void* a_ptr = untag_ptr(a);
47823         CHECK_ACCESS(a_ptr);
47824         LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr);
47825         if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
47826                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47827                 LDKCustomOnionMessageContents_JCalls_cloned(&a_conv);
47828         }
47829         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
47830         *ret_copy = OnionMessageContents_custom(a_conv);
47831         uint64_t ret_ref = tag_ptr(ret_copy, true);
47832         return ret_ref;
47833 }
47834
47835 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
47836         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
47837         *ret_ret = CustomOnionMessageContents_clone(arg);
47838         return tag_ptr(ret_ret, true);
47839 }
47840 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone_ptr"))) TS_CustomOnionMessageContents_clone_ptr(uint64_t arg) {
47841         void* arg_ptr = untag_ptr(arg);
47842         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
47843         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
47844         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
47845         return ret_conv;
47846 }
47847
47848 uint64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone"))) TS_CustomOnionMessageContents_clone(uint64_t orig) {
47849         void* orig_ptr = untag_ptr(orig);
47850         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
47851         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
47852         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
47853         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
47854         return tag_ptr(ret_ret, true);
47855 }
47856
47857 void  __attribute__((export_name("TS_CustomOnionMessageContents_free"))) TS_CustomOnionMessageContents_free(uint64_t this_ptr) {
47858         if (!ptr_is_owned(this_ptr)) return;
47859         void* this_ptr_ptr = untag_ptr(this_ptr);
47860         CHECK_ACCESS(this_ptr_ptr);
47861         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
47862         FREE(untag_ptr(this_ptr));
47863         CustomOnionMessageContents_free(this_ptr_conv);
47864 }
47865
47866 void  __attribute__((export_name("TS_GossipSync_free"))) TS_GossipSync_free(uint64_t this_ptr) {
47867         if (!ptr_is_owned(this_ptr)) return;
47868         void* this_ptr_ptr = untag_ptr(this_ptr);
47869         CHECK_ACCESS(this_ptr_ptr);
47870         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
47871         FREE(untag_ptr(this_ptr));
47872         GossipSync_free(this_ptr_conv);
47873 }
47874
47875 uint64_t  __attribute__((export_name("TS_GossipSync_p2_p"))) TS_GossipSync_p2_p(uint64_t a) {
47876         LDKP2PGossipSync a_conv;
47877         a_conv.inner = untag_ptr(a);
47878         a_conv.is_owned = ptr_is_owned(a);
47879         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47880         a_conv.is_owned = false;
47881         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
47882         *ret_copy = GossipSync_p2_p(&a_conv);
47883         uint64_t ret_ref = tag_ptr(ret_copy, true);
47884         return ret_ref;
47885 }
47886
47887 uint64_t  __attribute__((export_name("TS_GossipSync_rapid"))) TS_GossipSync_rapid(uint64_t a) {
47888         LDKRapidGossipSync a_conv;
47889         a_conv.inner = untag_ptr(a);
47890         a_conv.is_owned = ptr_is_owned(a);
47891         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47892         a_conv.is_owned = false;
47893         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
47894         *ret_copy = GossipSync_rapid(&a_conv);
47895         uint64_t ret_ref = tag_ptr(ret_copy, true);
47896         return ret_ref;
47897 }
47898
47899 uint64_t  __attribute__((export_name("TS_GossipSync_none"))) TS_GossipSync_none() {
47900         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
47901         *ret_copy = GossipSync_none();
47902         uint64_t ret_ref = tag_ptr(ret_copy, true);
47903         return ret_ref;
47904 }
47905
47906 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
47907         LDKRapidGossipSync this_obj_conv;
47908         this_obj_conv.inner = untag_ptr(this_obj);
47909         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47911         RapidGossipSync_free(this_obj_conv);
47912 }
47913
47914 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph, uint64_t logger) {
47915         LDKNetworkGraph network_graph_conv;
47916         network_graph_conv.inner = untag_ptr(network_graph);
47917         network_graph_conv.is_owned = ptr_is_owned(network_graph);
47918         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
47919         network_graph_conv.is_owned = false;
47920         void* logger_ptr = untag_ptr(logger);
47921         CHECK_ACCESS(logger_ptr);
47922         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47923         if (logger_conv.free == LDKLogger_JCalls_free) {
47924                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47925                 LDKLogger_JCalls_cloned(&logger_conv);
47926         }
47927         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
47928         uint64_t ret_ref = 0;
47929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47931         return ret_ref;
47932 }
47933
47934 uint64_t  __attribute__((export_name("TS_RapidGossipSync_update_network_graph"))) TS_RapidGossipSync_update_network_graph(uint64_t this_arg, int8_tArray update_data) {
47935         LDKRapidGossipSync this_arg_conv;
47936         this_arg_conv.inner = untag_ptr(this_arg);
47937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47939         this_arg_conv.is_owned = false;
47940         LDKu8slice update_data_ref;
47941         update_data_ref.datalen = update_data->arr_len;
47942         update_data_ref.data = update_data->elems;
47943         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
47944         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
47945         FREE(update_data);
47946         return tag_ptr(ret_conv, true);
47947 }
47948
47949 uint64_t  __attribute__((export_name("TS_RapidGossipSync_update_network_graph_no_std"))) TS_RapidGossipSync_update_network_graph_no_std(uint64_t this_arg, int8_tArray update_data, uint64_t current_time_unix) {
47950         LDKRapidGossipSync this_arg_conv;
47951         this_arg_conv.inner = untag_ptr(this_arg);
47952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47954         this_arg_conv.is_owned = false;
47955         LDKu8slice update_data_ref;
47956         update_data_ref.datalen = update_data->arr_len;
47957         update_data_ref.data = update_data->elems;
47958         void* current_time_unix_ptr = untag_ptr(current_time_unix);
47959         CHECK_ACCESS(current_time_unix_ptr);
47960         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
47961         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
47962         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
47963         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
47964         FREE(update_data);
47965         return tag_ptr(ret_conv, true);
47966 }
47967
47968 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
47969         LDKRapidGossipSync this_arg_conv;
47970         this_arg_conv.inner = untag_ptr(this_arg);
47971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47973         this_arg_conv.is_owned = false;
47974         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
47975         return ret_conv;
47976 }
47977
47978 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
47979         if (!ptr_is_owned(this_ptr)) return;
47980         void* this_ptr_ptr = untag_ptr(this_ptr);
47981         CHECK_ACCESS(this_ptr_ptr);
47982         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
47983         FREE(untag_ptr(this_ptr));
47984         GraphSyncError_free(this_ptr_conv);
47985 }
47986
47987 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
47988         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
47989         *ret_copy = GraphSyncError_clone(arg);
47990         uint64_t ret_ref = tag_ptr(ret_copy, true);
47991         return ret_ref;
47992 }
47993 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
47994         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
47995         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
47996         return ret_conv;
47997 }
47998
47999 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
48000         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
48001         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48002         *ret_copy = GraphSyncError_clone(orig_conv);
48003         uint64_t ret_ref = tag_ptr(ret_copy, true);
48004         return ret_ref;
48005 }
48006
48007 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
48008         void* a_ptr = untag_ptr(a);
48009         CHECK_ACCESS(a_ptr);
48010         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
48011         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
48012         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48013         *ret_copy = GraphSyncError_decode_error(a_conv);
48014         uint64_t ret_ref = tag_ptr(ret_copy, true);
48015         return ret_ref;
48016 }
48017
48018 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
48019         LDKLightningError a_conv;
48020         a_conv.inner = untag_ptr(a);
48021         a_conv.is_owned = ptr_is_owned(a);
48022         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48023         a_conv = LightningError_clone(&a_conv);
48024         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48025         *ret_copy = GraphSyncError_lightning_error(a_conv);
48026         uint64_t ret_ref = tag_ptr(ret_copy, true);
48027         return ret_ref;
48028 }
48029
48030 void  __attribute__((export_name("TS_ParseError_free"))) TS_ParseError_free(uint64_t this_ptr) {
48031         if (!ptr_is_owned(this_ptr)) return;
48032         void* this_ptr_ptr = untag_ptr(this_ptr);
48033         CHECK_ACCESS(this_ptr_ptr);
48034         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
48035         FREE(untag_ptr(this_ptr));
48036         ParseError_free(this_ptr_conv);
48037 }
48038
48039 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
48040         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48041         *ret_copy = ParseError_clone(arg);
48042         uint64_t ret_ref = tag_ptr(ret_copy, true);
48043         return ret_ref;
48044 }
48045 int64_t  __attribute__((export_name("TS_ParseError_clone_ptr"))) TS_ParseError_clone_ptr(uint64_t arg) {
48046         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
48047         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
48048         return ret_conv;
48049 }
48050
48051 uint64_t  __attribute__((export_name("TS_ParseError_clone"))) TS_ParseError_clone(uint64_t orig) {
48052         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
48053         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48054         *ret_copy = ParseError_clone(orig_conv);
48055         uint64_t ret_ref = tag_ptr(ret_copy, true);
48056         return ret_ref;
48057 }
48058
48059 uint64_t  __attribute__((export_name("TS_ParseError_bech32_error"))) TS_ParseError_bech32_error(uint64_t a) {
48060         void* a_ptr = untag_ptr(a);
48061         CHECK_ACCESS(a_ptr);
48062         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
48063         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
48064         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48065         *ret_copy = ParseError_bech32_error(a_conv);
48066         uint64_t ret_ref = tag_ptr(ret_copy, true);
48067         return ret_ref;
48068 }
48069
48070 uint64_t  __attribute__((export_name("TS_ParseError_parse_amount_error"))) TS_ParseError_parse_amount_error(int32_t a) {
48071         
48072         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48073         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
48074         uint64_t ret_ref = tag_ptr(ret_copy, true);
48075         return ret_ref;
48076 }
48077
48078 uint64_t  __attribute__((export_name("TS_ParseError_malformed_signature"))) TS_ParseError_malformed_signature(uint32_t a) {
48079         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
48080         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48081         *ret_copy = ParseError_malformed_signature(a_conv);
48082         uint64_t ret_ref = tag_ptr(ret_copy, true);
48083         return ret_ref;
48084 }
48085
48086 uint64_t  __attribute__((export_name("TS_ParseError_bad_prefix"))) TS_ParseError_bad_prefix() {
48087         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48088         *ret_copy = ParseError_bad_prefix();
48089         uint64_t ret_ref = tag_ptr(ret_copy, true);
48090         return ret_ref;
48091 }
48092
48093 uint64_t  __attribute__((export_name("TS_ParseError_unknown_currency"))) TS_ParseError_unknown_currency() {
48094         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48095         *ret_copy = ParseError_unknown_currency();
48096         uint64_t ret_ref = tag_ptr(ret_copy, true);
48097         return ret_ref;
48098 }
48099
48100 uint64_t  __attribute__((export_name("TS_ParseError_unknown_si_prefix"))) TS_ParseError_unknown_si_prefix() {
48101         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48102         *ret_copy = ParseError_unknown_si_prefix();
48103         uint64_t ret_ref = tag_ptr(ret_copy, true);
48104         return ret_ref;
48105 }
48106
48107 uint64_t  __attribute__((export_name("TS_ParseError_malformed_hrp"))) TS_ParseError_malformed_hrp() {
48108         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48109         *ret_copy = ParseError_malformed_hrp();
48110         uint64_t ret_ref = tag_ptr(ret_copy, true);
48111         return ret_ref;
48112 }
48113
48114 uint64_t  __attribute__((export_name("TS_ParseError_too_short_data_part"))) TS_ParseError_too_short_data_part() {
48115         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48116         *ret_copy = ParseError_too_short_data_part();
48117         uint64_t ret_ref = tag_ptr(ret_copy, true);
48118         return ret_ref;
48119 }
48120
48121 uint64_t  __attribute__((export_name("TS_ParseError_unexpected_end_of_tagged_fields"))) TS_ParseError_unexpected_end_of_tagged_fields() {
48122         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48123         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
48124         uint64_t ret_ref = tag_ptr(ret_copy, true);
48125         return ret_ref;
48126 }
48127
48128 uint64_t  __attribute__((export_name("TS_ParseError_description_decode_error"))) TS_ParseError_description_decode_error(int32_t a) {
48129         
48130         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48131         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
48132         uint64_t ret_ref = tag_ptr(ret_copy, true);
48133         return ret_ref;
48134 }
48135
48136 uint64_t  __attribute__((export_name("TS_ParseError_padding_error"))) TS_ParseError_padding_error() {
48137         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48138         *ret_copy = ParseError_padding_error();
48139         uint64_t ret_ref = tag_ptr(ret_copy, true);
48140         return ret_ref;
48141 }
48142
48143 uint64_t  __attribute__((export_name("TS_ParseError_integer_overflow_error"))) TS_ParseError_integer_overflow_error() {
48144         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48145         *ret_copy = ParseError_integer_overflow_error();
48146         uint64_t ret_ref = tag_ptr(ret_copy, true);
48147         return ret_ref;
48148 }
48149
48150 uint64_t  __attribute__((export_name("TS_ParseError_invalid_seg_wit_program_length"))) TS_ParseError_invalid_seg_wit_program_length() {
48151         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48152         *ret_copy = ParseError_invalid_seg_wit_program_length();
48153         uint64_t ret_ref = tag_ptr(ret_copy, true);
48154         return ret_ref;
48155 }
48156
48157 uint64_t  __attribute__((export_name("TS_ParseError_invalid_pub_key_hash_length"))) TS_ParseError_invalid_pub_key_hash_length() {
48158         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48159         *ret_copy = ParseError_invalid_pub_key_hash_length();
48160         uint64_t ret_ref = tag_ptr(ret_copy, true);
48161         return ret_ref;
48162 }
48163
48164 uint64_t  __attribute__((export_name("TS_ParseError_invalid_script_hash_length"))) TS_ParseError_invalid_script_hash_length() {
48165         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48166         *ret_copy = ParseError_invalid_script_hash_length();
48167         uint64_t ret_ref = tag_ptr(ret_copy, true);
48168         return ret_ref;
48169 }
48170
48171 uint64_t  __attribute__((export_name("TS_ParseError_invalid_recovery_id"))) TS_ParseError_invalid_recovery_id() {
48172         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48173         *ret_copy = ParseError_invalid_recovery_id();
48174         uint64_t ret_ref = tag_ptr(ret_copy, true);
48175         return ret_ref;
48176 }
48177
48178 uint64_t  __attribute__((export_name("TS_ParseError_invalid_slice_length"))) TS_ParseError_invalid_slice_length(jstring a) {
48179         LDKStr a_conv = str_ref_to_owned_c(a);
48180         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48181         *ret_copy = ParseError_invalid_slice_length(a_conv);
48182         uint64_t ret_ref = tag_ptr(ret_copy, true);
48183         return ret_ref;
48184 }
48185
48186 uint64_t  __attribute__((export_name("TS_ParseError_skip"))) TS_ParseError_skip() {
48187         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48188         *ret_copy = ParseError_skip();
48189         uint64_t ret_ref = tag_ptr(ret_copy, true);
48190         return ret_ref;
48191 }
48192
48193 jboolean  __attribute__((export_name("TS_ParseError_eq"))) TS_ParseError_eq(uint64_t a, uint64_t b) {
48194         LDKParseError* a_conv = (LDKParseError*)untag_ptr(a);
48195         LDKParseError* b_conv = (LDKParseError*)untag_ptr(b);
48196         jboolean ret_conv = ParseError_eq(a_conv, b_conv);
48197         return ret_conv;
48198 }
48199
48200 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
48201         if (!ptr_is_owned(this_ptr)) return;
48202         void* this_ptr_ptr = untag_ptr(this_ptr);
48203         CHECK_ACCESS(this_ptr_ptr);
48204         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
48205         FREE(untag_ptr(this_ptr));
48206         ParseOrSemanticError_free(this_ptr_conv);
48207 }
48208
48209 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
48210         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
48211         *ret_copy = ParseOrSemanticError_clone(arg);
48212         uint64_t ret_ref = tag_ptr(ret_copy, true);
48213         return ret_ref;
48214 }
48215 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
48216         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
48217         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
48218         return ret_conv;
48219 }
48220
48221 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
48222         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
48223         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
48224         *ret_copy = ParseOrSemanticError_clone(orig_conv);
48225         uint64_t ret_ref = tag_ptr(ret_copy, true);
48226         return ret_ref;
48227 }
48228
48229 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
48230         void* a_ptr = untag_ptr(a);
48231         CHECK_ACCESS(a_ptr);
48232         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
48233         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
48234         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
48235         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
48236         uint64_t ret_ref = tag_ptr(ret_copy, true);
48237         return ret_ref;
48238 }
48239
48240 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
48241         LDKSemanticError a_conv = LDKSemanticError_from_js(a);
48242         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
48243         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
48244         uint64_t ret_ref = tag_ptr(ret_copy, true);
48245         return ret_ref;
48246 }
48247
48248 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
48249         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
48250         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
48251         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
48252         return ret_conv;
48253 }
48254
48255 void  __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint64_t this_obj) {
48256         LDKInvoice this_obj_conv;
48257         this_obj_conv.inner = untag_ptr(this_obj);
48258         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48260         Invoice_free(this_obj_conv);
48261 }
48262
48263 jboolean  __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint64_t a, uint64_t b) {
48264         LDKInvoice a_conv;
48265         a_conv.inner = untag_ptr(a);
48266         a_conv.is_owned = ptr_is_owned(a);
48267         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48268         a_conv.is_owned = false;
48269         LDKInvoice b_conv;
48270         b_conv.inner = untag_ptr(b);
48271         b_conv.is_owned = ptr_is_owned(b);
48272         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48273         b_conv.is_owned = false;
48274         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
48275         return ret_conv;
48276 }
48277
48278 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
48279         LDKInvoice ret_var = Invoice_clone(arg);
48280         uint64_t ret_ref = 0;
48281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48283         return ret_ref;
48284 }
48285 int64_t  __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint64_t arg) {
48286         LDKInvoice arg_conv;
48287         arg_conv.inner = untag_ptr(arg);
48288         arg_conv.is_owned = ptr_is_owned(arg);
48289         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48290         arg_conv.is_owned = false;
48291         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
48292         return ret_conv;
48293 }
48294
48295 uint64_t  __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint64_t orig) {
48296         LDKInvoice orig_conv;
48297         orig_conv.inner = untag_ptr(orig);
48298         orig_conv.is_owned = ptr_is_owned(orig);
48299         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48300         orig_conv.is_owned = false;
48301         LDKInvoice ret_var = Invoice_clone(&orig_conv);
48302         uint64_t ret_ref = 0;
48303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48305         return ret_ref;
48306 }
48307
48308 int64_t  __attribute__((export_name("TS_Invoice_hash"))) TS_Invoice_hash(uint64_t o) {
48309         LDKInvoice o_conv;
48310         o_conv.inner = untag_ptr(o);
48311         o_conv.is_owned = ptr_is_owned(o);
48312         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48313         o_conv.is_owned = false;
48314         int64_t ret_conv = Invoice_hash(&o_conv);
48315         return ret_conv;
48316 }
48317
48318 void  __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint64_t this_obj) {
48319         LDKSignedRawInvoice this_obj_conv;
48320         this_obj_conv.inner = untag_ptr(this_obj);
48321         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48323         SignedRawInvoice_free(this_obj_conv);
48324 }
48325
48326 jboolean  __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint64_t a, uint64_t b) {
48327         LDKSignedRawInvoice a_conv;
48328         a_conv.inner = untag_ptr(a);
48329         a_conv.is_owned = ptr_is_owned(a);
48330         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48331         a_conv.is_owned = false;
48332         LDKSignedRawInvoice b_conv;
48333         b_conv.inner = untag_ptr(b);
48334         b_conv.is_owned = ptr_is_owned(b);
48335         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48336         b_conv.is_owned = false;
48337         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
48338         return ret_conv;
48339 }
48340
48341 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
48342         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
48343         uint64_t ret_ref = 0;
48344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48346         return ret_ref;
48347 }
48348 int64_t  __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint64_t arg) {
48349         LDKSignedRawInvoice arg_conv;
48350         arg_conv.inner = untag_ptr(arg);
48351         arg_conv.is_owned = ptr_is_owned(arg);
48352         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48353         arg_conv.is_owned = false;
48354         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
48355         return ret_conv;
48356 }
48357
48358 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint64_t orig) {
48359         LDKSignedRawInvoice orig_conv;
48360         orig_conv.inner = untag_ptr(orig);
48361         orig_conv.is_owned = ptr_is_owned(orig);
48362         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48363         orig_conv.is_owned = false;
48364         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
48365         uint64_t ret_ref = 0;
48366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48368         return ret_ref;
48369 }
48370
48371 int64_t  __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint64_t o) {
48372         LDKSignedRawInvoice o_conv;
48373         o_conv.inner = untag_ptr(o);
48374         o_conv.is_owned = ptr_is_owned(o);
48375         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48376         o_conv.is_owned = false;
48377         int64_t ret_conv = SignedRawInvoice_hash(&o_conv);
48378         return ret_conv;
48379 }
48380
48381 void  __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint64_t this_obj) {
48382         LDKRawInvoice this_obj_conv;
48383         this_obj_conv.inner = untag_ptr(this_obj);
48384         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48386         RawInvoice_free(this_obj_conv);
48387 }
48388
48389 uint64_t  __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint64_t this_ptr) {
48390         LDKRawInvoice this_ptr_conv;
48391         this_ptr_conv.inner = untag_ptr(this_ptr);
48392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48394         this_ptr_conv.is_owned = false;
48395         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
48396         uint64_t ret_ref = 0;
48397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48399         return ret_ref;
48400 }
48401
48402 void  __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint64_t this_ptr, uint64_t val) {
48403         LDKRawInvoice this_ptr_conv;
48404         this_ptr_conv.inner = untag_ptr(this_ptr);
48405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48407         this_ptr_conv.is_owned = false;
48408         LDKRawDataPart val_conv;
48409         val_conv.inner = untag_ptr(val);
48410         val_conv.is_owned = ptr_is_owned(val);
48411         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48412         val_conv = RawDataPart_clone(&val_conv);
48413         RawInvoice_set_data(&this_ptr_conv, val_conv);
48414 }
48415
48416 jboolean  __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint64_t a, uint64_t b) {
48417         LDKRawInvoice a_conv;
48418         a_conv.inner = untag_ptr(a);
48419         a_conv.is_owned = ptr_is_owned(a);
48420         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48421         a_conv.is_owned = false;
48422         LDKRawInvoice b_conv;
48423         b_conv.inner = untag_ptr(b);
48424         b_conv.is_owned = ptr_is_owned(b);
48425         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48426         b_conv.is_owned = false;
48427         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
48428         return ret_conv;
48429 }
48430
48431 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
48432         LDKRawInvoice ret_var = RawInvoice_clone(arg);
48433         uint64_t ret_ref = 0;
48434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48436         return ret_ref;
48437 }
48438 int64_t  __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint64_t arg) {
48439         LDKRawInvoice arg_conv;
48440         arg_conv.inner = untag_ptr(arg);
48441         arg_conv.is_owned = ptr_is_owned(arg);
48442         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48443         arg_conv.is_owned = false;
48444         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
48445         return ret_conv;
48446 }
48447
48448 uint64_t  __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint64_t orig) {
48449         LDKRawInvoice orig_conv;
48450         orig_conv.inner = untag_ptr(orig);
48451         orig_conv.is_owned = ptr_is_owned(orig);
48452         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48453         orig_conv.is_owned = false;
48454         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
48455         uint64_t ret_ref = 0;
48456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48458         return ret_ref;
48459 }
48460
48461 int64_t  __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint64_t o) {
48462         LDKRawInvoice o_conv;
48463         o_conv.inner = untag_ptr(o);
48464         o_conv.is_owned = ptr_is_owned(o);
48465         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48466         o_conv.is_owned = false;
48467         int64_t ret_conv = RawInvoice_hash(&o_conv);
48468         return ret_conv;
48469 }
48470
48471 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
48472         LDKRawDataPart this_obj_conv;
48473         this_obj_conv.inner = untag_ptr(this_obj);
48474         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48476         RawDataPart_free(this_obj_conv);
48477 }
48478
48479 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
48480         LDKRawDataPart this_ptr_conv;
48481         this_ptr_conv.inner = untag_ptr(this_ptr);
48482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48484         this_ptr_conv.is_owned = false;
48485         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
48486         uint64_t ret_ref = 0;
48487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48489         return ret_ref;
48490 }
48491
48492 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
48493         LDKRawDataPart this_ptr_conv;
48494         this_ptr_conv.inner = untag_ptr(this_ptr);
48495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48497         this_ptr_conv.is_owned = false;
48498         LDKPositiveTimestamp val_conv;
48499         val_conv.inner = untag_ptr(val);
48500         val_conv.is_owned = ptr_is_owned(val);
48501         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48502         val_conv = PositiveTimestamp_clone(&val_conv);
48503         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
48504 }
48505
48506 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
48507         LDKRawDataPart a_conv;
48508         a_conv.inner = untag_ptr(a);
48509         a_conv.is_owned = ptr_is_owned(a);
48510         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48511         a_conv.is_owned = false;
48512         LDKRawDataPart b_conv;
48513         b_conv.inner = untag_ptr(b);
48514         b_conv.is_owned = ptr_is_owned(b);
48515         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48516         b_conv.is_owned = false;
48517         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
48518         return ret_conv;
48519 }
48520
48521 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
48522         LDKRawDataPart ret_var = RawDataPart_clone(arg);
48523         uint64_t ret_ref = 0;
48524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48526         return ret_ref;
48527 }
48528 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
48529         LDKRawDataPart arg_conv;
48530         arg_conv.inner = untag_ptr(arg);
48531         arg_conv.is_owned = ptr_is_owned(arg);
48532         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48533         arg_conv.is_owned = false;
48534         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
48535         return ret_conv;
48536 }
48537
48538 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
48539         LDKRawDataPart orig_conv;
48540         orig_conv.inner = untag_ptr(orig);
48541         orig_conv.is_owned = ptr_is_owned(orig);
48542         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48543         orig_conv.is_owned = false;
48544         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
48545         uint64_t ret_ref = 0;
48546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48548         return ret_ref;
48549 }
48550
48551 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
48552         LDKRawDataPart o_conv;
48553         o_conv.inner = untag_ptr(o);
48554         o_conv.is_owned = ptr_is_owned(o);
48555         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48556         o_conv.is_owned = false;
48557         int64_t ret_conv = RawDataPart_hash(&o_conv);
48558         return ret_conv;
48559 }
48560
48561 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
48562         LDKPositiveTimestamp this_obj_conv;
48563         this_obj_conv.inner = untag_ptr(this_obj);
48564         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48566         PositiveTimestamp_free(this_obj_conv);
48567 }
48568
48569 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
48570         LDKPositiveTimestamp a_conv;
48571         a_conv.inner = untag_ptr(a);
48572         a_conv.is_owned = ptr_is_owned(a);
48573         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48574         a_conv.is_owned = false;
48575         LDKPositiveTimestamp b_conv;
48576         b_conv.inner = untag_ptr(b);
48577         b_conv.is_owned = ptr_is_owned(b);
48578         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48579         b_conv.is_owned = false;
48580         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
48581         return ret_conv;
48582 }
48583
48584 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
48585         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
48586         uint64_t ret_ref = 0;
48587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48589         return ret_ref;
48590 }
48591 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
48592         LDKPositiveTimestamp arg_conv;
48593         arg_conv.inner = untag_ptr(arg);
48594         arg_conv.is_owned = ptr_is_owned(arg);
48595         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48596         arg_conv.is_owned = false;
48597         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
48598         return ret_conv;
48599 }
48600
48601 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
48602         LDKPositiveTimestamp orig_conv;
48603         orig_conv.inner = untag_ptr(orig);
48604         orig_conv.is_owned = ptr_is_owned(orig);
48605         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48606         orig_conv.is_owned = false;
48607         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
48608         uint64_t ret_ref = 0;
48609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48611         return ret_ref;
48612 }
48613
48614 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
48615         LDKPositiveTimestamp o_conv;
48616         o_conv.inner = untag_ptr(o);
48617         o_conv.is_owned = ptr_is_owned(o);
48618         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48619         o_conv.is_owned = false;
48620         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
48621         return ret_conv;
48622 }
48623
48624 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
48625         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
48626         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
48627         return ret_conv;
48628 }
48629
48630 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
48631         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
48632         return ret_conv;
48633 }
48634
48635 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
48636         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
48637         return ret_conv;
48638 }
48639
48640 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
48641         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
48642         return ret_conv;
48643 }
48644
48645 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
48646         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
48647         return ret_conv;
48648 }
48649
48650 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
48651         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
48652         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
48653         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
48654         return ret_conv;
48655 }
48656
48657 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
48658         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
48659         int64_t ret_conv = SiPrefix_hash(o_conv);
48660         return ret_conv;
48661 }
48662
48663 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
48664         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
48665         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
48666         return ret_conv;
48667 }
48668
48669 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
48670         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
48671         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
48672         return ret_conv;
48673 }
48674
48675 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
48676         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
48677         return ret_conv;
48678 }
48679
48680 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
48681         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
48682         return ret_conv;
48683 }
48684
48685 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
48686         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
48687         return ret_conv;
48688 }
48689
48690 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
48691         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
48692         return ret_conv;
48693 }
48694
48695 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
48696         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
48697         return ret_conv;
48698 }
48699
48700 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
48701         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
48702         int64_t ret_conv = Currency_hash(o_conv);
48703         return ret_conv;
48704 }
48705
48706 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
48707         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
48708         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
48709         jboolean ret_conv = Currency_eq(a_conv, b_conv);
48710         return ret_conv;
48711 }
48712
48713 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
48714         LDKSha256 this_obj_conv;
48715         this_obj_conv.inner = untag_ptr(this_obj);
48716         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48718         Sha256_free(this_obj_conv);
48719 }
48720
48721 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
48722         LDKSha256 ret_var = Sha256_clone(arg);
48723         uint64_t ret_ref = 0;
48724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48726         return ret_ref;
48727 }
48728 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
48729         LDKSha256 arg_conv;
48730         arg_conv.inner = untag_ptr(arg);
48731         arg_conv.is_owned = ptr_is_owned(arg);
48732         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48733         arg_conv.is_owned = false;
48734         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
48735         return ret_conv;
48736 }
48737
48738 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
48739         LDKSha256 orig_conv;
48740         orig_conv.inner = untag_ptr(orig);
48741         orig_conv.is_owned = ptr_is_owned(orig);
48742         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48743         orig_conv.is_owned = false;
48744         LDKSha256 ret_var = Sha256_clone(&orig_conv);
48745         uint64_t ret_ref = 0;
48746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48748         return ret_ref;
48749 }
48750
48751 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
48752         LDKSha256 o_conv;
48753         o_conv.inner = untag_ptr(o);
48754         o_conv.is_owned = ptr_is_owned(o);
48755         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48756         o_conv.is_owned = false;
48757         int64_t ret_conv = Sha256_hash(&o_conv);
48758         return ret_conv;
48759 }
48760
48761 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
48762         LDKSha256 a_conv;
48763         a_conv.inner = untag_ptr(a);
48764         a_conv.is_owned = ptr_is_owned(a);
48765         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48766         a_conv.is_owned = false;
48767         LDKSha256 b_conv;
48768         b_conv.inner = untag_ptr(b);
48769         b_conv.is_owned = ptr_is_owned(b);
48770         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48771         b_conv.is_owned = false;
48772         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
48773         return ret_conv;
48774 }
48775
48776 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
48777         LDKDescription this_obj_conv;
48778         this_obj_conv.inner = untag_ptr(this_obj);
48779         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48781         Description_free(this_obj_conv);
48782 }
48783
48784 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
48785         LDKDescription ret_var = Description_clone(arg);
48786         uint64_t ret_ref = 0;
48787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48789         return ret_ref;
48790 }
48791 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
48792         LDKDescription arg_conv;
48793         arg_conv.inner = untag_ptr(arg);
48794         arg_conv.is_owned = ptr_is_owned(arg);
48795         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48796         arg_conv.is_owned = false;
48797         int64_t ret_conv = Description_clone_ptr(&arg_conv);
48798         return ret_conv;
48799 }
48800
48801 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
48802         LDKDescription orig_conv;
48803         orig_conv.inner = untag_ptr(orig);
48804         orig_conv.is_owned = ptr_is_owned(orig);
48805         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48806         orig_conv.is_owned = false;
48807         LDKDescription ret_var = Description_clone(&orig_conv);
48808         uint64_t ret_ref = 0;
48809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48811         return ret_ref;
48812 }
48813
48814 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
48815         LDKDescription o_conv;
48816         o_conv.inner = untag_ptr(o);
48817         o_conv.is_owned = ptr_is_owned(o);
48818         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48819         o_conv.is_owned = false;
48820         int64_t ret_conv = Description_hash(&o_conv);
48821         return ret_conv;
48822 }
48823
48824 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
48825         LDKDescription a_conv;
48826         a_conv.inner = untag_ptr(a);
48827         a_conv.is_owned = ptr_is_owned(a);
48828         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48829         a_conv.is_owned = false;
48830         LDKDescription b_conv;
48831         b_conv.inner = untag_ptr(b);
48832         b_conv.is_owned = ptr_is_owned(b);
48833         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48834         b_conv.is_owned = false;
48835         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
48836         return ret_conv;
48837 }
48838
48839 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
48840         LDKPayeePubKey this_obj_conv;
48841         this_obj_conv.inner = untag_ptr(this_obj);
48842         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48844         PayeePubKey_free(this_obj_conv);
48845 }
48846
48847 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
48848         LDKPayeePubKey this_ptr_conv;
48849         this_ptr_conv.inner = untag_ptr(this_ptr);
48850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48852         this_ptr_conv.is_owned = false;
48853         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
48854         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
48855         return ret_arr;
48856 }
48857
48858 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
48859         LDKPayeePubKey this_ptr_conv;
48860         this_ptr_conv.inner = untag_ptr(this_ptr);
48861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48863         this_ptr_conv.is_owned = false;
48864         LDKPublicKey val_ref;
48865         CHECK(val->arr_len == 33);
48866         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
48867         PayeePubKey_set_a(&this_ptr_conv, val_ref);
48868 }
48869
48870 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
48871         LDKPublicKey a_arg_ref;
48872         CHECK(a_arg->arr_len == 33);
48873         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
48874         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
48875         uint64_t ret_ref = 0;
48876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48878         return ret_ref;
48879 }
48880
48881 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
48882         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
48883         uint64_t ret_ref = 0;
48884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48886         return ret_ref;
48887 }
48888 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
48889         LDKPayeePubKey arg_conv;
48890         arg_conv.inner = untag_ptr(arg);
48891         arg_conv.is_owned = ptr_is_owned(arg);
48892         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48893         arg_conv.is_owned = false;
48894         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
48895         return ret_conv;
48896 }
48897
48898 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
48899         LDKPayeePubKey orig_conv;
48900         orig_conv.inner = untag_ptr(orig);
48901         orig_conv.is_owned = ptr_is_owned(orig);
48902         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48903         orig_conv.is_owned = false;
48904         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
48905         uint64_t ret_ref = 0;
48906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48908         return ret_ref;
48909 }
48910
48911 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
48912         LDKPayeePubKey o_conv;
48913         o_conv.inner = untag_ptr(o);
48914         o_conv.is_owned = ptr_is_owned(o);
48915         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48916         o_conv.is_owned = false;
48917         int64_t ret_conv = PayeePubKey_hash(&o_conv);
48918         return ret_conv;
48919 }
48920
48921 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
48922         LDKPayeePubKey a_conv;
48923         a_conv.inner = untag_ptr(a);
48924         a_conv.is_owned = ptr_is_owned(a);
48925         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48926         a_conv.is_owned = false;
48927         LDKPayeePubKey b_conv;
48928         b_conv.inner = untag_ptr(b);
48929         b_conv.is_owned = ptr_is_owned(b);
48930         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48931         b_conv.is_owned = false;
48932         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
48933         return ret_conv;
48934 }
48935
48936 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
48937         LDKExpiryTime this_obj_conv;
48938         this_obj_conv.inner = untag_ptr(this_obj);
48939         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48941         ExpiryTime_free(this_obj_conv);
48942 }
48943
48944 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
48945         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
48946         uint64_t ret_ref = 0;
48947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48949         return ret_ref;
48950 }
48951 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
48952         LDKExpiryTime arg_conv;
48953         arg_conv.inner = untag_ptr(arg);
48954         arg_conv.is_owned = ptr_is_owned(arg);
48955         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48956         arg_conv.is_owned = false;
48957         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
48958         return ret_conv;
48959 }
48960
48961 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
48962         LDKExpiryTime orig_conv;
48963         orig_conv.inner = untag_ptr(orig);
48964         orig_conv.is_owned = ptr_is_owned(orig);
48965         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48966         orig_conv.is_owned = false;
48967         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
48968         uint64_t ret_ref = 0;
48969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48971         return ret_ref;
48972 }
48973
48974 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
48975         LDKExpiryTime o_conv;
48976         o_conv.inner = untag_ptr(o);
48977         o_conv.is_owned = ptr_is_owned(o);
48978         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48979         o_conv.is_owned = false;
48980         int64_t ret_conv = ExpiryTime_hash(&o_conv);
48981         return ret_conv;
48982 }
48983
48984 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
48985         LDKExpiryTime a_conv;
48986         a_conv.inner = untag_ptr(a);
48987         a_conv.is_owned = ptr_is_owned(a);
48988         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48989         a_conv.is_owned = false;
48990         LDKExpiryTime b_conv;
48991         b_conv.inner = untag_ptr(b);
48992         b_conv.is_owned = ptr_is_owned(b);
48993         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48994         b_conv.is_owned = false;
48995         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
48996         return ret_conv;
48997 }
48998
48999 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_free"))) TS_MinFinalCltvExpiryDelta_free(uint64_t this_obj) {
49000         LDKMinFinalCltvExpiryDelta this_obj_conv;
49001         this_obj_conv.inner = untag_ptr(this_obj);
49002         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49004         MinFinalCltvExpiryDelta_free(this_obj_conv);
49005 }
49006
49007 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_get_a"))) TS_MinFinalCltvExpiryDelta_get_a(uint64_t this_ptr) {
49008         LDKMinFinalCltvExpiryDelta this_ptr_conv;
49009         this_ptr_conv.inner = untag_ptr(this_ptr);
49010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49012         this_ptr_conv.is_owned = false;
49013         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
49014         return ret_conv;
49015 }
49016
49017 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_set_a"))) TS_MinFinalCltvExpiryDelta_set_a(uint64_t this_ptr, int64_t val) {
49018         LDKMinFinalCltvExpiryDelta this_ptr_conv;
49019         this_ptr_conv.inner = untag_ptr(this_ptr);
49020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49022         this_ptr_conv.is_owned = false;
49023         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
49024 }
49025
49026 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_new"))) TS_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
49027         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
49028         uint64_t ret_ref = 0;
49029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49031         return ret_ref;
49032 }
49033
49034 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
49035         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
49036         uint64_t ret_ref = 0;
49037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49039         return ret_ref;
49040 }
49041 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone_ptr"))) TS_MinFinalCltvExpiryDelta_clone_ptr(uint64_t arg) {
49042         LDKMinFinalCltvExpiryDelta arg_conv;
49043         arg_conv.inner = untag_ptr(arg);
49044         arg_conv.is_owned = ptr_is_owned(arg);
49045         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49046         arg_conv.is_owned = false;
49047         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
49048         return ret_conv;
49049 }
49050
49051 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone"))) TS_MinFinalCltvExpiryDelta_clone(uint64_t orig) {
49052         LDKMinFinalCltvExpiryDelta orig_conv;
49053         orig_conv.inner = untag_ptr(orig);
49054         orig_conv.is_owned = ptr_is_owned(orig);
49055         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49056         orig_conv.is_owned = false;
49057         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
49058         uint64_t ret_ref = 0;
49059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49061         return ret_ref;
49062 }
49063
49064 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_hash"))) TS_MinFinalCltvExpiryDelta_hash(uint64_t o) {
49065         LDKMinFinalCltvExpiryDelta o_conv;
49066         o_conv.inner = untag_ptr(o);
49067         o_conv.is_owned = ptr_is_owned(o);
49068         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49069         o_conv.is_owned = false;
49070         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
49071         return ret_conv;
49072 }
49073
49074 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_eq"))) TS_MinFinalCltvExpiryDelta_eq(uint64_t a, uint64_t b) {
49075         LDKMinFinalCltvExpiryDelta a_conv;
49076         a_conv.inner = untag_ptr(a);
49077         a_conv.is_owned = ptr_is_owned(a);
49078         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49079         a_conv.is_owned = false;
49080         LDKMinFinalCltvExpiryDelta b_conv;
49081         b_conv.inner = untag_ptr(b);
49082         b_conv.is_owned = ptr_is_owned(b);
49083         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49084         b_conv.is_owned = false;
49085         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
49086         return ret_conv;
49087 }
49088
49089 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
49090         if (!ptr_is_owned(this_ptr)) return;
49091         void* this_ptr_ptr = untag_ptr(this_ptr);
49092         CHECK_ACCESS(this_ptr_ptr);
49093         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
49094         FREE(untag_ptr(this_ptr));
49095         Fallback_free(this_ptr_conv);
49096 }
49097
49098 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
49099         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
49100         *ret_copy = Fallback_clone(arg);
49101         uint64_t ret_ref = tag_ptr(ret_copy, true);
49102         return ret_ref;
49103 }
49104 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
49105         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
49106         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
49107         return ret_conv;
49108 }
49109
49110 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
49111         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
49112         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
49113         *ret_copy = Fallback_clone(orig_conv);
49114         uint64_t ret_ref = tag_ptr(ret_copy, true);
49115         return ret_ref;
49116 }
49117
49118 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
49119         
49120         LDKCVec_u8Z program_ref;
49121         program_ref.datalen = program->arr_len;
49122         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
49123         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
49124         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
49125         *ret_copy = Fallback_seg_wit_program((LDKU5){ ._0 = version }, program_ref);
49126         uint64_t ret_ref = tag_ptr(ret_copy, true);
49127         return ret_ref;
49128 }
49129
49130 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
49131         LDKTwentyBytes a_ref;
49132         CHECK(a->arr_len == 20);
49133         memcpy(a_ref.data, a->elems, 20); FREE(a);
49134         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
49135         *ret_copy = Fallback_pub_key_hash(a_ref);
49136         uint64_t ret_ref = tag_ptr(ret_copy, true);
49137         return ret_ref;
49138 }
49139
49140 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
49141         LDKTwentyBytes a_ref;
49142         CHECK(a->arr_len == 20);
49143         memcpy(a_ref.data, a->elems, 20); FREE(a);
49144         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
49145         *ret_copy = Fallback_script_hash(a_ref);
49146         uint64_t ret_ref = tag_ptr(ret_copy, true);
49147         return ret_ref;
49148 }
49149
49150 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
49151         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
49152         int64_t ret_conv = Fallback_hash(o_conv);
49153         return ret_conv;
49154 }
49155
49156 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
49157         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
49158         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
49159         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
49160         return ret_conv;
49161 }
49162
49163 void  __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint64_t this_obj) {
49164         LDKInvoiceSignature this_obj_conv;
49165         this_obj_conv.inner = untag_ptr(this_obj);
49166         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49168         InvoiceSignature_free(this_obj_conv);
49169 }
49170
49171 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
49172         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
49173         uint64_t ret_ref = 0;
49174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49176         return ret_ref;
49177 }
49178 int64_t  __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint64_t arg) {
49179         LDKInvoiceSignature arg_conv;
49180         arg_conv.inner = untag_ptr(arg);
49181         arg_conv.is_owned = ptr_is_owned(arg);
49182         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49183         arg_conv.is_owned = false;
49184         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
49185         return ret_conv;
49186 }
49187
49188 uint64_t  __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint64_t orig) {
49189         LDKInvoiceSignature orig_conv;
49190         orig_conv.inner = untag_ptr(orig);
49191         orig_conv.is_owned = ptr_is_owned(orig);
49192         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49193         orig_conv.is_owned = false;
49194         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
49195         uint64_t ret_ref = 0;
49196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49198         return ret_ref;
49199 }
49200
49201 int64_t  __attribute__((export_name("TS_InvoiceSignature_hash"))) TS_InvoiceSignature_hash(uint64_t o) {
49202         LDKInvoiceSignature o_conv;
49203         o_conv.inner = untag_ptr(o);
49204         o_conv.is_owned = ptr_is_owned(o);
49205         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49206         o_conv.is_owned = false;
49207         int64_t ret_conv = InvoiceSignature_hash(&o_conv);
49208         return ret_conv;
49209 }
49210
49211 jboolean  __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint64_t a, uint64_t b) {
49212         LDKInvoiceSignature a_conv;
49213         a_conv.inner = untag_ptr(a);
49214         a_conv.is_owned = ptr_is_owned(a);
49215         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49216         a_conv.is_owned = false;
49217         LDKInvoiceSignature b_conv;
49218         b_conv.inner = untag_ptr(b);
49219         b_conv.is_owned = ptr_is_owned(b);
49220         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49221         b_conv.is_owned = false;
49222         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
49223         return ret_conv;
49224 }
49225
49226 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
49227         LDKPrivateRoute this_obj_conv;
49228         this_obj_conv.inner = untag_ptr(this_obj);
49229         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49231         PrivateRoute_free(this_obj_conv);
49232 }
49233
49234 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
49235         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
49236         uint64_t ret_ref = 0;
49237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49239         return ret_ref;
49240 }
49241 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
49242         LDKPrivateRoute arg_conv;
49243         arg_conv.inner = untag_ptr(arg);
49244         arg_conv.is_owned = ptr_is_owned(arg);
49245         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49246         arg_conv.is_owned = false;
49247         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
49248         return ret_conv;
49249 }
49250
49251 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
49252         LDKPrivateRoute orig_conv;
49253         orig_conv.inner = untag_ptr(orig);
49254         orig_conv.is_owned = ptr_is_owned(orig);
49255         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49256         orig_conv.is_owned = false;
49257         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
49258         uint64_t ret_ref = 0;
49259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49261         return ret_ref;
49262 }
49263
49264 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
49265         LDKPrivateRoute o_conv;
49266         o_conv.inner = untag_ptr(o);
49267         o_conv.is_owned = ptr_is_owned(o);
49268         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49269         o_conv.is_owned = false;
49270         int64_t ret_conv = PrivateRoute_hash(&o_conv);
49271         return ret_conv;
49272 }
49273
49274 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
49275         LDKPrivateRoute a_conv;
49276         a_conv.inner = untag_ptr(a);
49277         a_conv.is_owned = ptr_is_owned(a);
49278         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49279         a_conv.is_owned = false;
49280         LDKPrivateRoute b_conv;
49281         b_conv.inner = untag_ptr(b);
49282         b_conv.is_owned = ptr_is_owned(b);
49283         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49284         b_conv.is_owned = false;
49285         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
49286         return ret_conv;
49287 }
49288
49289 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint64_t this_arg) {
49290         LDKSignedRawInvoice this_arg_conv;
49291         this_arg_conv.inner = untag_ptr(this_arg);
49292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49294         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
49295         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
49296         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
49297         return tag_ptr(ret_conv, true);
49298 }
49299
49300 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint64_t this_arg) {
49301         LDKSignedRawInvoice this_arg_conv;
49302         this_arg_conv.inner = untag_ptr(this_arg);
49303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49305         this_arg_conv.is_owned = false;
49306         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
49307         uint64_t ret_ref = 0;
49308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49310         return ret_ref;
49311 }
49312
49313 int8_tArray  __attribute__((export_name("TS_SignedRawInvoice_signable_hash"))) TS_SignedRawInvoice_signable_hash(uint64_t this_arg) {
49314         LDKSignedRawInvoice this_arg_conv;
49315         this_arg_conv.inner = untag_ptr(this_arg);
49316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49318         this_arg_conv.is_owned = false;
49319         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49320         memcpy(ret_arr->elems, *SignedRawInvoice_signable_hash(&this_arg_conv), 32);
49321         return ret_arr;
49322 }
49323
49324 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint64_t this_arg) {
49325         LDKSignedRawInvoice this_arg_conv;
49326         this_arg_conv.inner = untag_ptr(this_arg);
49327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49329         this_arg_conv.is_owned = false;
49330         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
49331         uint64_t ret_ref = 0;
49332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49334         return ret_ref;
49335 }
49336
49337 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint64_t this_arg) {
49338         LDKSignedRawInvoice this_arg_conv;
49339         this_arg_conv.inner = untag_ptr(this_arg);
49340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49342         this_arg_conv.is_owned = false;
49343         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
49344         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
49345         return tag_ptr(ret_conv, true);
49346 }
49347
49348 jboolean  __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint64_t this_arg) {
49349         LDKSignedRawInvoice this_arg_conv;
49350         this_arg_conv.inner = untag_ptr(this_arg);
49351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49353         this_arg_conv.is_owned = false;
49354         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
49355         return ret_conv;
49356 }
49357
49358 int8_tArray  __attribute__((export_name("TS_RawInvoice_signable_hash"))) TS_RawInvoice_signable_hash(uint64_t this_arg) {
49359         LDKRawInvoice this_arg_conv;
49360         this_arg_conv.inner = untag_ptr(this_arg);
49361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49363         this_arg_conv.is_owned = false;
49364         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49365         memcpy(ret_arr->elems, RawInvoice_signable_hash(&this_arg_conv).data, 32);
49366         return ret_arr;
49367 }
49368
49369 uint64_t  __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint64_t this_arg) {
49370         LDKRawInvoice this_arg_conv;
49371         this_arg_conv.inner = untag_ptr(this_arg);
49372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49374         this_arg_conv.is_owned = false;
49375         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
49376         uint64_t ret_ref = 0;
49377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49379         return ret_ref;
49380 }
49381
49382 uint64_t  __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint64_t this_arg) {
49383         LDKRawInvoice this_arg_conv;
49384         this_arg_conv.inner = untag_ptr(this_arg);
49385         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49387         this_arg_conv.is_owned = false;
49388         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
49389         uint64_t ret_ref = 0;
49390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49392         return ret_ref;
49393 }
49394
49395 uint64_t  __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint64_t this_arg) {
49396         LDKRawInvoice this_arg_conv;
49397         this_arg_conv.inner = untag_ptr(this_arg);
49398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49400         this_arg_conv.is_owned = false;
49401         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
49402         uint64_t ret_ref = 0;
49403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49405         return ret_ref;
49406 }
49407
49408 uint64_t  __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint64_t this_arg) {
49409         LDKRawInvoice this_arg_conv;
49410         this_arg_conv.inner = untag_ptr(this_arg);
49411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49413         this_arg_conv.is_owned = false;
49414         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
49415         uint64_t ret_ref = 0;
49416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49418         return ret_ref;
49419 }
49420
49421 uint64_t  __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint64_t this_arg) {
49422         LDKRawInvoice this_arg_conv;
49423         this_arg_conv.inner = untag_ptr(this_arg);
49424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49426         this_arg_conv.is_owned = false;
49427         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
49428         uint64_t ret_ref = 0;
49429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49431         return ret_ref;
49432 }
49433
49434 uint64_t  __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry_delta"))) TS_RawInvoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
49435         LDKRawInvoice this_arg_conv;
49436         this_arg_conv.inner = untag_ptr(this_arg);
49437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49439         this_arg_conv.is_owned = false;
49440         LDKMinFinalCltvExpiryDelta ret_var = RawInvoice_min_final_cltv_expiry_delta(&this_arg_conv);
49441         uint64_t ret_ref = 0;
49442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49444         return ret_ref;
49445 }
49446
49447 int8_tArray  __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint64_t this_arg) {
49448         LDKRawInvoice this_arg_conv;
49449         this_arg_conv.inner = untag_ptr(this_arg);
49450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49452         this_arg_conv.is_owned = false;
49453         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49454         memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
49455         return ret_arr;
49456 }
49457
49458 uint64_t  __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint64_t this_arg) {
49459         LDKRawInvoice this_arg_conv;
49460         this_arg_conv.inner = untag_ptr(this_arg);
49461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49463         this_arg_conv.is_owned = false;
49464         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
49465         uint64_t ret_ref = 0;
49466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49468         return ret_ref;
49469 }
49470
49471 uint64_tArray  __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint64_t this_arg) {
49472         LDKRawInvoice this_arg_conv;
49473         this_arg_conv.inner = untag_ptr(this_arg);
49474         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49476         this_arg_conv.is_owned = false;
49477         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
49478         uint64_tArray ret_arr = NULL;
49479         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
49480         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
49481         for (size_t o = 0; o < ret_var.datalen; o++) {
49482                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
49483                 uint64_t ret_conv_14_ref = 0;
49484                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
49485                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
49486                 ret_arr_ptr[o] = ret_conv_14_ref;
49487         }
49488         
49489         FREE(ret_var.data);
49490         return ret_arr;
49491 }
49492
49493 uint64_t  __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint64_t this_arg) {
49494         LDKRawInvoice this_arg_conv;
49495         this_arg_conv.inner = untag_ptr(this_arg);
49496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49498         this_arg_conv.is_owned = false;
49499         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
49500         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
49501         uint64_t ret_ref = tag_ptr(ret_copy, true);
49502         return ret_ref;
49503 }
49504
49505 uint32_t  __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint64_t this_arg) {
49506         LDKRawInvoice this_arg_conv;
49507         this_arg_conv.inner = untag_ptr(this_arg);
49508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49510         this_arg_conv.is_owned = false;
49511         uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
49512         return ret_conv;
49513 }
49514
49515 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
49516         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
49517         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
49518         return tag_ptr(ret_conv, true);
49519 }
49520
49521 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
49522         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
49523         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
49524         return tag_ptr(ret_conv, true);
49525 }
49526
49527 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
49528         LDKPositiveTimestamp this_arg_conv;
49529         this_arg_conv.inner = untag_ptr(this_arg);
49530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49532         this_arg_conv.is_owned = false;
49533         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
49534         return ret_conv;
49535 }
49536
49537 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
49538         LDKPositiveTimestamp this_arg_conv;
49539         this_arg_conv.inner = untag_ptr(this_arg);
49540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49542         this_arg_conv.is_owned = false;
49543         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
49544         return ret_conv;
49545 }
49546
49547 uint64_t  __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint64_t this_arg) {
49548         LDKInvoice this_arg_conv;
49549         this_arg_conv.inner = untag_ptr(this_arg);
49550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49552         this_arg_conv = Invoice_clone(&this_arg_conv);
49553         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
49554         uint64_t ret_ref = 0;
49555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49557         return ret_ref;
49558 }
49559
49560 uint64_t  __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint64_t this_arg) {
49561         LDKInvoice this_arg_conv;
49562         this_arg_conv.inner = untag_ptr(this_arg);
49563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49565         this_arg_conv.is_owned = false;
49566         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
49567         *ret_conv = Invoice_check_signature(&this_arg_conv);
49568         return tag_ptr(ret_conv, true);
49569 }
49570
49571 uint64_t  __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint64_t signed_invoice) {
49572         LDKSignedRawInvoice signed_invoice_conv;
49573         signed_invoice_conv.inner = untag_ptr(signed_invoice);
49574         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
49575         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
49576         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
49577         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
49578         *ret_conv = Invoice_from_signed(signed_invoice_conv);
49579         return tag_ptr(ret_conv, true);
49580 }
49581
49582 int64_t  __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint64_t this_arg) {
49583         LDKInvoice this_arg_conv;
49584         this_arg_conv.inner = untag_ptr(this_arg);
49585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49587         this_arg_conv.is_owned = false;
49588         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
49589         return ret_conv;
49590 }
49591
49592 int8_tArray  __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint64_t this_arg) {
49593         LDKInvoice this_arg_conv;
49594         this_arg_conv.inner = untag_ptr(this_arg);
49595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49597         this_arg_conv.is_owned = false;
49598         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49599         memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
49600         return ret_arr;
49601 }
49602
49603 int8_tArray  __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint64_t this_arg) {
49604         LDKInvoice this_arg_conv;
49605         this_arg_conv.inner = untag_ptr(this_arg);
49606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49608         this_arg_conv.is_owned = false;
49609         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
49610         memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
49611         return ret_arr;
49612 }
49613
49614 int8_tArray  __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint64_t this_arg) {
49615         LDKInvoice this_arg_conv;
49616         this_arg_conv.inner = untag_ptr(this_arg);
49617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49619         this_arg_conv.is_owned = false;
49620         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49621         memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
49622         return ret_arr;
49623 }
49624
49625 uint64_t  __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint64_t this_arg) {
49626         LDKInvoice this_arg_conv;
49627         this_arg_conv.inner = untag_ptr(this_arg);
49628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49630         this_arg_conv.is_owned = false;
49631         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
49632         uint64_t ret_ref = 0;
49633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49635         return ret_ref;
49636 }
49637
49638 int8_tArray  __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint64_t this_arg) {
49639         LDKInvoice this_arg_conv;
49640         this_arg_conv.inner = untag_ptr(this_arg);
49641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49643         this_arg_conv.is_owned = false;
49644         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
49645         memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
49646         return ret_arr;
49647 }
49648
49649 int64_t  __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint64_t this_arg) {
49650         LDKInvoice this_arg_conv;
49651         this_arg_conv.inner = untag_ptr(this_arg);
49652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49654         this_arg_conv.is_owned = false;
49655         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
49656         return ret_conv;
49657 }
49658
49659 jboolean  __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
49660         LDKInvoice this_arg_conv;
49661         this_arg_conv.inner = untag_ptr(this_arg);
49662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49664         this_arg_conv.is_owned = false;
49665         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
49666         return ret_conv;
49667 }
49668
49669 int64_t  __attribute__((export_name("TS_Invoice_min_final_cltv_expiry_delta"))) TS_Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
49670         LDKInvoice this_arg_conv;
49671         this_arg_conv.inner = untag_ptr(this_arg);
49672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49674         this_arg_conv.is_owned = false;
49675         int64_t ret_conv = Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
49676         return ret_conv;
49677 }
49678
49679 uint64_tArray  __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint64_t this_arg) {
49680         LDKInvoice this_arg_conv;
49681         this_arg_conv.inner = untag_ptr(this_arg);
49682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49684         this_arg_conv.is_owned = false;
49685         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
49686         uint64_tArray ret_arr = NULL;
49687         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
49688         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
49689         for (size_t o = 0; o < ret_var.datalen; o++) {
49690                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
49691                 uint64_t ret_conv_14_ref = 0;
49692                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
49693                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
49694                 ret_arr_ptr[o] = ret_conv_14_ref;
49695         }
49696         
49697         FREE(ret_var.data);
49698         return ret_arr;
49699 }
49700
49701 uint64_tArray  __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint64_t this_arg) {
49702         LDKInvoice this_arg_conv;
49703         this_arg_conv.inner = untag_ptr(this_arg);
49704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49706         this_arg_conv.is_owned = false;
49707         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
49708         uint64_tArray ret_arr = NULL;
49709         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
49710         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
49711         for (size_t l = 0; l < ret_var.datalen; l++) {
49712                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
49713                 uint64_t ret_conv_11_ref = 0;
49714                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
49715                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
49716                 ret_arr_ptr[l] = ret_conv_11_ref;
49717         }
49718         
49719         FREE(ret_var.data);
49720         return ret_arr;
49721 }
49722
49723 uint32_t  __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint64_t this_arg) {
49724         LDKInvoice this_arg_conv;
49725         this_arg_conv.inner = untag_ptr(this_arg);
49726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49728         this_arg_conv.is_owned = false;
49729         uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
49730         return ret_conv;
49731 }
49732
49733 uint64_t  __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint64_t this_arg) {
49734         LDKInvoice this_arg_conv;
49735         this_arg_conv.inner = untag_ptr(this_arg);
49736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49738         this_arg_conv.is_owned = false;
49739         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
49740         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
49741         uint64_t ret_ref = tag_ptr(ret_copy, true);
49742         return ret_ref;
49743 }
49744
49745 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
49746         LDKStr description_conv = str_ref_to_owned_c(description);
49747         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
49748         *ret_conv = Description_new(description_conv);
49749         return tag_ptr(ret_conv, true);
49750 }
49751
49752 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
49753         LDKDescription this_arg_conv;
49754         this_arg_conv.inner = untag_ptr(this_arg);
49755         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49757         this_arg_conv = Description_clone(&this_arg_conv);
49758         LDKStr ret_str = Description_into_inner(this_arg_conv);
49759         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
49760         Str_free(ret_str);
49761         return ret_conv;
49762 }
49763
49764 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
49765         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
49766         uint64_t ret_ref = 0;
49767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49769         return ret_ref;
49770 }
49771
49772 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
49773         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
49774         uint64_t ret_ref = 0;
49775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49777         return ret_ref;
49778 }
49779
49780 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
49781         LDKExpiryTime this_arg_conv;
49782         this_arg_conv.inner = untag_ptr(this_arg);
49783         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49785         this_arg_conv.is_owned = false;
49786         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
49787         return ret_conv;
49788 }
49789
49790 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
49791         LDKExpiryTime this_arg_conv;
49792         this_arg_conv.inner = untag_ptr(this_arg);
49793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49795         this_arg_conv.is_owned = false;
49796         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
49797         return ret_conv;
49798 }
49799
49800 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
49801         LDKRouteHint hops_conv;
49802         hops_conv.inner = untag_ptr(hops);
49803         hops_conv.is_owned = ptr_is_owned(hops);
49804         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
49805         hops_conv = RouteHint_clone(&hops_conv);
49806         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
49807         *ret_conv = PrivateRoute_new(hops_conv);
49808         return tag_ptr(ret_conv, true);
49809 }
49810
49811 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
49812         LDKPrivateRoute this_arg_conv;
49813         this_arg_conv.inner = untag_ptr(this_arg);
49814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49816         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
49817         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
49818         uint64_t ret_ref = 0;
49819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49821         return ret_ref;
49822 }
49823
49824 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
49825         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
49826         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
49827         return ret_conv;
49828 }
49829
49830 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
49831         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
49832         return ret_conv;
49833 }
49834
49835 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
49836         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
49837         return ret_conv;
49838 }
49839
49840 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
49841         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
49842         return ret_conv;
49843 }
49844
49845 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
49846         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
49847         return ret_conv;
49848 }
49849
49850 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
49851         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
49852         return ret_conv;
49853 }
49854
49855 uint32_t  __attribute__((export_name("TS_CreationError_min_final_cltv_expiry_delta_too_short"))) TS_CreationError_min_final_cltv_expiry_delta_too_short() {
49856         uint32_t ret_conv = LDKCreationError_to_js(CreationError_min_final_cltv_expiry_delta_too_short());
49857         return ret_conv;
49858 }
49859
49860 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
49861         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
49862         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
49863         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
49864         return ret_conv;
49865 }
49866
49867 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
49868         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
49869         LDKStr ret_str = CreationError_to_str(o_conv);
49870         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
49871         Str_free(ret_str);
49872         return ret_conv;
49873 }
49874
49875 uint32_t  __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint64_t orig) {
49876         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
49877         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
49878         return ret_conv;
49879 }
49880
49881 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
49882         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
49883         return ret_conv;
49884 }
49885
49886 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
49887         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
49888         return ret_conv;
49889 }
49890
49891 uint32_t  __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
49892         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
49893         return ret_conv;
49894 }
49895
49896 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
49897         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
49898         return ret_conv;
49899 }
49900
49901 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
49902         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
49903         return ret_conv;
49904 }
49905
49906 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
49907         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
49908         return ret_conv;
49909 }
49910
49911 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
49912         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
49913         return ret_conv;
49914 }
49915
49916 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
49917         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
49918         return ret_conv;
49919 }
49920
49921 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
49922         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
49923         return ret_conv;
49924 }
49925
49926 uint32_t  __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
49927         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
49928         return ret_conv;
49929 }
49930
49931 jboolean  __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint64_t a, uint64_t b) {
49932         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
49933         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
49934         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
49935         return ret_conv;
49936 }
49937
49938 jstring  __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint64_t o) {
49939         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
49940         LDKStr ret_str = SemanticError_to_str(o_conv);
49941         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
49942         Str_free(ret_str);
49943         return ret_conv;
49944 }
49945
49946 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
49947         if (!ptr_is_owned(this_ptr)) return;
49948         void* this_ptr_ptr = untag_ptr(this_ptr);
49949         CHECK_ACCESS(this_ptr_ptr);
49950         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
49951         FREE(untag_ptr(this_ptr));
49952         SignOrCreationError_free(this_ptr_conv);
49953 }
49954
49955 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
49956         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49957         *ret_copy = SignOrCreationError_clone(arg);
49958         uint64_t ret_ref = tag_ptr(ret_copy, true);
49959         return ret_ref;
49960 }
49961 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
49962         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
49963         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
49964         return ret_conv;
49965 }
49966
49967 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
49968         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
49969         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49970         *ret_copy = SignOrCreationError_clone(orig_conv);
49971         uint64_t ret_ref = tag_ptr(ret_copy, true);
49972         return ret_ref;
49973 }
49974
49975 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
49976         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49977         *ret_copy = SignOrCreationError_sign_error();
49978         uint64_t ret_ref = tag_ptr(ret_copy, true);
49979         return ret_ref;
49980 }
49981
49982 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
49983         LDKCreationError a_conv = LDKCreationError_from_js(a);
49984         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49985         *ret_copy = SignOrCreationError_creation_error(a_conv);
49986         uint64_t ret_ref = tag_ptr(ret_copy, true);
49987         return ret_ref;
49988 }
49989
49990 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
49991         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
49992         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
49993         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
49994         return ret_conv;
49995 }
49996
49997 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
49998         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
49999         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
50000         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
50001         Str_free(ret_str);
50002         return ret_conv;
50003 }
50004
50005 uint64_t  __attribute__((export_name("TS_pay_invoice"))) TS_pay_invoice(uint64_t invoice, uint64_t retry_strategy, uint64_t channelmanager) {
50006         LDKInvoice invoice_conv;
50007         invoice_conv.inner = untag_ptr(invoice);
50008         invoice_conv.is_owned = ptr_is_owned(invoice);
50009         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
50010         invoice_conv.is_owned = false;
50011         void* retry_strategy_ptr = untag_ptr(retry_strategy);
50012         CHECK_ACCESS(retry_strategy_ptr);
50013         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
50014         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
50015         LDKChannelManager channelmanager_conv;
50016         channelmanager_conv.inner = untag_ptr(channelmanager);
50017         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
50018         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
50019         channelmanager_conv.is_owned = false;
50020         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
50021         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
50022         return tag_ptr(ret_conv, true);
50023 }
50024
50025 uint64_t  __attribute__((export_name("TS_pay_invoice_with_id"))) TS_pay_invoice_with_id(uint64_t invoice, int8_tArray payment_id, uint64_t retry_strategy, uint64_t channelmanager) {
50026         LDKInvoice invoice_conv;
50027         invoice_conv.inner = untag_ptr(invoice);
50028         invoice_conv.is_owned = ptr_is_owned(invoice);
50029         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
50030         invoice_conv.is_owned = false;
50031         LDKThirtyTwoBytes payment_id_ref;
50032         CHECK(payment_id->arr_len == 32);
50033         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
50034         void* retry_strategy_ptr = untag_ptr(retry_strategy);
50035         CHECK_ACCESS(retry_strategy_ptr);
50036         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
50037         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
50038         LDKChannelManager channelmanager_conv;
50039         channelmanager_conv.inner = untag_ptr(channelmanager);
50040         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
50041         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
50042         channelmanager_conv.is_owned = false;
50043         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
50044         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
50045         return tag_ptr(ret_conv, true);
50046 }
50047
50048 uint64_t  __attribute__((export_name("TS_pay_zero_value_invoice"))) TS_pay_zero_value_invoice(uint64_t invoice, int64_t amount_msats, uint64_t retry_strategy, uint64_t channelmanager) {
50049         LDKInvoice invoice_conv;
50050         invoice_conv.inner = untag_ptr(invoice);
50051         invoice_conv.is_owned = ptr_is_owned(invoice);
50052         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
50053         invoice_conv.is_owned = false;
50054         void* retry_strategy_ptr = untag_ptr(retry_strategy);
50055         CHECK_ACCESS(retry_strategy_ptr);
50056         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
50057         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
50058         LDKChannelManager channelmanager_conv;
50059         channelmanager_conv.inner = untag_ptr(channelmanager);
50060         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
50061         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
50062         channelmanager_conv.is_owned = false;
50063         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
50064         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv);
50065         return tag_ptr(ret_conv, true);
50066 }
50067
50068 uint64_t  __attribute__((export_name("TS_pay_zero_value_invoice_with_id"))) TS_pay_zero_value_invoice_with_id(uint64_t invoice, int64_t amount_msats, int8_tArray payment_id, uint64_t retry_strategy, uint64_t channelmanager) {
50069         LDKInvoice invoice_conv;
50070         invoice_conv.inner = untag_ptr(invoice);
50071         invoice_conv.is_owned = ptr_is_owned(invoice);
50072         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
50073         invoice_conv.is_owned = false;
50074         LDKThirtyTwoBytes payment_id_ref;
50075         CHECK(payment_id->arr_len == 32);
50076         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
50077         void* retry_strategy_ptr = untag_ptr(retry_strategy);
50078         CHECK_ACCESS(retry_strategy_ptr);
50079         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
50080         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
50081         LDKChannelManager channelmanager_conv;
50082         channelmanager_conv.inner = untag_ptr(channelmanager);
50083         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
50084         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
50085         channelmanager_conv.is_owned = false;
50086         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
50087         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
50088         return tag_ptr(ret_conv, true);
50089 }
50090
50091 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
50092         if (!ptr_is_owned(this_ptr)) return;
50093         void* this_ptr_ptr = untag_ptr(this_ptr);
50094         CHECK_ACCESS(this_ptr_ptr);
50095         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
50096         FREE(untag_ptr(this_ptr));
50097         PaymentError_free(this_ptr_conv);
50098 }
50099
50100 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
50101         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
50102         *ret_copy = PaymentError_clone(arg);
50103         uint64_t ret_ref = tag_ptr(ret_copy, true);
50104         return ret_ref;
50105 }
50106 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
50107         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
50108         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
50109         return ret_conv;
50110 }
50111
50112 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
50113         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
50114         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
50115         *ret_copy = PaymentError_clone(orig_conv);
50116         uint64_t ret_ref = tag_ptr(ret_copy, true);
50117         return ret_ref;
50118 }
50119
50120 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
50121         LDKStr a_conv = str_ref_to_owned_c(a);
50122         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
50123         *ret_copy = PaymentError_invoice(a_conv);
50124         uint64_t ret_ref = tag_ptr(ret_copy, true);
50125         return ret_ref;
50126 }
50127
50128 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) {
50129         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_js(a);
50130         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
50131         *ret_copy = PaymentError_sending(a_conv);
50132         uint64_t ret_ref = tag_ptr(ret_copy, true);
50133         return ret_ref;
50134 }
50135
50136 uint64_t  __attribute__((export_name("TS_create_phantom_invoice"))) TS_create_phantom_invoice(uint64_t amt_msat, int8_tArray payment_hash, jstring description, int32_t invoice_expiry_delta_secs, uint64_tArray phantom_route_hints, uint64_t entropy_source, uint64_t node_signer, uint64_t logger, uint32_t network, uint64_t min_final_cltv_expiry_delta, int64_t duration_since_epoch) {
50137         void* amt_msat_ptr = untag_ptr(amt_msat);
50138         CHECK_ACCESS(amt_msat_ptr);
50139         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
50140         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
50141         LDKThirtyTwoBytes payment_hash_ref;
50142         CHECK(payment_hash->arr_len == 32);
50143         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
50144         LDKStr description_conv = str_ref_to_owned_c(description);
50145         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
50146         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
50147         if (phantom_route_hints_constr.datalen > 0)
50148                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
50149         else
50150                 phantom_route_hints_constr.data = NULL;
50151         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
50152         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
50153                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
50154                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
50155                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
50156                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
50157                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
50158                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
50159                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
50160         }
50161         FREE(phantom_route_hints);
50162         void* entropy_source_ptr = untag_ptr(entropy_source);
50163         CHECK_ACCESS(entropy_source_ptr);
50164         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
50165         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
50166                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50167                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
50168         }
50169         void* node_signer_ptr = untag_ptr(node_signer);
50170         CHECK_ACCESS(node_signer_ptr);
50171         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
50172         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
50173                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50174                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
50175         }
50176         void* logger_ptr = untag_ptr(logger);
50177         CHECK_ACCESS(logger_ptr);
50178         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
50179         if (logger_conv.free == LDKLogger_JCalls_free) {
50180                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50181                 LDKLogger_JCalls_cloned(&logger_conv);
50182         }
50183         LDKCurrency network_conv = LDKCurrency_from_js(network);
50184         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
50185         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
50186         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
50187         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
50188         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
50189         *ret_conv = create_phantom_invoice(amt_msat_conv, payment_hash_ref, description_conv, invoice_expiry_delta_secs, phantom_route_hints_constr, entropy_source_conv, node_signer_conv, logger_conv, network_conv, min_final_cltv_expiry_delta_conv, duration_since_epoch);
50190         return tag_ptr(ret_conv, true);
50191 }
50192
50193 uint64_t  __attribute__((export_name("TS_create_phantom_invoice_with_description_hash"))) TS_create_phantom_invoice_with_description_hash(uint64_t amt_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, uint64_t description_hash, uint64_tArray phantom_route_hints, uint64_t entropy_source, uint64_t node_signer, uint64_t logger, uint32_t network, uint64_t min_final_cltv_expiry_delta, int64_t duration_since_epoch) {
50194         void* amt_msat_ptr = untag_ptr(amt_msat);
50195         CHECK_ACCESS(amt_msat_ptr);
50196         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
50197         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
50198         LDKThirtyTwoBytes payment_hash_ref;
50199         CHECK(payment_hash->arr_len == 32);
50200         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
50201         LDKSha256 description_hash_conv;
50202         description_hash_conv.inner = untag_ptr(description_hash);
50203         description_hash_conv.is_owned = ptr_is_owned(description_hash);
50204         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
50205         description_hash_conv = Sha256_clone(&description_hash_conv);
50206         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
50207         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
50208         if (phantom_route_hints_constr.datalen > 0)
50209                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
50210         else
50211                 phantom_route_hints_constr.data = NULL;
50212         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
50213         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
50214                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
50215                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
50216                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
50217                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
50218                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
50219                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
50220                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
50221         }
50222         FREE(phantom_route_hints);
50223         void* entropy_source_ptr = untag_ptr(entropy_source);
50224         CHECK_ACCESS(entropy_source_ptr);
50225         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
50226         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
50227                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50228                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
50229         }
50230         void* node_signer_ptr = untag_ptr(node_signer);
50231         CHECK_ACCESS(node_signer_ptr);
50232         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
50233         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
50234                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50235                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
50236         }
50237         void* logger_ptr = untag_ptr(logger);
50238         CHECK_ACCESS(logger_ptr);
50239         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
50240         if (logger_conv.free == LDKLogger_JCalls_free) {
50241                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50242                 LDKLogger_JCalls_cloned(&logger_conv);
50243         }
50244         LDKCurrency network_conv = LDKCurrency_from_js(network);
50245         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
50246         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
50247         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
50248         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
50249         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
50250         *ret_conv = create_phantom_invoice_with_description_hash(amt_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, description_hash_conv, phantom_route_hints_constr, entropy_source_conv, node_signer_conv, logger_conv, network_conv, min_final_cltv_expiry_delta_conv, duration_since_epoch);
50251         return tag_ptr(ret_conv, true);
50252 }
50253
50254 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 node_signer, uint64_t logger, uint32_t network, uint64_t amt_msat, uint64_t description_hash, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, uint64_t min_final_cltv_expiry_delta) {
50255         LDKChannelManager channelmanager_conv;
50256         channelmanager_conv.inner = untag_ptr(channelmanager);
50257         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
50258         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
50259         channelmanager_conv.is_owned = false;
50260         void* node_signer_ptr = untag_ptr(node_signer);
50261         CHECK_ACCESS(node_signer_ptr);
50262         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
50263         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
50264                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50265                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
50266         }
50267         void* logger_ptr = untag_ptr(logger);
50268         CHECK_ACCESS(logger_ptr);
50269         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
50270         if (logger_conv.free == LDKLogger_JCalls_free) {
50271                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50272                 LDKLogger_JCalls_cloned(&logger_conv);
50273         }
50274         LDKCurrency network_conv = LDKCurrency_from_js(network);
50275         void* amt_msat_ptr = untag_ptr(amt_msat);
50276         CHECK_ACCESS(amt_msat_ptr);
50277         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
50278         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
50279         LDKSha256 description_hash_conv;
50280         description_hash_conv.inner = untag_ptr(description_hash);
50281         description_hash_conv.is_owned = ptr_is_owned(description_hash);
50282         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
50283         description_hash_conv = Sha256_clone(&description_hash_conv);
50284         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
50285         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
50286         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
50287         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
50288         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
50289         *ret_conv = create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_hash_conv, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
50290         return tag_ptr(ret_conv, true);
50291 }
50292
50293 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 node_signer, uint64_t logger, uint32_t network, uint64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, uint64_t min_final_cltv_expiry_delta) {
50294         LDKChannelManager channelmanager_conv;
50295         channelmanager_conv.inner = untag_ptr(channelmanager);
50296         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
50297         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
50298         channelmanager_conv.is_owned = false;
50299         void* node_signer_ptr = untag_ptr(node_signer);
50300         CHECK_ACCESS(node_signer_ptr);
50301         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
50302         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
50303                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50304                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
50305         }
50306         void* logger_ptr = untag_ptr(logger);
50307         CHECK_ACCESS(logger_ptr);
50308         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
50309         if (logger_conv.free == LDKLogger_JCalls_free) {
50310                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50311                 LDKLogger_JCalls_cloned(&logger_conv);
50312         }
50313         LDKCurrency network_conv = LDKCurrency_from_js(network);
50314         void* amt_msat_ptr = untag_ptr(amt_msat);
50315         CHECK_ACCESS(amt_msat_ptr);
50316         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
50317         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
50318         LDKStr description_conv = str_ref_to_owned_c(description);
50319         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
50320         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
50321         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
50322         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
50323         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
50324         *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
50325         return tag_ptr(ret_conv, true);
50326 }
50327
50328 uint64_t  __attribute__((export_name("TS_create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash"))) TS_create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(uint64_t channelmanager, uint64_t node_signer, uint64_t logger, uint32_t network, uint64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int8_tArray payment_hash, uint64_t min_final_cltv_expiry_delta) {
50329         LDKChannelManager channelmanager_conv;
50330         channelmanager_conv.inner = untag_ptr(channelmanager);
50331         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
50332         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
50333         channelmanager_conv.is_owned = false;
50334         void* node_signer_ptr = untag_ptr(node_signer);
50335         CHECK_ACCESS(node_signer_ptr);
50336         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
50337         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
50338                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50339                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
50340         }
50341         void* logger_ptr = untag_ptr(logger);
50342         CHECK_ACCESS(logger_ptr);
50343         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
50344         if (logger_conv.free == LDKLogger_JCalls_free) {
50345                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50346                 LDKLogger_JCalls_cloned(&logger_conv);
50347         }
50348         LDKCurrency network_conv = LDKCurrency_from_js(network);
50349         void* amt_msat_ptr = untag_ptr(amt_msat);
50350         CHECK_ACCESS(amt_msat_ptr);
50351         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
50352         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
50353         LDKStr description_conv = str_ref_to_owned_c(description);
50354         LDKThirtyTwoBytes payment_hash_ref;
50355         CHECK(payment_hash->arr_len == 32);
50356         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
50357         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
50358         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
50359         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
50360         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
50361         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
50362         *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs, payment_hash_ref, min_final_cltv_expiry_delta_conv);
50363         return tag_ptr(ret_conv, true);
50364 }
50365
50366 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
50367         LDKStr s_conv = str_ref_to_owned_c(s);
50368         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
50369         *ret_conv = SiPrefix_from_str(s_conv);
50370         return tag_ptr(ret_conv, true);
50371 }
50372
50373 uint64_t  __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
50374         LDKStr s_conv = str_ref_to_owned_c(s);
50375         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
50376         *ret_conv = Invoice_from_str(s_conv);
50377         return tag_ptr(ret_conv, true);
50378 }
50379
50380 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
50381         LDKStr s_conv = str_ref_to_owned_c(s);
50382         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
50383         *ret_conv = SignedRawInvoice_from_str(s_conv);
50384         return tag_ptr(ret_conv, true);
50385 }
50386
50387 jstring  __attribute__((export_name("TS_ParseError_to_str"))) TS_ParseError_to_str(uint64_t o) {
50388         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
50389         LDKStr ret_str = ParseError_to_str(o_conv);
50390         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
50391         Str_free(ret_str);
50392         return ret_conv;
50393 }
50394
50395 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
50396         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
50397         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
50398         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
50399         Str_free(ret_str);
50400         return ret_conv;
50401 }
50402
50403 jstring  __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint64_t o) {
50404         LDKInvoice o_conv;
50405         o_conv.inner = untag_ptr(o);
50406         o_conv.is_owned = ptr_is_owned(o);
50407         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50408         o_conv.is_owned = false;
50409         LDKStr ret_str = Invoice_to_str(&o_conv);
50410         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
50411         Str_free(ret_str);
50412         return ret_conv;
50413 }
50414
50415 jstring  __attribute__((export_name("TS_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint64_t o) {
50416         LDKSignedRawInvoice o_conv;
50417         o_conv.inner = untag_ptr(o);
50418         o_conv.is_owned = ptr_is_owned(o);
50419         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50420         o_conv.is_owned = false;
50421         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
50422         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
50423         Str_free(ret_str);
50424         return ret_conv;
50425 }
50426
50427 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
50428         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
50429         LDKStr ret_str = Currency_to_str(o_conv);
50430         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
50431         Str_free(ret_str);
50432         return ret_conv;
50433 }
50434
50435 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
50436         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
50437         LDKStr ret_str = SiPrefix_to_str(o_conv);
50438         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
50439         Str_free(ret_str);
50440         return ret_conv;
50441 }
50442