[TS] Update auto-generated 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 LDKPaymentFailureReason LDKPaymentFailureReason_from_js(int32_t ord) {
364         switch (ord) {
365                 case 0: return LDKPaymentFailureReason_RecipientRejected;
366                 case 1: return LDKPaymentFailureReason_UserAbandoned;
367                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
368                 case 3: return LDKPaymentFailureReason_PaymentExpired;
369                 case 4: return LDKPaymentFailureReason_RouteNotFound;
370                 case 5: return LDKPaymentFailureReason_UnexpectedError;
371         }
372         abort();
373 }
374 static inline int32_t LDKPaymentFailureReason_to_js(LDKPaymentFailureReason val) {
375         switch (val) {
376                 case LDKPaymentFailureReason_RecipientRejected: return 0;
377                 case LDKPaymentFailureReason_UserAbandoned: return 1;
378                 case LDKPaymentFailureReason_RetriesExhausted: return 2;
379                 case LDKPaymentFailureReason_PaymentExpired: return 3;
380                 case LDKPaymentFailureReason_RouteNotFound: return 4;
381                 case LDKPaymentFailureReason_UnexpectedError: return 5;
382                 default: abort();
383         }
384 }
385 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
386         switch (ord) {
387                 case 0: return LDKRecipient_Node;
388                 case 1: return LDKRecipient_PhantomNode;
389         }
390         abort();
391 }
392 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
393         switch (val) {
394                 case LDKRecipient_Node: return 0;
395                 case LDKRecipient_PhantomNode: return 1;
396                 default: abort();
397         }
398 }
399 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_js(int32_t ord) {
400         switch (ord) {
401                 case 0: return LDKRetryableSendFailure_PaymentExpired;
402                 case 1: return LDKRetryableSendFailure_RouteNotFound;
403                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
404         }
405         abort();
406 }
407 static inline int32_t LDKRetryableSendFailure_to_js(LDKRetryableSendFailure val) {
408         switch (val) {
409                 case LDKRetryableSendFailure_PaymentExpired: return 0;
410                 case LDKRetryableSendFailure_RouteNotFound: return 1;
411                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
412                 default: abort();
413         }
414 }
415 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
416         switch (ord) {
417                 case 0: return LDKSecp256k1Error_IncorrectSignature;
418                 case 1: return LDKSecp256k1Error_InvalidMessage;
419                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
420                 case 3: return LDKSecp256k1Error_InvalidSignature;
421                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
422                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
423                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
424                 case 7: return LDKSecp256k1Error_InvalidTweak;
425                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
426                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
427                 case 10: return LDKSecp256k1Error_InvalidParityValue;
428         }
429         abort();
430 }
431 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
432         switch (val) {
433                 case LDKSecp256k1Error_IncorrectSignature: return 0;
434                 case LDKSecp256k1Error_InvalidMessage: return 1;
435                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
436                 case LDKSecp256k1Error_InvalidSignature: return 3;
437                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
438                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
439                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
440                 case LDKSecp256k1Error_InvalidTweak: return 7;
441                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
442                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
443                 case LDKSecp256k1Error_InvalidParityValue: return 10;
444                 default: abort();
445         }
446 }
447 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
448         switch (ord) {
449                 case 0: return LDKSemanticError_NoPaymentHash;
450                 case 1: return LDKSemanticError_MultiplePaymentHashes;
451                 case 2: return LDKSemanticError_NoDescription;
452                 case 3: return LDKSemanticError_MultipleDescriptions;
453                 case 4: return LDKSemanticError_NoPaymentSecret;
454                 case 5: return LDKSemanticError_MultiplePaymentSecrets;
455                 case 6: return LDKSemanticError_InvalidFeatures;
456                 case 7: return LDKSemanticError_InvalidRecoveryId;
457                 case 8: return LDKSemanticError_InvalidSignature;
458                 case 9: return LDKSemanticError_ImpreciseAmount;
459         }
460         abort();
461 }
462 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
463         switch (val) {
464                 case LDKSemanticError_NoPaymentHash: return 0;
465                 case LDKSemanticError_MultiplePaymentHashes: return 1;
466                 case LDKSemanticError_NoDescription: return 2;
467                 case LDKSemanticError_MultipleDescriptions: return 3;
468                 case LDKSemanticError_NoPaymentSecret: return 4;
469                 case LDKSemanticError_MultiplePaymentSecrets: return 5;
470                 case LDKSemanticError_InvalidFeatures: return 6;
471                 case LDKSemanticError_InvalidRecoveryId: return 7;
472                 case LDKSemanticError_InvalidSignature: return 8;
473                 case LDKSemanticError_ImpreciseAmount: return 9;
474                 default: abort();
475         }
476 }
477 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
478         switch (ord) {
479                 case 0: return LDKSiPrefix_Milli;
480                 case 1: return LDKSiPrefix_Micro;
481                 case 2: return LDKSiPrefix_Nano;
482                 case 3: return LDKSiPrefix_Pico;
483         }
484         abort();
485 }
486 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
487         switch (val) {
488                 case LDKSiPrefix_Milli: return 0;
489                 case LDKSiPrefix_Micro: return 1;
490                 case LDKSiPrefix_Nano: return 2;
491                 case LDKSiPrefix_Pico: return 3;
492                 default: abort();
493         }
494 }
495 static inline LDKUtxoLookupError LDKUtxoLookupError_from_js(int32_t ord) {
496         switch (ord) {
497                 case 0: return LDKUtxoLookupError_UnknownChain;
498                 case 1: return LDKUtxoLookupError_UnknownTx;
499         }
500         abort();
501 }
502 static inline int32_t LDKUtxoLookupError_to_js(LDKUtxoLookupError val) {
503         switch (val) {
504                 case LDKUtxoLookupError_UnknownChain: return 0;
505                 case LDKUtxoLookupError_UnknownTx: return 1;
506                 default: abort();
507         }
508 }
509 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
510         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
511         return ret;
512 }
513 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
514         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
515         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
516         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
517         return ret_arr;
518 }
519
520 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
521 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
522         if (!ptr_is_owned(thing)) return;
523         void* thing_ptr = untag_ptr(thing);
524         CHECK_ACCESS(thing_ptr);
525         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
526         FREE(untag_ptr(thing));
527         BigEndianScalar_free(thing_conv);
528 }
529
530 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
531         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
532         switch(obj->tag) {
533                 case LDKBech32Error_MissingSeparator: return 0;
534                 case LDKBech32Error_InvalidChecksum: return 1;
535                 case LDKBech32Error_InvalidLength: return 2;
536                 case LDKBech32Error_InvalidChar: return 3;
537                 case LDKBech32Error_InvalidData: return 4;
538                 case LDKBech32Error_InvalidPadding: return 5;
539                 case LDKBech32Error_MixedCase: return 6;
540                 default: abort();
541         }
542 }
543 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
544         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
545         assert(obj->tag == LDKBech32Error_InvalidChar);
546                         int32_t invalid_char_conv = obj->invalid_char;
547         return invalid_char_conv;
548 }
549 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
550         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
551         assert(obj->tag == LDKBech32Error_InvalidData);
552                         int8_t invalid_data_conv = obj->invalid_data;
553         return invalid_data_conv;
554 }
555 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
556         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
557         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
558         return ret;
559 }
560 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) {
561         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
562         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
563         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
564         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
565         CVec_u8Z_free(ret_var);
566         return ret_arr;
567 }
568
569 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) {
570         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
571         int64_t ret_conv = TxOut_get_value(thing_conv);
572         return ret_conv;
573 }
574
575 uint32_t __attribute__((export_name("TS_LDKCOption_DurationZ_ty_from_ptr"))) TS_LDKCOption_DurationZ_ty_from_ptr(uint64_t ptr) {
576         LDKCOption_DurationZ *obj = (LDKCOption_DurationZ*)untag_ptr(ptr);
577         switch(obj->tag) {
578                 case LDKCOption_DurationZ_Some: return 0;
579                 case LDKCOption_DurationZ_None: return 1;
580                 default: abort();
581         }
582 }
583 int64_t __attribute__((export_name("TS_LDKCOption_DurationZ_Some_get_some"))) TS_LDKCOption_DurationZ_Some_get_some(uint64_t ptr) {
584         LDKCOption_DurationZ *obj = (LDKCOption_DurationZ*)untag_ptr(ptr);
585         assert(obj->tag == LDKCOption_DurationZ_Some);
586                         int64_t some_conv = obj->some;
587         return some_conv;
588 }
589 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
590         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
591         for (size_t i = 0; i < ret.datalen; i++) {
592                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
593         }
594         return ret;
595 }
596 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
597         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
598         switch(obj->tag) {
599                 case LDKCOption_u64Z_Some: return 0;
600                 case LDKCOption_u64Z_None: return 1;
601                 default: abort();
602         }
603 }
604 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
605         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
606         assert(obj->tag == LDKCOption_u64Z_Some);
607                         int64_t some_conv = obj->some;
608         return some_conv;
609 }
610 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
611         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
612         switch(obj->tag) {
613                 case LDKAPIError_APIMisuseError: return 0;
614                 case LDKAPIError_FeeRateTooHigh: return 1;
615                 case LDKAPIError_InvalidRoute: return 2;
616                 case LDKAPIError_ChannelUnavailable: return 3;
617                 case LDKAPIError_MonitorUpdateInProgress: return 4;
618                 case LDKAPIError_IncompatibleShutdownScript: return 5;
619                 default: abort();
620         }
621 }
622 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
623         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
624         assert(obj->tag == LDKAPIError_APIMisuseError);
625                         LDKStr err_str = obj->api_misuse_error.err;
626                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
627         return err_conv;
628 }
629 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
630         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
631         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
632                         LDKStr err_str = obj->fee_rate_too_high.err;
633                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
634         return err_conv;
635 }
636 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
637         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
638         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
639                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
640         return feerate_conv;
641 }
642 jstring __attribute__((export_name("TS_LDKAPIError_InvalidRoute_get_err"))) TS_LDKAPIError_InvalidRoute_get_err(uint64_t ptr) {
643         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
644         assert(obj->tag == LDKAPIError_InvalidRoute);
645                         LDKStr err_str = obj->invalid_route.err;
646                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
647         return err_conv;
648 }
649 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
650         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
651         assert(obj->tag == LDKAPIError_ChannelUnavailable);
652                         LDKStr err_str = obj->channel_unavailable.err;
653                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
654         return err_conv;
655 }
656 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
657         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
658         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
659                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
660                         uint64_t script_ref = 0;
661                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
662                         script_ref = tag_ptr(script_var.inner, false);
663         return script_ref;
664 }
665 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
666 CHECK(owner->result_ok);
667         return *owner->contents.result;
668 }
669 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
670         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
671         CResult_NoneAPIErrorZ_get_ok(owner_conv);
672 }
673
674 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
675 CHECK(!owner->result_ok);
676         return APIError_clone(&*owner->contents.err);
677 }
678 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
679         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
680         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
681         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
682         uint64_t ret_ref = tag_ptr(ret_copy, true);
683         return ret_ref;
684 }
685
686 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
687         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
688         for (size_t i = 0; i < ret.datalen; i++) {
689                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
690         }
691         return ret;
692 }
693 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
694         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
695         for (size_t i = 0; i < ret.datalen; i++) {
696                 ret.data[i] = APIError_clone(&orig->data[i]);
697         }
698         return ret;
699 }
700 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_ty_from_ptr"))) TS_LDKCOption_CVec_u8ZZ_ty_from_ptr(uint64_t ptr) {
701         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
702         switch(obj->tag) {
703                 case LDKCOption_CVec_u8ZZ_Some: return 0;
704                 case LDKCOption_CVec_u8ZZ_None: return 1;
705                 default: abort();
706         }
707 }
708 int8_tArray __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_Some_get_some"))) TS_LDKCOption_CVec_u8ZZ_Some_get_some(uint64_t ptr) {
709         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
710         assert(obj->tag == LDKCOption_CVec_u8ZZ_Some);
711                         LDKCVec_u8Z some_var = obj->some;
712                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
713                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
714         return some_arr;
715 }
716 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
717         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
718         switch(obj->tag) {
719                 case LDKDecodeError_UnknownVersion: return 0;
720                 case LDKDecodeError_UnknownRequiredFeature: return 1;
721                 case LDKDecodeError_InvalidValue: return 2;
722                 case LDKDecodeError_ShortRead: return 3;
723                 case LDKDecodeError_BadLengthDescriptor: return 4;
724                 case LDKDecodeError_Io: return 5;
725                 case LDKDecodeError_UnsupportedCompression: return 6;
726                 default: abort();
727         }
728 }
729 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
730         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
731         assert(obj->tag == LDKDecodeError_Io);
732                         uint32_t io_conv = LDKIOError_to_js(obj->io);
733         return io_conv;
734 }
735 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
736         LDKRecipientOnionFields ret = *owner->contents.result;
737         ret.is_owned = false;
738         return ret;
739 }
740 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(uint64_t owner) {
741         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
742         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
743         uint64_t ret_ref = 0;
744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
746         return ret_ref;
747 }
748
749 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
750 CHECK(!owner->result_ok);
751         return DecodeError_clone(&*owner->contents.err);
752 }
753 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err(uint64_t owner) {
754         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
755         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
756         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
757         uint64_t ret_ref = tag_ptr(ret_copy, true);
758         return ret_ref;
759 }
760
761 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_ty_from_ptr"))) TS_LDKCOption_HTLCClaimZ_ty_from_ptr(uint64_t ptr) {
762         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
763         switch(obj->tag) {
764                 case LDKCOption_HTLCClaimZ_Some: return 0;
765                 case LDKCOption_HTLCClaimZ_None: return 1;
766                 default: abort();
767         }
768 }
769 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_Some_get_some"))) TS_LDKCOption_HTLCClaimZ_Some_get_some(uint64_t ptr) {
770         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
771         assert(obj->tag == LDKCOption_HTLCClaimZ_Some);
772                         uint32_t some_conv = LDKHTLCClaim_to_js(obj->some);
773         return some_conv;
774 }
775 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
776 CHECK(owner->result_ok);
777         return *owner->contents.result;
778 }
779 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
780         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
781         CResult_NoneNoneZ_get_ok(owner_conv);
782 }
783
784 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
785 CHECK(!owner->result_ok);
786         return *owner->contents.err;
787 }
788 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
789         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
790         CResult_NoneNoneZ_get_err(owner_conv);
791 }
792
793 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
794         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
795         ret.is_owned = false;
796         return ret;
797 }
798 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
799         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
800         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
801         uint64_t ret_ref = 0;
802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
804         return ret_ref;
805 }
806
807 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
808 CHECK(!owner->result_ok);
809         return DecodeError_clone(&*owner->contents.err);
810 }
811 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
812         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
813         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
814         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
815         uint64_t ret_ref = tag_ptr(ret_copy, true);
816         return ret_ref;
817 }
818
819 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
820         LDKTxCreationKeys ret = *owner->contents.result;
821         ret.is_owned = false;
822         return ret;
823 }
824 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
825         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
826         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
827         uint64_t ret_ref = 0;
828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
830         return ret_ref;
831 }
832
833 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
834 CHECK(!owner->result_ok);
835         return DecodeError_clone(&*owner->contents.err);
836 }
837 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
838         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
839         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
840         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
841         uint64_t ret_ref = tag_ptr(ret_copy, true);
842         return ret_ref;
843 }
844
845 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
846         LDKChannelPublicKeys ret = *owner->contents.result;
847         ret.is_owned = false;
848         return ret;
849 }
850 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
851         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
852         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
853         uint64_t ret_ref = 0;
854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
856         return ret_ref;
857 }
858
859 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
860 CHECK(!owner->result_ok);
861         return DecodeError_clone(&*owner->contents.err);
862 }
863 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
864         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
865         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
866         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
867         uint64_t ret_ref = tag_ptr(ret_copy, true);
868         return ret_ref;
869 }
870
871 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
872         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
873         switch(obj->tag) {
874                 case LDKCOption_u32Z_Some: return 0;
875                 case LDKCOption_u32Z_None: return 1;
876                 default: abort();
877         }
878 }
879 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
880         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
881         assert(obj->tag == LDKCOption_u32Z_Some);
882                         int32_t some_conv = obj->some;
883         return some_conv;
884 }
885 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
886         LDKHTLCOutputInCommitment ret = *owner->contents.result;
887         ret.is_owned = false;
888         return ret;
889 }
890 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
891         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
892         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
893         uint64_t ret_ref = 0;
894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
896         return ret_ref;
897 }
898
899 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
900 CHECK(!owner->result_ok);
901         return DecodeError_clone(&*owner->contents.err);
902 }
903 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
904         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
905         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
906         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
907         uint64_t ret_ref = tag_ptr(ret_copy, true);
908         return ret_ref;
909 }
910
911 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
912         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
913         ret.is_owned = false;
914         return ret;
915 }
916 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
917         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
918         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
919         uint64_t ret_ref = 0;
920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
922         return ret_ref;
923 }
924
925 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
926 CHECK(!owner->result_ok);
927         return DecodeError_clone(&*owner->contents.err);
928 }
929 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
930         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
931         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
932         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
933         uint64_t ret_ref = tag_ptr(ret_copy, true);
934         return ret_ref;
935 }
936
937 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
938         LDKChannelTransactionParameters ret = *owner->contents.result;
939         ret.is_owned = false;
940         return ret;
941 }
942 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
943         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
944         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
945         uint64_t ret_ref = 0;
946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
948         return ret_ref;
949 }
950
951 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
952 CHECK(!owner->result_ok);
953         return DecodeError_clone(&*owner->contents.err);
954 }
955 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
956         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
957         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
958         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
959         uint64_t ret_ref = tag_ptr(ret_copy, true);
960         return ret_ref;
961 }
962
963 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
964         LDKHolderCommitmentTransaction ret = *owner->contents.result;
965         ret.is_owned = false;
966         return ret;
967 }
968 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
969         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
970         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
971         uint64_t ret_ref = 0;
972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
974         return ret_ref;
975 }
976
977 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
978 CHECK(!owner->result_ok);
979         return DecodeError_clone(&*owner->contents.err);
980 }
981 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
982         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
983         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
984         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
985         uint64_t ret_ref = tag_ptr(ret_copy, true);
986         return ret_ref;
987 }
988
989 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
990         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
991         ret.is_owned = false;
992         return ret;
993 }
994 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
995         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
996         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
997         uint64_t ret_ref = 0;
998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1000         return ret_ref;
1001 }
1002
1003 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1004 CHECK(!owner->result_ok);
1005         return DecodeError_clone(&*owner->contents.err);
1006 }
1007 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
1008         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1009         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1010         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1011         uint64_t ret_ref = tag_ptr(ret_copy, true);
1012         return ret_ref;
1013 }
1014
1015 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1016         LDKTrustedClosingTransaction ret = *owner->contents.result;
1017         ret.is_owned = false;
1018         return ret;
1019 }
1020 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
1021         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
1022         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
1023         uint64_t ret_ref = 0;
1024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1026         return ret_ref;
1027 }
1028
1029 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1030 CHECK(!owner->result_ok);
1031         return *owner->contents.err;
1032 }
1033 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
1034         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
1035         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
1036 }
1037
1038 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1039         LDKCommitmentTransaction ret = *owner->contents.result;
1040         ret.is_owned = false;
1041         return ret;
1042 }
1043 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
1044         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1045         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1046         uint64_t ret_ref = 0;
1047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1049         return ret_ref;
1050 }
1051
1052 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1053 CHECK(!owner->result_ok);
1054         return DecodeError_clone(&*owner->contents.err);
1055 }
1056 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
1057         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1058         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1059         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1060         uint64_t ret_ref = tag_ptr(ret_copy, true);
1061         return ret_ref;
1062 }
1063
1064 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1065         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
1066         ret.is_owned = false;
1067         return ret;
1068 }
1069 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
1070         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
1071         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
1072         uint64_t ret_ref = 0;
1073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1075         return ret_ref;
1076 }
1077
1078 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1079 CHECK(!owner->result_ok);
1080         return *owner->contents.err;
1081 }
1082 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
1083         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
1084         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
1085 }
1086
1087 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1088 CHECK(owner->result_ok);
1089         return *owner->contents.result;
1090 }
1091 ptrArray  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint64_t owner) {
1092         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1093         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
1094         ptrArray ret_arr = NULL;
1095         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1096         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1097         for (size_t m = 0; m < ret_var.datalen; m++) {
1098                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
1099                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1100                 ret_arr_ptr[m] = ret_conv_12_arr;
1101         }
1102         
1103         return ret_arr;
1104 }
1105
1106 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1107 CHECK(!owner->result_ok);
1108         return *owner->contents.err;
1109 }
1110 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint64_t owner) {
1111         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1112         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
1113 }
1114
1115 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1116         LDKShutdownScript ret = *owner->contents.result;
1117         ret.is_owned = false;
1118         return ret;
1119 }
1120 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
1121         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1122         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1123         uint64_t ret_ref = 0;
1124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1126         return ret_ref;
1127 }
1128
1129 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1130 CHECK(!owner->result_ok);
1131         return DecodeError_clone(&*owner->contents.err);
1132 }
1133 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
1134         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1135         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1136         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1137         uint64_t ret_ref = tag_ptr(ret_copy, true);
1138         return ret_ref;
1139 }
1140
1141 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1142         LDKShutdownScript ret = *owner->contents.result;
1143         ret.is_owned = false;
1144         return ret;
1145 }
1146 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
1147         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1148         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1149         uint64_t ret_ref = 0;
1150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1152         return ret_ref;
1153 }
1154
1155 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1156         LDKInvalidShutdownScript ret = *owner->contents.err;
1157         ret.is_owned = false;
1158         return ret;
1159 }
1160 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
1161         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1162         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1163         uint64_t ret_ref = 0;
1164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1166         return ret_ref;
1167 }
1168
1169 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1170         LDKBlindedPayInfo ret = *owner->contents.result;
1171         ret.is_owned = false;
1172         return ret;
1173 }
1174 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok(uint64_t owner) {
1175         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1176         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1177         uint64_t ret_ref = 0;
1178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1180         return ret_ref;
1181 }
1182
1183 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1184 CHECK(!owner->result_ok);
1185         return DecodeError_clone(&*owner->contents.err);
1186 }
1187 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_err(uint64_t owner) {
1188         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1189         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1190         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1191         uint64_t ret_ref = tag_ptr(ret_copy, true);
1192         return ret_ref;
1193 }
1194
1195 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1196         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1197         for (size_t i = 0; i < ret.datalen; i++) {
1198                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1199         }
1200         return ret;
1201 }
1202 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1203         LDKRoute ret = *owner->contents.result;
1204         ret.is_owned = false;
1205         return ret;
1206 }
1207 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
1208         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1209         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1210         uint64_t ret_ref = 0;
1211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1213         return ret_ref;
1214 }
1215
1216 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1217         LDKLightningError ret = *owner->contents.err;
1218         ret.is_owned = false;
1219         return ret;
1220 }
1221 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
1222         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1223         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1224         uint64_t ret_ref = 0;
1225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1227         return ret_ref;
1228 }
1229
1230 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
1231         LDKInFlightHtlcs ret = *owner->contents.result;
1232         ret.is_owned = false;
1233         return ret;
1234 }
1235 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
1236         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
1237         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
1238         uint64_t ret_ref = 0;
1239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1241         return ret_ref;
1242 }
1243
1244 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
1245 CHECK(!owner->result_ok);
1246         return DecodeError_clone(&*owner->contents.err);
1247 }
1248 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
1249         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
1250         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1251         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
1252         uint64_t ret_ref = tag_ptr(ret_copy, true);
1253         return ret_ref;
1254 }
1255
1256 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1257         LDKRouteHop ret = *owner->contents.result;
1258         ret.is_owned = false;
1259         return ret;
1260 }
1261 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
1262         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1263         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1264         uint64_t ret_ref = 0;
1265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1267         return ret_ref;
1268 }
1269
1270 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1271 CHECK(!owner->result_ok);
1272         return DecodeError_clone(&*owner->contents.err);
1273 }
1274 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
1275         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1276         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1277         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1278         uint64_t ret_ref = tag_ptr(ret_copy, true);
1279         return ret_ref;
1280 }
1281
1282 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
1283         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
1284         for (size_t i = 0; i < ret.datalen; i++) {
1285                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
1286         }
1287         return ret;
1288 }
1289 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
1290         LDKBlindedTail ret = *owner->contents.result;
1291         ret.is_owned = false;
1292         return ret;
1293 }
1294 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_ok"))) TS_CResult_BlindedTailDecodeErrorZ_get_ok(uint64_t owner) {
1295         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
1296         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
1297         uint64_t ret_ref = 0;
1298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1300         return ret_ref;
1301 }
1302
1303 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
1304 CHECK(!owner->result_ok);
1305         return DecodeError_clone(&*owner->contents.err);
1306 }
1307 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_err"))) TS_CResult_BlindedTailDecodeErrorZ_get_err(uint64_t owner) {
1308         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
1309         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1310         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
1311         uint64_t ret_ref = tag_ptr(ret_copy, true);
1312         return ret_ref;
1313 }
1314
1315 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1316         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1317         for (size_t i = 0; i < ret.datalen; i++) {
1318                 ret.data[i] = RouteHop_clone(&orig->data[i]);
1319         }
1320         return ret;
1321 }
1322 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
1323         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
1324         for (size_t i = 0; i < ret.datalen; i++) {
1325                 ret.data[i] = Path_clone(&orig->data[i]);
1326         }
1327         return ret;
1328 }
1329 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1330         LDKRoute ret = *owner->contents.result;
1331         ret.is_owned = false;
1332         return ret;
1333 }
1334 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
1335         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1336         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1337         uint64_t ret_ref = 0;
1338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1340         return ret_ref;
1341 }
1342
1343 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1344 CHECK(!owner->result_ok);
1345         return DecodeError_clone(&*owner->contents.err);
1346 }
1347 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
1348         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1349         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1350         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1351         uint64_t ret_ref = tag_ptr(ret_copy, true);
1352         return ret_ref;
1353 }
1354
1355 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1356         LDKRouteParameters ret = *owner->contents.result;
1357         ret.is_owned = false;
1358         return ret;
1359 }
1360 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
1361         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1362         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1363         uint64_t ret_ref = 0;
1364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1366         return ret_ref;
1367 }
1368
1369 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1370 CHECK(!owner->result_ok);
1371         return DecodeError_clone(&*owner->contents.err);
1372 }
1373 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
1374         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1375         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1376         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1377         uint64_t ret_ref = tag_ptr(ret_copy, true);
1378         return ret_ref;
1379 }
1380
1381 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1382         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1383         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1384         return ret;
1385 }
1386 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1387         LDKPaymentParameters ret = *owner->contents.result;
1388         ret.is_owned = false;
1389         return ret;
1390 }
1391 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
1392         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1393         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1394         uint64_t ret_ref = 0;
1395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1397         return ret_ref;
1398 }
1399
1400 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1401 CHECK(!owner->result_ok);
1402         return DecodeError_clone(&*owner->contents.err);
1403 }
1404 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
1405         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1406         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1407         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1408         uint64_t ret_ref = tag_ptr(ret_copy, true);
1409         return ret_ref;
1410 }
1411
1412 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
1413         LDKBlindedPayInfo ret = owner->a;
1414         ret.is_owned = false;
1415         return ret;
1416 }
1417 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a(uint64_t owner) {
1418         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
1419         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
1420         uint64_t ret_ref = 0;
1421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1423         return ret_ref;
1424 }
1425
1426 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
1427         LDKBlindedPath ret = owner->b;
1428         ret.is_owned = false;
1429         return ret;
1430 }
1431 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b(uint64_t owner) {
1432         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
1433         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
1434         uint64_t ret_ref = 0;
1435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1437         return ret_ref;
1438 }
1439
1440 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
1441         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
1442         for (size_t i = 0; i < ret.datalen; i++) {
1443                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
1444         }
1445         return ret;
1446 }
1447 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1448         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1449         for (size_t i = 0; i < ret.datalen; i++) {
1450                 ret.data[i] = RouteHint_clone(&orig->data[i]);
1451         }
1452         return ret;
1453 }
1454 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1455         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1456         for (size_t i = 0; i < ret.datalen; i++) {
1457                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1458         }
1459         return ret;
1460 }
1461 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1462         LDKRouteHint ret = *owner->contents.result;
1463         ret.is_owned = false;
1464         return ret;
1465 }
1466 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
1467         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1468         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1469         uint64_t ret_ref = 0;
1470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1472         return ret_ref;
1473 }
1474
1475 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1476 CHECK(!owner->result_ok);
1477         return DecodeError_clone(&*owner->contents.err);
1478 }
1479 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
1480         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1481         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1482         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1483         uint64_t ret_ref = tag_ptr(ret_copy, true);
1484         return ret_ref;
1485 }
1486
1487 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1488         LDKRouteHintHop ret = *owner->contents.result;
1489         ret.is_owned = false;
1490         return ret;
1491 }
1492 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
1493         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1494         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1495         uint64_t ret_ref = 0;
1496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1498         return ret_ref;
1499 }
1500
1501 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1502 CHECK(!owner->result_ok);
1503         return DecodeError_clone(&*owner->contents.err);
1504 }
1505 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
1506         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1507         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1508         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1509         uint64_t ret_ref = tag_ptr(ret_copy, true);
1510         return ret_ref;
1511 }
1512
1513 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1514         return owner->a;
1515 }
1516 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
1517         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
1518         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
1519         return ret_conv;
1520 }
1521
1522 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1523         return owner->b;
1524 }
1525 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
1526         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
1527         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
1528         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1529         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1530         return ret_arr;
1531 }
1532
1533 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1534         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1535         for (size_t i = 0; i < ret.datalen; i++) {
1536                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1537         }
1538         return ret;
1539 }
1540 static inline struct LDKThirtyTwoBytes C2Tuple_TxidBlockHashZ_get_a(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR owner){
1541         return ThirtyTwoBytes_clone(&owner->a);
1542 }
1543 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_get_a"))) TS_C2Tuple_TxidBlockHashZ_get_a(uint64_t owner) {
1544         LDKC2Tuple_TxidBlockHashZ* owner_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(owner);
1545         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1546         memcpy(ret_arr->elems, C2Tuple_TxidBlockHashZ_get_a(owner_conv).data, 32);
1547         return ret_arr;
1548 }
1549
1550 static inline struct LDKThirtyTwoBytes C2Tuple_TxidBlockHashZ_get_b(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR owner){
1551         return ThirtyTwoBytes_clone(&owner->b);
1552 }
1553 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_get_b"))) TS_C2Tuple_TxidBlockHashZ_get_b(uint64_t owner) {
1554         LDKC2Tuple_TxidBlockHashZ* owner_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(owner);
1555         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1556         memcpy(ret_arr->elems, C2Tuple_TxidBlockHashZ_get_b(owner_conv).data, 32);
1557         return ret_arr;
1558 }
1559
1560 static inline LDKCVec_C2Tuple_TxidBlockHashZZ CVec_C2Tuple_TxidBlockHashZZ_clone(const LDKCVec_C2Tuple_TxidBlockHashZZ *orig) {
1561         LDKCVec_C2Tuple_TxidBlockHashZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ) * orig->datalen, "LDKCVec_C2Tuple_TxidBlockHashZZ clone bytes"), .datalen = orig->datalen };
1562         for (size_t i = 0; i < ret.datalen; i++) {
1563                 ret.data[i] = C2Tuple_TxidBlockHashZ_clone(&orig->data[i]);
1564         }
1565         return ret;
1566 }
1567 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
1568         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
1569         switch(obj->tag) {
1570                 case LDKMonitorEvent_HTLCEvent: return 0;
1571                 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
1572                 case LDKMonitorEvent_Completed: return 2;
1573                 case LDKMonitorEvent_UpdateFailed: return 3;
1574                 default: abort();
1575         }
1576 }
1577 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
1578         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
1579         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
1580                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1581                         uint64_t htlc_event_ref = 0;
1582                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
1583                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
1584         return htlc_event_ref;
1585 }
1586 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint64_t ptr) {
1587         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
1588         assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
1589                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
1590                         uint64_t commitment_tx_confirmed_ref = 0;
1591                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
1592                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
1593         return commitment_tx_confirmed_ref;
1594 }
1595 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
1596         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
1597         assert(obj->tag == LDKMonitorEvent_Completed);
1598                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
1599                         uint64_t funding_txo_ref = 0;
1600                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
1601                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
1602         return funding_txo_ref;
1603 }
1604 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
1605         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
1606         assert(obj->tag == LDKMonitorEvent_Completed);
1607                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
1608         return monitor_update_id_conv;
1609 }
1610 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint64_t ptr) {
1611         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
1612         assert(obj->tag == LDKMonitorEvent_UpdateFailed);
1613                         LDKOutPoint update_failed_var = obj->update_failed;
1614                         uint64_t update_failed_ref = 0;
1615                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
1616                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
1617         return update_failed_ref;
1618 }
1619 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1620         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1621         for (size_t i = 0; i < ret.datalen; i++) {
1622                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1623         }
1624         return ret;
1625 }
1626 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
1627         LDKOutPoint ret = owner->a;
1628         ret.is_owned = false;
1629         return ret;
1630 }
1631 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
1632         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
1633         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
1634         uint64_t ret_ref = 0;
1635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1637         return ret_ref;
1638 }
1639
1640 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
1641         return CVec_MonitorEventZ_clone(&owner->b);
1642 }
1643 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
1644         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
1645         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
1646         uint64_tArray ret_arr = NULL;
1647         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
1648         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
1649         for (size_t o = 0; o < ret_var.datalen; o++) {
1650                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
1651                 *ret_conv_14_copy = ret_var.data[o];
1652                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
1653                 ret_arr_ptr[o] = ret_conv_14_ref;
1654         }
1655         
1656         FREE(ret_var.data);
1657         return ret_arr;
1658 }
1659
1660 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
1661         return owner->c;
1662 }
1663 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
1664         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
1665         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1666         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
1667         return ret_arr;
1668 }
1669
1670 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
1671         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
1672         for (size_t i = 0; i < ret.datalen; i++) {
1673                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
1674         }
1675         return ret;
1676 }
1677 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
1678         LDKFixedPenaltyScorer ret = *owner->contents.result;
1679         ret.is_owned = false;
1680         return ret;
1681 }
1682 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
1683         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
1684         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
1685         uint64_t ret_ref = 0;
1686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1688         return ret_ref;
1689 }
1690
1691 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
1692 CHECK(!owner->result_ok);
1693         return DecodeError_clone(&*owner->contents.err);
1694 }
1695 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
1696         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
1697         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1698         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
1699         uint64_t ret_ref = tag_ptr(ret_copy, true);
1700         return ret_ref;
1701 }
1702
1703 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
1704         return owner->a;
1705 }
1706 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
1707         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
1708         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
1709         return ret_conv;
1710 }
1711
1712 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
1713         return owner->b;
1714 }
1715 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
1716         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
1717         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
1718         return ret_conv;
1719 }
1720
1721 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
1722         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
1723         switch(obj->tag) {
1724                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
1725                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
1726                 default: abort();
1727         }
1728 }
1729 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
1730         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
1731         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
1732                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1733                         *some_conv = obj->some;
1734                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
1735         return tag_ptr(some_conv, true);
1736 }
1737 static inline struct LDKEightU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
1738         return owner->a;
1739 }
1740 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_a"))) TS_C2Tuple_Z_get_a(uint64_t owner) {
1741         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
1742         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
1743         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 8 * 2);
1744         return ret_arr;
1745 }
1746
1747 static inline struct LDKEightU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
1748         return owner->b;
1749 }
1750 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_b"))) TS_C2Tuple_Z_get_b(uint64_t owner) {
1751         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
1752         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
1753         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 8 * 2);
1754         return ret_arr;
1755 }
1756
1757 static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_a(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){
1758         return owner->a;
1759 }
1760 int16_tArray  __attribute__((export_name("TS_C2Tuple__u168_u168Z_get_a"))) TS_C2Tuple__u168_u168Z_get_a(uint64_t owner) {
1761         LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner);
1762         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
1763         memcpy(ret_arr->elems, C2Tuple__u168_u168Z_get_a(owner_conv).data, 8 * 2);
1764         return ret_arr;
1765 }
1766
1767 static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_b(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){
1768         return owner->b;
1769 }
1770 int16_tArray  __attribute__((export_name("TS_C2Tuple__u168_u168Z_get_b"))) TS_C2Tuple__u168_u168Z_get_b(uint64_t owner) {
1771         LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner);
1772         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
1773         memcpy(ret_arr->elems, C2Tuple__u168_u168Z_get_b(owner_conv).data, 8 * 2);
1774         return ret_arr;
1775 }
1776
1777 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_ty_from_ptr(uint64_t ptr) {
1778         LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr);
1779         switch(obj->tag) {
1780                 case LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some: return 0;
1781                 case LDKCOption_C2Tuple_EightU16sEightU16sZZ_None: return 1;
1782                 default: abort();
1783         }
1784 }
1785 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_get_some(uint64_t ptr) {
1786         LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr);
1787         assert(obj->tag == LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some);
1788                         LDKC2Tuple__u168_u168Z* some_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
1789                         *some_conv = obj->some;
1790                         *some_conv = C2Tuple__u168_u168Z_clone(some_conv);
1791         return tag_ptr(some_conv, true);
1792 }
1793 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
1794         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
1795         for (size_t i = 0; i < ret.datalen; i++) {
1796                 ret.data[i] = NodeId_clone(&orig->data[i]);
1797         }
1798         return ret;
1799 }
1800 typedef struct LDKLogger_JCalls {
1801         atomic_size_t refcnt;
1802         uint32_t instance_ptr;
1803 } LDKLogger_JCalls;
1804 static void LDKLogger_JCalls_free(void* this_arg) {
1805         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1806         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1807                 FREE(j_calls);
1808         }
1809 }
1810 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
1811         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1812         LDKRecord record_var = *record;
1813         uint64_t record_ref = 0;
1814         record_var = Record_clone(&record_var);
1815         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
1816         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
1817         js_invoke_function_buuuuu(j_calls->instance_ptr, 0, record_ref, 0, 0, 0, 0, 0);
1818 }
1819 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
1820         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
1821         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1822 }
1823 static inline LDKLogger LDKLogger_init (JSValue o) {
1824         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1825         atomic_init(&calls->refcnt, 1);
1826         calls->instance_ptr = o;
1827
1828         LDKLogger ret = {
1829                 .this_arg = (void*) calls,
1830                 .log = log_LDKLogger_jcall,
1831                 .free = LDKLogger_JCalls_free,
1832         };
1833         return ret;
1834 }
1835 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
1836         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1837         *res_ptr = LDKLogger_init(o);
1838         return tag_ptr(res_ptr, true);
1839 }
1840 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
1841         LDKProbabilisticScorer ret = *owner->contents.result;
1842         ret.is_owned = false;
1843         return ret;
1844 }
1845 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
1846         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
1847         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
1848         uint64_t ret_ref = 0;
1849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1851         return ret_ref;
1852 }
1853
1854 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
1855 CHECK(!owner->result_ok);
1856         return DecodeError_clone(&*owner->contents.err);
1857 }
1858 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
1859         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
1860         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1861         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
1862         uint64_t ret_ref = tag_ptr(ret_copy, true);
1863         return ret_ref;
1864 }
1865
1866 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
1867         LDKInitFeatures ret = *owner->contents.result;
1868         ret.is_owned = false;
1869         return ret;
1870 }
1871 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
1872         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
1873         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
1874         uint64_t ret_ref = 0;
1875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1877         return ret_ref;
1878 }
1879
1880 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
1881 CHECK(!owner->result_ok);
1882         return DecodeError_clone(&*owner->contents.err);
1883 }
1884 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
1885         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
1886         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1887         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
1888         uint64_t ret_ref = tag_ptr(ret_copy, true);
1889         return ret_ref;
1890 }
1891
1892 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
1893         LDKChannelFeatures ret = *owner->contents.result;
1894         ret.is_owned = false;
1895         return ret;
1896 }
1897 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
1898         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
1899         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
1900         uint64_t ret_ref = 0;
1901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1903         return ret_ref;
1904 }
1905
1906 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
1907 CHECK(!owner->result_ok);
1908         return DecodeError_clone(&*owner->contents.err);
1909 }
1910 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
1911         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
1912         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1913         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
1914         uint64_t ret_ref = tag_ptr(ret_copy, true);
1915         return ret_ref;
1916 }
1917
1918 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
1919         LDKNodeFeatures ret = *owner->contents.result;
1920         ret.is_owned = false;
1921         return ret;
1922 }
1923 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
1924         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
1925         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
1926         uint64_t ret_ref = 0;
1927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1929         return ret_ref;
1930 }
1931
1932 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
1933 CHECK(!owner->result_ok);
1934         return DecodeError_clone(&*owner->contents.err);
1935 }
1936 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
1937         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
1938         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1939         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
1940         uint64_t ret_ref = tag_ptr(ret_copy, true);
1941         return ret_ref;
1942 }
1943
1944 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
1945         LDKInvoiceFeatures ret = *owner->contents.result;
1946         ret.is_owned = false;
1947         return ret;
1948 }
1949 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
1950         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
1951         LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
1952         uint64_t ret_ref = 0;
1953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1955         return ret_ref;
1956 }
1957
1958 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
1959 CHECK(!owner->result_ok);
1960         return DecodeError_clone(&*owner->contents.err);
1961 }
1962 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
1963         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
1964         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1965         *ret_copy = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
1966         uint64_t ret_ref = tag_ptr(ret_copy, true);
1967         return ret_ref;
1968 }
1969
1970 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
1971         LDKBlindedHopFeatures ret = *owner->contents.result;
1972         ret.is_owned = false;
1973         return ret;
1974 }
1975 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
1976         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
1977         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
1978         uint64_t ret_ref = 0;
1979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1981         return ret_ref;
1982 }
1983
1984 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
1985 CHECK(!owner->result_ok);
1986         return DecodeError_clone(&*owner->contents.err);
1987 }
1988 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(uint64_t owner) {
1989         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
1990         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1991         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
1992         uint64_t ret_ref = tag_ptr(ret_copy, true);
1993         return ret_ref;
1994 }
1995
1996 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
1997         LDKChannelTypeFeatures ret = *owner->contents.result;
1998         ret.is_owned = false;
1999         return ret;
2000 }
2001 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2002         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
2003         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
2004         uint64_t ret_ref = 0;
2005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2007         return ret_ref;
2008 }
2009
2010 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2011 CHECK(!owner->result_ok);
2012         return DecodeError_clone(&*owner->contents.err);
2013 }
2014 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2015         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
2016         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2017         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
2018         uint64_t ret_ref = tag_ptr(ret_copy, true);
2019         return ret_ref;
2020 }
2021
2022 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
2023         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
2024         switch(obj->tag) {
2025                 case LDKPaymentPurpose_InvoicePayment: return 0;
2026                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
2027                 default: abort();
2028         }
2029 }
2030 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
2031         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
2032         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
2033                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
2034                         memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
2035         return payment_preimage_arr;
2036 }
2037 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
2038         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
2039         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
2040                         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
2041                         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
2042         return payment_secret_arr;
2043 }
2044 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
2045         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
2046         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
2047                         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
2048                         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
2049         return spontaneous_payment_arr;
2050 }
2051 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
2052 CHECK(owner->result_ok);
2053         return PaymentPurpose_clone(&*owner->contents.result);
2054 }
2055 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
2056         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
2057         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
2058         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
2059         uint64_t ret_ref = tag_ptr(ret_copy, true);
2060         return ret_ref;
2061 }
2062
2063 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
2064 CHECK(!owner->result_ok);
2065         return DecodeError_clone(&*owner->contents.err);
2066 }
2067 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
2068         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
2069         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2070         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
2071         uint64_t ret_ref = tag_ptr(ret_copy, true);
2072         return ret_ref;
2073 }
2074
2075 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
2076         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
2077         switch(obj->tag) {
2078                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
2079                 case LDKNetworkUpdate_ChannelFailure: return 1;
2080                 case LDKNetworkUpdate_NodeFailure: return 2;
2081                 default: abort();
2082         }
2083 }
2084 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
2085         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
2086         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
2087                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
2088                         uint64_t msg_ref = 0;
2089                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2090                         msg_ref = tag_ptr(msg_var.inner, false);
2091         return msg_ref;
2092 }
2093 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
2094         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
2095         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
2096                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
2097         return short_channel_id_conv;
2098 }
2099 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
2100         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
2101         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
2102                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
2103         return is_permanent_conv;
2104 }
2105 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
2106         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
2107         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
2108                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2109                         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
2110         return node_id_arr;
2111 }
2112 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
2113         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
2114         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
2115                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
2116         return is_permanent_conv;
2117 }
2118 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
2119         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
2120         switch(obj->tag) {
2121                 case LDKCOption_NetworkUpdateZ_Some: return 0;
2122                 case LDKCOption_NetworkUpdateZ_None: return 1;
2123                 default: abort();
2124         }
2125 }
2126 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
2127         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
2128         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
2129                         uint64_t some_ref = tag_ptr(&obj->some, false);
2130         return some_ref;
2131 }
2132 uint32_t __attribute__((export_name("TS_LDKPathFailure_ty_from_ptr"))) TS_LDKPathFailure_ty_from_ptr(uint64_t ptr) {
2133         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
2134         switch(obj->tag) {
2135                 case LDKPathFailure_InitialSend: return 0;
2136                 case LDKPathFailure_OnPath: return 1;
2137                 default: abort();
2138         }
2139 }
2140 uint64_t __attribute__((export_name("TS_LDKPathFailure_InitialSend_get_err"))) TS_LDKPathFailure_InitialSend_get_err(uint64_t ptr) {
2141         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
2142         assert(obj->tag == LDKPathFailure_InitialSend);
2143                         uint64_t err_ref = tag_ptr(&obj->initial_send.err, false);
2144         return err_ref;
2145 }
2146 uint64_t __attribute__((export_name("TS_LDKPathFailure_OnPath_get_network_update"))) TS_LDKPathFailure_OnPath_get_network_update(uint64_t ptr) {
2147         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
2148         assert(obj->tag == LDKPathFailure_OnPath);
2149                         uint64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
2150         return network_update_ref;
2151 }
2152 uint32_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_ty_from_ptr"))) TS_LDKCOption_PathFailureZ_ty_from_ptr(uint64_t ptr) {
2153         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
2154         switch(obj->tag) {
2155                 case LDKCOption_PathFailureZ_Some: return 0;
2156                 case LDKCOption_PathFailureZ_None: return 1;
2157                 default: abort();
2158         }
2159 }
2160 uint64_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_Some_get_some"))) TS_LDKCOption_PathFailureZ_Some_get_some(uint64_t ptr) {
2161         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
2162         assert(obj->tag == LDKCOption_PathFailureZ_Some);
2163                         uint64_t some_ref = tag_ptr(&obj->some, false);
2164         return some_ref;
2165 }
2166 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
2167 CHECK(owner->result_ok);
2168         return COption_PathFailureZ_clone(&*owner->contents.result);
2169 }
2170 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok(uint64_t owner) {
2171         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
2172         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
2173         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
2174         uint64_t ret_ref = tag_ptr(ret_copy, true);
2175         return ret_ref;
2176 }
2177
2178 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
2179 CHECK(!owner->result_ok);
2180         return DecodeError_clone(&*owner->contents.err);
2181 }
2182 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_err(uint64_t owner) {
2183         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
2184         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2185         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
2186         uint64_t ret_ref = tag_ptr(ret_copy, true);
2187         return ret_ref;
2188 }
2189
2190 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
2191         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
2192         switch(obj->tag) {
2193                 case LDKClosureReason_CounterpartyForceClosed: return 0;
2194                 case LDKClosureReason_HolderForceClosed: return 1;
2195                 case LDKClosureReason_CooperativeClosure: return 2;
2196                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
2197                 case LDKClosureReason_FundingTimedOut: return 4;
2198                 case LDKClosureReason_ProcessingError: return 5;
2199                 case LDKClosureReason_DisconnectedPeer: return 6;
2200                 case LDKClosureReason_OutdatedChannelManager: return 7;
2201                 default: abort();
2202         }
2203 }
2204 uint64_t __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
2205         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
2206         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
2207                         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
2208                         uint64_t peer_msg_ref = 0;
2209                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
2210                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
2211         return peer_msg_ref;
2212 }
2213 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
2214         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
2215         assert(obj->tag == LDKClosureReason_ProcessingError);
2216                         LDKStr err_str = obj->processing_error.err;
2217                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2218         return err_conv;
2219 }
2220 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
2221         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
2222         switch(obj->tag) {
2223                 case LDKCOption_ClosureReasonZ_Some: return 0;
2224                 case LDKCOption_ClosureReasonZ_None: return 1;
2225                 default: abort();
2226         }
2227 }
2228 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
2229         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
2230         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
2231                         uint64_t some_ref = tag_ptr(&obj->some, false);
2232         return some_ref;
2233 }
2234 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2235 CHECK(owner->result_ok);
2236         return COption_ClosureReasonZ_clone(&*owner->contents.result);
2237 }
2238 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
2239         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
2240         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
2241         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
2242         uint64_t ret_ref = tag_ptr(ret_copy, true);
2243         return ret_ref;
2244 }
2245
2246 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2247 CHECK(!owner->result_ok);
2248         return DecodeError_clone(&*owner->contents.err);
2249 }
2250 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
2251         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
2252         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2253         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
2254         uint64_t ret_ref = tag_ptr(ret_copy, true);
2255         return ret_ref;
2256 }
2257
2258 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
2259         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
2260         switch(obj->tag) {
2261                 case LDKHTLCDestination_NextHopChannel: return 0;
2262                 case LDKHTLCDestination_UnknownNextHop: return 1;
2263                 case LDKHTLCDestination_InvalidForward: return 2;
2264                 case LDKHTLCDestination_FailedPayment: return 3;
2265                 default: abort();
2266         }
2267 }
2268 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
2269         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
2270         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
2271                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2272                         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
2273         return node_id_arr;
2274 }
2275 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
2276         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
2277         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
2278                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2279                         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
2280         return channel_id_arr;
2281 }
2282 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
2283         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
2284         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
2285                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
2286         return requested_forward_scid_conv;
2287 }
2288 int64_t __attribute__((export_name("TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid"))) TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(uint64_t ptr) {
2289         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
2290         assert(obj->tag == LDKHTLCDestination_InvalidForward);
2291                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
2292         return requested_forward_scid_conv;
2293 }
2294 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
2295         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
2296         assert(obj->tag == LDKHTLCDestination_FailedPayment);
2297                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2298                         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
2299         return payment_hash_arr;
2300 }
2301 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
2302         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
2303         switch(obj->tag) {
2304                 case LDKCOption_HTLCDestinationZ_Some: return 0;
2305                 case LDKCOption_HTLCDestinationZ_None: return 1;
2306                 default: abort();
2307         }
2308 }
2309 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
2310         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
2311         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
2312                         uint64_t some_ref = tag_ptr(&obj->some, false);
2313         return some_ref;
2314 }
2315 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
2316 CHECK(owner->result_ok);
2317         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
2318 }
2319 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
2320         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
2321         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
2322         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_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_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *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_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
2332         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
2333         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2334         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
2335         uint64_t ret_ref = tag_ptr(ret_copy, true);
2336         return ret_ref;
2337 }
2338
2339 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
2340 CHECK(owner->result_ok);
2341         return PaymentFailureReason_clone(&*owner->contents.result);
2342 }
2343 uint32_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok(uint64_t owner) {
2344         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
2345         uint32_t ret_conv = LDKPaymentFailureReason_to_js(CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
2346         return ret_conv;
2347 }
2348
2349 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
2350 CHECK(!owner->result_ok);
2351         return DecodeError_clone(&*owner->contents.err);
2352 }
2353 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err(uint64_t owner) {
2354         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
2355         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2356         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
2357         uint64_t ret_ref = tag_ptr(ret_copy, true);
2358         return ret_ref;
2359 }
2360
2361 uint32_t __attribute__((export_name("TS_LDKCOption_u128Z_ty_from_ptr"))) TS_LDKCOption_u128Z_ty_from_ptr(uint64_t ptr) {
2362         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
2363         switch(obj->tag) {
2364                 case LDKCOption_u128Z_Some: return 0;
2365                 case LDKCOption_u128Z_None: return 1;
2366                 default: abort();
2367         }
2368 }
2369 int8_tArray __attribute__((export_name("TS_LDKCOption_u128Z_Some_get_some"))) TS_LDKCOption_u128Z_Some_get_some(uint64_t ptr) {
2370         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
2371         assert(obj->tag == LDKCOption_u128Z_Some);
2372                         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
2373                         memcpy(some_arr->elems, obj->some.le_bytes, 16);
2374         return some_arr;
2375 }
2376 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr"))) TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr(uint64_t ptr) {
2377         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
2378         switch(obj->tag) {
2379                 case LDKCOption_PaymentFailureReasonZ_Some: return 0;
2380                 case LDKCOption_PaymentFailureReasonZ_None: return 1;
2381                 default: abort();
2382         }
2383 }
2384 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_Some_get_some"))) TS_LDKCOption_PaymentFailureReasonZ_Some_get_some(uint64_t ptr) {
2385         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
2386         assert(obj->tag == LDKCOption_PaymentFailureReasonZ_Some);
2387                         uint32_t some_conv = LDKPaymentFailureReason_to_js(obj->some);
2388         return some_conv;
2389 }
2390 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
2391         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2392         switch(obj->tag) {
2393                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
2394                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
2395                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
2396                 default: abort();
2397         }
2398 }
2399 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
2400         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2401         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
2402                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
2403                         uint64_t outpoint_ref = 0;
2404                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2405                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
2406         return outpoint_ref;
2407 }
2408 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
2409         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2410         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
2411                         LDKTxOut* output_ref = &obj->static_output.output;
2412         return tag_ptr(output_ref, false);
2413 }
2414 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
2415         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2416         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
2417                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2418                         uint64_t delayed_payment_output_ref = 0;
2419                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2420                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
2421         return delayed_payment_output_ref;
2422 }
2423 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
2424         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2425         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
2426                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2427                         uint64_t static_payment_output_ref = 0;
2428                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2429                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
2430         return static_payment_output_ref;
2431 }
2432 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2433         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2434         for (size_t i = 0; i < ret.datalen; i++) {
2435                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2436         }
2437         return ret;
2438 }
2439 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
2440         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2441         switch(obj->tag) {
2442                 case LDKEvent_FundingGenerationReady: return 0;
2443                 case LDKEvent_PaymentClaimable: return 1;
2444                 case LDKEvent_PaymentClaimed: return 2;
2445                 case LDKEvent_PaymentSent: return 3;
2446                 case LDKEvent_PaymentFailed: return 4;
2447                 case LDKEvent_PaymentPathSuccessful: return 5;
2448                 case LDKEvent_PaymentPathFailed: return 6;
2449                 case LDKEvent_ProbeSuccessful: return 7;
2450                 case LDKEvent_ProbeFailed: return 8;
2451                 case LDKEvent_PendingHTLCsForwardable: return 9;
2452                 case LDKEvent_HTLCIntercepted: return 10;
2453                 case LDKEvent_SpendableOutputs: return 11;
2454                 case LDKEvent_PaymentForwarded: return 12;
2455                 case LDKEvent_ChannelPending: return 13;
2456                 case LDKEvent_ChannelReady: return 14;
2457                 case LDKEvent_ChannelClosed: return 15;
2458                 case LDKEvent_DiscardFunding: return 16;
2459                 case LDKEvent_OpenChannelRequest: return 17;
2460                 case LDKEvent_HTLCHandlingFailed: return 18;
2461                 default: abort();
2462         }
2463 }
2464 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
2465         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2466         assert(obj->tag == LDKEvent_FundingGenerationReady);
2467                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
2468                         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
2469         return temporary_channel_id_arr;
2470 }
2471 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
2472         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2473         assert(obj->tag == LDKEvent_FundingGenerationReady);
2474                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
2475                         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
2476         return counterparty_node_id_arr;
2477 }
2478 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
2479         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2480         assert(obj->tag == LDKEvent_FundingGenerationReady);
2481                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
2482         return channel_value_satoshis_conv;
2483 }
2484 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
2485         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2486         assert(obj->tag == LDKEvent_FundingGenerationReady);
2487                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
2488                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
2489                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
2490         return output_script_arr;
2491 }
2492 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
2493         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2494         assert(obj->tag == LDKEvent_FundingGenerationReady);
2495                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
2496                         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
2497         return user_channel_id_arr;
2498 }
2499 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimable_get_receiver_node_id(uint64_t ptr) {
2500         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2501         assert(obj->tag == LDKEvent_PaymentClaimable);
2502                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
2503                         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
2504         return receiver_node_id_arr;
2505 }
2506 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_payment_hash"))) TS_LDKEvent_PaymentClaimable_get_payment_hash(uint64_t ptr) {
2507         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2508         assert(obj->tag == LDKEvent_PaymentClaimable);
2509                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2510                         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
2511         return payment_hash_arr;
2512 }
2513 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_onion_fields"))) TS_LDKEvent_PaymentClaimable_get_onion_fields(uint64_t ptr) {
2514         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2515         assert(obj->tag == LDKEvent_PaymentClaimable);
2516                         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
2517                         uint64_t onion_fields_ref = 0;
2518                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
2519                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
2520         return onion_fields_ref;
2521 }
2522 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_amount_msat"))) TS_LDKEvent_PaymentClaimable_get_amount_msat(uint64_t ptr) {
2523         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2524         assert(obj->tag == LDKEvent_PaymentClaimable);
2525                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
2526         return amount_msat_conv;
2527 }
2528 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_purpose"))) TS_LDKEvent_PaymentClaimable_get_purpose(uint64_t ptr) {
2529         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2530         assert(obj->tag == LDKEvent_PaymentClaimable);
2531                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
2532         return purpose_ref;
2533 }
2534 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_channel_id(uint64_t ptr) {
2535         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2536         assert(obj->tag == LDKEvent_PaymentClaimable);
2537                         int8_tArray via_channel_id_arr = init_int8_tArray(32, __LINE__);
2538                         memcpy(via_channel_id_arr->elems, obj->payment_claimable.via_channel_id.data, 32);
2539         return via_channel_id_arr;
2540 }
2541 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_user_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_user_channel_id(uint64_t ptr) {
2542         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2543         assert(obj->tag == LDKEvent_PaymentClaimable);
2544                         uint64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
2545         return via_user_channel_id_ref;
2546 }
2547 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_claim_deadline"))) TS_LDKEvent_PaymentClaimable_get_claim_deadline(uint64_t ptr) {
2548         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2549         assert(obj->tag == LDKEvent_PaymentClaimable);
2550                         uint64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
2551         return claim_deadline_ref;
2552 }
2553 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimed_get_receiver_node_id(uint64_t ptr) {
2554         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2555         assert(obj->tag == LDKEvent_PaymentClaimed);
2556                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
2557                         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
2558         return receiver_node_id_arr;
2559 }
2560 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
2561         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2562         assert(obj->tag == LDKEvent_PaymentClaimed);
2563                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2564                         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
2565         return payment_hash_arr;
2566 }
2567 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
2568         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2569         assert(obj->tag == LDKEvent_PaymentClaimed);
2570                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
2571         return amount_msat_conv;
2572 }
2573 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
2574         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2575         assert(obj->tag == LDKEvent_PaymentClaimed);
2576                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
2577         return purpose_ref;
2578 }
2579 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
2580         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2581         assert(obj->tag == LDKEvent_PaymentSent);
2582                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
2583                         memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
2584         return payment_id_arr;
2585 }
2586 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
2587         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2588         assert(obj->tag == LDKEvent_PaymentSent);
2589                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
2590                         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
2591         return payment_preimage_arr;
2592 }
2593 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
2594         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2595         assert(obj->tag == LDKEvent_PaymentSent);
2596                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2597                         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
2598         return payment_hash_arr;
2599 }
2600 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
2601         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2602         assert(obj->tag == LDKEvent_PaymentSent);
2603                         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
2604         return fee_paid_msat_ref;
2605 }
2606 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
2607         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2608         assert(obj->tag == LDKEvent_PaymentFailed);
2609                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
2610                         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
2611         return payment_id_arr;
2612 }
2613 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
2614         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2615         assert(obj->tag == LDKEvent_PaymentFailed);
2616                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2617                         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
2618         return payment_hash_arr;
2619 }
2620 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_reason"))) TS_LDKEvent_PaymentFailed_get_reason(uint64_t ptr) {
2621         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2622         assert(obj->tag == LDKEvent_PaymentFailed);
2623                         uint64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
2624         return reason_ref;
2625 }
2626 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
2627         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2628         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
2629                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
2630                         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
2631         return payment_id_arr;
2632 }
2633 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
2634         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2635         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
2636                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2637                         memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
2638         return payment_hash_arr;
2639 }
2640 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
2641         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2642         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
2643                         LDKPath path_var = obj->payment_path_successful.path;
2644                         uint64_t path_ref = 0;
2645                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2646                         path_ref = tag_ptr(path_var.inner, false);
2647         return path_ref;
2648 }
2649 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
2650         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2651         assert(obj->tag == LDKEvent_PaymentPathFailed);
2652                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
2653                         memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
2654         return payment_id_arr;
2655 }
2656 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
2657         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2658         assert(obj->tag == LDKEvent_PaymentPathFailed);
2659                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2660                         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
2661         return payment_hash_arr;
2662 }
2663 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
2664         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2665         assert(obj->tag == LDKEvent_PaymentPathFailed);
2666                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
2667         return payment_failed_permanently_conv;
2668 }
2669 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_failure"))) TS_LDKEvent_PaymentPathFailed_get_failure(uint64_t ptr) {
2670         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2671         assert(obj->tag == LDKEvent_PaymentPathFailed);
2672                         uint64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
2673         return failure_ref;
2674 }
2675 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
2676         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2677         assert(obj->tag == LDKEvent_PaymentPathFailed);
2678                         LDKPath path_var = obj->payment_path_failed.path;
2679                         uint64_t path_ref = 0;
2680                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2681                         path_ref = tag_ptr(path_var.inner, false);
2682         return path_ref;
2683 }
2684 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
2685         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2686         assert(obj->tag == LDKEvent_PaymentPathFailed);
2687                         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
2688         return short_channel_id_ref;
2689 }
2690 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
2691         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2692         assert(obj->tag == LDKEvent_ProbeSuccessful);
2693                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
2694                         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
2695         return payment_id_arr;
2696 }
2697 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
2698         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2699         assert(obj->tag == LDKEvent_ProbeSuccessful);
2700                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2701                         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
2702         return payment_hash_arr;
2703 }
2704 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
2705         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2706         assert(obj->tag == LDKEvent_ProbeSuccessful);
2707                         LDKPath path_var = obj->probe_successful.path;
2708                         uint64_t path_ref = 0;
2709                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2710                         path_ref = tag_ptr(path_var.inner, false);
2711         return path_ref;
2712 }
2713 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
2714         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2715         assert(obj->tag == LDKEvent_ProbeFailed);
2716                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
2717                         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
2718         return payment_id_arr;
2719 }
2720 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
2721         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2722         assert(obj->tag == LDKEvent_ProbeFailed);
2723                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2724                         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
2725         return payment_hash_arr;
2726 }
2727 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
2728         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2729         assert(obj->tag == LDKEvent_ProbeFailed);
2730                         LDKPath path_var = obj->probe_failed.path;
2731                         uint64_t path_ref = 0;
2732                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2733                         path_ref = tag_ptr(path_var.inner, false);
2734         return path_ref;
2735 }
2736 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
2737         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2738         assert(obj->tag == LDKEvent_ProbeFailed);
2739                         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
2740         return short_channel_id_ref;
2741 }
2742 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
2743         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2744         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
2745                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
2746         return time_forwardable_conv;
2747 }
2748 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_intercept_id"))) TS_LDKEvent_HTLCIntercepted_get_intercept_id(uint64_t ptr) {
2749         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2750         assert(obj->tag == LDKEvent_HTLCIntercepted);
2751                         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
2752                         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
2753         return intercept_id_arr;
2754 }
2755 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid"))) TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(uint64_t ptr) {
2756         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2757         assert(obj->tag == LDKEvent_HTLCIntercepted);
2758                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
2759         return requested_next_hop_scid_conv;
2760 }
2761 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_payment_hash"))) TS_LDKEvent_HTLCIntercepted_get_payment_hash(uint64_t ptr) {
2762         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2763         assert(obj->tag == LDKEvent_HTLCIntercepted);
2764                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
2765                         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
2766         return payment_hash_arr;
2767 }
2768 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(uint64_t ptr) {
2769         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2770         assert(obj->tag == LDKEvent_HTLCIntercepted);
2771                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
2772         return inbound_amount_msat_conv;
2773 }
2774 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(uint64_t ptr) {
2775         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2776         assert(obj->tag == LDKEvent_HTLCIntercepted);
2777                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
2778         return expected_outbound_amount_msat_conv;
2779 }
2780 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
2781         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2782         assert(obj->tag == LDKEvent_SpendableOutputs);
2783                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
2784                         uint64_tArray outputs_arr = NULL;
2785                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
2786                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
2787                         for (size_t b = 0; b < outputs_var.datalen; b++) {
2788                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
2789                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
2790                         }
2791                         
2792         return outputs_arr;
2793 }
2794 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
2795         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2796         assert(obj->tag == LDKEvent_PaymentForwarded);
2797                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
2798                         memcpy(prev_channel_id_arr->elems, obj->payment_forwarded.prev_channel_id.data, 32);
2799         return prev_channel_id_arr;
2800 }
2801 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
2802         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2803         assert(obj->tag == LDKEvent_PaymentForwarded);
2804                         int8_tArray next_channel_id_arr = init_int8_tArray(32, __LINE__);
2805                         memcpy(next_channel_id_arr->elems, obj->payment_forwarded.next_channel_id.data, 32);
2806         return next_channel_id_arr;
2807 }
2808 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
2809         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2810         assert(obj->tag == LDKEvent_PaymentForwarded);
2811                         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
2812         return fee_earned_msat_ref;
2813 }
2814 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
2815         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2816         assert(obj->tag == LDKEvent_PaymentForwarded);
2817                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
2818         return claim_from_onchain_tx_conv;
2819 }
2820 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat"))) TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(uint64_t ptr) {
2821         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2822         assert(obj->tag == LDKEvent_PaymentForwarded);
2823                         uint64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
2824         return outbound_amount_forwarded_msat_ref;
2825 }
2826 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_channel_id"))) TS_LDKEvent_ChannelPending_get_channel_id(uint64_t ptr) {
2827         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2828         assert(obj->tag == LDKEvent_ChannelPending);
2829                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2830                         memcpy(channel_id_arr->elems, obj->channel_pending.channel_id.data, 32);
2831         return channel_id_arr;
2832 }
2833 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_user_channel_id"))) TS_LDKEvent_ChannelPending_get_user_channel_id(uint64_t ptr) {
2834         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2835         assert(obj->tag == LDKEvent_ChannelPending);
2836                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
2837                         memcpy(user_channel_id_arr->elems, obj->channel_pending.user_channel_id.le_bytes, 16);
2838         return user_channel_id_arr;
2839 }
2840 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_former_temporary_channel_id"))) TS_LDKEvent_ChannelPending_get_former_temporary_channel_id(uint64_t ptr) {
2841         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2842         assert(obj->tag == LDKEvent_ChannelPending);
2843                         int8_tArray former_temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
2844                         memcpy(former_temporary_channel_id_arr->elems, obj->channel_pending.former_temporary_channel_id.data, 32);
2845         return former_temporary_channel_id_arr;
2846 }
2847 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_counterparty_node_id"))) TS_LDKEvent_ChannelPending_get_counterparty_node_id(uint64_t ptr) {
2848         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2849         assert(obj->tag == LDKEvent_ChannelPending);
2850                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
2851                         memcpy(counterparty_node_id_arr->elems, obj->channel_pending.counterparty_node_id.compressed_form, 33);
2852         return counterparty_node_id_arr;
2853 }
2854 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_funding_txo"))) TS_LDKEvent_ChannelPending_get_funding_txo(uint64_t ptr) {
2855         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2856         assert(obj->tag == LDKEvent_ChannelPending);
2857                         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
2858                         uint64_t funding_txo_ref = 0;
2859                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2860                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
2861         return funding_txo_ref;
2862 }
2863 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_id"))) TS_LDKEvent_ChannelReady_get_channel_id(uint64_t ptr) {
2864         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2865         assert(obj->tag == LDKEvent_ChannelReady);
2866                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2867                         memcpy(channel_id_arr->elems, obj->channel_ready.channel_id.data, 32);
2868         return channel_id_arr;
2869 }
2870 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_user_channel_id"))) TS_LDKEvent_ChannelReady_get_user_channel_id(uint64_t ptr) {
2871         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2872         assert(obj->tag == LDKEvent_ChannelReady);
2873                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
2874                         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
2875         return user_channel_id_arr;
2876 }
2877 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_counterparty_node_id"))) TS_LDKEvent_ChannelReady_get_counterparty_node_id(uint64_t ptr) {
2878         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2879         assert(obj->tag == LDKEvent_ChannelReady);
2880                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
2881                         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
2882         return counterparty_node_id_arr;
2883 }
2884 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_type"))) TS_LDKEvent_ChannelReady_get_channel_type(uint64_t ptr) {
2885         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2886         assert(obj->tag == LDKEvent_ChannelReady);
2887                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
2888                         uint64_t channel_type_ref = 0;
2889                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2890                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2891         return channel_type_ref;
2892 }
2893 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
2894         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2895         assert(obj->tag == LDKEvent_ChannelClosed);
2896                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2897                         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
2898         return channel_id_arr;
2899 }
2900 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
2901         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2902         assert(obj->tag == LDKEvent_ChannelClosed);
2903                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
2904                         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
2905         return user_channel_id_arr;
2906 }
2907 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
2908         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2909         assert(obj->tag == LDKEvent_ChannelClosed);
2910                         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
2911         return reason_ref;
2912 }
2913 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
2914         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2915         assert(obj->tag == LDKEvent_DiscardFunding);
2916                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2917                         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
2918         return channel_id_arr;
2919 }
2920 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
2921         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2922         assert(obj->tag == LDKEvent_DiscardFunding);
2923                         LDKTransaction transaction_var = obj->discard_funding.transaction;
2924                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
2925                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
2926         return transaction_arr;
2927 }
2928 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
2929         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2930         assert(obj->tag == LDKEvent_OpenChannelRequest);
2931                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
2932                         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
2933         return temporary_channel_id_arr;
2934 }
2935 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
2936         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2937         assert(obj->tag == LDKEvent_OpenChannelRequest);
2938                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
2939                         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
2940         return counterparty_node_id_arr;
2941 }
2942 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
2943         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2944         assert(obj->tag == LDKEvent_OpenChannelRequest);
2945                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
2946         return funding_satoshis_conv;
2947 }
2948 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
2949         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2950         assert(obj->tag == LDKEvent_OpenChannelRequest);
2951                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
2952         return push_msat_conv;
2953 }
2954 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
2955         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2956         assert(obj->tag == LDKEvent_OpenChannelRequest);
2957                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
2958                         uint64_t channel_type_ref = 0;
2959                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2960                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2961         return channel_type_ref;
2962 }
2963 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
2964         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2965         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2966                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
2967                         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
2968         return prev_channel_id_arr;
2969 }
2970 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
2971         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2972         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2973                         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
2974         return failed_next_destination_ref;
2975 }
2976 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
2977         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2978         switch(obj->tag) {
2979                 case LDKCOption_EventZ_Some: return 0;
2980                 case LDKCOption_EventZ_None: return 1;
2981                 default: abort();
2982         }
2983 }
2984 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
2985         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2986         assert(obj->tag == LDKCOption_EventZ_Some);
2987                         uint64_t some_ref = tag_ptr(&obj->some, false);
2988         return some_ref;
2989 }
2990 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2991 CHECK(owner->result_ok);
2992         return COption_EventZ_clone(&*owner->contents.result);
2993 }
2994 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
2995         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2996         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2997         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2998         uint64_t ret_ref = tag_ptr(ret_copy, true);
2999         return ret_ref;
3000 }
3001
3002 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
3003 CHECK(!owner->result_ok);
3004         return DecodeError_clone(&*owner->contents.err);
3005 }
3006 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
3007         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
3008         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3009         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
3010         uint64_t ret_ref = tag_ptr(ret_copy, true);
3011         return ret_ref;
3012 }
3013
3014 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
3015         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3016         switch(obj->tag) {
3017                 case LDKErrorAction_DisconnectPeer: return 0;
3018                 case LDKErrorAction_IgnoreError: return 1;
3019                 case LDKErrorAction_IgnoreAndLog: return 2;
3020                 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
3021                 case LDKErrorAction_SendErrorMessage: return 4;
3022                 case LDKErrorAction_SendWarningMessage: return 5;
3023                 default: abort();
3024         }
3025 }
3026 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
3027         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3028         assert(obj->tag == LDKErrorAction_DisconnectPeer);
3029                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
3030                         uint64_t msg_ref = 0;
3031                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3032                         msg_ref = tag_ptr(msg_var.inner, false);
3033         return msg_ref;
3034 }
3035 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
3036         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3037         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
3038                         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
3039         return ignore_and_log_conv;
3040 }
3041 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
3042         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3043         assert(obj->tag == LDKErrorAction_SendErrorMessage);
3044                         LDKErrorMessage msg_var = obj->send_error_message.msg;
3045                         uint64_t msg_ref = 0;
3046                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3047                         msg_ref = tag_ptr(msg_var.inner, false);
3048         return msg_ref;
3049 }
3050 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
3051         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3052         assert(obj->tag == LDKErrorAction_SendWarningMessage);
3053                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
3054                         uint64_t msg_ref = 0;
3055                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3056                         msg_ref = tag_ptr(msg_var.inner, false);
3057         return msg_ref;
3058 }
3059 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
3060         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3061         assert(obj->tag == LDKErrorAction_SendWarningMessage);
3062                         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
3063         return log_level_conv;
3064 }
3065 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
3066         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3067         switch(obj->tag) {
3068                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
3069                 case LDKMessageSendEvent_SendOpenChannel: return 1;
3070                 case LDKMessageSendEvent_SendFundingCreated: return 2;
3071                 case LDKMessageSendEvent_SendFundingSigned: return 3;
3072                 case LDKMessageSendEvent_SendChannelReady: return 4;
3073                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
3074                 case LDKMessageSendEvent_UpdateHTLCs: return 6;
3075                 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
3076                 case LDKMessageSendEvent_SendClosingSigned: return 8;
3077                 case LDKMessageSendEvent_SendShutdown: return 9;
3078                 case LDKMessageSendEvent_SendChannelReestablish: return 10;
3079                 case LDKMessageSendEvent_SendChannelAnnouncement: return 11;
3080                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 12;
3081                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
3082                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 14;
3083                 case LDKMessageSendEvent_SendChannelUpdate: return 15;
3084                 case LDKMessageSendEvent_HandleError: return 16;
3085                 case LDKMessageSendEvent_SendChannelRangeQuery: return 17;
3086                 case LDKMessageSendEvent_SendShortIdsQuery: return 18;
3087                 case LDKMessageSendEvent_SendReplyChannelRange: return 19;
3088                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 20;
3089                 default: abort();
3090         }
3091 }
3092 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
3093         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3094         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
3095                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3096                         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
3097         return node_id_arr;
3098 }
3099 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
3100         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3101         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
3102                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
3103                         uint64_t msg_ref = 0;
3104                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3105                         msg_ref = tag_ptr(msg_var.inner, false);
3106         return msg_ref;
3107 }
3108 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
3109         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3110         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
3111                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3112                         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
3113         return node_id_arr;
3114 }
3115 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
3116         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3117         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
3118                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
3119                         uint64_t msg_ref = 0;
3120                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3121                         msg_ref = tag_ptr(msg_var.inner, false);
3122         return msg_ref;
3123 }
3124 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
3125         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3126         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
3127                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3128                         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
3129         return node_id_arr;
3130 }
3131 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
3132         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3133         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
3134                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
3135                         uint64_t msg_ref = 0;
3136                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3137                         msg_ref = tag_ptr(msg_var.inner, false);
3138         return msg_ref;
3139 }
3140 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
3141         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3142         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
3143                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3144                         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
3145         return node_id_arr;
3146 }
3147 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
3148         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3149         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
3150                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
3151                         uint64_t msg_ref = 0;
3152                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3153                         msg_ref = tag_ptr(msg_var.inner, false);
3154         return msg_ref;
3155 }
3156 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
3157         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3158         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
3159                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3160                         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
3161         return node_id_arr;
3162 }
3163 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
3164         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3165         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
3166                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
3167                         uint64_t msg_ref = 0;
3168                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3169                         msg_ref = tag_ptr(msg_var.inner, false);
3170         return msg_ref;
3171 }
3172 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
3173         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3174         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
3175                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3176                         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
3177         return node_id_arr;
3178 }
3179 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
3180         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3181         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
3182                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
3183                         uint64_t msg_ref = 0;
3184                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3185                         msg_ref = tag_ptr(msg_var.inner, false);
3186         return msg_ref;
3187 }
3188 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
3189         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3190         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
3191                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3192                         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
3193         return node_id_arr;
3194 }
3195 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
3196         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3197         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
3198                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
3199                         uint64_t updates_ref = 0;
3200                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
3201                         updates_ref = tag_ptr(updates_var.inner, false);
3202         return updates_ref;
3203 }
3204 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
3205         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3206         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
3207                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3208                         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
3209         return node_id_arr;
3210 }
3211 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
3212         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3213         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
3214                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
3215                         uint64_t msg_ref = 0;
3216                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3217                         msg_ref = tag_ptr(msg_var.inner, false);
3218         return msg_ref;
3219 }
3220 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
3221         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3222         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
3223                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3224                         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
3225         return node_id_arr;
3226 }
3227 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
3228         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3229         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
3230                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
3231                         uint64_t msg_ref = 0;
3232                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3233                         msg_ref = tag_ptr(msg_var.inner, false);
3234         return msg_ref;
3235 }
3236 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
3237         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3238         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
3239                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3240                         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
3241         return node_id_arr;
3242 }
3243 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
3244         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3245         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
3246                         LDKShutdown msg_var = obj->send_shutdown.msg;
3247                         uint64_t msg_ref = 0;
3248                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3249                         msg_ref = tag_ptr(msg_var.inner, false);
3250         return msg_ref;
3251 }
3252 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
3253         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3254         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
3255                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3256                         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
3257         return node_id_arr;
3258 }
3259 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
3260         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3261         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
3262                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
3263                         uint64_t msg_ref = 0;
3264                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3265                         msg_ref = tag_ptr(msg_var.inner, false);
3266         return msg_ref;
3267 }
3268 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
3269         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3270         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
3271                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3272                         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
3273         return node_id_arr;
3274 }
3275 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
3276         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3277         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
3278                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
3279                         uint64_t msg_ref = 0;
3280                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3281                         msg_ref = tag_ptr(msg_var.inner, false);
3282         return msg_ref;
3283 }
3284 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
3285         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3286         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
3287                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
3288                         uint64_t update_msg_ref = 0;
3289                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
3290                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
3291         return update_msg_ref;
3292 }
3293 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
3294         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3295         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
3296                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
3297                         uint64_t msg_ref = 0;
3298                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3299                         msg_ref = tag_ptr(msg_var.inner, false);
3300         return msg_ref;
3301 }
3302 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
3303         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3304         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
3305                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
3306                         uint64_t update_msg_ref = 0;
3307                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
3308                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
3309         return update_msg_ref;
3310 }
3311 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
3312         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3313         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
3314                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
3315                         uint64_t msg_ref = 0;
3316                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3317                         msg_ref = tag_ptr(msg_var.inner, false);
3318         return msg_ref;
3319 }
3320 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint64_t ptr) {
3321         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3322         assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
3323                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
3324                         uint64_t msg_ref = 0;
3325                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3326                         msg_ref = tag_ptr(msg_var.inner, false);
3327         return msg_ref;
3328 }
3329 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
3330         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3331         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
3332                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3333                         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
3334         return node_id_arr;
3335 }
3336 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
3337         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3338         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
3339                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
3340                         uint64_t msg_ref = 0;
3341                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3342                         msg_ref = tag_ptr(msg_var.inner, false);
3343         return msg_ref;
3344 }
3345 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
3346         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3347         assert(obj->tag == LDKMessageSendEvent_HandleError);
3348                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3349                         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
3350         return node_id_arr;
3351 }
3352 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
3353         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3354         assert(obj->tag == LDKMessageSendEvent_HandleError);
3355                         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
3356         return action_ref;
3357 }
3358 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
3359         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3360         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
3361                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3362                         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
3363         return node_id_arr;
3364 }
3365 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
3366         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3367         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
3368                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
3369                         uint64_t msg_ref = 0;
3370                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3371                         msg_ref = tag_ptr(msg_var.inner, false);
3372         return msg_ref;
3373 }
3374 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
3375         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3376         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
3377                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3378                         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
3379         return node_id_arr;
3380 }
3381 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
3382         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3383         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
3384                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
3385                         uint64_t msg_ref = 0;
3386                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3387                         msg_ref = tag_ptr(msg_var.inner, false);
3388         return msg_ref;
3389 }
3390 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
3391         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3392         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
3393                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3394                         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
3395         return node_id_arr;
3396 }
3397 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
3398         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3399         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
3400                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
3401                         uint64_t msg_ref = 0;
3402                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3403                         msg_ref = tag_ptr(msg_var.inner, false);
3404         return msg_ref;
3405 }
3406 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
3407         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3408         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
3409                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3410                         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
3411         return node_id_arr;
3412 }
3413 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
3414         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3415         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
3416                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
3417                         uint64_t msg_ref = 0;
3418                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3419                         msg_ref = tag_ptr(msg_var.inner, false);
3420         return msg_ref;
3421 }
3422 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
3423         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
3424         for (size_t i = 0; i < ret.datalen; i++) {
3425                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
3426         }
3427         return ret;
3428 }
3429 static inline LDKCVec_ChainHashZ CVec_ChainHashZ_clone(const LDKCVec_ChainHashZ *orig) {
3430         LDKCVec_ChainHashZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ChainHashZ clone bytes"), .datalen = orig->datalen };
3431         for (size_t i = 0; i < ret.datalen; i++) {
3432                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3433         }
3434         return ret;
3435 }
3436 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
3437 CHECK(owner->result_ok);
3438         return *owner->contents.result;
3439 }
3440 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint64_t owner) {
3441         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
3442         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3443         memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
3444         return ret_arr;
3445 }
3446
3447 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
3448 CHECK(!owner->result_ok);
3449         return *owner->contents.err;
3450 }
3451 uint32_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint64_t owner) {
3452         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
3453         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
3454         return ret_conv;
3455 }
3456
3457 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3458         LDKNodeId ret = *owner->contents.result;
3459         ret.is_owned = false;
3460         return ret;
3461 }
3462 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
3463         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3464         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3465         uint64_t ret_ref = 0;
3466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3468         return ret_ref;
3469 }
3470
3471 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3472 CHECK(!owner->result_ok);
3473         return DecodeError_clone(&*owner->contents.err);
3474 }
3475 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
3476         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3477         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3478         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3479         uint64_t ret_ref = tag_ptr(ret_copy, true);
3480         return ret_ref;
3481 }
3482
3483 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3484 CHECK(owner->result_ok);
3485         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3486 }
3487 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
3488         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3489         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3490         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3491         uint64_t ret_ref = tag_ptr(ret_copy, true);
3492         return ret_ref;
3493 }
3494
3495 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3496 CHECK(!owner->result_ok);
3497         return DecodeError_clone(&*owner->contents.err);
3498 }
3499 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
3500         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3501         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3502         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3503         uint64_t ret_ref = tag_ptr(ret_copy, true);
3504         return ret_ref;
3505 }
3506
3507 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3508 CHECK(owner->result_ok);
3509         return TxOut_clone(&*owner->contents.result);
3510 }
3511 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_get_ok(uint64_t owner) {
3512         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3513         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3514         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
3515         return tag_ptr(ret_ref, true);
3516 }
3517
3518 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3519 CHECK(!owner->result_ok);
3520         return UtxoLookupError_clone(&*owner->contents.err);
3521 }
3522 uint32_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_err"))) TS_CResult_TxOutUtxoLookupErrorZ_get_err(uint64_t owner) {
3523         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3524         uint32_t ret_conv = LDKUtxoLookupError_to_js(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
3525         return ret_conv;
3526 }
3527
3528 uint32_t __attribute__((export_name("TS_LDKUtxoResult_ty_from_ptr"))) TS_LDKUtxoResult_ty_from_ptr(uint64_t ptr) {
3529         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3530         switch(obj->tag) {
3531                 case LDKUtxoResult_Sync: return 0;
3532                 case LDKUtxoResult_Async: return 1;
3533                 default: abort();
3534         }
3535 }
3536 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Sync_get_sync"))) TS_LDKUtxoResult_Sync_get_sync(uint64_t ptr) {
3537         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3538         assert(obj->tag == LDKUtxoResult_Sync);
3539                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
3540                         *sync_conv = obj->sync;
3541                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
3542         return tag_ptr(sync_conv, true);
3543 }
3544 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Async_get_async"))) TS_LDKUtxoResult_Async_get_async(uint64_t ptr) {
3545         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3546         assert(obj->tag == LDKUtxoResult_Async);
3547                         LDKUtxoFuture async_var = obj->async;
3548                         uint64_t async_ref = 0;
3549                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
3550                         async_ref = tag_ptr(async_var.inner, false);
3551         return async_ref;
3552 }
3553 typedef struct LDKUtxoLookup_JCalls {
3554         atomic_size_t refcnt;
3555         uint32_t instance_ptr;
3556 } LDKUtxoLookup_JCalls;
3557 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
3558         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3559         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3560                 FREE(j_calls);
3561         }
3562 }
3563 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3564         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3565         int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
3566         memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
3567         int64_t short_channel_id_conv = short_channel_id;
3568         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);
3569         void* ret_ptr = untag_ptr(ret);
3570         CHECK_ACCESS(ret_ptr);
3571         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
3572         FREE(untag_ptr(ret));
3573         return ret_conv;
3574 }
3575 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
3576         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
3577         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3578 }
3579 static inline LDKUtxoLookup LDKUtxoLookup_init (JSValue o) {
3580         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
3581         atomic_init(&calls->refcnt, 1);
3582         calls->instance_ptr = o;
3583
3584         LDKUtxoLookup ret = {
3585                 .this_arg = (void*) calls,
3586                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
3587                 .free = LDKUtxoLookup_JCalls_free,
3588         };
3589         return ret;
3590 }
3591 uint64_t  __attribute__((export_name("TS_LDKUtxoLookup_new"))) TS_LDKUtxoLookup_new(JSValue o) {
3592         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3593         *res_ptr = LDKUtxoLookup_init(o);
3594         return tag_ptr(res_ptr, true);
3595 }
3596 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) {
3597         void* this_arg_ptr = untag_ptr(this_arg);
3598         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3599         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
3600         uint8_t genesis_hash_arr[32];
3601         CHECK(genesis_hash->arr_len == 32);
3602         memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
3603         uint8_t (*genesis_hash_ref)[32] = &genesis_hash_arr;
3604         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
3605         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3606         uint64_t ret_ref = tag_ptr(ret_copy, true);
3607         return ret_ref;
3608 }
3609
3610 uint32_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_ty_from_ptr"))) TS_LDKCOption_UtxoLookupZ_ty_from_ptr(uint64_t ptr) {
3611         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3612         switch(obj->tag) {
3613                 case LDKCOption_UtxoLookupZ_Some: return 0;
3614                 case LDKCOption_UtxoLookupZ_None: return 1;
3615                 default: abort();
3616         }
3617 }
3618 uint64_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_Some_get_some"))) TS_LDKCOption_UtxoLookupZ_Some_get_some(uint64_t ptr) {
3619         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3620         assert(obj->tag == LDKCOption_UtxoLookupZ_Some);
3621                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3622                         *some_ret = obj->some;
3623                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3624                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
3625                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3626                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
3627                         }
3628         return tag_ptr(some_ret, true);
3629 }
3630 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3631 CHECK(owner->result_ok);
3632         return *owner->contents.result;
3633 }
3634 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
3635         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3636         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3637         return ret_conv;
3638 }
3639
3640 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3641         LDKLightningError ret = *owner->contents.err;
3642         ret.is_owned = false;
3643         return ret;
3644 }
3645 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
3646         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3647         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3648         uint64_t ret_ref = 0;
3649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3651         return ret_ref;
3652 }
3653
3654 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3655         LDKChannelAnnouncement ret = owner->a;
3656         ret.is_owned = false;
3657         return ret;
3658 }
3659 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
3660         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3661         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3662         uint64_t ret_ref = 0;
3663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3665         return ret_ref;
3666 }
3667
3668 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3669         LDKChannelUpdate ret = owner->b;
3670         ret.is_owned = false;
3671         return ret;
3672 }
3673 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
3674         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3675         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3676         uint64_t ret_ref = 0;
3677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3679         return ret_ref;
3680 }
3681
3682 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3683         LDKChannelUpdate ret = owner->c;
3684         ret.is_owned = false;
3685         return ret;
3686 }
3687 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
3688         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3689         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3690         uint64_t ret_ref = 0;
3691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3693         return ret_ref;
3694 }
3695
3696 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
3697         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3698         switch(obj->tag) {
3699                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
3700                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
3701                 default: abort();
3702         }
3703 }
3704 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
3705         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3706         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
3707                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3708                         *some_conv = obj->some;
3709                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
3710         return tag_ptr(some_conv, true);
3711 }
3712 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3713 CHECK(owner->result_ok);
3714         return *owner->contents.result;
3715 }
3716 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3717         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3718         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3719 }
3720
3721 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3722         LDKLightningError ret = *owner->contents.err;
3723         ret.is_owned = false;
3724         return ret;
3725 }
3726 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3727         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3728         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3729         uint64_t ret_ref = 0;
3730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3732         return ret_ref;
3733 }
3734
3735 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3736         LDKChannelUpdateInfo ret = *owner->contents.result;
3737         ret.is_owned = false;
3738         return ret;
3739 }
3740 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
3741         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3742         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3743         uint64_t ret_ref = 0;
3744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3746         return ret_ref;
3747 }
3748
3749 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3750 CHECK(!owner->result_ok);
3751         return DecodeError_clone(&*owner->contents.err);
3752 }
3753 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
3754         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3755         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3756         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3757         uint64_t ret_ref = tag_ptr(ret_copy, true);
3758         return ret_ref;
3759 }
3760
3761 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3762         LDKChannelInfo ret = *owner->contents.result;
3763         ret.is_owned = false;
3764         return ret;
3765 }
3766 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
3767         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3768         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3769         uint64_t ret_ref = 0;
3770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3772         return ret_ref;
3773 }
3774
3775 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3776 CHECK(!owner->result_ok);
3777         return DecodeError_clone(&*owner->contents.err);
3778 }
3779 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
3780         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3781         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3782         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3783         uint64_t ret_ref = tag_ptr(ret_copy, true);
3784         return ret_ref;
3785 }
3786
3787 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3788         LDKRoutingFees ret = *owner->contents.result;
3789         ret.is_owned = false;
3790         return ret;
3791 }
3792 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
3793         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3794         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3795         uint64_t ret_ref = 0;
3796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3798         return ret_ref;
3799 }
3800
3801 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3802 CHECK(!owner->result_ok);
3803         return DecodeError_clone(&*owner->contents.err);
3804 }
3805 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
3806         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3807         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3808         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3809         uint64_t ret_ref = tag_ptr(ret_copy, true);
3810         return ret_ref;
3811 }
3812
3813 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint64_t ptr) {
3814         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3815         switch(obj->tag) {
3816                 case LDKNetAddress_IPv4: return 0;
3817                 case LDKNetAddress_IPv6: return 1;
3818                 case LDKNetAddress_OnionV2: return 2;
3819                 case LDKNetAddress_OnionV3: return 3;
3820                 case LDKNetAddress_Hostname: return 4;
3821                 default: abort();
3822         }
3823 }
3824 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint64_t ptr) {
3825         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3826         assert(obj->tag == LDKNetAddress_IPv4);
3827                         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
3828                         memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3829         return addr_arr;
3830 }
3831 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint64_t ptr) {
3832         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3833         assert(obj->tag == LDKNetAddress_IPv4);
3834                         int16_t port_conv = obj->i_pv4.port;
3835         return port_conv;
3836 }
3837 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint64_t ptr) {
3838         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3839         assert(obj->tag == LDKNetAddress_IPv6);
3840                         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
3841                         memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3842         return addr_arr;
3843 }
3844 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint64_t ptr) {
3845         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3846         assert(obj->tag == LDKNetAddress_IPv6);
3847                         int16_t port_conv = obj->i_pv6.port;
3848         return port_conv;
3849 }
3850 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint64_t ptr) {
3851         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3852         assert(obj->tag == LDKNetAddress_OnionV2);
3853                         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
3854                         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3855         return onion_v2_arr;
3856 }
3857 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
3858         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3859         assert(obj->tag == LDKNetAddress_OnionV3);
3860                         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
3861                         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3862         return ed25519_pubkey_arr;
3863 }
3864 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint64_t ptr) {
3865         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3866         assert(obj->tag == LDKNetAddress_OnionV3);
3867                         int16_t checksum_conv = obj->onion_v3.checksum;
3868         return checksum_conv;
3869 }
3870 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint64_t ptr) {
3871         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3872         assert(obj->tag == LDKNetAddress_OnionV3);
3873                         int8_t version_conv = obj->onion_v3.version;
3874         return version_conv;
3875 }
3876 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint64_t ptr) {
3877         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3878         assert(obj->tag == LDKNetAddress_OnionV3);
3879                         int16_t port_conv = obj->onion_v3.port;
3880         return port_conv;
3881 }
3882 uint64_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_hostname"))) TS_LDKNetAddress_Hostname_get_hostname(uint64_t ptr) {
3883         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3884         assert(obj->tag == LDKNetAddress_Hostname);
3885                         LDKHostname hostname_var = obj->hostname.hostname;
3886                         uint64_t hostname_ref = 0;
3887                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
3888                         hostname_ref = tag_ptr(hostname_var.inner, false);
3889         return hostname_ref;
3890 }
3891 int16_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_port"))) TS_LDKNetAddress_Hostname_get_port(uint64_t ptr) {
3892         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3893         assert(obj->tag == LDKNetAddress_Hostname);
3894                         int16_t port_conv = obj->hostname.port;
3895         return port_conv;
3896 }
3897 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3898         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3899         for (size_t i = 0; i < ret.datalen; i++) {
3900                 ret.data[i] = NetAddress_clone(&orig->data[i]);
3901         }
3902         return ret;
3903 }
3904 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3905         LDKNodeAnnouncementInfo ret = *owner->contents.result;
3906         ret.is_owned = false;
3907         return ret;
3908 }
3909 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
3910         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3911         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3912         uint64_t ret_ref = 0;
3913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3915         return ret_ref;
3916 }
3917
3918 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3919 CHECK(!owner->result_ok);
3920         return DecodeError_clone(&*owner->contents.err);
3921 }
3922 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
3923         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3924         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3925         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3926         uint64_t ret_ref = tag_ptr(ret_copy, true);
3927         return ret_ref;
3928 }
3929
3930 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3931         LDKNodeAlias ret = *owner->contents.result;
3932         ret.is_owned = false;
3933         return ret;
3934 }
3935 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
3936         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3937         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
3938         uint64_t ret_ref = 0;
3939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3941         return ret_ref;
3942 }
3943
3944 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3945 CHECK(!owner->result_ok);
3946         return DecodeError_clone(&*owner->contents.err);
3947 }
3948 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
3949         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3950         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3951         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
3952         uint64_t ret_ref = tag_ptr(ret_copy, true);
3953         return ret_ref;
3954 }
3955
3956 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3957         LDKNodeInfo ret = *owner->contents.result;
3958         ret.is_owned = false;
3959         return ret;
3960 }
3961 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
3962         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3963         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3964         uint64_t ret_ref = 0;
3965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3967         return ret_ref;
3968 }
3969
3970 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3971 CHECK(!owner->result_ok);
3972         return DecodeError_clone(&*owner->contents.err);
3973 }
3974 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
3975         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3976         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3977         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3978         uint64_t ret_ref = tag_ptr(ret_copy, true);
3979         return ret_ref;
3980 }
3981
3982 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3983         LDKNetworkGraph ret = *owner->contents.result;
3984         ret.is_owned = false;
3985         return ret;
3986 }
3987 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
3988         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3989         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3990         uint64_t ret_ref = 0;
3991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3993         return ret_ref;
3994 }
3995
3996 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3997 CHECK(!owner->result_ok);
3998         return DecodeError_clone(&*owner->contents.err);
3999 }
4000 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
4001         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4002         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4003         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
4004         uint64_t ret_ref = tag_ptr(ret_copy, true);
4005         return ret_ref;
4006 }
4007
4008 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint64_t ptr) {
4009         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
4010         switch(obj->tag) {
4011                 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
4012                 case LDKCOption_CVec_NetAddressZZ_None: return 1;
4013                 default: abort();
4014         }
4015 }
4016 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint64_t ptr) {
4017         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
4018         assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
4019                         LDKCVec_NetAddressZ some_var = obj->some;
4020                         uint64_tArray some_arr = NULL;
4021                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
4022                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
4023                         for (size_t m = 0; m < some_var.datalen; m++) {
4024                                 uint64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
4025                                 some_arr_ptr[m] = some_conv_12_ref;
4026                         }
4027                         
4028         return some_arr;
4029 }
4030 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4031         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
4032         ret.is_owned = false;
4033         return ret;
4034 }
4035 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
4036         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4037         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4038         uint64_t ret_ref = 0;
4039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4041         return ret_ref;
4042 }
4043
4044 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4045 CHECK(!owner->result_ok);
4046         return DecodeError_clone(&*owner->contents.err);
4047 }
4048 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
4049         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4050         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4051         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4052         uint64_t ret_ref = tag_ptr(ret_copy, true);
4053         return ret_ref;
4054 }
4055
4056 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4057         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
4058         ret.is_owned = false;
4059         return ret;
4060 }
4061 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
4062         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4063         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4064         uint64_t ret_ref = 0;
4065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4067         return ret_ref;
4068 }
4069
4070 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4071 CHECK(!owner->result_ok);
4072         return DecodeError_clone(&*owner->contents.err);
4073 }
4074 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
4075         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4076         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4077         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4078         uint64_t ret_ref = tag_ptr(ret_copy, true);
4079         return ret_ref;
4080 }
4081
4082 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4083 CHECK(owner->result_ok);
4084         return SpendableOutputDescriptor_clone(&*owner->contents.result);
4085 }
4086 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
4087         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4088         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
4089         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4090         uint64_t ret_ref = tag_ptr(ret_copy, true);
4091         return ret_ref;
4092 }
4093
4094 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4095 CHECK(!owner->result_ok);
4096         return DecodeError_clone(&*owner->contents.err);
4097 }
4098 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
4099         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4100         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4101         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4102         uint64_t ret_ref = tag_ptr(ret_copy, true);
4103         return ret_ref;
4104 }
4105
4106 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
4107         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
4108         for (size_t i = 0; i < ret.datalen; i++) {
4109                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4110         }
4111         return ret;
4112 }
4113 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4114         return owner->a;
4115 }
4116 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint64_t owner) {
4117         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
4118         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
4119         memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
4120         return ret_arr;
4121 }
4122
4123 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4124         return owner->b;
4125 }
4126 ptrArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint64_t owner) {
4127         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
4128         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
4129         ptrArray ret_arr = NULL;
4130         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
4131         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
4132         for (size_t m = 0; m < ret_var.datalen; m++) {
4133                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
4134                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
4135                 ret_arr_ptr[m] = ret_conv_12_arr;
4136         }
4137         
4138         return ret_arr;
4139 }
4140
4141 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
4142 CHECK(owner->result_ok);
4143         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
4144 }
4145 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint64_t owner) {
4146         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
4147         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4148         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
4149         return tag_ptr(ret_conv, true);
4150 }
4151
4152 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
4153 CHECK(!owner->result_ok);
4154         return *owner->contents.err;
4155 }
4156 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint64_t owner) {
4157         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
4158         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
4159 }
4160
4161 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
4162 CHECK(owner->result_ok);
4163         return *owner->contents.result;
4164 }
4165 int8_tArray  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint64_t owner) {
4166         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
4167         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
4168         memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
4169         return ret_arr;
4170 }
4171
4172 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
4173 CHECK(!owner->result_ok);
4174         return *owner->contents.err;
4175 }
4176 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint64_t owner) {
4177         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
4178         CResult_SignatureNoneZ_get_err(owner_conv);
4179 }
4180
4181 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
4182 CHECK(owner->result_ok);
4183         return *owner->contents.result;
4184 }
4185 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
4186         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
4187         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
4188         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
4189         return ret_arr;
4190 }
4191
4192 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
4193 CHECK(!owner->result_ok);
4194         return *owner->contents.err;
4195 }
4196 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
4197         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
4198         CResult_PublicKeyNoneZ_get_err(owner_conv);
4199 }
4200
4201 uint32_t __attribute__((export_name("TS_LDKCOption_ScalarZ_ty_from_ptr"))) TS_LDKCOption_ScalarZ_ty_from_ptr(uint64_t ptr) {
4202         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
4203         switch(obj->tag) {
4204                 case LDKCOption_ScalarZ_Some: return 0;
4205                 case LDKCOption_ScalarZ_None: return 1;
4206                 default: abort();
4207         }
4208 }
4209 uint64_t __attribute__((export_name("TS_LDKCOption_ScalarZ_Some_get_some"))) TS_LDKCOption_ScalarZ_Some_get_some(uint64_t ptr) {
4210         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
4211         assert(obj->tag == LDKCOption_ScalarZ_Some);
4212                         LDKBigEndianScalar* some_ref = &obj->some;
4213         return tag_ptr(some_ref, false);
4214 }
4215 static inline struct LDKThirtyTwoBytes CResult_SharedSecretNoneZ_get_ok(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
4216 CHECK(owner->result_ok);
4217         return ThirtyTwoBytes_clone(&*owner->contents.result);
4218 }
4219 int8_tArray  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_ok"))) TS_CResult_SharedSecretNoneZ_get_ok(uint64_t owner) {
4220         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
4221         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4222         memcpy(ret_arr->elems, CResult_SharedSecretNoneZ_get_ok(owner_conv).data, 32);
4223         return ret_arr;
4224 }
4225
4226 static inline void CResult_SharedSecretNoneZ_get_err(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
4227 CHECK(!owner->result_ok);
4228         return *owner->contents.err;
4229 }
4230 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_err"))) TS_CResult_SharedSecretNoneZ_get_err(uint64_t owner) {
4231         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
4232         CResult_SharedSecretNoneZ_get_err(owner_conv);
4233 }
4234
4235 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4236 CHECK(owner->result_ok);
4237         return *owner->contents.result;
4238 }
4239 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
4240         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4241         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
4242         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
4243         return ret_arr;
4244 }
4245
4246 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4247 CHECK(!owner->result_ok);
4248         return *owner->contents.err;
4249 }
4250 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
4251         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4252         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4253 }
4254
4255 typedef struct LDKChannelSigner_JCalls {
4256         atomic_size_t refcnt;
4257         uint32_t instance_ptr;
4258 } LDKChannelSigner_JCalls;
4259 static void LDKChannelSigner_JCalls_free(void* this_arg) {
4260         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4261         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4262                 FREE(j_calls);
4263         }
4264 }
4265 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
4266         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4267         int64_t idx_conv = idx;
4268         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 2, idx_conv, 0, 0, 0, 0, 0);
4269         LDKPublicKey ret_ref;
4270         CHECK(ret->arr_len == 33);
4271         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
4272         return ret_ref;
4273 }
4274 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
4275         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4276         int64_t idx_conv = idx;
4277         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 3, idx_conv, 0, 0, 0, 0, 0);
4278         LDKThirtyTwoBytes ret_ref;
4279         CHECK(ret->arr_len == 32);
4280         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
4281         return ret_ref;
4282 }
4283 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
4284         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4285         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
4286         uint64_t holder_tx_ref = 0;
4287         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
4288         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
4289         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
4290         LDKCVec_PaymentPreimageZ preimages_var = preimages;
4291         ptrArray preimages_arr = NULL;
4292         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
4293         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
4294         for (size_t m = 0; m < preimages_var.datalen; m++) {
4295                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
4296                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
4297                 preimages_arr_ptr[m] = preimages_conv_12_arr;
4298         }
4299         
4300         FREE(preimages_var.data);
4301         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 4, holder_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
4302         void* ret_ptr = untag_ptr(ret);
4303         CHECK_ACCESS(ret_ptr);
4304         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4305         FREE(untag_ptr(ret));
4306         return ret_conv;
4307 }
4308 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
4309         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4310         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 5, 0, 0, 0, 0, 0, 0);
4311         LDKThirtyTwoBytes ret_ref;
4312         CHECK(ret->arr_len == 32);
4313         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
4314         return ret_ref;
4315 }
4316 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
4317         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
4318         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
4319         uint64_t channel_parameters_ref = 0;
4320         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
4321         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
4322         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
4323         js_invoke_function_buuuuu(j_calls->instance_ptr, 6, channel_parameters_ref, 0, 0, 0, 0, 0);
4324 }
4325 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
4326         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
4327         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4328 }
4329 static inline LDKChannelSigner LDKChannelSigner_init (JSValue o, uint64_t pubkeys) {
4330         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
4331         atomic_init(&calls->refcnt, 1);
4332         calls->instance_ptr = o;
4333
4334         LDKChannelPublicKeys pubkeys_conv;
4335         pubkeys_conv.inner = untag_ptr(pubkeys);
4336         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4337         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4338
4339         LDKChannelSigner ret = {
4340                 .this_arg = (void*) calls,
4341                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
4342                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
4343                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
4344                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
4345                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
4346                 .free = LDKChannelSigner_JCalls_free,
4347                 .pubkeys = pubkeys_conv,
4348                 .set_pubkeys = NULL,
4349         };
4350         return ret;
4351 }
4352 uint64_t  __attribute__((export_name("TS_LDKChannelSigner_new"))) TS_LDKChannelSigner_new(JSValue o, uint64_t pubkeys) {
4353         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
4354         *res_ptr = LDKChannelSigner_init(o, pubkeys);
4355         return tag_ptr(res_ptr, true);
4356 }
4357 int8_tArray  __attribute__((export_name("TS_ChannelSigner_get_per_commitment_point"))) TS_ChannelSigner_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
4358         void* this_arg_ptr = untag_ptr(this_arg);
4359         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4360         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4361         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
4362         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
4363         return ret_arr;
4364 }
4365
4366 int8_tArray  __attribute__((export_name("TS_ChannelSigner_release_commitment_secret"))) TS_ChannelSigner_release_commitment_secret(uint64_t this_arg, int64_t idx) {
4367         void* this_arg_ptr = untag_ptr(this_arg);
4368         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4369         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4370         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4371         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
4372         return ret_arr;
4373 }
4374
4375 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) {
4376         void* this_arg_ptr = untag_ptr(this_arg);
4377         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4378         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4379         LDKHolderCommitmentTransaction holder_tx_conv;
4380         holder_tx_conv.inner = untag_ptr(holder_tx);
4381         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
4382         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
4383         holder_tx_conv.is_owned = false;
4384         LDKCVec_PaymentPreimageZ preimages_constr;
4385         preimages_constr.datalen = preimages->arr_len;
4386         if (preimages_constr.datalen > 0)
4387                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4388         else
4389                 preimages_constr.data = NULL;
4390         int8_tArray* preimages_vals = (void*) preimages->elems;
4391         for (size_t m = 0; m < preimages_constr.datalen; m++) {
4392                 int8_tArray preimages_conv_12 = preimages_vals[m];
4393                 LDKThirtyTwoBytes preimages_conv_12_ref;
4394                 CHECK(preimages_conv_12->arr_len == 32);
4395                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4396                 preimages_constr.data[m] = preimages_conv_12_ref;
4397         }
4398         FREE(preimages);
4399         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4400         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4401         return tag_ptr(ret_conv, true);
4402 }
4403
4404 int8_tArray  __attribute__((export_name("TS_ChannelSigner_channel_keys_id"))) TS_ChannelSigner_channel_keys_id(uint64_t this_arg) {
4405         void* this_arg_ptr = untag_ptr(this_arg);
4406         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4407         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4408         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4409         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
4410         return ret_arr;
4411 }
4412
4413 void  __attribute__((export_name("TS_ChannelSigner_provide_channel_parameters"))) TS_ChannelSigner_provide_channel_parameters(uint64_t this_arg, uint64_t channel_parameters) {
4414         void* this_arg_ptr = untag_ptr(this_arg);
4415         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4416         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4417         LDKChannelTransactionParameters channel_parameters_conv;
4418         channel_parameters_conv.inner = untag_ptr(channel_parameters);
4419         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
4420         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4421         channel_parameters_conv.is_owned = false;
4422         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
4423 }
4424
4425 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
4426         if (this_arg->set_pubkeys != NULL)
4427                 this_arg->set_pubkeys(this_arg);
4428         return this_arg->pubkeys;
4429 }
4430 uint64_t  __attribute__((export_name("TS_ChannelSigner_get_pubkeys"))) TS_ChannelSigner_get_pubkeys(uint64_t this_arg) {
4431         void* this_arg_ptr = untag_ptr(this_arg);
4432         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4433         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
4434         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
4435         uint64_t ret_ref = 0;
4436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4438         return ret_ref;
4439 }
4440
4441 typedef struct LDKEcdsaChannelSigner_JCalls {
4442         atomic_size_t refcnt;
4443         uint32_t instance_ptr;
4444         LDKChannelSigner_JCalls* ChannelSigner;
4445 } LDKEcdsaChannelSigner_JCalls;
4446 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
4447         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4448         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4449                 FREE(j_calls);
4450         }
4451 }
4452 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
4453         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4454         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
4455         uint64_t commitment_tx_ref = 0;
4456         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
4457         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4458         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
4459         LDKCVec_PaymentPreimageZ preimages_var = preimages;
4460         ptrArray preimages_arr = NULL;
4461         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
4462         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
4463         for (size_t m = 0; m < preimages_var.datalen; m++) {
4464                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
4465                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
4466                 preimages_arr_ptr[m] = preimages_conv_12_arr;
4467         }
4468         
4469         FREE(preimages_var.data);
4470         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
4471         void* ret_ptr = untag_ptr(ret);
4472         CHECK_ACCESS(ret_ptr);
4473         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4474         FREE(untag_ptr(ret));
4475         return ret_conv;
4476 }
4477 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
4478         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4479         int64_t idx_conv = idx;
4480         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
4481         memcpy(secret_arr->elems, *secret, 32);
4482         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 8, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
4483         void* ret_ptr = untag_ptr(ret);
4484         CHECK_ACCESS(ret_ptr);
4485         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4486         FREE(untag_ptr(ret));
4487         return ret_conv;
4488 }
4489 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
4490         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4491         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
4492         uint64_t commitment_tx_ref = 0;
4493         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
4494         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4495         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
4496         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 9, commitment_tx_ref, 0, 0, 0, 0, 0);
4497         void* ret_ptr = untag_ptr(ret);
4498         CHECK_ACCESS(ret_ptr);
4499         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4500         FREE(untag_ptr(ret));
4501         return ret_conv;
4502 }
4503 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]) {
4504         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4505         LDKTransaction justice_tx_var = justice_tx;
4506         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
4507         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
4508         Transaction_free(justice_tx_var);
4509         uint32_t input_conv = input;
4510         int64_t amount_conv = amount;
4511         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
4512         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
4513         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);
4514         void* ret_ptr = untag_ptr(ret);
4515         CHECK_ACCESS(ret_ptr);
4516         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4517         FREE(untag_ptr(ret));
4518         return ret_conv;
4519 }
4520 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) {
4521         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4522         LDKTransaction justice_tx_var = justice_tx;
4523         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
4524         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
4525         Transaction_free(justice_tx_var);
4526         uint32_t input_conv = input;
4527         int64_t amount_conv = amount;
4528         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
4529         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
4530         LDKHTLCOutputInCommitment htlc_var = *htlc;
4531         uint64_t htlc_ref = 0;
4532         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4533         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4534         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
4535         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);
4536         void* ret_ptr = untag_ptr(ret);
4537         CHECK_ACCESS(ret_ptr);
4538         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4539         FREE(untag_ptr(ret));
4540         return ret_conv;
4541 }
4542 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) {
4543         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4544         LDKTransaction htlc_tx_var = htlc_tx;
4545         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
4546         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
4547         Transaction_free(htlc_tx_var);
4548         uint32_t input_conv = input;
4549         int64_t amount_conv = amount;
4550         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
4551         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
4552         LDKHTLCOutputInCommitment htlc_var = *htlc;
4553         uint64_t htlc_ref = 0;
4554         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4555         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4556         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
4557         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);
4558         void* ret_ptr = untag_ptr(ret);
4559         CHECK_ACCESS(ret_ptr);
4560         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4561         FREE(untag_ptr(ret));
4562         return ret_conv;
4563 }
4564 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
4565         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4566         LDKClosingTransaction closing_tx_var = *closing_tx;
4567         uint64_t closing_tx_ref = 0;
4568         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
4569         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
4570         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
4571         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 13, closing_tx_ref, 0, 0, 0, 0, 0);
4572         void* ret_ptr = untag_ptr(ret);
4573         CHECK_ACCESS(ret_ptr);
4574         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4575         FREE(untag_ptr(ret));
4576         return ret_conv;
4577 }
4578 LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
4579         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4580         LDKTransaction anchor_tx_var = anchor_tx;
4581         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
4582         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
4583         Transaction_free(anchor_tx_var);
4584         uint32_t input_conv = input;
4585         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 14, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
4586         void* ret_ptr = untag_ptr(ret);
4587         CHECK_ACCESS(ret_ptr);
4588         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4589         FREE(untag_ptr(ret));
4590         return ret_conv;
4591 }
4592 LDKCResult_SignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
4593         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
4594         LDKUnsignedChannelAnnouncement msg_var = *msg;
4595         uint64_t msg_ref = 0;
4596         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
4597         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4598         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
4599         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 15, msg_ref, 0, 0, 0, 0, 0);
4600         void* ret_ptr = untag_ptr(ret);
4601         CHECK_ACCESS(ret_ptr);
4602         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4603         FREE(untag_ptr(ret));
4604         return ret_conv;
4605 }
4606 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
4607         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
4608         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4609         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
4610 }
4611 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
4612         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
4613         atomic_init(&calls->refcnt, 1);
4614         calls->instance_ptr = o;
4615
4616         LDKChannelPublicKeys pubkeys_conv;
4617         pubkeys_conv.inner = untag_ptr(pubkeys);
4618         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4619         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4620
4621         LDKEcdsaChannelSigner ret = {
4622                 .this_arg = (void*) calls,
4623                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
4624                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall,
4625                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall,
4626                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
4627                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
4628                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
4629                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
4630                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
4631                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
4632                 .free = LDKEcdsaChannelSigner_JCalls_free,
4633                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
4634         };
4635         calls->ChannelSigner = ret.ChannelSigner.this_arg;
4636         return ret;
4637 }
4638 uint64_t  __attribute__((export_name("TS_LDKEcdsaChannelSigner_new"))) TS_LDKEcdsaChannelSigner_new(JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
4639         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
4640         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
4641         return tag_ptr(res_ptr, true);
4642 }
4643 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) {
4644         void* this_arg_ptr = untag_ptr(this_arg);
4645         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4646         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4647         LDKCommitmentTransaction commitment_tx_conv;
4648         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4649         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4650         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4651         commitment_tx_conv.is_owned = false;
4652         LDKCVec_PaymentPreimageZ preimages_constr;
4653         preimages_constr.datalen = preimages->arr_len;
4654         if (preimages_constr.datalen > 0)
4655                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4656         else
4657                 preimages_constr.data = NULL;
4658         int8_tArray* preimages_vals = (void*) preimages->elems;
4659         for (size_t m = 0; m < preimages_constr.datalen; m++) {
4660                 int8_tArray preimages_conv_12 = preimages_vals[m];
4661                 LDKThirtyTwoBytes preimages_conv_12_ref;
4662                 CHECK(preimages_conv_12->arr_len == 32);
4663                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4664                 preimages_constr.data[m] = preimages_conv_12_ref;
4665         }
4666         FREE(preimages);
4667         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4668         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4669         return tag_ptr(ret_conv, true);
4670 }
4671
4672 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) {
4673         void* this_arg_ptr = untag_ptr(this_arg);
4674         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4675         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4676         uint8_t secret_arr[32];
4677         CHECK(secret->arr_len == 32);
4678         memcpy(secret_arr, secret->elems, 32); FREE(secret);
4679         uint8_t (*secret_ref)[32] = &secret_arr;
4680         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4681         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
4682         return tag_ptr(ret_conv, true);
4683 }
4684
4685 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) {
4686         void* this_arg_ptr = untag_ptr(this_arg);
4687         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4688         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4689         LDKHolderCommitmentTransaction commitment_tx_conv;
4690         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4691         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4692         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4693         commitment_tx_conv.is_owned = false;
4694         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4695         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
4696         return tag_ptr(ret_conv, true);
4697 }
4698
4699 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) {
4700         void* this_arg_ptr = untag_ptr(this_arg);
4701         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4702         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4703         LDKTransaction justice_tx_ref;
4704         justice_tx_ref.datalen = justice_tx->arr_len;
4705         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4706         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4707         justice_tx_ref.data_is_owned = true;
4708         uint8_t per_commitment_key_arr[32];
4709         CHECK(per_commitment_key->arr_len == 32);
4710         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4711         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4712         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4713         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
4714         return tag_ptr(ret_conv, true);
4715 }
4716
4717 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) {
4718         void* this_arg_ptr = untag_ptr(this_arg);
4719         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4720         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4721         LDKTransaction justice_tx_ref;
4722         justice_tx_ref.datalen = justice_tx->arr_len;
4723         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4724         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4725         justice_tx_ref.data_is_owned = true;
4726         uint8_t per_commitment_key_arr[32];
4727         CHECK(per_commitment_key->arr_len == 32);
4728         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4729         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4730         LDKHTLCOutputInCommitment htlc_conv;
4731         htlc_conv.inner = untag_ptr(htlc);
4732         htlc_conv.is_owned = ptr_is_owned(htlc);
4733         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4734         htlc_conv.is_owned = false;
4735         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4736         *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);
4737         return tag_ptr(ret_conv, true);
4738 }
4739
4740 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) {
4741         void* this_arg_ptr = untag_ptr(this_arg);
4742         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4743         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4744         LDKTransaction htlc_tx_ref;
4745         htlc_tx_ref.datalen = htlc_tx->arr_len;
4746         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4747         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
4748         htlc_tx_ref.data_is_owned = true;
4749         LDKPublicKey per_commitment_point_ref;
4750         CHECK(per_commitment_point->arr_len == 33);
4751         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
4752         LDKHTLCOutputInCommitment htlc_conv;
4753         htlc_conv.inner = untag_ptr(htlc);
4754         htlc_conv.is_owned = ptr_is_owned(htlc);
4755         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4756         htlc_conv.is_owned = false;
4757         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4758         *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);
4759         return tag_ptr(ret_conv, true);
4760 }
4761
4762 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_closing_transaction"))) TS_EcdsaChannelSigner_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
4763         void* this_arg_ptr = untag_ptr(this_arg);
4764         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4765         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4766         LDKClosingTransaction closing_tx_conv;
4767         closing_tx_conv.inner = untag_ptr(closing_tx);
4768         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
4769         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4770         closing_tx_conv.is_owned = false;
4771         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4772         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4773         return tag_ptr(ret_conv, true);
4774 }
4775
4776 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) {
4777         void* this_arg_ptr = untag_ptr(this_arg);
4778         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4779         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4780         LDKTransaction anchor_tx_ref;
4781         anchor_tx_ref.datalen = anchor_tx->arr_len;
4782         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
4783         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
4784         anchor_tx_ref.data_is_owned = true;
4785         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4786         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
4787         return tag_ptr(ret_conv, true);
4788 }
4789
4790 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) {
4791         void* this_arg_ptr = untag_ptr(this_arg);
4792         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4793         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
4794         LDKUnsignedChannelAnnouncement msg_conv;
4795         msg_conv.inner = untag_ptr(msg);
4796         msg_conv.is_owned = ptr_is_owned(msg);
4797         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4798         msg_conv.is_owned = false;
4799         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4800         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
4801         return tag_ptr(ret_conv, true);
4802 }
4803
4804 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
4805         atomic_size_t refcnt;
4806         uint32_t instance_ptr;
4807         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
4808         LDKChannelSigner_JCalls* ChannelSigner;
4809 } LDKWriteableEcdsaChannelSigner_JCalls;
4810 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
4811         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
4812         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4813                 FREE(j_calls);
4814         }
4815 }
4816 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
4817         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
4818         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 16, 0, 0, 0, 0, 0, 0);
4819         LDKCVec_u8Z ret_ref;
4820         ret_ref.datalen = ret->arr_len;
4821         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4822         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4823         return ret_ref;
4824 }
4825 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
4826         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
4827         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4828         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
4829         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
4830 }
4831 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
4832         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
4833         atomic_init(&calls->refcnt, 1);
4834         calls->instance_ptr = o;
4835
4836         LDKChannelPublicKeys pubkeys_conv;
4837         pubkeys_conv.inner = untag_ptr(pubkeys);
4838         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4839         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4840
4841         LDKWriteableEcdsaChannelSigner ret = {
4842                 .this_arg = (void*) calls,
4843                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
4844                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
4845                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
4846                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
4847         };
4848         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
4849         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
4850         return ret;
4851 }
4852 uint64_t  __attribute__((export_name("TS_LDKWriteableEcdsaChannelSigner_new"))) TS_LDKWriteableEcdsaChannelSigner_new(JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
4853         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
4854         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
4855         return tag_ptr(res_ptr, true);
4856 }
4857 int8_tArray  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_write"))) TS_WriteableEcdsaChannelSigner_write(uint64_t this_arg) {
4858         void* this_arg_ptr = untag_ptr(this_arg);
4859         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4860         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
4861         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4862         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4863         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4864         CVec_u8Z_free(ret_var);
4865         return ret_arr;
4866 }
4867
4868 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
4869 CHECK(owner->result_ok);
4870         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
4871 }
4872 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(uint64_t owner) {
4873         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
4874         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
4875         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
4876         return tag_ptr(ret_ret, true);
4877 }
4878
4879 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
4880 CHECK(!owner->result_ok);
4881         return DecodeError_clone(&*owner->contents.err);
4882 }
4883 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(uint64_t owner) {
4884         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
4885         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4886         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
4887         uint64_t ret_ref = tag_ptr(ret_copy, true);
4888         return ret_ref;
4889 }
4890
4891 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4892         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4893         for (size_t i = 0; i < ret.datalen; i++) {
4894                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4895         }
4896         return ret;
4897 }
4898 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4899 CHECK(owner->result_ok);
4900         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4901 }
4902 ptrArray  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint64_t owner) {
4903         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4904         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4905         ptrArray ret_arr = NULL;
4906         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
4907         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
4908         for (size_t m = 0; m < ret_var.datalen; m++) {
4909                 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
4910                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
4911                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
4912                 CVec_u8Z_free(ret_conv_12_var);
4913                 ret_arr_ptr[m] = ret_conv_12_arr;
4914         }
4915         
4916         FREE(ret_var.data);
4917         return ret_arr;
4918 }
4919
4920 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4921 CHECK(!owner->result_ok);
4922         return *owner->contents.err;
4923 }
4924 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint64_t owner) {
4925         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4926         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4927 }
4928
4929 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4930         LDKInMemorySigner ret = *owner->contents.result;
4931         ret.is_owned = false;
4932         return ret;
4933 }
4934 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
4935         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4936         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4937         uint64_t ret_ref = 0;
4938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4940         return ret_ref;
4941 }
4942
4943 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4944 CHECK(!owner->result_ok);
4945         return DecodeError_clone(&*owner->contents.err);
4946 }
4947 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
4948         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4949         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4950         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4951         uint64_t ret_ref = tag_ptr(ret_copy, true);
4952         return ret_ref;
4953 }
4954
4955 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4956         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4957         for (size_t i = 0; i < ret.datalen; i++) {
4958                 ret.data[i] = TxOut_clone(&orig->data[i]);
4959         }
4960         return ret;
4961 }
4962 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4963 CHECK(owner->result_ok);
4964         return *owner->contents.result;
4965 }
4966 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
4967         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4968         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4969         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4970         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4971         return ret_arr;
4972 }
4973
4974 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4975 CHECK(!owner->result_ok);
4976         return *owner->contents.err;
4977 }
4978 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
4979         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4980         CResult_TransactionNoneZ_get_err(owner_conv);
4981 }
4982
4983 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
4984         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4985         switch(obj->tag) {
4986                 case LDKCOption_u16Z_Some: return 0;
4987                 case LDKCOption_u16Z_None: return 1;
4988                 default: abort();
4989         }
4990 }
4991 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
4992         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4993         assert(obj->tag == LDKCOption_u16Z_Some);
4994                         int16_t some_conv = obj->some;
4995         return some_conv;
4996 }
4997 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4998 CHECK(owner->result_ok);
4999         return ThirtyTwoBytes_clone(&*owner->contents.result);
5000 }
5001 int8_tArray  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint64_t owner) {
5002         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
5003         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5004         memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
5005         return ret_arr;
5006 }
5007
5008 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5009 CHECK(!owner->result_ok);
5010         return APIError_clone(&*owner->contents.err);
5011 }
5012 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint64_t owner) {
5013         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
5014         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5015         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
5016         uint64_t ret_ref = tag_ptr(ret_copy, true);
5017         return ret_ref;
5018 }
5019
5020 uint32_t __attribute__((export_name("TS_LDKRecentPaymentDetails_ty_from_ptr"))) TS_LDKRecentPaymentDetails_ty_from_ptr(uint64_t ptr) {
5021         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5022         switch(obj->tag) {
5023                 case LDKRecentPaymentDetails_Pending: return 0;
5024                 case LDKRecentPaymentDetails_Fulfilled: return 1;
5025                 case LDKRecentPaymentDetails_Abandoned: return 2;
5026                 default: abort();
5027         }
5028 }
5029 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_hash"))) TS_LDKRecentPaymentDetails_Pending_get_payment_hash(uint64_t ptr) {
5030         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5031         assert(obj->tag == LDKRecentPaymentDetails_Pending);
5032                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5033                         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
5034         return payment_hash_arr;
5035 }
5036 int64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_total_msat"))) TS_LDKRecentPaymentDetails_Pending_get_total_msat(uint64_t ptr) {
5037         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5038         assert(obj->tag == LDKRecentPaymentDetails_Pending);
5039                         int64_t total_msat_conv = obj->pending.total_msat;
5040         return total_msat_conv;
5041 }
5042 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(uint64_t ptr) {
5043         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5044         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
5045                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5046                         memcpy(payment_hash_arr->elems, obj->fulfilled.payment_hash.data, 32);
5047         return payment_hash_arr;
5048 }
5049 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash(uint64_t ptr) {
5050         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5051         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
5052                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5053                         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
5054         return payment_hash_arr;
5055 }
5056 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
5057         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
5058         for (size_t i = 0; i < ret.datalen; i++) {
5059                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
5060         }
5061         return ret;
5062 }
5063 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
5064         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5065         switch(obj->tag) {
5066                 case LDKPaymentSendFailure_ParameterError: return 0;
5067                 case LDKPaymentSendFailure_PathParameterError: return 1;
5068                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
5069                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
5070                 case LDKPaymentSendFailure_PartialFailure: return 4;
5071                 default: abort();
5072         }
5073 }
5074 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
5075         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5076         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
5077                         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
5078         return parameter_error_ref;
5079 }
5080 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
5081         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5082         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
5083                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
5084                         uint64_tArray path_parameter_error_arr = NULL;
5085                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
5086                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
5087                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
5088                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5089                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
5090                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
5091                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
5092                         }
5093                         
5094         return path_parameter_error_arr;
5095 }
5096 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe"))) TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(uint64_t ptr) {
5097         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5098         assert(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
5099                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
5100                         uint64_tArray all_failed_resend_safe_arr = NULL;
5101                         all_failed_resend_safe_arr = init_uint64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
5102                         uint64_t *all_failed_resend_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
5103                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
5104                                 uint64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
5105                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
5106                         }
5107                         
5108         return all_failed_resend_safe_arr;
5109 }
5110 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
5111         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5112         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
5113                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
5114                         uint64_tArray results_arr = NULL;
5115                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
5116                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
5117                         for (size_t w = 0; w < results_var.datalen; w++) {
5118                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5119                                 *results_conv_22_conv = results_var.data[w];
5120                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
5121                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
5122                         }
5123                         
5124         return results_arr;
5125 }
5126 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
5127         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5128         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
5129                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
5130                         uint64_t failed_paths_retry_ref = 0;
5131                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
5132                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
5133         return failed_paths_retry_ref;
5134 }
5135 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
5136         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5137         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
5138                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5139                         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
5140         return payment_id_arr;
5141 }
5142 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5143 CHECK(owner->result_ok);
5144         return *owner->contents.result;
5145 }
5146 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
5147         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5148         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
5149 }
5150
5151 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5152 CHECK(!owner->result_ok);
5153         return PaymentSendFailure_clone(&*owner->contents.err);
5154 }
5155 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
5156         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5157         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5158         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
5159         uint64_t ret_ref = tag_ptr(ret_copy, true);
5160         return ret_ref;
5161 }
5162
5163 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
5164 CHECK(owner->result_ok);
5165         return *owner->contents.result;
5166 }
5167 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_ok"))) TS_CResult_NoneRetryableSendFailureZ_get_ok(uint64_t owner) {
5168         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
5169         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
5170 }
5171
5172 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
5173 CHECK(!owner->result_ok);
5174         return RetryableSendFailure_clone(&*owner->contents.err);
5175 }
5176 uint32_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_err"))) TS_CResult_NoneRetryableSendFailureZ_get_err(uint64_t owner) {
5177         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
5178         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
5179         return ret_conv;
5180 }
5181
5182 static inline struct LDKThirtyTwoBytes CResult_PaymentHashPaymentSendFailureZ_get_ok(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
5183 CHECK(owner->result_ok);
5184         return ThirtyTwoBytes_clone(&*owner->contents.result);
5185 }
5186 int8_tArray  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_get_ok(uint64_t owner) {
5187         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
5188         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5189         memcpy(ret_arr->elems, CResult_PaymentHashPaymentSendFailureZ_get_ok(owner_conv).data, 32);
5190         return ret_arr;
5191 }
5192
5193 static inline struct LDKPaymentSendFailure CResult_PaymentHashPaymentSendFailureZ_get_err(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
5194 CHECK(!owner->result_ok);
5195         return PaymentSendFailure_clone(&*owner->contents.err);
5196 }
5197 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_get_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_get_err(uint64_t owner) {
5198         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
5199         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5200         *ret_copy = CResult_PaymentHashPaymentSendFailureZ_get_err(owner_conv);
5201         uint64_t ret_ref = tag_ptr(ret_copy, true);
5202         return ret_ref;
5203 }
5204
5205 static inline struct LDKThirtyTwoBytes CResult_PaymentHashRetryableSendFailureZ_get_ok(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){
5206 CHECK(owner->result_ok);
5207         return ThirtyTwoBytes_clone(&*owner->contents.result);
5208 }
5209 int8_tArray  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_get_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_get_ok(uint64_t owner) {
5210         LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner);
5211         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5212         memcpy(ret_arr->elems, CResult_PaymentHashRetryableSendFailureZ_get_ok(owner_conv).data, 32);
5213         return ret_arr;
5214 }
5215
5216 static inline enum LDKRetryableSendFailure CResult_PaymentHashRetryableSendFailureZ_get_err(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){
5217 CHECK(!owner->result_ok);
5218         return RetryableSendFailure_clone(&*owner->contents.err);
5219 }
5220 uint32_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_get_err"))) TS_CResult_PaymentHashRetryableSendFailureZ_get_err(uint64_t owner) {
5221         LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner);
5222         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_PaymentHashRetryableSendFailureZ_get_err(owner_conv));
5223         return ret_conv;
5224 }
5225
5226 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5227         return ThirtyTwoBytes_clone(&owner->a);
5228 }
5229 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint64_t owner) {
5230         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
5231         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5232         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
5233         return ret_arr;
5234 }
5235
5236 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5237         return ThirtyTwoBytes_clone(&owner->b);
5238 }
5239 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint64_t owner) {
5240         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
5241         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5242         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
5243         return ret_arr;
5244 }
5245
5246 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5247 CHECK(owner->result_ok);
5248         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
5249 }
5250 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint64_t owner) {
5251         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
5252         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
5253         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
5254         return tag_ptr(ret_conv, true);
5255 }
5256
5257 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5258 CHECK(!owner->result_ok);
5259         return PaymentSendFailure_clone(&*owner->contents.err);
5260 }
5261 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint64_t owner) {
5262         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
5263         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5264         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
5265         uint64_t ret_ref = tag_ptr(ret_copy, true);
5266         return ret_ref;
5267 }
5268
5269 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
5270         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
5271         for (size_t i = 0; i < ret.datalen; i++) {
5272                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
5273         }
5274         return ret;
5275 }
5276 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5277         return ThirtyTwoBytes_clone(&owner->a);
5278 }
5279 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint64_t owner) {
5280         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
5281         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5282         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
5283         return ret_arr;
5284 }
5285
5286 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5287         return ThirtyTwoBytes_clone(&owner->b);
5288 }
5289 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint64_t owner) {
5290         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
5291         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5292         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
5293         return ret_arr;
5294 }
5295
5296 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5297 CHECK(owner->result_ok);
5298         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5299 }
5300 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint64_t owner) {
5301         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
5302         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5303         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
5304         return tag_ptr(ret_conv, true);
5305 }
5306
5307 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5308 CHECK(!owner->result_ok);
5309         return *owner->contents.err;
5310 }
5311 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint64_t owner) {
5312         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
5313         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
5314 }
5315
5316 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5317 CHECK(owner->result_ok);
5318         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5319 }
5320 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint64_t owner) {
5321         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
5322         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5323         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
5324         return tag_ptr(ret_conv, true);
5325 }
5326
5327 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5328 CHECK(!owner->result_ok);
5329         return APIError_clone(&*owner->contents.err);
5330 }
5331 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint64_t owner) {
5332         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
5333         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5334         *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
5335         uint64_t ret_ref = tag_ptr(ret_copy, true);
5336         return ret_ref;
5337 }
5338
5339 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5340 CHECK(owner->result_ok);
5341         return ThirtyTwoBytes_clone(&*owner->contents.result);
5342 }
5343 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint64_t owner) {
5344         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
5345         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5346         memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
5347         return ret_arr;
5348 }
5349
5350 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5351 CHECK(!owner->result_ok);
5352         return *owner->contents.err;
5353 }
5354 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint64_t owner) {
5355         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
5356         CResult_PaymentSecretNoneZ_get_err(owner_conv);
5357 }
5358
5359 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5360 CHECK(owner->result_ok);
5361         return ThirtyTwoBytes_clone(&*owner->contents.result);
5362 }
5363 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint64_t owner) {
5364         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
5365         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5366         memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
5367         return ret_arr;
5368 }
5369
5370 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5371 CHECK(!owner->result_ok);
5372         return APIError_clone(&*owner->contents.err);
5373 }
5374 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint64_t owner) {
5375         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
5376         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5377         *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
5378         uint64_t ret_ref = tag_ptr(ret_copy, true);
5379         return ret_ref;
5380 }
5381
5382 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5383 CHECK(owner->result_ok);
5384         return ThirtyTwoBytes_clone(&*owner->contents.result);
5385 }
5386 int8_tArray  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint64_t owner) {
5387         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
5388         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5389         memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
5390         return ret_arr;
5391 }
5392
5393 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5394 CHECK(!owner->result_ok);
5395         return APIError_clone(&*owner->contents.err);
5396 }
5397 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint64_t owner) {
5398         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
5399         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5400         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
5401         uint64_t ret_ref = tag_ptr(ret_copy, true);
5402         return ret_ref;
5403 }
5404
5405 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5406         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
5407         ret.is_owned = false;
5408         return ret;
5409 }
5410 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
5411         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5412         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5413         uint64_t ret_ref = 0;
5414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5416         return ret_ref;
5417 }
5418
5419 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5420 CHECK(!owner->result_ok);
5421         return DecodeError_clone(&*owner->contents.err);
5422 }
5423 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
5424         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5425         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5426         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5427         uint64_t ret_ref = tag_ptr(ret_copy, true);
5428         return ret_ref;
5429 }
5430
5431 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5432         LDKChannelCounterparty ret = *owner->contents.result;
5433         ret.is_owned = false;
5434         return ret;
5435 }
5436 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
5437         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5438         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5439         uint64_t ret_ref = 0;
5440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5442         return ret_ref;
5443 }
5444
5445 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5446 CHECK(!owner->result_ok);
5447         return DecodeError_clone(&*owner->contents.err);
5448 }
5449 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
5450         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5451         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5452         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5453         uint64_t ret_ref = tag_ptr(ret_copy, true);
5454         return ret_ref;
5455 }
5456
5457 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5458         LDKChannelDetails ret = *owner->contents.result;
5459         ret.is_owned = false;
5460         return ret;
5461 }
5462 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
5463         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5464         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5465         uint64_t ret_ref = 0;
5466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5468         return ret_ref;
5469 }
5470
5471 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5472 CHECK(!owner->result_ok);
5473         return DecodeError_clone(&*owner->contents.err);
5474 }
5475 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
5476         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5477         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5478         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5479         uint64_t ret_ref = tag_ptr(ret_copy, true);
5480         return ret_ref;
5481 }
5482
5483 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5484         LDKPhantomRouteHints ret = *owner->contents.result;
5485         ret.is_owned = false;
5486         return ret;
5487 }
5488 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
5489         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5490         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5491         uint64_t ret_ref = 0;
5492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5494         return ret_ref;
5495 }
5496
5497 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5498 CHECK(!owner->result_ok);
5499         return DecodeError_clone(&*owner->contents.err);
5500 }
5501 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
5502         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5503         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5504         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5505         uint64_t ret_ref = tag_ptr(ret_copy, true);
5506         return ret_ref;
5507 }
5508
5509 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5510         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5511         for (size_t i = 0; i < ret.datalen; i++) {
5512                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5513         }
5514         return ret;
5515 }
5516 typedef struct LDKWatch_JCalls {
5517         atomic_size_t refcnt;
5518         uint32_t instance_ptr;
5519 } LDKWatch_JCalls;
5520 static void LDKWatch_JCalls_free(void* this_arg) {
5521         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5522         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5523                 FREE(j_calls);
5524         }
5525 }
5526 LDKChannelMonitorUpdateStatus watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5527         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5528         LDKOutPoint funding_txo_var = funding_txo;
5529         uint64_t funding_txo_ref = 0;
5530         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5531         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5532         LDKChannelMonitor monitor_var = monitor;
5533         uint64_t monitor_ref = 0;
5534         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5535         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
5536         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 17, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
5537         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
5538         return ret_conv;
5539 }
5540 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
5541         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5542         LDKOutPoint funding_txo_var = funding_txo;
5543         uint64_t funding_txo_ref = 0;
5544         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5545         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5546         LDKChannelMonitorUpdate update_var = *update;
5547         uint64_t update_ref = 0;
5548         update_var = ChannelMonitorUpdate_clone(&update_var);
5549         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5550         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
5551         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, update_ref, 0, 0, 0, 0);
5552         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
5553         return ret_conv;
5554 }
5555 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5556         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5557         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 19, 0, 0, 0, 0, 0, 0);
5558         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
5559         ret_constr.datalen = ret->arr_len;
5560         if (ret_constr.datalen > 0)
5561                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
5562         else
5563                 ret_constr.data = NULL;
5564         uint64_t* ret_vals = ret->elems;
5565         for (size_t x = 0; x < ret_constr.datalen; x++) {
5566                 uint64_t ret_conv_49 = ret_vals[x];
5567                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
5568                 CHECK_ACCESS(ret_conv_49_ptr);
5569                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
5570                 FREE(untag_ptr(ret_conv_49));
5571                 ret_constr.data[x] = ret_conv_49_conv;
5572         }
5573         FREE(ret);
5574         return ret_constr;
5575 }
5576 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5577         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5578         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5579 }
5580 static inline LDKWatch LDKWatch_init (JSValue o) {
5581         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5582         atomic_init(&calls->refcnt, 1);
5583         calls->instance_ptr = o;
5584
5585         LDKWatch ret = {
5586                 .this_arg = (void*) calls,
5587                 .watch_channel = watch_channel_LDKWatch_jcall,
5588                 .update_channel = update_channel_LDKWatch_jcall,
5589                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5590                 .free = LDKWatch_JCalls_free,
5591         };
5592         return ret;
5593 }
5594 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5595         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5596         *res_ptr = LDKWatch_init(o);
5597         return tag_ptr(res_ptr, true);
5598 }
5599 uint32_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
5600         void* this_arg_ptr = untag_ptr(this_arg);
5601         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5602         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5603         LDKOutPoint funding_txo_conv;
5604         funding_txo_conv.inner = untag_ptr(funding_txo);
5605         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5606         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5607         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5608         LDKChannelMonitor monitor_conv;
5609         monitor_conv.inner = untag_ptr(monitor);
5610         monitor_conv.is_owned = ptr_is_owned(monitor);
5611         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5612         monitor_conv = ChannelMonitor_clone(&monitor_conv);
5613         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv));
5614         return ret_conv;
5615 }
5616
5617 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
5618         void* this_arg_ptr = untag_ptr(this_arg);
5619         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5620         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5621         LDKOutPoint funding_txo_conv;
5622         funding_txo_conv.inner = untag_ptr(funding_txo);
5623         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5624         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5625         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5626         LDKChannelMonitorUpdate update_conv;
5627         update_conv.inner = untag_ptr(update);
5628         update_conv.is_owned = ptr_is_owned(update);
5629         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5630         update_conv.is_owned = false;
5631         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
5632         return ret_conv;
5633 }
5634
5635 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
5636         void* this_arg_ptr = untag_ptr(this_arg);
5637         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5638         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5639         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5640         uint64_tArray ret_arr = NULL;
5641         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5642         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5643         for (size_t x = 0; x < ret_var.datalen; x++) {
5644                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
5645                 *ret_conv_49_conv = ret_var.data[x];
5646                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
5647         }
5648         
5649         FREE(ret_var.data);
5650         return ret_arr;
5651 }
5652
5653 typedef struct LDKBroadcasterInterface_JCalls {
5654         atomic_size_t refcnt;
5655         uint32_t instance_ptr;
5656 } LDKBroadcasterInterface_JCalls;
5657 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5658         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5659         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5660                 FREE(j_calls);
5661         }
5662 }
5663 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5664         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5665         LDKTransaction tx_var = tx;
5666         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
5667         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
5668         Transaction_free(tx_var);
5669         js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
5670 }
5671 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5672         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5673         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5674 }
5675 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5676         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5677         atomic_init(&calls->refcnt, 1);
5678         calls->instance_ptr = o;
5679
5680         LDKBroadcasterInterface ret = {
5681                 .this_arg = (void*) calls,
5682                 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5683                 .free = LDKBroadcasterInterface_JCalls_free,
5684         };
5685         return ret;
5686 }
5687 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5688         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5689         *res_ptr = LDKBroadcasterInterface_init(o);
5690         return tag_ptr(res_ptr, true);
5691 }
5692 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint64_t this_arg, int8_tArray tx) {
5693         void* this_arg_ptr = untag_ptr(this_arg);
5694         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5695         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5696         LDKTransaction tx_ref;
5697         tx_ref.datalen = tx->arr_len;
5698         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5699         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
5700         tx_ref.data_is_owned = true;
5701         (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5702 }
5703
5704 typedef struct LDKEntropySource_JCalls {
5705         atomic_size_t refcnt;
5706         uint32_t instance_ptr;
5707 } LDKEntropySource_JCalls;
5708 static void LDKEntropySource_JCalls_free(void* this_arg) {
5709         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5710         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5711                 FREE(j_calls);
5712         }
5713 }
5714 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
5715         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5716         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, 0, 0, 0, 0, 0, 0);
5717         LDKThirtyTwoBytes ret_ref;
5718         CHECK(ret->arr_len == 32);
5719         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5720         return ret_ref;
5721 }
5722 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
5723         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
5724         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5725 }
5726 static inline LDKEntropySource LDKEntropySource_init (JSValue o) {
5727         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
5728         atomic_init(&calls->refcnt, 1);
5729         calls->instance_ptr = o;
5730
5731         LDKEntropySource ret = {
5732                 .this_arg = (void*) calls,
5733                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
5734                 .free = LDKEntropySource_JCalls_free,
5735         };
5736         return ret;
5737 }
5738 uint64_t  __attribute__((export_name("TS_LDKEntropySource_new"))) TS_LDKEntropySource_new(JSValue o) {
5739         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
5740         *res_ptr = LDKEntropySource_init(o);
5741         return tag_ptr(res_ptr, true);
5742 }
5743 int8_tArray  __attribute__((export_name("TS_EntropySource_get_secure_random_bytes"))) TS_EntropySource_get_secure_random_bytes(uint64_t this_arg) {
5744         void* this_arg_ptr = untag_ptr(this_arg);
5745         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5746         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
5747         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5748         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5749         return ret_arr;
5750 }
5751
5752 uint32_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ty_from_ptr"))) TS_LDKUnsignedGossipMessage_ty_from_ptr(uint64_t ptr) {
5753         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5754         switch(obj->tag) {
5755                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
5756                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
5757                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
5758                 default: abort();
5759         }
5760 }
5761 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement"))) TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(uint64_t ptr) {
5762         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5763         assert(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
5764                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
5765                         uint64_t channel_announcement_ref = 0;
5766                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
5767                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
5768         return channel_announcement_ref;
5769 }
5770 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update"))) TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(uint64_t ptr) {
5771         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5772         assert(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
5773                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
5774                         uint64_t channel_update_ref = 0;
5775                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
5776                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
5777         return channel_update_ref;
5778 }
5779 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement"))) TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(uint64_t ptr) {
5780         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5781         assert(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
5782                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
5783                         uint64_t node_announcement_ref = 0;
5784                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
5785                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
5786         return node_announcement_ref;
5787 }
5788 typedef struct LDKNodeSigner_JCalls {
5789         atomic_size_t refcnt;
5790         uint32_t instance_ptr;
5791 } LDKNodeSigner_JCalls;
5792 static void LDKNodeSigner_JCalls_free(void* this_arg) {
5793         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5794         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5795                 FREE(j_calls);
5796         }
5797 }
5798 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
5799         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5800         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
5801         LDKThirtyTwoBytes ret_ref;
5802         CHECK(ret->arr_len == 32);
5803         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5804         return ret_ref;
5805 }
5806 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
5807         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5808         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5809         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 23, recipient_conv, 0, 0, 0, 0, 0);
5810         void* ret_ptr = untag_ptr(ret);
5811         CHECK_ACCESS(ret_ptr);
5812         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
5813         FREE(untag_ptr(ret));
5814         return ret_conv;
5815 }
5816 LDKCResult_SharedSecretNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) {
5817         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5818         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5819         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
5820         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
5821         LDKCOption_ScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
5822         *tweak_copy = tweak;
5823         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
5824         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 24, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
5825         void* ret_ptr = untag_ptr(ret);
5826         CHECK_ACCESS(ret_ptr);
5827         LDKCResult_SharedSecretNoneZ ret_conv = *(LDKCResult_SharedSecretNoneZ*)(ret_ptr);
5828         FREE(untag_ptr(ret));
5829         return ret_conv;
5830 }
5831 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
5832         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5833         LDKu8slice hrp_bytes_var = hrp_bytes;
5834         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5835         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5836         LDKCVec_U5Z invoice_data_var = invoice_data;
5837         ptrArray invoice_data_arr = NULL;
5838         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5839         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
5840         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5841                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5842                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5843         }
5844         
5845         FREE(invoice_data_var.data);
5846         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5847         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);
5848         void* ret_ptr = untag_ptr(ret);
5849         CHECK_ACCESS(ret_ptr);
5850         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5851         FREE(untag_ptr(ret));
5852         return ret_conv;
5853 }
5854 LDKCResult_SignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
5855         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5856         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
5857         *msg_copy = msg;
5858         uint64_t msg_ref = tag_ptr(msg_copy, true);
5859         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 26, msg_ref, 0, 0, 0, 0, 0);
5860         void* ret_ptr = untag_ptr(ret);
5861         CHECK_ACCESS(ret_ptr);
5862         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
5863         FREE(untag_ptr(ret));
5864         return ret_conv;
5865 }
5866 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
5867         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
5868         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5869 }
5870 static inline LDKNodeSigner LDKNodeSigner_init (JSValue o) {
5871         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
5872         atomic_init(&calls->refcnt, 1);
5873         calls->instance_ptr = o;
5874
5875         LDKNodeSigner ret = {
5876                 .this_arg = (void*) calls,
5877                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
5878                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
5879                 .ecdh = ecdh_LDKNodeSigner_jcall,
5880                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
5881                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
5882                 .free = LDKNodeSigner_JCalls_free,
5883         };
5884         return ret;
5885 }
5886 uint64_t  __attribute__((export_name("TS_LDKNodeSigner_new"))) TS_LDKNodeSigner_new(JSValue o) {
5887         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
5888         *res_ptr = LDKNodeSigner_init(o);
5889         return tag_ptr(res_ptr, true);
5890 }
5891 int8_tArray  __attribute__((export_name("TS_NodeSigner_get_inbound_payment_key_material"))) TS_NodeSigner_get_inbound_payment_key_material(uint64_t this_arg) {
5892         void* this_arg_ptr = untag_ptr(this_arg);
5893         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5894         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5895         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5896         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5897         return ret_arr;
5898 }
5899
5900 uint64_t  __attribute__((export_name("TS_NodeSigner_get_node_id"))) TS_NodeSigner_get_node_id(uint64_t this_arg, uint32_t recipient) {
5901         void* this_arg_ptr = untag_ptr(this_arg);
5902         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5903         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5904         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5905         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
5906         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
5907         return tag_ptr(ret_conv, true);
5908 }
5909
5910 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) {
5911         void* this_arg_ptr = untag_ptr(this_arg);
5912         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5913         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5914         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5915         LDKPublicKey other_key_ref;
5916         CHECK(other_key->arr_len == 33);
5917         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
5918         void* tweak_ptr = untag_ptr(tweak);
5919         CHECK_ACCESS(tweak_ptr);
5920         LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr);
5921         tweak_conv = COption_ScalarZ_clone((LDKCOption_ScalarZ*)untag_ptr(tweak));
5922         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
5923         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
5924         return tag_ptr(ret_conv, true);
5925 }
5926
5927 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) {
5928         void* this_arg_ptr = untag_ptr(this_arg);
5929         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5930         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5931         LDKu8slice hrp_bytes_ref;
5932         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5933         hrp_bytes_ref.data = hrp_bytes->elems;
5934         LDKCVec_U5Z invoice_data_constr;
5935         invoice_data_constr.datalen = invoice_data->arr_len;
5936         if (invoice_data_constr.datalen > 0)
5937                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
5938         else
5939                 invoice_data_constr.data = NULL;
5940         int8_t* invoice_data_vals = (void*) invoice_data->elems;
5941         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5942                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5943                 
5944                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
5945         }
5946         FREE(invoice_data);
5947         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5948         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5949         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
5950         FREE(hrp_bytes);
5951         return tag_ptr(ret_conv, true);
5952 }
5953
5954 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_gossip_message"))) TS_NodeSigner_sign_gossip_message(uint64_t this_arg, uint64_t msg) {
5955         void* this_arg_ptr = untag_ptr(this_arg);
5956         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5957         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5958         void* msg_ptr = untag_ptr(msg);
5959         CHECK_ACCESS(msg_ptr);
5960         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
5961         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
5962         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5963         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
5964         return tag_ptr(ret_conv, true);
5965 }
5966
5967 typedef struct LDKSignerProvider_JCalls {
5968         atomic_size_t refcnt;
5969         uint32_t instance_ptr;
5970 } LDKSignerProvider_JCalls;
5971 static void LDKSignerProvider_JCalls_free(void* this_arg) {
5972         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5973         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5974                 FREE(j_calls);
5975         }
5976 }
5977 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
5978         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5979         jboolean inbound_conv = inbound;
5980         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5981         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
5982         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
5983         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);
5984         LDKThirtyTwoBytes ret_ref;
5985         CHECK(ret->arr_len == 32);
5986         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5987         return ret_ref;
5988 }
5989 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
5990         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5991         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5992         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
5993         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
5994         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);
5995         void* ret_ptr = untag_ptr(ret);
5996         CHECK_ACCESS(ret_ptr);
5997         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
5998         FREE(untag_ptr(ret));
5999         return ret_conv;
6000 }
6001 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
6002         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6003         LDKu8slice reader_var = reader;
6004         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
6005         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
6006         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 29, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
6007         void* ret_ptr = untag_ptr(ret);
6008         CHECK_ACCESS(ret_ptr);
6009         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
6010         FREE(untag_ptr(ret));
6011         return ret_conv;
6012 }
6013 LDKCVec_u8Z get_destination_script_LDKSignerProvider_jcall(const void* this_arg) {
6014         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6015         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 30, 0, 0, 0, 0, 0, 0);
6016         LDKCVec_u8Z ret_ref;
6017         ret_ref.datalen = ret->arr_len;
6018         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6019         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6020         return ret_ref;
6021 }
6022 LDKShutdownScript get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
6023         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6024         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 31, 0, 0, 0, 0, 0, 0);
6025         LDKShutdownScript ret_conv;
6026         ret_conv.inner = untag_ptr(ret);
6027         ret_conv.is_owned = ptr_is_owned(ret);
6028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
6029         return ret_conv;
6030 }
6031 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
6032         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
6033         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6034 }
6035 static inline LDKSignerProvider LDKSignerProvider_init (JSValue o) {
6036         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
6037         atomic_init(&calls->refcnt, 1);
6038         calls->instance_ptr = o;
6039
6040         LDKSignerProvider ret = {
6041                 .this_arg = (void*) calls,
6042                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
6043                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
6044                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
6045                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
6046                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
6047                 .free = LDKSignerProvider_JCalls_free,
6048         };
6049         return ret;
6050 }
6051 uint64_t  __attribute__((export_name("TS_LDKSignerProvider_new"))) TS_LDKSignerProvider_new(JSValue o) {
6052         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
6053         *res_ptr = LDKSignerProvider_init(o);
6054         return tag_ptr(res_ptr, true);
6055 }
6056 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) {
6057         void* this_arg_ptr = untag_ptr(this_arg);
6058         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6059         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6060         LDKU128 user_channel_id_ref;
6061         CHECK(user_channel_id->arr_len == 16);
6062         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
6063         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6064         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);
6065         return ret_arr;
6066 }
6067
6068 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) {
6069         void* this_arg_ptr = untag_ptr(this_arg);
6070         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6071         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6072         LDKThirtyTwoBytes channel_keys_id_ref;
6073         CHECK(channel_keys_id->arr_len == 32);
6074         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
6075         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
6076         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
6077         return tag_ptr(ret_ret, true);
6078 }
6079
6080 uint64_t  __attribute__((export_name("TS_SignerProvider_read_chan_signer"))) TS_SignerProvider_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
6081         void* this_arg_ptr = untag_ptr(this_arg);
6082         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6083         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6084         LDKu8slice reader_ref;
6085         reader_ref.datalen = reader->arr_len;
6086         reader_ref.data = reader->elems;
6087         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
6088         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6089         FREE(reader);
6090         return tag_ptr(ret_conv, true);
6091 }
6092
6093 int8_tArray  __attribute__((export_name("TS_SignerProvider_get_destination_script"))) TS_SignerProvider_get_destination_script(uint64_t this_arg) {
6094         void* this_arg_ptr = untag_ptr(this_arg);
6095         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6096         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6097         LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
6098         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6099         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6100         CVec_u8Z_free(ret_var);
6101         return ret_arr;
6102 }
6103
6104 uint64_t  __attribute__((export_name("TS_SignerProvider_get_shutdown_scriptpubkey"))) TS_SignerProvider_get_shutdown_scriptpubkey(uint64_t this_arg) {
6105         void* this_arg_ptr = untag_ptr(this_arg);
6106         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6107         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6108         LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6109         uint64_t ret_ref = 0;
6110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6112         return ret_ref;
6113 }
6114
6115 typedef struct LDKFeeEstimator_JCalls {
6116         atomic_size_t refcnt;
6117         uint32_t instance_ptr;
6118 } LDKFeeEstimator_JCalls;
6119 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6120         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6121         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6122                 FREE(j_calls);
6123         }
6124 }
6125 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6126         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6127         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
6128         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, confirmation_target_conv, 0, 0, 0, 0, 0);
6129 }
6130 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6131         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6132         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6133 }
6134 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
6135         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6136         atomic_init(&calls->refcnt, 1);
6137         calls->instance_ptr = o;
6138
6139         LDKFeeEstimator ret = {
6140                 .this_arg = (void*) calls,
6141                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6142                 .free = LDKFeeEstimator_JCalls_free,
6143         };
6144         return ret;
6145 }
6146 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
6147         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6148         *res_ptr = LDKFeeEstimator_init(o);
6149         return tag_ptr(res_ptr, true);
6150 }
6151 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) {
6152         void* this_arg_ptr = untag_ptr(this_arg);
6153         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6154         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6155         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
6156         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6157         return ret_conv;
6158 }
6159
6160 typedef struct LDKRouter_JCalls {
6161         atomic_size_t refcnt;
6162         uint32_t instance_ptr;
6163 } LDKRouter_JCalls;
6164 static void LDKRouter_JCalls_free(void* this_arg) {
6165         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6166         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6167                 FREE(j_calls);
6168         }
6169 }
6170 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, const LDKInFlightHtlcs * inflight_htlcs) {
6171         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6172         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
6173         memcpy(payer_arr->elems, payer.compressed_form, 33);
6174         LDKRouteParameters route_params_var = *route_params;
6175         uint64_t route_params_ref = 0;
6176         route_params_var = RouteParameters_clone(&route_params_var);
6177         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
6178         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
6179         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
6180         uint64_tArray first_hops_arr = NULL;
6181         if (first_hops != NULL) {
6182                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
6183                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
6184                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
6185                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
6186                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
6187                         uint64_t first_hops_conv_16_ref = 0;
6188                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
6189                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
6190                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
6191                 }
6192         
6193         }
6194         LDKInFlightHtlcs inflight_htlcs_var = *inflight_htlcs;
6195         uint64_t inflight_htlcs_ref = 0;
6196         inflight_htlcs_var = InFlightHtlcs_clone(&inflight_htlcs_var);
6197         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
6198         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
6199         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);
6200         void* ret_ptr = untag_ptr(ret);
6201         CHECK_ACCESS(ret_ptr);
6202         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
6203         FREE(untag_ptr(ret));
6204         return ret_conv;
6205 }
6206 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) {
6207         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6208         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
6209         memcpy(payer_arr->elems, payer.compressed_form, 33);
6210         LDKRouteParameters route_params_var = *route_params;
6211         uint64_t route_params_ref = 0;
6212         route_params_var = RouteParameters_clone(&route_params_var);
6213         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
6214         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
6215         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
6216         uint64_tArray first_hops_arr = NULL;
6217         if (first_hops != NULL) {
6218                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
6219                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
6220                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
6221                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
6222                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
6223                         uint64_t first_hops_conv_16_ref = 0;
6224                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
6225                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
6226                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
6227                 }
6228         
6229         }
6230         LDKInFlightHtlcs inflight_htlcs_var = *inflight_htlcs;
6231         uint64_t inflight_htlcs_ref = 0;
6232         inflight_htlcs_var = InFlightHtlcs_clone(&inflight_htlcs_var);
6233         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
6234         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
6235         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
6236         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
6237         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
6238         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
6239         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);
6240         void* ret_ptr = untag_ptr(ret);
6241         CHECK_ACCESS(ret_ptr);
6242         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
6243         FREE(untag_ptr(ret));
6244         return ret_conv;
6245 }
6246 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
6247         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
6248         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6249 }
6250 static inline LDKRouter LDKRouter_init (JSValue o) {
6251         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
6252         atomic_init(&calls->refcnt, 1);
6253         calls->instance_ptr = o;
6254
6255         LDKRouter ret = {
6256                 .this_arg = (void*) calls,
6257                 .find_route = find_route_LDKRouter_jcall,
6258                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
6259                 .free = LDKRouter_JCalls_free,
6260         };
6261         return ret;
6262 }
6263 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
6264         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
6265         *res_ptr = LDKRouter_init(o);
6266         return tag_ptr(res_ptr, true);
6267 }
6268 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) {
6269         void* this_arg_ptr = untag_ptr(this_arg);
6270         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6271         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6272         LDKPublicKey payer_ref;
6273         CHECK(payer->arr_len == 33);
6274         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
6275         LDKRouteParameters route_params_conv;
6276         route_params_conv.inner = untag_ptr(route_params);
6277         route_params_conv.is_owned = ptr_is_owned(route_params);
6278         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
6279         route_params_conv.is_owned = false;
6280         LDKCVec_ChannelDetailsZ first_hops_constr;
6281         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
6282         if (first_hops != 0) {
6283                 first_hops_constr.datalen = first_hops->arr_len;
6284                 if (first_hops_constr.datalen > 0)
6285                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6286                 else
6287                         first_hops_constr.data = NULL;
6288                 uint64_t* first_hops_vals = first_hops->elems;
6289                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6290                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6291                         LDKChannelDetails first_hops_conv_16_conv;
6292                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6293                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6294                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6295                         first_hops_conv_16_conv.is_owned = false;
6296                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6297                 }
6298                 FREE(first_hops);
6299                 first_hops_ptr = &first_hops_constr;
6300         }
6301         LDKInFlightHtlcs inflight_htlcs_conv;
6302         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6303         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6304         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6305         inflight_htlcs_conv.is_owned = false;
6306         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6307         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, &inflight_htlcs_conv);
6308         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6309         return tag_ptr(ret_conv, true);
6310 }
6311
6312 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) {
6313         void* this_arg_ptr = untag_ptr(this_arg);
6314         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6315         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6316         LDKPublicKey payer_ref;
6317         CHECK(payer->arr_len == 33);
6318         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
6319         LDKRouteParameters route_params_conv;
6320         route_params_conv.inner = untag_ptr(route_params);
6321         route_params_conv.is_owned = ptr_is_owned(route_params);
6322         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
6323         route_params_conv.is_owned = false;
6324         LDKCVec_ChannelDetailsZ first_hops_constr;
6325         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
6326         if (first_hops != 0) {
6327                 first_hops_constr.datalen = first_hops->arr_len;
6328                 if (first_hops_constr.datalen > 0)
6329                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6330                 else
6331                         first_hops_constr.data = NULL;
6332                 uint64_t* first_hops_vals = first_hops->elems;
6333                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6334                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6335                         LDKChannelDetails first_hops_conv_16_conv;
6336                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6337                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6338                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6339                         first_hops_conv_16_conv.is_owned = false;
6340                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6341                 }
6342                 FREE(first_hops);
6343                 first_hops_ptr = &first_hops_constr;
6344         }
6345         LDKInFlightHtlcs inflight_htlcs_conv;
6346         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6347         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6348         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6349         inflight_htlcs_conv.is_owned = false;
6350         LDKThirtyTwoBytes _payment_hash_ref;
6351         CHECK(_payment_hash->arr_len == 32);
6352         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
6353         LDKThirtyTwoBytes _payment_id_ref;
6354         CHECK(_payment_id->arr_len == 32);
6355         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
6356         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6357         *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);
6358         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6359         return tag_ptr(ret_conv, true);
6360 }
6361
6362 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6363         return ThirtyTwoBytes_clone(&owner->a);
6364 }
6365 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint64_t owner) {
6366         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
6367         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6368         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
6369         return ret_arr;
6370 }
6371
6372 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6373         LDKChannelManager ret = owner->b;
6374         ret.is_owned = false;
6375         return ret;
6376 }
6377 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint64_t owner) {
6378         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
6379         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
6380         uint64_t ret_ref = 0;
6381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6383         return ret_ref;
6384 }
6385
6386 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6387 CHECK(owner->result_ok);
6388         return &*owner->contents.result;
6389 }
6390 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
6391         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6392         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
6393         return ret_ret;
6394 }
6395
6396 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6397 CHECK(!owner->result_ok);
6398         return DecodeError_clone(&*owner->contents.err);
6399 }
6400 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
6401         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6402         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6403         *ret_copy = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
6404         uint64_t ret_ref = tag_ptr(ret_copy, true);
6405         return ret_ref;
6406 }
6407
6408 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6409         LDKChannelConfig ret = *owner->contents.result;
6410         ret.is_owned = false;
6411         return ret;
6412 }
6413 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
6414         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6415         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
6416         uint64_t ret_ref = 0;
6417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6419         return ret_ref;
6420 }
6421
6422 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6423 CHECK(!owner->result_ok);
6424         return DecodeError_clone(&*owner->contents.err);
6425 }
6426 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
6427         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6428         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6429         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
6430         uint64_t ret_ref = tag_ptr(ret_copy, true);
6431         return ret_ref;
6432 }
6433
6434 uint32_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_ty_from_ptr"))) TS_LDKCOption_APIErrorZ_ty_from_ptr(uint64_t ptr) {
6435         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6436         switch(obj->tag) {
6437                 case LDKCOption_APIErrorZ_Some: return 0;
6438                 case LDKCOption_APIErrorZ_None: return 1;
6439                 default: abort();
6440         }
6441 }
6442 uint64_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_Some_get_some"))) TS_LDKCOption_APIErrorZ_Some_get_some(uint64_t ptr) {
6443         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6444         assert(obj->tag == LDKCOption_APIErrorZ_Some);
6445                         uint64_t some_ref = tag_ptr(&obj->some, false);
6446         return some_ref;
6447 }
6448 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6449 CHECK(owner->result_ok);
6450         return COption_APIErrorZ_clone(&*owner->contents.result);
6451 }
6452 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok(uint64_t owner) {
6453         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6454         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
6455         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
6456         uint64_t ret_ref = tag_ptr(ret_copy, true);
6457         return ret_ref;
6458 }
6459
6460 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6461 CHECK(!owner->result_ok);
6462         return DecodeError_clone(&*owner->contents.err);
6463 }
6464 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_err(uint64_t owner) {
6465         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6466         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6467         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
6468         uint64_t ret_ref = tag_ptr(ret_copy, true);
6469         return ret_ref;
6470 }
6471
6472 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
6473         LDKUntrustedString ret = *owner->contents.result;
6474         ret.is_owned = false;
6475         return ret;
6476 }
6477 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_get_ok(uint64_t owner) {
6478         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
6479         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
6480         uint64_t ret_ref = 0;
6481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6483         return ret_ref;
6484 }
6485
6486 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
6487 CHECK(!owner->result_ok);
6488         return DecodeError_clone(&*owner->contents.err);
6489 }
6490 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_err"))) TS_CResult_UntrustedStringDecodeErrorZ_get_err(uint64_t owner) {
6491         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
6492         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6493         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
6494         uint64_t ret_ref = tag_ptr(ret_copy, true);
6495         return ret_ref;
6496 }
6497
6498 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6499         LDKOutPoint ret = *owner->contents.result;
6500         ret.is_owned = false;
6501         return ret;
6502 }
6503 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
6504         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
6505         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
6506         uint64_t ret_ref = 0;
6507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6509         return ret_ref;
6510 }
6511
6512 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6513 CHECK(!owner->result_ok);
6514         return DecodeError_clone(&*owner->contents.err);
6515 }
6516 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
6517         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
6518         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6519         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
6520         uint64_t ret_ref = tag_ptr(ret_copy, true);
6521         return ret_ref;
6522 }
6523
6524 typedef struct LDKType_JCalls {
6525         atomic_size_t refcnt;
6526         uint32_t instance_ptr;
6527 } LDKType_JCalls;
6528 static void LDKType_JCalls_free(void* this_arg) {
6529         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6530         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6531                 FREE(j_calls);
6532         }
6533 }
6534 uint16_t type_id_LDKType_jcall(const void* this_arg) {
6535         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6536         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, 0, 0, 0, 0, 0, 0);
6537 }
6538 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
6539         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6540         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 36, 0, 0, 0, 0, 0, 0);
6541         LDKStr ret_conv = str_ref_to_owned_c(ret);
6542         return ret_conv;
6543 }
6544 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
6545         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6546         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 37, 0, 0, 0, 0, 0, 0);
6547         LDKCVec_u8Z ret_ref;
6548         ret_ref.datalen = ret->arr_len;
6549         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6550         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6551         return ret_ref;
6552 }
6553 static void LDKType_JCalls_cloned(LDKType* new_obj) {
6554         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
6555         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6556 }
6557 static inline LDKType LDKType_init (JSValue o) {
6558         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
6559         atomic_init(&calls->refcnt, 1);
6560         calls->instance_ptr = o;
6561
6562         LDKType ret = {
6563                 .this_arg = (void*) calls,
6564                 .type_id = type_id_LDKType_jcall,
6565                 .debug_str = debug_str_LDKType_jcall,
6566                 .write = write_LDKType_jcall,
6567                 .cloned = LDKType_JCalls_cloned,
6568                 .free = LDKType_JCalls_free,
6569         };
6570         return ret;
6571 }
6572 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
6573         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
6574         *res_ptr = LDKType_init(o);
6575         return tag_ptr(res_ptr, true);
6576 }
6577 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
6578         void* this_arg_ptr = untag_ptr(this_arg);
6579         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6580         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6581         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
6582         return ret_conv;
6583 }
6584
6585 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
6586         void* this_arg_ptr = untag_ptr(this_arg);
6587         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6588         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6589         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
6590         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6591         Str_free(ret_str);
6592         return ret_conv;
6593 }
6594
6595 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
6596         void* this_arg_ptr = untag_ptr(this_arg);
6597         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6598         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6599         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6600         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6601         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6602         CVec_u8Z_free(ret_var);
6603         return ret_arr;
6604 }
6605
6606 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
6607         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
6608         switch(obj->tag) {
6609                 case LDKCOption_TypeZ_Some: return 0;
6610                 case LDKCOption_TypeZ_None: return 1;
6611                 default: abort();
6612         }
6613 }
6614 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
6615         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
6616         assert(obj->tag == LDKCOption_TypeZ_Some);
6617                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
6618                         *some_ret = Type_clone(&obj->some);
6619         return tag_ptr(some_ret, true);
6620 }
6621 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6622 CHECK(owner->result_ok);
6623         return COption_TypeZ_clone(&*owner->contents.result);
6624 }
6625 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
6626         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
6627         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
6628         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
6629         uint64_t ret_ref = tag_ptr(ret_copy, true);
6630         return ret_ref;
6631 }
6632
6633 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6634 CHECK(!owner->result_ok);
6635         return DecodeError_clone(&*owner->contents.err);
6636 }
6637 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
6638         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
6639         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6640         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
6641         uint64_t ret_ref = tag_ptr(ret_copy, true);
6642         return ret_ref;
6643 }
6644
6645 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint64_t ptr) {
6646         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
6647         switch(obj->tag) {
6648                 case LDKPaymentError_Invoice: return 0;
6649                 case LDKPaymentError_Sending: return 1;
6650                 default: abort();
6651         }
6652 }
6653 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint64_t ptr) {
6654         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
6655         assert(obj->tag == LDKPaymentError_Invoice);
6656                         LDKStr invoice_str = obj->invoice;
6657                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
6658         return invoice_conv;
6659 }
6660 uint32_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) {
6661         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
6662         assert(obj->tag == LDKPaymentError_Sending);
6663                         uint32_t sending_conv = LDKRetryableSendFailure_to_js(obj->sending);
6664         return sending_conv;
6665 }
6666 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6667 CHECK(owner->result_ok);
6668         return ThirtyTwoBytes_clone(&*owner->contents.result);
6669 }
6670 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint64_t owner) {
6671         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
6672         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6673         memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
6674         return ret_arr;
6675 }
6676
6677 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6678 CHECK(!owner->result_ok);
6679         return PaymentError_clone(&*owner->contents.err);
6680 }
6681 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint64_t owner) {
6682         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
6683         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
6684         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
6685         uint64_t ret_ref = tag_ptr(ret_copy, true);
6686         return ret_ref;
6687 }
6688
6689 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
6690 CHECK(owner->result_ok);
6691         return *owner->contents.result;
6692 }
6693 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_ok"))) TS_CResult_NonePaymentErrorZ_get_ok(uint64_t owner) {
6694         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
6695         CResult_NonePaymentErrorZ_get_ok(owner_conv);
6696 }
6697
6698 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
6699 CHECK(!owner->result_ok);
6700         return PaymentError_clone(&*owner->contents.err);
6701 }
6702 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_err"))) TS_CResult_NonePaymentErrorZ_get_err(uint64_t owner) {
6703         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
6704         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
6705         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
6706         uint64_t ret_ref = tag_ptr(ret_copy, true);
6707         return ret_ref;
6708 }
6709
6710 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6711 CHECK(owner->result_ok);
6712         return *owner->contents.result;
6713 }
6714 jstring  __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint64_t owner) {
6715         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
6716         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
6717         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6718         return ret_conv;
6719 }
6720
6721 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6722 CHECK(!owner->result_ok);
6723         return *owner->contents.err;
6724 }
6725 uint32_t  __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint64_t owner) {
6726         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
6727         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
6728         return ret_conv;
6729 }
6730
6731 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6732         LDKChannelMonitorUpdate ret = *owner->contents.result;
6733         ret.is_owned = false;
6734         return ret;
6735 }
6736 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6737         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6738         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
6739         uint64_t ret_ref = 0;
6740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6742         return ret_ref;
6743 }
6744
6745 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6746 CHECK(!owner->result_ok);
6747         return DecodeError_clone(&*owner->contents.err);
6748 }
6749 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
6750         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6751         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6752         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6753         uint64_t ret_ref = tag_ptr(ret_copy, true);
6754         return ret_ref;
6755 }
6756
6757 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
6758         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6759         switch(obj->tag) {
6760                 case LDKCOption_MonitorEventZ_Some: return 0;
6761                 case LDKCOption_MonitorEventZ_None: return 1;
6762                 default: abort();
6763         }
6764 }
6765 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
6766         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6767         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
6768                         uint64_t some_ref = tag_ptr(&obj->some, false);
6769         return some_ref;
6770 }
6771 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6772 CHECK(owner->result_ok);
6773         return COption_MonitorEventZ_clone(&*owner->contents.result);
6774 }
6775 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
6776         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6777         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6778         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6779         uint64_t ret_ref = tag_ptr(ret_copy, true);
6780         return ret_ref;
6781 }
6782
6783 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6784 CHECK(!owner->result_ok);
6785         return DecodeError_clone(&*owner->contents.err);
6786 }
6787 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
6788         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6789         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6790         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6791         uint64_t ret_ref = tag_ptr(ret_copy, true);
6792         return ret_ref;
6793 }
6794
6795 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6796         LDKHTLCUpdate ret = *owner->contents.result;
6797         ret.is_owned = false;
6798         return ret;
6799 }
6800 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6801         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6802         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6803         uint64_t ret_ref = 0;
6804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6806         return ret_ref;
6807 }
6808
6809 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6810 CHECK(!owner->result_ok);
6811         return DecodeError_clone(&*owner->contents.err);
6812 }
6813 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
6814         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6815         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6816         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6817         uint64_t ret_ref = tag_ptr(ret_copy, true);
6818         return ret_ref;
6819 }
6820
6821 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6822         LDKOutPoint ret = owner->a;
6823         ret.is_owned = false;
6824         return ret;
6825 }
6826 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint64_t owner) {
6827         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6828         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
6829         uint64_t ret_ref = 0;
6830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6832         return ret_ref;
6833 }
6834
6835 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6836         return CVec_u8Z_clone(&owner->b);
6837 }
6838 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint64_t owner) {
6839         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6840         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
6841         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6842         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6843         CVec_u8Z_free(ret_var);
6844         return ret_arr;
6845 }
6846
6847 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6848         return owner->a;
6849 }
6850 int32_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint64_t owner) {
6851         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6852         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
6853         return ret_conv;
6854 }
6855
6856 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6857         return CVec_u8Z_clone(&owner->b);
6858 }
6859 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint64_t owner) {
6860         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6861         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
6862         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6863         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6864         CVec_u8Z_free(ret_var);
6865         return ret_arr;
6866 }
6867
6868 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
6869         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
6870         for (size_t i = 0; i < ret.datalen; i++) {
6871                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
6872         }
6873         return ret;
6874 }
6875 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6876         return ThirtyTwoBytes_clone(&owner->a);
6877 }
6878 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint64_t owner) {
6879         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6880         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6881         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
6882         return ret_arr;
6883 }
6884
6885 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6886         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
6887 }
6888 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint64_t owner) {
6889         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6890         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
6891         uint64_tArray ret_arr = NULL;
6892         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6893         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6894         for (size_t v = 0; v < ret_var.datalen; v++) {
6895                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6896                 *ret_conv_21_conv = ret_var.data[v];
6897                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
6898         }
6899         
6900         FREE(ret_var.data);
6901         return ret_arr;
6902 }
6903
6904 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
6905         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 };
6906         for (size_t i = 0; i < ret.datalen; i++) {
6907                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
6908         }
6909         return ret;
6910 }
6911 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
6912         LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
6913         for (size_t i = 0; i < ret.datalen; i++) {
6914                 ret.data[i] = Event_clone(&orig->data[i]);
6915         }
6916         return ret;
6917 }
6918 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6919         return owner->a;
6920 }
6921 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
6922         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6923         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6924         return ret_conv;
6925 }
6926
6927 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6928         return TxOut_clone(&owner->b);
6929 }
6930 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
6931         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6932         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6933         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6934         return tag_ptr(ret_ref, true);
6935 }
6936
6937 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6938         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6939         for (size_t i = 0; i < ret.datalen; i++) {
6940                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6941         }
6942         return ret;
6943 }
6944 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6945         return ThirtyTwoBytes_clone(&owner->a);
6946 }
6947 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
6948         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6949         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6950         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6951         return ret_arr;
6952 }
6953
6954 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6955         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6956 }
6957 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
6958         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6959         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6960         uint64_tArray ret_arr = NULL;
6961         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6962         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6963         for (size_t u = 0; u < ret_var.datalen; u++) {
6964                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6965                 *ret_conv_20_conv = ret_var.data[u];
6966                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
6967         }
6968         
6969         FREE(ret_var.data);
6970         return ret_arr;
6971 }
6972
6973 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
6974         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 };
6975         for (size_t i = 0; i < ret.datalen; i++) {
6976                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6977         }
6978         return ret;
6979 }
6980 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
6981         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6982         switch(obj->tag) {
6983                 case LDKBalance_ClaimableOnChannelClose: return 0;
6984                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6985                 case LDKBalance_ContentiousClaimable: return 2;
6986                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
6987                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
6988                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
6989                 default: abort();
6990         }
6991 }
6992 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint64_t ptr) {
6993         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6994         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6995                         int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
6996         return claimable_amount_satoshis_conv;
6997 }
6998 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint64_t ptr) {
6999         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7000         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
7001                         int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
7002         return claimable_amount_satoshis_conv;
7003 }
7004 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
7005         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7006         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
7007                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
7008         return confirmation_height_conv;
7009 }
7010 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
7011         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7012         assert(obj->tag == LDKBalance_ContentiousClaimable);
7013                         int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
7014         return claimable_amount_satoshis_conv;
7015 }
7016 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
7017         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7018         assert(obj->tag == LDKBalance_ContentiousClaimable);
7019                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
7020         return timeout_height_conv;
7021 }
7022 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
7023         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7024         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7025                         int64_t claimable_amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.claimable_amount_satoshis;
7026         return claimable_amount_satoshis_conv;
7027 }
7028 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
7029         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7030         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7031                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
7032         return claimable_height_conv;
7033 }
7034 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
7035         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7036         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7037                         int64_t claimable_amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.claimable_amount_satoshis;
7038         return claimable_amount_satoshis_conv;
7039 }
7040 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
7041         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7042         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7043                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
7044         return expiry_height_conv;
7045 }
7046 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
7047         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7048         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
7049                         int64_t claimable_amount_satoshis_conv = obj->counterparty_revoked_output_claimable.claimable_amount_satoshis;
7050         return claimable_amount_satoshis_conv;
7051 }
7052 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
7053         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
7054         for (size_t i = 0; i < ret.datalen; i++) {
7055                 ret.data[i] = Balance_clone(&orig->data[i]);
7056         }
7057         return ret;
7058 }
7059 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
7060         return ThirtyTwoBytes_clone(&owner->a);
7061 }
7062 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint64_t owner) {
7063         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
7064         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7065         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
7066         return ret_arr;
7067 }
7068
7069 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
7070         LDKChannelMonitor ret = owner->b;
7071         ret.is_owned = false;
7072         return ret;
7073 }
7074 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint64_t owner) {
7075         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
7076         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
7077         uint64_t ret_ref = 0;
7078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7080         return ret_ref;
7081 }
7082
7083 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7084 CHECK(owner->result_ok);
7085         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
7086 }
7087 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
7088         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
7089         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
7090         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
7091         return tag_ptr(ret_conv, true);
7092 }
7093
7094 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7095 CHECK(!owner->result_ok);
7096         return DecodeError_clone(&*owner->contents.err);
7097 }
7098 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
7099         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
7100         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7101         *ret_copy = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
7102         uint64_t ret_ref = tag_ptr(ret_copy, true);
7103         return ret_ref;
7104 }
7105
7106 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7107         return owner->a;
7108 }
7109 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
7110         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
7111         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
7112         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
7113         return ret_arr;
7114 }
7115
7116 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7117         return Type_clone(&owner->b);
7118 }
7119 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
7120         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
7121         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
7122         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
7123         return tag_ptr(ret_ret, true);
7124 }
7125
7126 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
7127         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
7128         for (size_t i = 0; i < ret.datalen; i++) {
7129                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
7130         }
7131         return ret;
7132 }
7133 typedef struct LDKCustomOnionMessageContents_JCalls {
7134         atomic_size_t refcnt;
7135         uint32_t instance_ptr;
7136 } LDKCustomOnionMessageContents_JCalls;
7137 static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) {
7138         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
7139         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7140                 FREE(j_calls);
7141         }
7142 }
7143 uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
7144         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
7145         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 38, 0, 0, 0, 0, 0, 0);
7146 }
7147 LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
7148         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
7149         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 39, 0, 0, 0, 0, 0, 0);
7150         LDKCVec_u8Z ret_ref;
7151         ret_ref.datalen = ret->arr_len;
7152         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7153         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
7154         return ret_ref;
7155 }
7156 static void LDKCustomOnionMessageContents_JCalls_cloned(LDKCustomOnionMessageContents* new_obj) {
7157         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) new_obj->this_arg;
7158         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7159 }
7160 static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init (JSValue o) {
7161         LDKCustomOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageContents_JCalls), "LDKCustomOnionMessageContents_JCalls");
7162         atomic_init(&calls->refcnt, 1);
7163         calls->instance_ptr = o;
7164
7165         LDKCustomOnionMessageContents ret = {
7166                 .this_arg = (void*) calls,
7167                 .tlv_type = tlv_type_LDKCustomOnionMessageContents_jcall,
7168                 .write = write_LDKCustomOnionMessageContents_jcall,
7169                 .cloned = LDKCustomOnionMessageContents_JCalls_cloned,
7170                 .free = LDKCustomOnionMessageContents_JCalls_free,
7171         };
7172         return ret;
7173 }
7174 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageContents_new"))) TS_LDKCustomOnionMessageContents_new(JSValue o) {
7175         LDKCustomOnionMessageContents *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
7176         *res_ptr = LDKCustomOnionMessageContents_init(o);
7177         return tag_ptr(res_ptr, true);
7178 }
7179 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_tlv_type"))) TS_CustomOnionMessageContents_tlv_type(uint64_t this_arg) {
7180         void* this_arg_ptr = untag_ptr(this_arg);
7181         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7182         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
7183         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
7184         return ret_conv;
7185 }
7186
7187 int8_tArray  __attribute__((export_name("TS_CustomOnionMessageContents_write"))) TS_CustomOnionMessageContents_write(uint64_t this_arg) {
7188         void* this_arg_ptr = untag_ptr(this_arg);
7189         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7190         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
7191         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7192         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7193         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7194         CVec_u8Z_free(ret_var);
7195         return ret_arr;
7196 }
7197
7198 uint32_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
7199         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
7200         switch(obj->tag) {
7201                 case LDKCOption_CustomOnionMessageContentsZ_Some: return 0;
7202                 case LDKCOption_CustomOnionMessageContentsZ_None: return 1;
7203                 default: abort();
7204         }
7205 }
7206 uint64_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some(uint64_t ptr) {
7207         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
7208         assert(obj->tag == LDKCOption_CustomOnionMessageContentsZ_Some);
7209                         LDKCustomOnionMessageContents* some_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
7210                         *some_ret = CustomOnionMessageContents_clone(&obj->some);
7211         return tag_ptr(some_ret, true);
7212 }
7213 static inline struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
7214 CHECK(owner->result_ok);
7215         return COption_CustomOnionMessageContentsZ_clone(&*owner->contents.result);
7216 }
7217 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
7218         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
7219         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
7220         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
7221         uint64_t ret_ref = tag_ptr(ret_copy, true);
7222         return ret_ref;
7223 }
7224
7225 static inline struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
7226 CHECK(!owner->result_ok);
7227         return DecodeError_clone(&*owner->contents.err);
7228 }
7229 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
7230         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
7231         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7232         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
7233         uint64_t ret_ref = tag_ptr(ret_copy, true);
7234         return ret_ref;
7235 }
7236
7237 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_ty_from_ptr"))) TS_LDKCOption_NetAddressZ_ty_from_ptr(uint64_t ptr) {
7238         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
7239         switch(obj->tag) {
7240                 case LDKCOption_NetAddressZ_Some: return 0;
7241                 case LDKCOption_NetAddressZ_None: return 1;
7242                 default: abort();
7243         }
7244 }
7245 uint64_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) TS_LDKCOption_NetAddressZ_Some_get_some(uint64_t ptr) {
7246         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
7247         assert(obj->tag == LDKCOption_NetAddressZ_Some);
7248                         uint64_t some_ref = tag_ptr(&obj->some, false);
7249         return some_ref;
7250 }
7251 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){
7252         return owner->a;
7253 }
7254 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_a"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(uint64_t owner) {
7255         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner);
7256         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
7257         memcpy(ret_arr->elems, C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(owner_conv).compressed_form, 33);
7258         return ret_arr;
7259 }
7260
7261 static inline struct LDKCOption_NetAddressZ C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){
7262         return COption_NetAddressZ_clone(&owner->b);
7263 }
7264 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_b"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(uint64_t owner) {
7265         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner);
7266         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
7267         *ret_copy = C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(owner_conv);
7268         uint64_t ret_ref = tag_ptr(ret_copy, true);
7269         return ret_ref;
7270 }
7271
7272 static inline LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ *orig) {
7273         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ clone bytes"), .datalen = orig->datalen };
7274         for (size_t i = 0; i < ret.datalen; i++) {
7275                 ret.data[i] = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(&orig->data[i]);
7276         }
7277         return ret;
7278 }
7279 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7280 CHECK(owner->result_ok);
7281         return CVec_u8Z_clone(&*owner->contents.result);
7282 }
7283 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
7284         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7285         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
7286         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7287         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7288         CVec_u8Z_free(ret_var);
7289         return ret_arr;
7290 }
7291
7292 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7293         LDKPeerHandleError ret = *owner->contents.err;
7294         ret.is_owned = false;
7295         return ret;
7296 }
7297 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
7298         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7299         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
7300         uint64_t ret_ref = 0;
7301         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7302         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7303         return ret_ref;
7304 }
7305
7306 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7307 CHECK(owner->result_ok);
7308         return *owner->contents.result;
7309 }
7310 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
7311         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7312         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
7313 }
7314
7315 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7316         LDKPeerHandleError ret = *owner->contents.err;
7317         ret.is_owned = false;
7318         return ret;
7319 }
7320 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
7321         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7322         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
7323         uint64_t ret_ref = 0;
7324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7326         return ret_ref;
7327 }
7328
7329 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7330 CHECK(owner->result_ok);
7331         return *owner->contents.result;
7332 }
7333 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
7334         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7335         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
7336         return ret_conv;
7337 }
7338
7339 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7340         LDKPeerHandleError ret = *owner->contents.err;
7341         ret.is_owned = false;
7342         return ret;
7343 }
7344 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
7345         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7346         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
7347         uint64_t ret_ref = 0;
7348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7350         return ret_ref;
7351 }
7352
7353 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
7354         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
7355         switch(obj->tag) {
7356                 case LDKSendError_Secp256k1: return 0;
7357                 case LDKSendError_TooBigPacket: return 1;
7358                 case LDKSendError_TooFewBlindedHops: return 2;
7359                 case LDKSendError_InvalidFirstHop: return 3;
7360                 case LDKSendError_InvalidMessage: return 4;
7361                 case LDKSendError_BufferFull: return 5;
7362                 case LDKSendError_GetNodeIdFailed: return 6;
7363                 case LDKSendError_BlindedPathAdvanceFailed: return 7;
7364                 default: abort();
7365         }
7366 }
7367 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
7368         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
7369         assert(obj->tag == LDKSendError_Secp256k1);
7370                         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
7371         return secp256k1_conv;
7372 }
7373 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
7374 CHECK(owner->result_ok);
7375         return *owner->contents.result;
7376 }
7377 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_ok"))) TS_CResult_NoneSendErrorZ_get_ok(uint64_t owner) {
7378         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
7379         CResult_NoneSendErrorZ_get_ok(owner_conv);
7380 }
7381
7382 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
7383 CHECK(!owner->result_ok);
7384         return SendError_clone(&*owner->contents.err);
7385 }
7386 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_err"))) TS_CResult_NoneSendErrorZ_get_err(uint64_t owner) {
7387         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
7388         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
7389         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
7390         uint64_t ret_ref = tag_ptr(ret_copy, true);
7391         return ret_ref;
7392 }
7393
7394 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
7395         LDKBlindedPath ret = *owner->contents.result;
7396         ret.is_owned = false;
7397         return ret;
7398 }
7399 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_ok"))) TS_CResult_BlindedPathNoneZ_get_ok(uint64_t owner) {
7400         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
7401         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
7402         uint64_t ret_ref = 0;
7403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7405         return ret_ref;
7406 }
7407
7408 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
7409 CHECK(!owner->result_ok);
7410         return *owner->contents.err;
7411 }
7412 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_err"))) TS_CResult_BlindedPathNoneZ_get_err(uint64_t owner) {
7413         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
7414         CResult_BlindedPathNoneZ_get_err(owner_conv);
7415 }
7416
7417 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
7418         LDKBlindedPath ret = *owner->contents.result;
7419         ret.is_owned = false;
7420         return ret;
7421 }
7422 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_ok"))) TS_CResult_BlindedPathDecodeErrorZ_get_ok(uint64_t owner) {
7423         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
7424         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
7425         uint64_t ret_ref = 0;
7426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7428         return ret_ref;
7429 }
7430
7431 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
7432 CHECK(!owner->result_ok);
7433         return DecodeError_clone(&*owner->contents.err);
7434 }
7435 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_err"))) TS_CResult_BlindedPathDecodeErrorZ_get_err(uint64_t owner) {
7436         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
7437         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7438         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
7439         uint64_t ret_ref = tag_ptr(ret_copy, true);
7440         return ret_ref;
7441 }
7442
7443 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
7444         LDKBlindedHop ret = *owner->contents.result;
7445         ret.is_owned = false;
7446         return ret;
7447 }
7448 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
7449         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
7450         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
7451         uint64_t ret_ref = 0;
7452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7454         return ret_ref;
7455 }
7456
7457 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
7458 CHECK(!owner->result_ok);
7459         return DecodeError_clone(&*owner->contents.err);
7460 }
7461 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
7462         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
7463         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7464         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
7465         uint64_t ret_ref = tag_ptr(ret_copy, true);
7466         return ret_ref;
7467 }
7468
7469 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
7470         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7471         switch(obj->tag) {
7472                 case LDKGraphSyncError_DecodeError: return 0;
7473                 case LDKGraphSyncError_LightningError: return 1;
7474                 default: abort();
7475         }
7476 }
7477 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
7478         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7479         assert(obj->tag == LDKGraphSyncError_DecodeError);
7480                         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
7481         return decode_error_ref;
7482 }
7483 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
7484         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7485         assert(obj->tag == LDKGraphSyncError_LightningError);
7486                         LDKLightningError lightning_error_var = obj->lightning_error;
7487                         uint64_t lightning_error_ref = 0;
7488                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
7489                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
7490         return lightning_error_ref;
7491 }
7492 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7493 CHECK(owner->result_ok);
7494         return *owner->contents.result;
7495 }
7496 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
7497         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7498         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
7499         return ret_conv;
7500 }
7501
7502 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7503 CHECK(!owner->result_ok);
7504         return GraphSyncError_clone(&*owner->contents.err);
7505 }
7506 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
7507         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7508         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
7509         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
7510         uint64_t ret_ref = tag_ptr(ret_copy, true);
7511         return ret_ref;
7512 }
7513
7514 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
7515 CHECK(owner->result_ok);
7516         return *owner->contents.result;
7517 }
7518 void  __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint64_t owner) {
7519         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
7520         CResult_NoneErrorZ_get_ok(owner_conv);
7521 }
7522
7523 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
7524 CHECK(!owner->result_ok);
7525         return *owner->contents.err;
7526 }
7527 uint32_t  __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint64_t owner) {
7528         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
7529         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv));
7530         return ret_conv;
7531 }
7532
7533 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
7534 CHECK(owner->result_ok);
7535         return NetAddress_clone(&*owner->contents.result);
7536 }
7537 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint64_t owner) {
7538         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
7539         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
7540         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
7541         uint64_t ret_ref = tag_ptr(ret_copy, true);
7542         return ret_ref;
7543 }
7544
7545 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
7546 CHECK(!owner->result_ok);
7547         return DecodeError_clone(&*owner->contents.err);
7548 }
7549 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint64_t owner) {
7550         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
7551         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7552         *ret_copy = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
7553         uint64_t ret_ref = tag_ptr(ret_copy, true);
7554         return ret_ref;
7555 }
7556
7557 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
7558         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
7559         for (size_t i = 0; i < ret.datalen; i++) {
7560                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
7561         }
7562         return ret;
7563 }
7564 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
7565         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
7566         for (size_t i = 0; i < ret.datalen; i++) {
7567                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
7568         }
7569         return ret;
7570 }
7571 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
7572         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
7573         for (size_t i = 0; i < ret.datalen; i++) {
7574                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
7575         }
7576         return ret;
7577 }
7578 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
7579         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
7580         for (size_t i = 0; i < ret.datalen; i++) {
7581                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
7582         }
7583         return ret;
7584 }
7585 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7586         LDKAcceptChannel ret = *owner->contents.result;
7587         ret.is_owned = false;
7588         return ret;
7589 }
7590 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
7591         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7592         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
7593         uint64_t ret_ref = 0;
7594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7596         return ret_ref;
7597 }
7598
7599 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7600 CHECK(!owner->result_ok);
7601         return DecodeError_clone(&*owner->contents.err);
7602 }
7603 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
7604         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7605         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7606         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
7607         uint64_t ret_ref = tag_ptr(ret_copy, true);
7608         return ret_ref;
7609 }
7610
7611 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7612         LDKAnnouncementSignatures ret = *owner->contents.result;
7613         ret.is_owned = false;
7614         return ret;
7615 }
7616 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
7617         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7618         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
7619         uint64_t ret_ref = 0;
7620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7622         return ret_ref;
7623 }
7624
7625 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7626 CHECK(!owner->result_ok);
7627         return DecodeError_clone(&*owner->contents.err);
7628 }
7629 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
7630         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7631         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7632         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
7633         uint64_t ret_ref = tag_ptr(ret_copy, true);
7634         return ret_ref;
7635 }
7636
7637 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7638         LDKChannelReestablish ret = *owner->contents.result;
7639         ret.is_owned = false;
7640         return ret;
7641 }
7642 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
7643         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7644         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
7645         uint64_t ret_ref = 0;
7646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7648         return ret_ref;
7649 }
7650
7651 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7652 CHECK(!owner->result_ok);
7653         return DecodeError_clone(&*owner->contents.err);
7654 }
7655 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
7656         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7657         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7658         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
7659         uint64_t ret_ref = tag_ptr(ret_copy, true);
7660         return ret_ref;
7661 }
7662
7663 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7664         LDKClosingSigned ret = *owner->contents.result;
7665         ret.is_owned = false;
7666         return ret;
7667 }
7668 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7669         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7670         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
7671         uint64_t ret_ref = 0;
7672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7674         return ret_ref;
7675 }
7676
7677 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7678 CHECK(!owner->result_ok);
7679         return DecodeError_clone(&*owner->contents.err);
7680 }
7681 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
7682         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7683         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7684         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
7685         uint64_t ret_ref = tag_ptr(ret_copy, true);
7686         return ret_ref;
7687 }
7688
7689 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7690         LDKClosingSignedFeeRange ret = *owner->contents.result;
7691         ret.is_owned = false;
7692         return ret;
7693 }
7694 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
7695         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7696         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
7697         uint64_t ret_ref = 0;
7698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7700         return ret_ref;
7701 }
7702
7703 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7704 CHECK(!owner->result_ok);
7705         return DecodeError_clone(&*owner->contents.err);
7706 }
7707 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
7708         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7709         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7710         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
7711         uint64_t ret_ref = tag_ptr(ret_copy, true);
7712         return ret_ref;
7713 }
7714
7715 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7716         LDKCommitmentSigned ret = *owner->contents.result;
7717         ret.is_owned = false;
7718         return ret;
7719 }
7720 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
7721         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7722         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
7723         uint64_t ret_ref = 0;
7724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7726         return ret_ref;
7727 }
7728
7729 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7730 CHECK(!owner->result_ok);
7731         return DecodeError_clone(&*owner->contents.err);
7732 }
7733 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
7734         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7735         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7736         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
7737         uint64_t ret_ref = tag_ptr(ret_copy, true);
7738         return ret_ref;
7739 }
7740
7741 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7742         LDKFundingCreated ret = *owner->contents.result;
7743         ret.is_owned = false;
7744         return ret;
7745 }
7746 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
7747         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7748         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
7749         uint64_t ret_ref = 0;
7750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7752         return ret_ref;
7753 }
7754
7755 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7756 CHECK(!owner->result_ok);
7757         return DecodeError_clone(&*owner->contents.err);
7758 }
7759 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
7760         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7761         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7762         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
7763         uint64_t ret_ref = tag_ptr(ret_copy, true);
7764         return ret_ref;
7765 }
7766
7767 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7768         LDKFundingSigned ret = *owner->contents.result;
7769         ret.is_owned = false;
7770         return ret;
7771 }
7772 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7773         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7774         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
7775         uint64_t ret_ref = 0;
7776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7778         return ret_ref;
7779 }
7780
7781 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7782 CHECK(!owner->result_ok);
7783         return DecodeError_clone(&*owner->contents.err);
7784 }
7785 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
7786         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7787         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7788         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7789         uint64_t ret_ref = tag_ptr(ret_copy, true);
7790         return ret_ref;
7791 }
7792
7793 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7794         LDKChannelReady ret = *owner->contents.result;
7795         ret.is_owned = false;
7796         return ret;
7797 }
7798 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
7799         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7800         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
7801         uint64_t ret_ref = 0;
7802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7804         return ret_ref;
7805 }
7806
7807 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7808 CHECK(!owner->result_ok);
7809         return DecodeError_clone(&*owner->contents.err);
7810 }
7811 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
7812         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7813         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7814         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
7815         uint64_t ret_ref = tag_ptr(ret_copy, true);
7816         return ret_ref;
7817 }
7818
7819 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7820         LDKInit ret = *owner->contents.result;
7821         ret.is_owned = false;
7822         return ret;
7823 }
7824 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
7825         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7826         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
7827         uint64_t ret_ref = 0;
7828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7830         return ret_ref;
7831 }
7832
7833 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7834 CHECK(!owner->result_ok);
7835         return DecodeError_clone(&*owner->contents.err);
7836 }
7837 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
7838         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7839         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7840         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
7841         uint64_t ret_ref = tag_ptr(ret_copy, true);
7842         return ret_ref;
7843 }
7844
7845 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7846         LDKOpenChannel ret = *owner->contents.result;
7847         ret.is_owned = false;
7848         return ret;
7849 }
7850 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
7851         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7852         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
7853         uint64_t ret_ref = 0;
7854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7856         return ret_ref;
7857 }
7858
7859 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7860 CHECK(!owner->result_ok);
7861         return DecodeError_clone(&*owner->contents.err);
7862 }
7863 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
7864         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7865         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7866         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
7867         uint64_t ret_ref = tag_ptr(ret_copy, true);
7868         return ret_ref;
7869 }
7870
7871 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7872         LDKRevokeAndACK ret = *owner->contents.result;
7873         ret.is_owned = false;
7874         return ret;
7875 }
7876 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
7877         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7878         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
7879         uint64_t ret_ref = 0;
7880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7882         return ret_ref;
7883 }
7884
7885 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7886 CHECK(!owner->result_ok);
7887         return DecodeError_clone(&*owner->contents.err);
7888 }
7889 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
7890         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7891         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7892         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
7893         uint64_t ret_ref = tag_ptr(ret_copy, true);
7894         return ret_ref;
7895 }
7896
7897 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7898         LDKShutdown ret = *owner->contents.result;
7899         ret.is_owned = false;
7900         return ret;
7901 }
7902 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
7903         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7904         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
7905         uint64_t ret_ref = 0;
7906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7908         return ret_ref;
7909 }
7910
7911 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7912 CHECK(!owner->result_ok);
7913         return DecodeError_clone(&*owner->contents.err);
7914 }
7915 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
7916         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7917         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7918         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
7919         uint64_t ret_ref = tag_ptr(ret_copy, true);
7920         return ret_ref;
7921 }
7922
7923 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7924         LDKUpdateFailHTLC ret = *owner->contents.result;
7925         ret.is_owned = false;
7926         return ret;
7927 }
7928 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7929         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
7930         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
7931         uint64_t ret_ref = 0;
7932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7934         return ret_ref;
7935 }
7936
7937 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7938 CHECK(!owner->result_ok);
7939         return DecodeError_clone(&*owner->contents.err);
7940 }
7941 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
7942         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
7943         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7944         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
7945         uint64_t ret_ref = tag_ptr(ret_copy, true);
7946         return ret_ref;
7947 }
7948
7949 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7950         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
7951         ret.is_owned = false;
7952         return ret;
7953 }
7954 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7955         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
7956         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
7957         uint64_t ret_ref = 0;
7958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7960         return ret_ref;
7961 }
7962
7963 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7964 CHECK(!owner->result_ok);
7965         return DecodeError_clone(&*owner->contents.err);
7966 }
7967 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
7968         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
7969         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7970         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
7971         uint64_t ret_ref = tag_ptr(ret_copy, true);
7972         return ret_ref;
7973 }
7974
7975 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7976         LDKUpdateFee ret = *owner->contents.result;
7977         ret.is_owned = false;
7978         return ret;
7979 }
7980 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
7981         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
7982         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
7983         uint64_t ret_ref = 0;
7984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7986         return ret_ref;
7987 }
7988
7989 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7990 CHECK(!owner->result_ok);
7991         return DecodeError_clone(&*owner->contents.err);
7992 }
7993 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
7994         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
7995         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7996         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
7997         uint64_t ret_ref = tag_ptr(ret_copy, true);
7998         return ret_ref;
7999 }
8000
8001 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8002         LDKUpdateFulfillHTLC ret = *owner->contents.result;
8003         ret.is_owned = false;
8004         return ret;
8005 }
8006 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8007         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8008         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
8009         uint64_t ret_ref = 0;
8010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8012         return ret_ref;
8013 }
8014
8015 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8016 CHECK(!owner->result_ok);
8017         return DecodeError_clone(&*owner->contents.err);
8018 }
8019 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
8020         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8021         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8022         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
8023         uint64_t ret_ref = tag_ptr(ret_copy, true);
8024         return ret_ref;
8025 }
8026
8027 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8028         LDKUpdateAddHTLC ret = *owner->contents.result;
8029         ret.is_owned = false;
8030         return ret;
8031 }
8032 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8033         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8034         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
8035         uint64_t ret_ref = 0;
8036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8038         return ret_ref;
8039 }
8040
8041 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8042 CHECK(!owner->result_ok);
8043         return DecodeError_clone(&*owner->contents.err);
8044 }
8045 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
8046         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8047         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8048         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
8049         uint64_t ret_ref = tag_ptr(ret_copy, true);
8050         return ret_ref;
8051 }
8052
8053 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
8054         LDKOnionMessage ret = *owner->contents.result;
8055         ret.is_owned = false;
8056         return ret;
8057 }
8058 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
8059         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
8060         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
8061         uint64_t ret_ref = 0;
8062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8064         return ret_ref;
8065 }
8066
8067 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
8068 CHECK(!owner->result_ok);
8069         return DecodeError_clone(&*owner->contents.err);
8070 }
8071 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
8072         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
8073         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8074         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
8075         uint64_t ret_ref = tag_ptr(ret_copy, true);
8076         return ret_ref;
8077 }
8078
8079 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8080         LDKPing ret = *owner->contents.result;
8081         ret.is_owned = false;
8082         return ret;
8083 }
8084 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
8085         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8086         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
8087         uint64_t ret_ref = 0;
8088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8090         return ret_ref;
8091 }
8092
8093 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8094 CHECK(!owner->result_ok);
8095         return DecodeError_clone(&*owner->contents.err);
8096 }
8097 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
8098         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8099         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8100         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
8101         uint64_t ret_ref = tag_ptr(ret_copy, true);
8102         return ret_ref;
8103 }
8104
8105 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8106         LDKPong ret = *owner->contents.result;
8107         ret.is_owned = false;
8108         return ret;
8109 }
8110 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
8111         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8112         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
8113         uint64_t ret_ref = 0;
8114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8116         return ret_ref;
8117 }
8118
8119 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8120 CHECK(!owner->result_ok);
8121         return DecodeError_clone(&*owner->contents.err);
8122 }
8123 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
8124         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8125         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8126         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
8127         uint64_t ret_ref = tag_ptr(ret_copy, true);
8128         return ret_ref;
8129 }
8130
8131 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8132         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
8133         ret.is_owned = false;
8134         return ret;
8135 }
8136 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8137         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8138         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8139         uint64_t ret_ref = 0;
8140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8142         return ret_ref;
8143 }
8144
8145 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8146 CHECK(!owner->result_ok);
8147         return DecodeError_clone(&*owner->contents.err);
8148 }
8149 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8150         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8151         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8152         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8153         uint64_t ret_ref = tag_ptr(ret_copy, true);
8154         return ret_ref;
8155 }
8156
8157 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8158         LDKChannelAnnouncement ret = *owner->contents.result;
8159         ret.is_owned = false;
8160         return ret;
8161 }
8162 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8163         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8164         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8165         uint64_t ret_ref = 0;
8166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8168         return ret_ref;
8169 }
8170
8171 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8172 CHECK(!owner->result_ok);
8173         return DecodeError_clone(&*owner->contents.err);
8174 }
8175 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8176         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8177         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8178         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8179         uint64_t ret_ref = tag_ptr(ret_copy, true);
8180         return ret_ref;
8181 }
8182
8183 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8184         LDKUnsignedChannelUpdate ret = *owner->contents.result;
8185         ret.is_owned = false;
8186         return ret;
8187 }
8188 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
8189         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8190         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8191         uint64_t ret_ref = 0;
8192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8194         return ret_ref;
8195 }
8196
8197 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8198 CHECK(!owner->result_ok);
8199         return DecodeError_clone(&*owner->contents.err);
8200 }
8201 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
8202         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8203         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8204         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
8205         uint64_t ret_ref = tag_ptr(ret_copy, true);
8206         return ret_ref;
8207 }
8208
8209 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8210         LDKChannelUpdate ret = *owner->contents.result;
8211         ret.is_owned = false;
8212         return ret;
8213 }
8214 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
8215         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8216         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8217         uint64_t ret_ref = 0;
8218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8220         return ret_ref;
8221 }
8222
8223 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8224 CHECK(!owner->result_ok);
8225         return DecodeError_clone(&*owner->contents.err);
8226 }
8227 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
8228         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8229         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8230         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
8231         uint64_t ret_ref = tag_ptr(ret_copy, true);
8232         return ret_ref;
8233 }
8234
8235 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8236         LDKErrorMessage ret = *owner->contents.result;
8237         ret.is_owned = false;
8238         return ret;
8239 }
8240 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
8241         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8242         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
8243         uint64_t ret_ref = 0;
8244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8246         return ret_ref;
8247 }
8248
8249 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8250 CHECK(!owner->result_ok);
8251         return DecodeError_clone(&*owner->contents.err);
8252 }
8253 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
8254         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8255         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8256         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
8257         uint64_t ret_ref = tag_ptr(ret_copy, true);
8258         return ret_ref;
8259 }
8260
8261 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8262         LDKWarningMessage ret = *owner->contents.result;
8263         ret.is_owned = false;
8264         return ret;
8265 }
8266 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
8267         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
8268         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
8269         uint64_t ret_ref = 0;
8270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8272         return ret_ref;
8273 }
8274
8275 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8276 CHECK(!owner->result_ok);
8277         return DecodeError_clone(&*owner->contents.err);
8278 }
8279 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
8280         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
8281         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8282         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
8283         uint64_t ret_ref = tag_ptr(ret_copy, true);
8284         return ret_ref;
8285 }
8286
8287 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8288         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
8289         ret.is_owned = false;
8290         return ret;
8291 }
8292 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8293         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8294         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8295         uint64_t ret_ref = 0;
8296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8298         return ret_ref;
8299 }
8300
8301 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8302 CHECK(!owner->result_ok);
8303         return DecodeError_clone(&*owner->contents.err);
8304 }
8305 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8306         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8307         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8308         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8309         uint64_t ret_ref = tag_ptr(ret_copy, true);
8310         return ret_ref;
8311 }
8312
8313 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8314         LDKNodeAnnouncement ret = *owner->contents.result;
8315         ret.is_owned = false;
8316         return ret;
8317 }
8318 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8319         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8320         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8321         uint64_t ret_ref = 0;
8322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8324         return ret_ref;
8325 }
8326
8327 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8328 CHECK(!owner->result_ok);
8329         return DecodeError_clone(&*owner->contents.err);
8330 }
8331 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8332         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8333         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8334         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8335         uint64_t ret_ref = tag_ptr(ret_copy, true);
8336         return ret_ref;
8337 }
8338
8339 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8340         LDKQueryShortChannelIds ret = *owner->contents.result;
8341         ret.is_owned = false;
8342         return ret;
8343 }
8344 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
8345         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
8346         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
8347         uint64_t ret_ref = 0;
8348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8350         return ret_ref;
8351 }
8352
8353 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8354 CHECK(!owner->result_ok);
8355         return DecodeError_clone(&*owner->contents.err);
8356 }
8357 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
8358         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
8359         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8360         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
8361         uint64_t ret_ref = tag_ptr(ret_copy, true);
8362         return ret_ref;
8363 }
8364
8365 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8366         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
8367         ret.is_owned = false;
8368         return ret;
8369 }
8370 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
8371         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
8372         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
8373         uint64_t ret_ref = 0;
8374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8376         return ret_ref;
8377 }
8378
8379 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8380 CHECK(!owner->result_ok);
8381         return DecodeError_clone(&*owner->contents.err);
8382 }
8383 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
8384         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
8385         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8386         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
8387         uint64_t ret_ref = tag_ptr(ret_copy, true);
8388         return ret_ref;
8389 }
8390
8391 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8392         LDKQueryChannelRange ret = *owner->contents.result;
8393         ret.is_owned = false;
8394         return ret;
8395 }
8396 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
8397         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
8398         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
8399         uint64_t ret_ref = 0;
8400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8402         return ret_ref;
8403 }
8404
8405 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8406 CHECK(!owner->result_ok);
8407         return DecodeError_clone(&*owner->contents.err);
8408 }
8409 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
8410         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
8411         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8412         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
8413         uint64_t ret_ref = tag_ptr(ret_copy, true);
8414         return ret_ref;
8415 }
8416
8417 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8418         LDKReplyChannelRange ret = *owner->contents.result;
8419         ret.is_owned = false;
8420         return ret;
8421 }
8422 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
8423         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
8424         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
8425         uint64_t ret_ref = 0;
8426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8428         return ret_ref;
8429 }
8430
8431 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8432 CHECK(!owner->result_ok);
8433         return DecodeError_clone(&*owner->contents.err);
8434 }
8435 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
8436         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
8437         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8438         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
8439         uint64_t ret_ref = tag_ptr(ret_copy, true);
8440         return ret_ref;
8441 }
8442
8443 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8444         LDKGossipTimestampFilter ret = *owner->contents.result;
8445         ret.is_owned = false;
8446         return ret;
8447 }
8448 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
8449         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
8450         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
8451         uint64_t ret_ref = 0;
8452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8454         return ret_ref;
8455 }
8456
8457 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8458 CHECK(!owner->result_ok);
8459         return DecodeError_clone(&*owner->contents.err);
8460 }
8461 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
8462         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
8463         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8464         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
8465         uint64_t ret_ref = tag_ptr(ret_copy, true);
8466         return ret_ref;
8467 }
8468
8469 typedef struct LDKFilter_JCalls {
8470         atomic_size_t refcnt;
8471         uint32_t instance_ptr;
8472 } LDKFilter_JCalls;
8473 static void LDKFilter_JCalls_free(void* this_arg) {
8474         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8475         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8476                 FREE(j_calls);
8477         }
8478 }
8479 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
8480         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8481         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8482         memcpy(txid_arr->elems, *txid, 32);
8483         LDKu8slice script_pubkey_var = script_pubkey;
8484         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
8485         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
8486         js_invoke_function_uuuuuu(j_calls->instance_ptr, 40, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
8487 }
8488 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
8489         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8490         LDKWatchedOutput output_var = output;
8491         uint64_t output_ref = 0;
8492         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
8493         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
8494         js_invoke_function_buuuuu(j_calls->instance_ptr, 41, output_ref, 0, 0, 0, 0, 0);
8495 }
8496 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
8497         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
8498         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8499 }
8500 static inline LDKFilter LDKFilter_init (JSValue o) {
8501         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
8502         atomic_init(&calls->refcnt, 1);
8503         calls->instance_ptr = o;
8504
8505         LDKFilter ret = {
8506                 .this_arg = (void*) calls,
8507                 .register_tx = register_tx_LDKFilter_jcall,
8508                 .register_output = register_output_LDKFilter_jcall,
8509                 .free = LDKFilter_JCalls_free,
8510         };
8511         return ret;
8512 }
8513 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
8514         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
8515         *res_ptr = LDKFilter_init(o);
8516         return tag_ptr(res_ptr, true);
8517 }
8518 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
8519         void* this_arg_ptr = untag_ptr(this_arg);
8520         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8521         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8522         uint8_t txid_arr[32];
8523         CHECK(txid->arr_len == 32);
8524         memcpy(txid_arr, txid->elems, 32); FREE(txid);
8525         uint8_t (*txid_ref)[32] = &txid_arr;
8526         LDKu8slice script_pubkey_ref;
8527         script_pubkey_ref.datalen = script_pubkey->arr_len;
8528         script_pubkey_ref.data = script_pubkey->elems;
8529         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
8530         FREE(script_pubkey);
8531 }
8532
8533 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
8534         void* this_arg_ptr = untag_ptr(this_arg);
8535         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8536         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8537         LDKWatchedOutput output_conv;
8538         output_conv.inner = untag_ptr(output);
8539         output_conv.is_owned = ptr_is_owned(output);
8540         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
8541         output_conv = WatchedOutput_clone(&output_conv);
8542         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
8543 }
8544
8545 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
8546         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
8547         switch(obj->tag) {
8548                 case LDKCOption_FilterZ_Some: return 0;
8549                 case LDKCOption_FilterZ_None: return 1;
8550                 default: abort();
8551         }
8552 }
8553 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
8554         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
8555         assert(obj->tag == LDKCOption_FilterZ_Some);
8556                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
8557                         *some_ret = obj->some;
8558                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
8559                         if ((*some_ret).free == LDKFilter_JCalls_free) {
8560                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8561                                 LDKFilter_JCalls_cloned(&(*some_ret));
8562                         }
8563         return tag_ptr(some_ret, true);
8564 }
8565 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8566         LDKLockedChannelMonitor ret = *owner->contents.result;
8567         ret.is_owned = false;
8568         return ret;
8569 }
8570 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
8571         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
8572         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
8573         uint64_t ret_ref = 0;
8574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8576         return ret_ref;
8577 }
8578
8579 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8580 CHECK(!owner->result_ok);
8581         return *owner->contents.err;
8582 }
8583 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
8584         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
8585         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
8586 }
8587
8588 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
8589         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
8590         for (size_t i = 0; i < ret.datalen; i++) {
8591                 ret.data[i] = OutPoint_clone(&orig->data[i]);
8592         }
8593         return ret;
8594 }
8595 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
8596         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
8597         for (size_t i = 0; i < ret.datalen; i++) {
8598                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
8599         }
8600         return ret;
8601 }
8602 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
8603         LDKOutPoint ret = owner->a;
8604         ret.is_owned = false;
8605         return ret;
8606 }
8607 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(uint64_t owner) {
8608         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
8609         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
8610         uint64_t ret_ref = 0;
8611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8613         return ret_ref;
8614 }
8615
8616 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
8617         return CVec_MonitorUpdateIdZ_clone(&owner->b);
8618 }
8619 uint64_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(uint64_t owner) {
8620         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
8621         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
8622         uint64_tArray ret_arr = NULL;
8623         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8624         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8625         for (size_t r = 0; r < ret_var.datalen; r++) {
8626                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
8627                 uint64_t ret_conv_17_ref = 0;
8628                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
8629                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
8630                 ret_arr_ptr[r] = ret_conv_17_ref;
8631         }
8632         
8633         FREE(ret_var.data);
8634         return ret_arr;
8635 }
8636
8637 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
8638         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
8639         for (size_t i = 0; i < ret.datalen; i++) {
8640                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
8641         }
8642         return ret;
8643 }
8644 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
8645         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
8646         for (size_t i = 0; i < ret.datalen; i++) {
8647                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
8648         }
8649         return ret;
8650 }
8651 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
8652         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
8653         switch(obj->tag) {
8654                 case LDKSignOrCreationError_SignError: return 0;
8655                 case LDKSignOrCreationError_CreationError: return 1;
8656                 default: abort();
8657         }
8658 }
8659 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
8660         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
8661         assert(obj->tag == LDKSignOrCreationError_CreationError);
8662                         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
8663         return creation_error_conv;
8664 }
8665 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8666         LDKInvoice ret = *owner->contents.result;
8667         ret.is_owned = false;
8668         return ret;
8669 }
8670 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
8671         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
8672         LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
8673         uint64_t ret_ref = 0;
8674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8676         return ret_ref;
8677 }
8678
8679 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8680 CHECK(!owner->result_ok);
8681         return SignOrCreationError_clone(&*owner->contents.err);
8682 }
8683 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
8684         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
8685         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
8686         *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
8687         uint64_t ret_ref = tag_ptr(ret_copy, true);
8688         return ret_ref;
8689 }
8690
8691 uint32_t __attribute__((export_name("TS_LDKParseError_ty_from_ptr"))) TS_LDKParseError_ty_from_ptr(uint64_t ptr) {
8692         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
8693         switch(obj->tag) {
8694                 case LDKParseError_Bech32Error: return 0;
8695                 case LDKParseError_ParseAmountError: return 1;
8696                 case LDKParseError_MalformedSignature: return 2;
8697                 case LDKParseError_BadPrefix: return 3;
8698                 case LDKParseError_UnknownCurrency: return 4;
8699                 case LDKParseError_UnknownSiPrefix: return 5;
8700                 case LDKParseError_MalformedHRP: return 6;
8701                 case LDKParseError_TooShortDataPart: return 7;
8702                 case LDKParseError_UnexpectedEndOfTaggedFields: return 8;
8703                 case LDKParseError_DescriptionDecodeError: return 9;
8704                 case LDKParseError_PaddingError: return 10;
8705                 case LDKParseError_IntegerOverflowError: return 11;
8706                 case LDKParseError_InvalidSegWitProgramLength: return 12;
8707                 case LDKParseError_InvalidPubKeyHashLength: return 13;
8708                 case LDKParseError_InvalidScriptHashLength: return 14;
8709                 case LDKParseError_InvalidRecoveryId: return 15;
8710                 case LDKParseError_InvalidSliceLength: return 16;
8711                 case LDKParseError_Skip: return 17;
8712                 default: abort();
8713         }
8714 }
8715 uint64_t __attribute__((export_name("TS_LDKParseError_Bech32Error_get_bech32_error"))) TS_LDKParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
8716         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
8717         assert(obj->tag == LDKParseError_Bech32Error);
8718                         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
8719         return bech32_error_ref;
8720 }
8721 int32_t __attribute__((export_name("TS_LDKParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
8722         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
8723         assert(obj->tag == LDKParseError_ParseAmountError);
8724                         /*obj->parse_amount_error*/
8725         return 0;
8726 }
8727 uint32_t __attribute__((export_name("TS_LDKParseError_MalformedSignature_get_malformed_signature"))) TS_LDKParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
8728         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
8729         assert(obj->tag == LDKParseError_MalformedSignature);
8730                         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
8731         return malformed_signature_conv;
8732 }
8733 int32_t __attribute__((export_name("TS_LDKParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
8734         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
8735         assert(obj->tag == LDKParseError_DescriptionDecodeError);
8736                         /*obj->description_decode_error*/
8737         return 0;
8738 }
8739 jstring __attribute__((export_name("TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
8740         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
8741         assert(obj->tag == LDKParseError_InvalidSliceLength);
8742                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
8743                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
8744         return invalid_slice_length_conv;
8745 }
8746 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
8747 CHECK(owner->result_ok);
8748         return SiPrefix_clone(&*owner->contents.result);
8749 }
8750 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_ok"))) TS_CResult_SiPrefixParseErrorZ_get_ok(uint64_t owner) {
8751         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
8752         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
8753         return ret_conv;
8754 }
8755
8756 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
8757 CHECK(!owner->result_ok);
8758         return ParseError_clone(&*owner->contents.err);
8759 }
8760 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_err"))) TS_CResult_SiPrefixParseErrorZ_get_err(uint64_t owner) {
8761         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
8762         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
8763         *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
8764         uint64_t ret_ref = tag_ptr(ret_copy, true);
8765         return ret_ref;
8766 }
8767
8768 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
8769         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
8770         switch(obj->tag) {
8771                 case LDKParseOrSemanticError_ParseError: return 0;
8772                 case LDKParseOrSemanticError_SemanticError: return 1;
8773                 default: abort();
8774         }
8775 }
8776 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
8777         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
8778         assert(obj->tag == LDKParseOrSemanticError_ParseError);
8779                         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
8780         return parse_error_ref;
8781 }
8782 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
8783         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
8784         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
8785                         uint32_t semantic_error_conv = LDKSemanticError_to_js(obj->semantic_error);
8786         return semantic_error_conv;
8787 }
8788 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
8789         LDKInvoice ret = *owner->contents.result;
8790         ret.is_owned = false;
8791         return ret;
8792 }
8793 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
8794         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
8795         LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
8796         uint64_t ret_ref = 0;
8797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8799         return ret_ref;
8800 }
8801
8802 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
8803 CHECK(!owner->result_ok);
8804         return ParseOrSemanticError_clone(&*owner->contents.err);
8805 }
8806 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
8807         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
8808         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
8809         *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
8810         uint64_t ret_ref = tag_ptr(ret_copy, true);
8811         return ret_ref;
8812 }
8813
8814 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
8815         LDKSignedRawInvoice ret = *owner->contents.result;
8816         ret.is_owned = false;
8817         return ret;
8818 }
8819 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_ok(uint64_t owner) {
8820         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
8821         LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
8822         uint64_t ret_ref = 0;
8823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8825         return ret_ref;
8826 }
8827
8828 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
8829 CHECK(!owner->result_ok);
8830         return ParseError_clone(&*owner->contents.err);
8831 }
8832 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_err(uint64_t owner) {
8833         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
8834         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
8835         *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
8836         uint64_t ret_ref = tag_ptr(ret_copy, true);
8837         return ret_ref;
8838 }
8839
8840 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
8841         LDKRawInvoice ret = owner->a;
8842         ret.is_owned = false;
8843         return ret;
8844 }
8845 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint64_t owner) {
8846         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
8847         LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
8848         uint64_t ret_ref = 0;
8849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8851         return ret_ref;
8852 }
8853
8854 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
8855         return ThirtyTwoBytes_clone(&owner->b);
8856 }
8857 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint64_t owner) {
8858         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
8859         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
8860         memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32);
8861         return ret_arr;
8862 }
8863
8864 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
8865         LDKInvoiceSignature ret = owner->c;
8866         ret.is_owned = false;
8867         return ret;
8868 }
8869 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint64_t owner) {
8870         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
8871         LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
8872         uint64_t ret_ref = 0;
8873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8875         return ret_ref;
8876 }
8877
8878 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
8879         LDKPayeePubKey ret = *owner->contents.result;
8880         ret.is_owned = false;
8881         return ret;
8882 }
8883 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint64_t owner) {
8884         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
8885         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
8886         uint64_t ret_ref = 0;
8887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8889         return ret_ref;
8890 }
8891
8892 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
8893 CHECK(!owner->result_ok);
8894         return *owner->contents.err;
8895 }
8896 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint64_t owner) {
8897         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
8898         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
8899         return ret_conv;
8900 }
8901
8902 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
8903         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
8904         for (size_t i = 0; i < ret.datalen; i++) {
8905                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
8906         }
8907         return ret;
8908 }
8909 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
8910         LDKPositiveTimestamp ret = *owner->contents.result;
8911         ret.is_owned = false;
8912         return ret;
8913 }
8914 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
8915         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
8916         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
8917         uint64_t ret_ref = 0;
8918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8920         return ret_ref;
8921 }
8922
8923 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
8924 CHECK(!owner->result_ok);
8925         return CreationError_clone(&*owner->contents.err);
8926 }
8927 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
8928         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
8929         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
8930         return ret_conv;
8931 }
8932
8933 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
8934 CHECK(owner->result_ok);
8935         return *owner->contents.result;
8936 }
8937 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint64_t owner) {
8938         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
8939         CResult_NoneSemanticErrorZ_get_ok(owner_conv);
8940 }
8941
8942 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
8943 CHECK(!owner->result_ok);
8944         return SemanticError_clone(&*owner->contents.err);
8945 }
8946 uint32_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint64_t owner) {
8947         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
8948         uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv));
8949         return ret_conv;
8950 }
8951
8952 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
8953         LDKInvoice ret = *owner->contents.result;
8954         ret.is_owned = false;
8955         return ret;
8956 }
8957 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint64_t owner) {
8958         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
8959         LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
8960         uint64_t ret_ref = 0;
8961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8963         return ret_ref;
8964 }
8965
8966 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
8967 CHECK(!owner->result_ok);
8968         return SemanticError_clone(&*owner->contents.err);
8969 }
8970 uint32_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint64_t owner) {
8971         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
8972         uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
8973         return ret_conv;
8974 }
8975
8976 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
8977         LDKDescription ret = *owner->contents.result;
8978         ret.is_owned = false;
8979         return ret;
8980 }
8981 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
8982         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
8983         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
8984         uint64_t ret_ref = 0;
8985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8987         return ret_ref;
8988 }
8989
8990 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
8991 CHECK(!owner->result_ok);
8992         return CreationError_clone(&*owner->contents.err);
8993 }
8994 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
8995         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
8996         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
8997         return ret_conv;
8998 }
8999
9000 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
9001         LDKPrivateRoute ret = *owner->contents.result;
9002         ret.is_owned = false;
9003         return ret;
9004 }
9005 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
9006         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
9007         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
9008         uint64_t ret_ref = 0;
9009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9011         return ret_ref;
9012 }
9013
9014 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
9015 CHECK(!owner->result_ok);
9016         return CreationError_clone(&*owner->contents.err);
9017 }
9018 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
9019         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
9020         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
9021         return ret_conv;
9022 }
9023
9024 typedef struct LDKScore_JCalls {
9025         atomic_size_t refcnt;
9026         uint32_t instance_ptr;
9027 } LDKScore_JCalls;
9028 static void LDKScore_JCalls_free(void* this_arg) {
9029         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9030         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9031                 FREE(j_calls);
9032         }
9033 }
9034 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
9035         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9036         int64_t short_channel_id_conv = short_channel_id;
9037         LDKNodeId source_var = *source;
9038         uint64_t source_ref = 0;
9039         source_var = NodeId_clone(&source_var);
9040         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
9041         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
9042         LDKNodeId target_var = *target;
9043         uint64_t target_ref = 0;
9044         target_var = NodeId_clone(&target_var);
9045         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
9046         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
9047         LDKChannelUsage usage_var = usage;
9048         uint64_t usage_ref = 0;
9049         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
9050         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
9051         return js_invoke_function_bbbbuu(j_calls->instance_ptr, 42, short_channel_id_conv, source_ref, target_ref, usage_ref, 0, 0);
9052 }
9053 void payment_path_failed_LDKScore_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
9054         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9055         LDKPath path_var = *path;
9056         uint64_t path_ref = 0;
9057         path_var = Path_clone(&path_var);
9058         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9059         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
9060         int64_t short_channel_id_conv = short_channel_id;
9061         js_invoke_function_bbuuuu(j_calls->instance_ptr, 43, path_ref, short_channel_id_conv, 0, 0, 0, 0);
9062 }
9063 void payment_path_successful_LDKScore_jcall(void* this_arg, const LDKPath * path) {
9064         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9065         LDKPath path_var = *path;
9066         uint64_t path_ref = 0;
9067         path_var = Path_clone(&path_var);
9068         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9069         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
9070         js_invoke_function_buuuuu(j_calls->instance_ptr, 44, path_ref, 0, 0, 0, 0, 0);
9071 }
9072 void probe_failed_LDKScore_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
9073         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9074         LDKPath path_var = *path;
9075         uint64_t path_ref = 0;
9076         path_var = Path_clone(&path_var);
9077         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9078         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
9079         int64_t short_channel_id_conv = short_channel_id;
9080         js_invoke_function_bbuuuu(j_calls->instance_ptr, 45, path_ref, short_channel_id_conv, 0, 0, 0, 0);
9081 }
9082 void probe_successful_LDKScore_jcall(void* this_arg, const LDKPath * path) {
9083         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9084         LDKPath path_var = *path;
9085         uint64_t path_ref = 0;
9086         path_var = Path_clone(&path_var);
9087         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9088         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
9089         js_invoke_function_buuuuu(j_calls->instance_ptr, 46, path_ref, 0, 0, 0, 0, 0);
9090 }
9091 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
9092         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9093         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 47, 0, 0, 0, 0, 0, 0);
9094         LDKCVec_u8Z ret_ref;
9095         ret_ref.datalen = ret->arr_len;
9096         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9097         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
9098         return ret_ref;
9099 }
9100 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
9101         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
9102         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9103 }
9104 static inline LDKScore LDKScore_init (JSValue o) {
9105         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
9106         atomic_init(&calls->refcnt, 1);
9107         calls->instance_ptr = o;
9108
9109         LDKScore ret = {
9110                 .this_arg = (void*) calls,
9111                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
9112                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
9113                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
9114                 .probe_failed = probe_failed_LDKScore_jcall,
9115                 .probe_successful = probe_successful_LDKScore_jcall,
9116                 .write = write_LDKScore_jcall,
9117                 .free = LDKScore_JCalls_free,
9118         };
9119         return ret;
9120 }
9121 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
9122         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
9123         *res_ptr = LDKScore_init(o);
9124         return tag_ptr(res_ptr, true);
9125 }
9126 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) {
9127         void* this_arg_ptr = untag_ptr(this_arg);
9128         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9129         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9130         LDKNodeId source_conv;
9131         source_conv.inner = untag_ptr(source);
9132         source_conv.is_owned = ptr_is_owned(source);
9133         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
9134         source_conv.is_owned = false;
9135         LDKNodeId target_conv;
9136         target_conv.inner = untag_ptr(target);
9137         target_conv.is_owned = ptr_is_owned(target);
9138         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
9139         target_conv.is_owned = false;
9140         LDKChannelUsage usage_conv;
9141         usage_conv.inner = untag_ptr(usage);
9142         usage_conv.is_owned = ptr_is_owned(usage);
9143         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
9144         usage_conv = ChannelUsage_clone(&usage_conv);
9145         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
9146         return ret_conv;
9147 }
9148
9149 void  __attribute__((export_name("TS_Score_payment_path_failed"))) TS_Score_payment_path_failed(uint64_t this_arg, uint64_t path, int64_t short_channel_id) {
9150         void* this_arg_ptr = untag_ptr(this_arg);
9151         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9152         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9153         LDKPath path_conv;
9154         path_conv.inner = untag_ptr(path);
9155         path_conv.is_owned = ptr_is_owned(path);
9156         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
9157         path_conv.is_owned = false;
9158         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
9159 }
9160
9161 void  __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint64_t this_arg, uint64_t path) {
9162         void* this_arg_ptr = untag_ptr(this_arg);
9163         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9164         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9165         LDKPath path_conv;
9166         path_conv.inner = untag_ptr(path);
9167         path_conv.is_owned = ptr_is_owned(path);
9168         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
9169         path_conv.is_owned = false;
9170         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv);
9171 }
9172
9173 void  __attribute__((export_name("TS_Score_probe_failed"))) TS_Score_probe_failed(uint64_t this_arg, uint64_t path, int64_t short_channel_id) {
9174         void* this_arg_ptr = untag_ptr(this_arg);
9175         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9176         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9177         LDKPath path_conv;
9178         path_conv.inner = untag_ptr(path);
9179         path_conv.is_owned = ptr_is_owned(path);
9180         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
9181         path_conv.is_owned = false;
9182         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
9183 }
9184
9185 void  __attribute__((export_name("TS_Score_probe_successful"))) TS_Score_probe_successful(uint64_t this_arg, uint64_t path) {
9186         void* this_arg_ptr = untag_ptr(this_arg);
9187         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9188         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9189         LDKPath path_conv;
9190         path_conv.inner = untag_ptr(path);
9191         path_conv.is_owned = ptr_is_owned(path);
9192         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
9193         path_conv.is_owned = false;
9194         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv);
9195 }
9196
9197 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
9198         void* this_arg_ptr = untag_ptr(this_arg);
9199         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9200         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9201         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9202         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
9203         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
9204         CVec_u8Z_free(ret_var);
9205         return ret_arr;
9206 }
9207
9208 typedef struct LDKLockableScore_JCalls {
9209         atomic_size_t refcnt;
9210         uint32_t instance_ptr;
9211 } LDKLockableScore_JCalls;
9212 static void LDKLockableScore_JCalls_free(void* this_arg) {
9213         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
9214         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9215                 FREE(j_calls);
9216         }
9217 }
9218 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
9219         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
9220         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, 0, 0, 0, 0, 0, 0);
9221         void* ret_ptr = untag_ptr(ret);
9222         CHECK_ACCESS(ret_ptr);
9223         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
9224         if (ret_conv.free == LDKScore_JCalls_free) {
9225                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9226                 LDKScore_JCalls_cloned(&ret_conv);
9227         }// WARNING: we may need a move here but no clone is available for LDKScore
9228         
9229         return ret_conv;
9230 }
9231 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
9232         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
9233         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9234 }
9235 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
9236         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
9237         atomic_init(&calls->refcnt, 1);
9238         calls->instance_ptr = o;
9239
9240         LDKLockableScore ret = {
9241                 .this_arg = (void*) calls,
9242                 .lock = lock_LDKLockableScore_jcall,
9243                 .free = LDKLockableScore_JCalls_free,
9244         };
9245         return ret;
9246 }
9247 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
9248         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
9249         *res_ptr = LDKLockableScore_init(o);
9250         return tag_ptr(res_ptr, true);
9251 }
9252 uint64_t  __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint64_t this_arg) {
9253         void* this_arg_ptr = untag_ptr(this_arg);
9254         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9255         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
9256         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
9257         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
9258         return tag_ptr(ret_ret, true);
9259 }
9260
9261 typedef struct LDKWriteableScore_JCalls {
9262         atomic_size_t refcnt;
9263         uint32_t instance_ptr;
9264         LDKLockableScore_JCalls* LockableScore;
9265 } LDKWriteableScore_JCalls;
9266 static void LDKWriteableScore_JCalls_free(void* this_arg) {
9267         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
9268         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9269                 FREE(j_calls);
9270         }
9271 }
9272 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
9273         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
9274         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 49, 0, 0, 0, 0, 0, 0);
9275         LDKCVec_u8Z ret_ref;
9276         ret_ref.datalen = ret->arr_len;
9277         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9278         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
9279         return ret_ref;
9280 }
9281 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
9282         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
9283         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9284         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
9285 }
9286 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
9287         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
9288         atomic_init(&calls->refcnt, 1);
9289         calls->instance_ptr = o;
9290
9291         LDKWriteableScore ret = {
9292                 .this_arg = (void*) calls,
9293                 .write = write_LDKWriteableScore_jcall,
9294                 .free = LDKWriteableScore_JCalls_free,
9295                 .LockableScore = LDKLockableScore_init(LockableScore),
9296         };
9297         calls->LockableScore = ret.LockableScore.this_arg;
9298         return ret;
9299 }
9300 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
9301         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
9302         *res_ptr = LDKWriteableScore_init(o, LockableScore);
9303         return tag_ptr(res_ptr, true);
9304 }
9305 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
9306         void* this_arg_ptr = untag_ptr(this_arg);
9307         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9308         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
9309         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9310         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
9311         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
9312         CVec_u8Z_free(ret_var);
9313         return ret_arr;
9314 }
9315
9316 typedef struct LDKPersister_JCalls {
9317         atomic_size_t refcnt;
9318         uint32_t instance_ptr;
9319 } LDKPersister_JCalls;
9320 static void LDKPersister_JCalls_free(void* this_arg) {
9321         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
9322         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9323                 FREE(j_calls);
9324         }
9325 }
9326 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
9327         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
9328         LDKChannelManager channel_manager_var = *channel_manager;
9329         uint64_t channel_manager_ref = 0;
9330         // WARNING: we may need a move here but no clone is available for LDKChannelManager
9331         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
9332         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
9333         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 50, channel_manager_ref, 0, 0, 0, 0, 0);
9334         void* ret_ptr = untag_ptr(ret);
9335         CHECK_ACCESS(ret_ptr);
9336         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
9337         FREE(untag_ptr(ret));
9338         return ret_conv;
9339 }
9340 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
9341         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
9342         LDKNetworkGraph network_graph_var = *network_graph;
9343         uint64_t network_graph_ref = 0;
9344         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
9345         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
9346         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
9347         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 51, network_graph_ref, 0, 0, 0, 0, 0);
9348         void* ret_ptr = untag_ptr(ret);
9349         CHECK_ACCESS(ret_ptr);
9350         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
9351         FREE(untag_ptr(ret));
9352         return ret_conv;
9353 }
9354 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
9355         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
9356         // WARNING: This object doesn't live past this scope, needs clone!
9357         uint64_t ret_scorer = tag_ptr(scorer, false);
9358         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 52, ret_scorer, 0, 0, 0, 0, 0);
9359         void* ret_ptr = untag_ptr(ret);
9360         CHECK_ACCESS(ret_ptr);
9361         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
9362         FREE(untag_ptr(ret));
9363         return ret_conv;
9364 }
9365 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
9366         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
9367         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9368 }
9369 static inline LDKPersister LDKPersister_init (JSValue o) {
9370         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
9371         atomic_init(&calls->refcnt, 1);
9372         calls->instance_ptr = o;
9373
9374         LDKPersister ret = {
9375                 .this_arg = (void*) calls,
9376                 .persist_manager = persist_manager_LDKPersister_jcall,
9377                 .persist_graph = persist_graph_LDKPersister_jcall,
9378                 .persist_scorer = persist_scorer_LDKPersister_jcall,
9379                 .free = LDKPersister_JCalls_free,
9380         };
9381         return ret;
9382 }
9383 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
9384         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
9385         *res_ptr = LDKPersister_init(o);
9386         return tag_ptr(res_ptr, true);
9387 }
9388 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
9389         void* this_arg_ptr = untag_ptr(this_arg);
9390         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9391         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
9392         LDKChannelManager channel_manager_conv;
9393         channel_manager_conv.inner = untag_ptr(channel_manager);
9394         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
9395         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
9396         channel_manager_conv.is_owned = false;
9397         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9398         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
9399         return tag_ptr(ret_conv, true);
9400 }
9401
9402 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
9403         void* this_arg_ptr = untag_ptr(this_arg);
9404         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9405         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
9406         LDKNetworkGraph network_graph_conv;
9407         network_graph_conv.inner = untag_ptr(network_graph);
9408         network_graph_conv.is_owned = ptr_is_owned(network_graph);
9409         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
9410         network_graph_conv.is_owned = false;
9411         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9412         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
9413         return tag_ptr(ret_conv, true);
9414 }
9415
9416 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
9417         void* this_arg_ptr = untag_ptr(this_arg);
9418         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9419         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
9420         void* scorer_ptr = untag_ptr(scorer);
9421         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
9422         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
9423         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9424         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
9425         return tag_ptr(ret_conv, true);
9426 }
9427
9428 typedef struct LDKFutureCallback_JCalls {
9429         atomic_size_t refcnt;
9430         uint32_t instance_ptr;
9431 } LDKFutureCallback_JCalls;
9432 static void LDKFutureCallback_JCalls_free(void* this_arg) {
9433         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
9434         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9435                 FREE(j_calls);
9436         }
9437 }
9438 void call_LDKFutureCallback_jcall(const void* this_arg) {
9439         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
9440         js_invoke_function_uuuuuu(j_calls->instance_ptr, 53, 0, 0, 0, 0, 0, 0);
9441 }
9442 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
9443         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
9444         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9445 }
9446 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
9447         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
9448         atomic_init(&calls->refcnt, 1);
9449         calls->instance_ptr = o;
9450
9451         LDKFutureCallback ret = {
9452                 .this_arg = (void*) calls,
9453                 .call = call_LDKFutureCallback_jcall,
9454                 .free = LDKFutureCallback_JCalls_free,
9455         };
9456         return ret;
9457 }
9458 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
9459         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
9460         *res_ptr = LDKFutureCallback_init(o);
9461         return tag_ptr(res_ptr, true);
9462 }
9463 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
9464         void* this_arg_ptr = untag_ptr(this_arg);
9465         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9466         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
9467         (this_arg_conv->call)(this_arg_conv->this_arg);
9468 }
9469
9470 typedef struct LDKListen_JCalls {
9471         atomic_size_t refcnt;
9472         uint32_t instance_ptr;
9473 } LDKListen_JCalls;
9474 static void LDKListen_JCalls_free(void* this_arg) {
9475         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9476         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9477                 FREE(j_calls);
9478         }
9479 }
9480 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
9481         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9482         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9483         memcpy(header_arr->elems, *header, 80);
9484         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
9485         uint64_tArray txdata_arr = NULL;
9486         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
9487         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
9488         for (size_t c = 0; c < txdata_var.datalen; c++) {
9489                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9490                 *txdata_conv_28_conv = txdata_var.data[c];
9491                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
9492         }
9493         
9494         FREE(txdata_var.data);
9495         int32_t height_conv = height;
9496         js_invoke_function_uuuuuu(j_calls->instance_ptr, 54, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
9497 }
9498 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
9499         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9500         LDKu8slice block_var = block;
9501         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
9502         memcpy(block_arr->elems, block_var.data, block_var.datalen);
9503         int32_t height_conv = height;
9504         js_invoke_function_uuuuuu(j_calls->instance_ptr, 55, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
9505 }
9506 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
9507         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9508         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9509         memcpy(header_arr->elems, *header, 80);
9510         int32_t height_conv = height;
9511         js_invoke_function_uuuuuu(j_calls->instance_ptr, 56, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
9512 }
9513 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
9514         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
9515         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9516 }
9517 static inline LDKListen LDKListen_init (JSValue o) {
9518         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
9519         atomic_init(&calls->refcnt, 1);
9520         calls->instance_ptr = o;
9521
9522         LDKListen ret = {
9523                 .this_arg = (void*) calls,
9524                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
9525                 .block_connected = block_connected_LDKListen_jcall,
9526                 .block_disconnected = block_disconnected_LDKListen_jcall,
9527                 .free = LDKListen_JCalls_free,
9528         };
9529         return ret;
9530 }
9531 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
9532         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
9533         *res_ptr = LDKListen_init(o);
9534         return tag_ptr(res_ptr, true);
9535 }
9536 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) {
9537         void* this_arg_ptr = untag_ptr(this_arg);
9538         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9539         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9540         uint8_t header_arr[80];
9541         CHECK(header->arr_len == 80);
9542         memcpy(header_arr, header->elems, 80); FREE(header);
9543         uint8_t (*header_ref)[80] = &header_arr;
9544         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9545         txdata_constr.datalen = txdata->arr_len;
9546         if (txdata_constr.datalen > 0)
9547                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9548         else
9549                 txdata_constr.data = NULL;
9550         uint64_t* txdata_vals = txdata->elems;
9551         for (size_t c = 0; c < txdata_constr.datalen; c++) {
9552                 uint64_t txdata_conv_28 = txdata_vals[c];
9553                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
9554                 CHECK_ACCESS(txdata_conv_28_ptr);
9555                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
9556                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
9557                 txdata_constr.data[c] = txdata_conv_28_conv;
9558         }
9559         FREE(txdata);
9560         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
9561 }
9562
9563 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
9564         void* this_arg_ptr = untag_ptr(this_arg);
9565         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9566         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9567         LDKu8slice block_ref;
9568         block_ref.datalen = block->arr_len;
9569         block_ref.data = block->elems;
9570         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
9571         FREE(block);
9572 }
9573
9574 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
9575         void* this_arg_ptr = untag_ptr(this_arg);
9576         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9577         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9578         uint8_t header_arr[80];
9579         CHECK(header->arr_len == 80);
9580         memcpy(header_arr, header->elems, 80); FREE(header);
9581         uint8_t (*header_ref)[80] = &header_arr;
9582         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
9583 }
9584
9585 typedef struct LDKConfirm_JCalls {
9586         atomic_size_t refcnt;
9587         uint32_t instance_ptr;
9588 } LDKConfirm_JCalls;
9589 static void LDKConfirm_JCalls_free(void* this_arg) {
9590         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9591         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9592                 FREE(j_calls);
9593         }
9594 }
9595 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
9596         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9597         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9598         memcpy(header_arr->elems, *header, 80);
9599         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
9600         uint64_tArray txdata_arr = NULL;
9601         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
9602         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
9603         for (size_t c = 0; c < txdata_var.datalen; c++) {
9604                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9605                 *txdata_conv_28_conv = txdata_var.data[c];
9606                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
9607         }
9608         
9609         FREE(txdata_var.data);
9610         int32_t height_conv = height;
9611         js_invoke_function_uuuuuu(j_calls->instance_ptr, 57, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
9612 }
9613 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
9614         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9615         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
9616         memcpy(txid_arr->elems, *txid, 32);
9617         js_invoke_function_uuuuuu(j_calls->instance_ptr, 58, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
9618 }
9619 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
9620         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9621         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9622         memcpy(header_arr->elems, *header, 80);
9623         int32_t height_conv = height;
9624         js_invoke_function_uuuuuu(j_calls->instance_ptr, 59, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
9625 }
9626 LDKCVec_C2Tuple_TxidBlockHashZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
9627         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9628         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 60, 0, 0, 0, 0, 0, 0);
9629         LDKCVec_C2Tuple_TxidBlockHashZZ ret_constr;
9630         ret_constr.datalen = ret->arr_len;
9631         if (ret_constr.datalen > 0)
9632                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKCVec_C2Tuple_TxidBlockHashZZ Elements");
9633         else
9634                 ret_constr.data = NULL;
9635         uint64_t* ret_vals = ret->elems;
9636         for (size_t z = 0; z < ret_constr.datalen; z++) {
9637                 uint64_t ret_conv_25 = ret_vals[z];
9638                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
9639                 CHECK_ACCESS(ret_conv_25_ptr);
9640                 LDKC2Tuple_TxidBlockHashZ ret_conv_25_conv = *(LDKC2Tuple_TxidBlockHashZ*)(ret_conv_25_ptr);
9641                 FREE(untag_ptr(ret_conv_25));
9642                 ret_constr.data[z] = ret_conv_25_conv;
9643         }
9644         FREE(ret);
9645         return ret_constr;
9646 }
9647 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
9648         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
9649         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9650 }
9651 static inline LDKConfirm LDKConfirm_init (JSValue o) {
9652         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
9653         atomic_init(&calls->refcnt, 1);
9654         calls->instance_ptr = o;
9655
9656         LDKConfirm ret = {
9657                 .this_arg = (void*) calls,
9658                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
9659                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
9660                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
9661                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
9662                 .free = LDKConfirm_JCalls_free,
9663         };
9664         return ret;
9665 }
9666 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
9667         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
9668         *res_ptr = LDKConfirm_init(o);
9669         return tag_ptr(res_ptr, true);
9670 }
9671 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) {
9672         void* this_arg_ptr = untag_ptr(this_arg);
9673         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9674         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9675         uint8_t header_arr[80];
9676         CHECK(header->arr_len == 80);
9677         memcpy(header_arr, header->elems, 80); FREE(header);
9678         uint8_t (*header_ref)[80] = &header_arr;
9679         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9680         txdata_constr.datalen = txdata->arr_len;
9681         if (txdata_constr.datalen > 0)
9682                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9683         else
9684                 txdata_constr.data = NULL;
9685         uint64_t* txdata_vals = txdata->elems;
9686         for (size_t c = 0; c < txdata_constr.datalen; c++) {
9687                 uint64_t txdata_conv_28 = txdata_vals[c];
9688                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
9689                 CHECK_ACCESS(txdata_conv_28_ptr);
9690                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
9691                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
9692                 txdata_constr.data[c] = txdata_conv_28_conv;
9693         }
9694         FREE(txdata);
9695         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
9696 }
9697
9698 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
9699         void* this_arg_ptr = untag_ptr(this_arg);
9700         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9701         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9702         uint8_t txid_arr[32];
9703         CHECK(txid->arr_len == 32);
9704         memcpy(txid_arr, txid->elems, 32); FREE(txid);
9705         uint8_t (*txid_ref)[32] = &txid_arr;
9706         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
9707 }
9708
9709 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
9710         void* this_arg_ptr = untag_ptr(this_arg);
9711         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9712         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9713         uint8_t header_arr[80];
9714         CHECK(header->arr_len == 80);
9715         memcpy(header_arr, header->elems, 80); FREE(header);
9716         uint8_t (*header_ref)[80] = &header_arr;
9717         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
9718 }
9719
9720 uint64_tArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
9721         void* this_arg_ptr = untag_ptr(this_arg);
9722         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9723         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9724         LDKCVec_C2Tuple_TxidBlockHashZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
9725         uint64_tArray ret_arr = NULL;
9726         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
9727         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
9728         for (size_t z = 0; z < ret_var.datalen; z++) {
9729                 LDKC2Tuple_TxidBlockHashZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
9730                 *ret_conv_25_conv = ret_var.data[z];
9731                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
9732         }
9733         
9734         FREE(ret_var.data);
9735         return ret_arr;
9736 }
9737
9738 typedef struct LDKPersist_JCalls {
9739         atomic_size_t refcnt;
9740         uint32_t instance_ptr;
9741 } LDKPersist_JCalls;
9742 static void LDKPersist_JCalls_free(void* this_arg) {
9743         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9744         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9745                 FREE(j_calls);
9746         }
9747 }
9748 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
9749         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9750         LDKOutPoint channel_id_var = channel_id;
9751         uint64_t channel_id_ref = 0;
9752         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
9753         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
9754         LDKChannelMonitor data_var = *data;
9755         uint64_t data_ref = 0;
9756         data_var = ChannelMonitor_clone(&data_var);
9757         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
9758         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
9759         LDKMonitorUpdateId update_id_var = update_id;
9760         uint64_t update_id_ref = 0;
9761         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
9762         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
9763         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 61, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
9764         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
9765         return ret_conv;
9766 }
9767 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
9768         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9769         LDKOutPoint channel_id_var = channel_id;
9770         uint64_t channel_id_ref = 0;
9771         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
9772         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
9773         LDKChannelMonitorUpdate update_var = update;
9774         uint64_t update_ref = 0;
9775         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
9776         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
9777         LDKChannelMonitor data_var = *data;
9778         uint64_t data_ref = 0;
9779         data_var = ChannelMonitor_clone(&data_var);
9780         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
9781         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
9782         LDKMonitorUpdateId update_id_var = update_id;
9783         uint64_t update_id_ref = 0;
9784         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
9785         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
9786         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 62, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
9787         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
9788         return ret_conv;
9789 }
9790 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
9791         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
9792         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9793 }
9794 static inline LDKPersist LDKPersist_init (JSValue o) {
9795         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
9796         atomic_init(&calls->refcnt, 1);
9797         calls->instance_ptr = o;
9798
9799         LDKPersist ret = {
9800                 .this_arg = (void*) calls,
9801                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
9802                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
9803                 .free = LDKPersist_JCalls_free,
9804         };
9805         return ret;
9806 }
9807 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
9808         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
9809         *res_ptr = LDKPersist_init(o);
9810         return tag_ptr(res_ptr, true);
9811 }
9812 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) {
9813         void* this_arg_ptr = untag_ptr(this_arg);
9814         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9815         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9816         LDKOutPoint channel_id_conv;
9817         channel_id_conv.inner = untag_ptr(channel_id);
9818         channel_id_conv.is_owned = ptr_is_owned(channel_id);
9819         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9820         channel_id_conv = OutPoint_clone(&channel_id_conv);
9821         LDKChannelMonitor data_conv;
9822         data_conv.inner = untag_ptr(data);
9823         data_conv.is_owned = ptr_is_owned(data);
9824         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9825         data_conv.is_owned = false;
9826         LDKMonitorUpdateId update_id_conv;
9827         update_id_conv.inner = untag_ptr(update_id);
9828         update_id_conv.is_owned = ptr_is_owned(update_id);
9829         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9830         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9831         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));
9832         return ret_conv;
9833 }
9834
9835 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) {
9836         void* this_arg_ptr = untag_ptr(this_arg);
9837         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9838         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9839         LDKOutPoint channel_id_conv;
9840         channel_id_conv.inner = untag_ptr(channel_id);
9841         channel_id_conv.is_owned = ptr_is_owned(channel_id);
9842         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9843         channel_id_conv = OutPoint_clone(&channel_id_conv);
9844         LDKChannelMonitorUpdate update_conv;
9845         update_conv.inner = untag_ptr(update);
9846         update_conv.is_owned = ptr_is_owned(update);
9847         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
9848         update_conv = ChannelMonitorUpdate_clone(&update_conv);
9849         LDKChannelMonitor data_conv;
9850         data_conv.inner = untag_ptr(data);
9851         data_conv.is_owned = ptr_is_owned(data);
9852         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9853         data_conv.is_owned = false;
9854         LDKMonitorUpdateId update_id_conv;
9855         update_id_conv.inner = untag_ptr(update_id);
9856         update_id_conv.is_owned = ptr_is_owned(update_id);
9857         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9858         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9859         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));
9860         return ret_conv;
9861 }
9862
9863 typedef struct LDKEventHandler_JCalls {
9864         atomic_size_t refcnt;
9865         uint32_t instance_ptr;
9866 } LDKEventHandler_JCalls;
9867 static void LDKEventHandler_JCalls_free(void* this_arg) {
9868         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
9869         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9870                 FREE(j_calls);
9871         }
9872 }
9873 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
9874         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
9875         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
9876         *event_copy = event;
9877         uint64_t event_ref = tag_ptr(event_copy, true);
9878         js_invoke_function_buuuuu(j_calls->instance_ptr, 63, event_ref, 0, 0, 0, 0, 0);
9879 }
9880 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
9881         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
9882         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9883 }
9884 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
9885         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
9886         atomic_init(&calls->refcnt, 1);
9887         calls->instance_ptr = o;
9888
9889         LDKEventHandler ret = {
9890                 .this_arg = (void*) calls,
9891                 .handle_event = handle_event_LDKEventHandler_jcall,
9892                 .free = LDKEventHandler_JCalls_free,
9893         };
9894         return ret;
9895 }
9896 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
9897         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
9898         *res_ptr = LDKEventHandler_init(o);
9899         return tag_ptr(res_ptr, true);
9900 }
9901 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
9902         void* this_arg_ptr = untag_ptr(this_arg);
9903         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9904         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
9905         void* event_ptr = untag_ptr(event);
9906         CHECK_ACCESS(event_ptr);
9907         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
9908         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
9909         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
9910 }
9911
9912 typedef struct LDKEventsProvider_JCalls {
9913         atomic_size_t refcnt;
9914         uint32_t instance_ptr;
9915 } LDKEventsProvider_JCalls;
9916 static void LDKEventsProvider_JCalls_free(void* this_arg) {
9917         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
9918         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9919                 FREE(j_calls);
9920         }
9921 }
9922 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
9923         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
9924         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
9925         *handler_ret = handler;
9926         js_invoke_function_buuuuu(j_calls->instance_ptr, 64, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
9927 }
9928 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
9929         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
9930         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9931 }
9932 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
9933         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
9934         atomic_init(&calls->refcnt, 1);
9935         calls->instance_ptr = o;
9936
9937         LDKEventsProvider ret = {
9938                 .this_arg = (void*) calls,
9939                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
9940                 .free = LDKEventsProvider_JCalls_free,
9941         };
9942         return ret;
9943 }
9944 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
9945         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
9946         *res_ptr = LDKEventsProvider_init(o);
9947         return tag_ptr(res_ptr, true);
9948 }
9949 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
9950         void* this_arg_ptr = untag_ptr(this_arg);
9951         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9952         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
9953         void* handler_ptr = untag_ptr(handler);
9954         CHECK_ACCESS(handler_ptr);
9955         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
9956         if (handler_conv.free == LDKEventHandler_JCalls_free) {
9957                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9958                 LDKEventHandler_JCalls_cloned(&handler_conv);
9959         }
9960         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
9961 }
9962
9963 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
9964         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
9965         switch(obj->tag) {
9966                 case LDKRetry_Attempts: return 0;
9967                 default: abort();
9968         }
9969 }
9970 uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
9971         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
9972         assert(obj->tag == LDKRetry_Attempts);
9973                         uint32_t attempts_conv = obj->attempts;
9974         return attempts_conv;
9975 }
9976 typedef struct LDKMessageSendEventsProvider_JCalls {
9977         atomic_size_t refcnt;
9978         uint32_t instance_ptr;
9979 } LDKMessageSendEventsProvider_JCalls;
9980 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
9981         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9982         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9983                 FREE(j_calls);
9984         }
9985 }
9986 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
9987         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9988         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 65, 0, 0, 0, 0, 0, 0);
9989         LDKCVec_MessageSendEventZ ret_constr;
9990         ret_constr.datalen = ret->arr_len;
9991         if (ret_constr.datalen > 0)
9992                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9993         else
9994                 ret_constr.data = NULL;
9995         uint64_t* ret_vals = ret->elems;
9996         for (size_t s = 0; s < ret_constr.datalen; s++) {
9997                 uint64_t ret_conv_18 = ret_vals[s];
9998                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
9999                 CHECK_ACCESS(ret_conv_18_ptr);
10000                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
10001                 FREE(untag_ptr(ret_conv_18));
10002                 ret_constr.data[s] = ret_conv_18_conv;
10003         }
10004         FREE(ret);
10005         return ret_constr;
10006 }
10007 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
10008         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
10009         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10010 }
10011 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
10012         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
10013         atomic_init(&calls->refcnt, 1);
10014         calls->instance_ptr = o;
10015
10016         LDKMessageSendEventsProvider ret = {
10017                 .this_arg = (void*) calls,
10018                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
10019                 .free = LDKMessageSendEventsProvider_JCalls_free,
10020         };
10021         return ret;
10022 }
10023 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
10024         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
10025         *res_ptr = LDKMessageSendEventsProvider_init(o);
10026         return tag_ptr(res_ptr, true);
10027 }
10028 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) {
10029         void* this_arg_ptr = untag_ptr(this_arg);
10030         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10031         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
10032         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
10033         uint64_tArray ret_arr = NULL;
10034         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10035         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10036         for (size_t s = 0; s < ret_var.datalen; s++) {
10037                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10038                 *ret_conv_18_copy = ret_var.data[s];
10039                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
10040                 ret_arr_ptr[s] = ret_conv_18_ref;
10041         }
10042         
10043         FREE(ret_var.data);
10044         return ret_arr;
10045 }
10046
10047 typedef struct LDKChannelMessageHandler_JCalls {
10048         atomic_size_t refcnt;
10049         uint32_t instance_ptr;
10050         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
10051 } LDKChannelMessageHandler_JCalls;
10052 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
10053         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10054         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10055                 FREE(j_calls);
10056         }
10057 }
10058 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
10059         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10060         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10061         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10062         LDKOpenChannel msg_var = *msg;
10063         uint64_t msg_ref = 0;
10064         msg_var = OpenChannel_clone(&msg_var);
10065         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10066         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10067         js_invoke_function_ubuuuu(j_calls->instance_ptr, 66, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10068 }
10069 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
10070         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10071         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10072         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10073         LDKAcceptChannel msg_var = *msg;
10074         uint64_t msg_ref = 0;
10075         msg_var = AcceptChannel_clone(&msg_var);
10076         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10077         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10078         js_invoke_function_ubuuuu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10079 }
10080 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
10081         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10082         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10083         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10084         LDKFundingCreated msg_var = *msg;
10085         uint64_t msg_ref = 0;
10086         msg_var = FundingCreated_clone(&msg_var);
10087         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10088         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10089         js_invoke_function_ubuuuu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10090 }
10091 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
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         LDKFundingSigned msg_var = *msg;
10096         uint64_t msg_ref = 0;
10097         msg_var = FundingSigned_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         js_invoke_function_ubuuuu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10101 }
10102 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
10103         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10104         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10105         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10106         LDKChannelReady msg_var = *msg;
10107         uint64_t msg_ref = 0;
10108         msg_var = ChannelReady_clone(&msg_var);
10109         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10110         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10111         js_invoke_function_ubuuuu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10112 }
10113 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
10114         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10115         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10116         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10117         LDKShutdown msg_var = *msg;
10118         uint64_t msg_ref = 0;
10119         msg_var = Shutdown_clone(&msg_var);
10120         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10121         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10122         js_invoke_function_ubuuuu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10123 }
10124 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
10125         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10126         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10127         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10128         LDKClosingSigned msg_var = *msg;
10129         uint64_t msg_ref = 0;
10130         msg_var = ClosingSigned_clone(&msg_var);
10131         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10132         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10133         js_invoke_function_ubuuuu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10134 }
10135 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
10136         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10137         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10138         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10139         LDKUpdateAddHTLC msg_var = *msg;
10140         uint64_t msg_ref = 0;
10141         msg_var = UpdateAddHTLC_clone(&msg_var);
10142         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10143         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10144         js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10145 }
10146 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
10147         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10148         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10149         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10150         LDKUpdateFulfillHTLC msg_var = *msg;
10151         uint64_t msg_ref = 0;
10152         msg_var = UpdateFulfillHTLC_clone(&msg_var);
10153         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10154         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10155         js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10156 }
10157 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
10158         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10159         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10160         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10161         LDKUpdateFailHTLC msg_var = *msg;
10162         uint64_t msg_ref = 0;
10163         msg_var = UpdateFailHTLC_clone(&msg_var);
10164         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10165         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10166         js_invoke_function_ubuuuu(j_calls->instance_ptr, 75, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10167 }
10168 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
10169         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10170         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10171         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10172         LDKUpdateFailMalformedHTLC msg_var = *msg;
10173         uint64_t msg_ref = 0;
10174         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
10175         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10176         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10177         js_invoke_function_ubuuuu(j_calls->instance_ptr, 76, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10178 }
10179 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
10180         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10181         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10182         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10183         LDKCommitmentSigned msg_var = *msg;
10184         uint64_t msg_ref = 0;
10185         msg_var = CommitmentSigned_clone(&msg_var);
10186         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10187         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10188         js_invoke_function_ubuuuu(j_calls->instance_ptr, 77, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10189 }
10190 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
10191         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10192         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10193         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10194         LDKRevokeAndACK msg_var = *msg;
10195         uint64_t msg_ref = 0;
10196         msg_var = RevokeAndACK_clone(&msg_var);
10197         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10198         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10199         js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10200 }
10201 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
10202         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10203         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10204         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10205         LDKUpdateFee msg_var = *msg;
10206         uint64_t msg_ref = 0;
10207         msg_var = UpdateFee_clone(&msg_var);
10208         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10209         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10210         js_invoke_function_ubuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10211 }
10212 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
10213         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10214         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10215         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10216         LDKAnnouncementSignatures msg_var = *msg;
10217         uint64_t msg_ref = 0;
10218         msg_var = AnnouncementSignatures_clone(&msg_var);
10219         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10220         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10221         js_invoke_function_ubuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10222 }
10223 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10224         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10225         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10226         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10227         js_invoke_function_uuuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10228 }
10229 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
10230         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10231         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10232         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10233         LDKInit msg_var = *msg;
10234         uint64_t msg_ref = 0;
10235         msg_var = Init_clone(&msg_var);
10236         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10237         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10238         jboolean inbound_conv = inbound;
10239         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, inbound_conv, 0, 0, 0);
10240         void* ret_ptr = untag_ptr(ret);
10241         CHECK_ACCESS(ret_ptr);
10242         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
10243         FREE(untag_ptr(ret));
10244         return ret_conv;
10245 }
10246 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
10247         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10248         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10249         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10250         LDKChannelReestablish msg_var = *msg;
10251         uint64_t msg_ref = 0;
10252         msg_var = ChannelReestablish_clone(&msg_var);
10253         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10254         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10255         js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10256 }
10257 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
10258         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10259         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10260         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10261         LDKChannelUpdate msg_var = *msg;
10262         uint64_t msg_ref = 0;
10263         msg_var = ChannelUpdate_clone(&msg_var);
10264         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10265         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10266         js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10267 }
10268 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
10269         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10270         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10271         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10272         LDKErrorMessage msg_var = *msg;
10273         uint64_t msg_ref = 0;
10274         msg_var = ErrorMessage_clone(&msg_var);
10275         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10276         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10277         js_invoke_function_ubuuuu(j_calls->instance_ptr, 85, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10278 }
10279 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
10280         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10281         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 86, 0, 0, 0, 0, 0, 0);
10282         LDKNodeFeatures ret_conv;
10283         ret_conv.inner = untag_ptr(ret);
10284         ret_conv.is_owned = ptr_is_owned(ret);
10285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10286         return ret_conv;
10287 }
10288 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10289         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10290         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10291         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10292         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 87, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10293         LDKInitFeatures ret_conv;
10294         ret_conv.inner = untag_ptr(ret);
10295         ret_conv.is_owned = ptr_is_owned(ret);
10296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10297         return ret_conv;
10298 }
10299 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
10300         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
10301         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10302         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
10303 }
10304 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
10305         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
10306         atomic_init(&calls->refcnt, 1);
10307         calls->instance_ptr = o;
10308
10309         LDKChannelMessageHandler ret = {
10310                 .this_arg = (void*) calls,
10311                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
10312                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
10313                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
10314                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
10315                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
10316                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
10317                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
10318                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
10319                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
10320                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
10321                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
10322                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
10323                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
10324                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
10325                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
10326                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
10327                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
10328                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
10329                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
10330                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
10331                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
10332                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
10333                 .free = LDKChannelMessageHandler_JCalls_free,
10334                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
10335         };
10336         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
10337         return ret;
10338 }
10339 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
10340         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
10341         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
10342         return tag_ptr(res_ptr, true);
10343 }
10344 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) {
10345         void* this_arg_ptr = untag_ptr(this_arg);
10346         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10347         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10348         LDKPublicKey their_node_id_ref;
10349         CHECK(their_node_id->arr_len == 33);
10350         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10351         LDKOpenChannel msg_conv;
10352         msg_conv.inner = untag_ptr(msg);
10353         msg_conv.is_owned = ptr_is_owned(msg);
10354         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10355         msg_conv.is_owned = false;
10356         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10357 }
10358
10359 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) {
10360         void* this_arg_ptr = untag_ptr(this_arg);
10361         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10362         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10363         LDKPublicKey their_node_id_ref;
10364         CHECK(their_node_id->arr_len == 33);
10365         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10366         LDKAcceptChannel msg_conv;
10367         msg_conv.inner = untag_ptr(msg);
10368         msg_conv.is_owned = ptr_is_owned(msg);
10369         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10370         msg_conv.is_owned = false;
10371         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10372 }
10373
10374 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) {
10375         void* this_arg_ptr = untag_ptr(this_arg);
10376         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10377         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10378         LDKPublicKey their_node_id_ref;
10379         CHECK(their_node_id->arr_len == 33);
10380         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10381         LDKFundingCreated msg_conv;
10382         msg_conv.inner = untag_ptr(msg);
10383         msg_conv.is_owned = ptr_is_owned(msg);
10384         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10385         msg_conv.is_owned = false;
10386         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10387 }
10388
10389 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) {
10390         void* this_arg_ptr = untag_ptr(this_arg);
10391         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10392         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10393         LDKPublicKey their_node_id_ref;
10394         CHECK(their_node_id->arr_len == 33);
10395         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10396         LDKFundingSigned msg_conv;
10397         msg_conv.inner = untag_ptr(msg);
10398         msg_conv.is_owned = ptr_is_owned(msg);
10399         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10400         msg_conv.is_owned = false;
10401         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10402 }
10403
10404 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) {
10405         void* this_arg_ptr = untag_ptr(this_arg);
10406         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10407         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10408         LDKPublicKey their_node_id_ref;
10409         CHECK(their_node_id->arr_len == 33);
10410         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10411         LDKChannelReady msg_conv;
10412         msg_conv.inner = untag_ptr(msg);
10413         msg_conv.is_owned = ptr_is_owned(msg);
10414         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10415         msg_conv.is_owned = false;
10416         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10417 }
10418
10419 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
10420         void* this_arg_ptr = untag_ptr(this_arg);
10421         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10422         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10423         LDKPublicKey their_node_id_ref;
10424         CHECK(their_node_id->arr_len == 33);
10425         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10426         LDKShutdown msg_conv;
10427         msg_conv.inner = untag_ptr(msg);
10428         msg_conv.is_owned = ptr_is_owned(msg);
10429         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10430         msg_conv.is_owned = false;
10431         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10432 }
10433
10434 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) {
10435         void* this_arg_ptr = untag_ptr(this_arg);
10436         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10437         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10438         LDKPublicKey their_node_id_ref;
10439         CHECK(their_node_id->arr_len == 33);
10440         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10441         LDKClosingSigned msg_conv;
10442         msg_conv.inner = untag_ptr(msg);
10443         msg_conv.is_owned = ptr_is_owned(msg);
10444         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10445         msg_conv.is_owned = false;
10446         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10447 }
10448
10449 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) {
10450         void* this_arg_ptr = untag_ptr(this_arg);
10451         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10452         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10453         LDKPublicKey their_node_id_ref;
10454         CHECK(their_node_id->arr_len == 33);
10455         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10456         LDKUpdateAddHTLC msg_conv;
10457         msg_conv.inner = untag_ptr(msg);
10458         msg_conv.is_owned = ptr_is_owned(msg);
10459         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10460         msg_conv.is_owned = false;
10461         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10462 }
10463
10464 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) {
10465         void* this_arg_ptr = untag_ptr(this_arg);
10466         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10467         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10468         LDKPublicKey their_node_id_ref;
10469         CHECK(their_node_id->arr_len == 33);
10470         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10471         LDKUpdateFulfillHTLC msg_conv;
10472         msg_conv.inner = untag_ptr(msg);
10473         msg_conv.is_owned = ptr_is_owned(msg);
10474         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10475         msg_conv.is_owned = false;
10476         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10477 }
10478
10479 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) {
10480         void* this_arg_ptr = untag_ptr(this_arg);
10481         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10482         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10483         LDKPublicKey their_node_id_ref;
10484         CHECK(their_node_id->arr_len == 33);
10485         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10486         LDKUpdateFailHTLC msg_conv;
10487         msg_conv.inner = untag_ptr(msg);
10488         msg_conv.is_owned = ptr_is_owned(msg);
10489         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10490         msg_conv.is_owned = false;
10491         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10492 }
10493
10494 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) {
10495         void* this_arg_ptr = untag_ptr(this_arg);
10496         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10497         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10498         LDKPublicKey their_node_id_ref;
10499         CHECK(their_node_id->arr_len == 33);
10500         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10501         LDKUpdateFailMalformedHTLC msg_conv;
10502         msg_conv.inner = untag_ptr(msg);
10503         msg_conv.is_owned = ptr_is_owned(msg);
10504         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10505         msg_conv.is_owned = false;
10506         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10507 }
10508
10509 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) {
10510         void* this_arg_ptr = untag_ptr(this_arg);
10511         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10512         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10513         LDKPublicKey their_node_id_ref;
10514         CHECK(their_node_id->arr_len == 33);
10515         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10516         LDKCommitmentSigned msg_conv;
10517         msg_conv.inner = untag_ptr(msg);
10518         msg_conv.is_owned = ptr_is_owned(msg);
10519         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10520         msg_conv.is_owned = false;
10521         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10522 }
10523
10524 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) {
10525         void* this_arg_ptr = untag_ptr(this_arg);
10526         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10527         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10528         LDKPublicKey their_node_id_ref;
10529         CHECK(their_node_id->arr_len == 33);
10530         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10531         LDKRevokeAndACK msg_conv;
10532         msg_conv.inner = untag_ptr(msg);
10533         msg_conv.is_owned = ptr_is_owned(msg);
10534         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10535         msg_conv.is_owned = false;
10536         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10537 }
10538
10539 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) {
10540         void* this_arg_ptr = untag_ptr(this_arg);
10541         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10542         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10543         LDKPublicKey their_node_id_ref;
10544         CHECK(their_node_id->arr_len == 33);
10545         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10546         LDKUpdateFee msg_conv;
10547         msg_conv.inner = untag_ptr(msg);
10548         msg_conv.is_owned = ptr_is_owned(msg);
10549         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10550         msg_conv.is_owned = false;
10551         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10552 }
10553
10554 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) {
10555         void* this_arg_ptr = untag_ptr(this_arg);
10556         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10557         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10558         LDKPublicKey their_node_id_ref;
10559         CHECK(their_node_id->arr_len == 33);
10560         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10561         LDKAnnouncementSignatures msg_conv;
10562         msg_conv.inner = untag_ptr(msg);
10563         msg_conv.is_owned = ptr_is_owned(msg);
10564         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10565         msg_conv.is_owned = false;
10566         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10567 }
10568
10569 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
10570         void* this_arg_ptr = untag_ptr(this_arg);
10571         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10572         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10573         LDKPublicKey their_node_id_ref;
10574         CHECK(their_node_id->arr_len == 33);
10575         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10576         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
10577 }
10578
10579 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) {
10580         void* this_arg_ptr = untag_ptr(this_arg);
10581         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10582         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10583         LDKPublicKey their_node_id_ref;
10584         CHECK(their_node_id->arr_len == 33);
10585         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10586         LDKInit msg_conv;
10587         msg_conv.inner = untag_ptr(msg);
10588         msg_conv.is_owned = ptr_is_owned(msg);
10589         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10590         msg_conv.is_owned = false;
10591         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10592         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
10593         return tag_ptr(ret_conv, true);
10594 }
10595
10596 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) {
10597         void* this_arg_ptr = untag_ptr(this_arg);
10598         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10599         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10600         LDKPublicKey their_node_id_ref;
10601         CHECK(their_node_id->arr_len == 33);
10602         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10603         LDKChannelReestablish msg_conv;
10604         msg_conv.inner = untag_ptr(msg);
10605         msg_conv.is_owned = ptr_is_owned(msg);
10606         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10607         msg_conv.is_owned = false;
10608         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10609 }
10610
10611 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) {
10612         void* this_arg_ptr = untag_ptr(this_arg);
10613         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10614         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10615         LDKPublicKey their_node_id_ref;
10616         CHECK(their_node_id->arr_len == 33);
10617         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10618         LDKChannelUpdate msg_conv;
10619         msg_conv.inner = untag_ptr(msg);
10620         msg_conv.is_owned = ptr_is_owned(msg);
10621         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10622         msg_conv.is_owned = false;
10623         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10624 }
10625
10626 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
10627         void* this_arg_ptr = untag_ptr(this_arg);
10628         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10629         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10630         LDKPublicKey their_node_id_ref;
10631         CHECK(their_node_id->arr_len == 33);
10632         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10633         LDKErrorMessage msg_conv;
10634         msg_conv.inner = untag_ptr(msg);
10635         msg_conv.is_owned = ptr_is_owned(msg);
10636         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10637         msg_conv.is_owned = false;
10638         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10639 }
10640
10641 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
10642         void* this_arg_ptr = untag_ptr(this_arg);
10643         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10644         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10645         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
10646         uint64_t ret_ref = 0;
10647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10649         return ret_ref;
10650 }
10651
10652 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
10653         void* this_arg_ptr = untag_ptr(this_arg);
10654         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10655         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10656         LDKPublicKey their_node_id_ref;
10657         CHECK(their_node_id->arr_len == 33);
10658         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10659         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
10660         uint64_t ret_ref = 0;
10661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10663         return ret_ref;
10664 }
10665
10666 typedef struct LDKRoutingMessageHandler_JCalls {
10667         atomic_size_t refcnt;
10668         uint32_t instance_ptr;
10669         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
10670 } LDKRoutingMessageHandler_JCalls;
10671 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
10672         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10673         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10674                 FREE(j_calls);
10675         }
10676 }
10677 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
10678         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10679         LDKNodeAnnouncement msg_var = *msg;
10680         uint64_t msg_ref = 0;
10681         msg_var = NodeAnnouncement_clone(&msg_var);
10682         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10683         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10684         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 88, msg_ref, 0, 0, 0, 0, 0);
10685         void* ret_ptr = untag_ptr(ret);
10686         CHECK_ACCESS(ret_ptr);
10687         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
10688         FREE(untag_ptr(ret));
10689         return ret_conv;
10690 }
10691 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
10692         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10693         LDKChannelAnnouncement msg_var = *msg;
10694         uint64_t msg_ref = 0;
10695         msg_var = ChannelAnnouncement_clone(&msg_var);
10696         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10697         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10698         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 89, msg_ref, 0, 0, 0, 0, 0);
10699         void* ret_ptr = untag_ptr(ret);
10700         CHECK_ACCESS(ret_ptr);
10701         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
10702         FREE(untag_ptr(ret));
10703         return ret_conv;
10704 }
10705 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
10706         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10707         LDKChannelUpdate msg_var = *msg;
10708         uint64_t msg_ref = 0;
10709         msg_var = ChannelUpdate_clone(&msg_var);
10710         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10711         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10712         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 90, msg_ref, 0, 0, 0, 0, 0);
10713         void* ret_ptr = untag_ptr(ret);
10714         CHECK_ACCESS(ret_ptr);
10715         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
10716         FREE(untag_ptr(ret));
10717         return ret_conv;
10718 }
10719 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
10720         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10721         int64_t starting_point_conv = starting_point;
10722         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 91, starting_point_conv, 0, 0, 0, 0, 0);
10723         void* ret_ptr = untag_ptr(ret);
10724         CHECK_ACCESS(ret_ptr);
10725         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
10726         FREE(untag_ptr(ret));
10727         return ret_conv;
10728 }
10729 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
10730         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10731         LDKNodeId starting_point_var = starting_point;
10732         uint64_t starting_point_ref = 0;
10733         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
10734         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
10735         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 92, starting_point_ref, 0, 0, 0, 0, 0);
10736         LDKNodeAnnouncement ret_conv;
10737         ret_conv.inner = untag_ptr(ret);
10738         ret_conv.is_owned = ptr_is_owned(ret);
10739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10740         return ret_conv;
10741 }
10742 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
10743         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10744         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10745         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10746         LDKInit init_var = *init;
10747         uint64_t init_ref = 0;
10748         init_var = Init_clone(&init_var);
10749         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
10750         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
10751         jboolean inbound_conv = inbound;
10752         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0);
10753         void* ret_ptr = untag_ptr(ret);
10754         CHECK_ACCESS(ret_ptr);
10755         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
10756         FREE(untag_ptr(ret));
10757         return ret_conv;
10758 }
10759 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
10760         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10761         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10762         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10763         LDKReplyChannelRange msg_var = msg;
10764         uint64_t msg_ref = 0;
10765         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10766         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10767         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10768         void* ret_ptr = untag_ptr(ret);
10769         CHECK_ACCESS(ret_ptr);
10770         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10771         FREE(untag_ptr(ret));
10772         return ret_conv;
10773 }
10774 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
10775         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10776         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10777         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10778         LDKReplyShortChannelIdsEnd msg_var = msg;
10779         uint64_t msg_ref = 0;
10780         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10781         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10782         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10783         void* ret_ptr = untag_ptr(ret);
10784         CHECK_ACCESS(ret_ptr);
10785         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10786         FREE(untag_ptr(ret));
10787         return ret_conv;
10788 }
10789 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
10790         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10791         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10792         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10793         LDKQueryChannelRange msg_var = msg;
10794         uint64_t msg_ref = 0;
10795         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10796         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10797         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10798         void* ret_ptr = untag_ptr(ret);
10799         CHECK_ACCESS(ret_ptr);
10800         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10801         FREE(untag_ptr(ret));
10802         return ret_conv;
10803 }
10804 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
10805         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10806         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10807         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10808         LDKQueryShortChannelIds msg_var = msg;
10809         uint64_t msg_ref = 0;
10810         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10811         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10812         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 97, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10813         void* ret_ptr = untag_ptr(ret);
10814         CHECK_ACCESS(ret_ptr);
10815         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10816         FREE(untag_ptr(ret));
10817         return ret_conv;
10818 }
10819 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
10820         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10821         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 98, 0, 0, 0, 0, 0, 0);
10822 }
10823 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
10824         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10825         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 99, 0, 0, 0, 0, 0, 0);
10826         LDKNodeFeatures ret_conv;
10827         ret_conv.inner = untag_ptr(ret);
10828         ret_conv.is_owned = ptr_is_owned(ret);
10829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10830         return ret_conv;
10831 }
10832 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10833         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10834         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10835         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10836         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 100, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10837         LDKInitFeatures ret_conv;
10838         ret_conv.inner = untag_ptr(ret);
10839         ret_conv.is_owned = ptr_is_owned(ret);
10840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10841         return ret_conv;
10842 }
10843 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
10844         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
10845         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10846         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
10847 }
10848 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
10849         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
10850         atomic_init(&calls->refcnt, 1);
10851         calls->instance_ptr = o;
10852
10853         LDKRoutingMessageHandler ret = {
10854                 .this_arg = (void*) calls,
10855                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
10856                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
10857                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
10858                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
10859                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
10860                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
10861                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
10862                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
10863                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
10864                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
10865                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
10866                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
10867                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
10868                 .free = LDKRoutingMessageHandler_JCalls_free,
10869                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
10870         };
10871         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
10872         return ret;
10873 }
10874 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
10875         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
10876         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
10877         return tag_ptr(res_ptr, true);
10878 }
10879 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
10880         void* this_arg_ptr = untag_ptr(this_arg);
10881         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10882         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10883         LDKNodeAnnouncement msg_conv;
10884         msg_conv.inner = untag_ptr(msg);
10885         msg_conv.is_owned = ptr_is_owned(msg);
10886         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10887         msg_conv.is_owned = false;
10888         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10889         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
10890         return tag_ptr(ret_conv, true);
10891 }
10892
10893 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
10894         void* this_arg_ptr = untag_ptr(this_arg);
10895         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10896         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10897         LDKChannelAnnouncement msg_conv;
10898         msg_conv.inner = untag_ptr(msg);
10899         msg_conv.is_owned = ptr_is_owned(msg);
10900         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10901         msg_conv.is_owned = false;
10902         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10903         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
10904         return tag_ptr(ret_conv, true);
10905 }
10906
10907 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
10908         void* this_arg_ptr = untag_ptr(this_arg);
10909         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10910         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10911         LDKChannelUpdate msg_conv;
10912         msg_conv.inner = untag_ptr(msg);
10913         msg_conv.is_owned = ptr_is_owned(msg);
10914         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10915         msg_conv.is_owned = false;
10916         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10917         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
10918         return tag_ptr(ret_conv, true);
10919 }
10920
10921 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) {
10922         void* this_arg_ptr = untag_ptr(this_arg);
10923         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10924         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10925         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
10926         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
10927         uint64_t ret_ref = tag_ptr(ret_copy, true);
10928         return ret_ref;
10929 }
10930
10931 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) {
10932         void* this_arg_ptr = untag_ptr(this_arg);
10933         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10934         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10935         LDKNodeId starting_point_conv;
10936         starting_point_conv.inner = untag_ptr(starting_point);
10937         starting_point_conv.is_owned = ptr_is_owned(starting_point);
10938         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
10939         starting_point_conv = NodeId_clone(&starting_point_conv);
10940         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
10941         uint64_t ret_ref = 0;
10942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10944         return ret_ref;
10945 }
10946
10947 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) {
10948         void* this_arg_ptr = untag_ptr(this_arg);
10949         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10950         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10951         LDKPublicKey their_node_id_ref;
10952         CHECK(their_node_id->arr_len == 33);
10953         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10954         LDKInit init_conv;
10955         init_conv.inner = untag_ptr(init);
10956         init_conv.is_owned = ptr_is_owned(init);
10957         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
10958         init_conv.is_owned = false;
10959         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10960         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
10961         return tag_ptr(ret_conv, true);
10962 }
10963
10964 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) {
10965         void* this_arg_ptr = untag_ptr(this_arg);
10966         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10967         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10968         LDKPublicKey their_node_id_ref;
10969         CHECK(their_node_id->arr_len == 33);
10970         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10971         LDKReplyChannelRange msg_conv;
10972         msg_conv.inner = untag_ptr(msg);
10973         msg_conv.is_owned = ptr_is_owned(msg);
10974         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10975         msg_conv = ReplyChannelRange_clone(&msg_conv);
10976         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10977         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10978         return tag_ptr(ret_conv, true);
10979 }
10980
10981 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) {
10982         void* this_arg_ptr = untag_ptr(this_arg);
10983         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10984         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10985         LDKPublicKey their_node_id_ref;
10986         CHECK(their_node_id->arr_len == 33);
10987         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10988         LDKReplyShortChannelIdsEnd msg_conv;
10989         msg_conv.inner = untag_ptr(msg);
10990         msg_conv.is_owned = ptr_is_owned(msg);
10991         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10992         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
10993         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10994         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10995         return tag_ptr(ret_conv, true);
10996 }
10997
10998 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) {
10999         void* this_arg_ptr = untag_ptr(this_arg);
11000         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11001         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11002         LDKPublicKey their_node_id_ref;
11003         CHECK(their_node_id->arr_len == 33);
11004         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
11005         LDKQueryChannelRange msg_conv;
11006         msg_conv.inner = untag_ptr(msg);
11007         msg_conv.is_owned = ptr_is_owned(msg);
11008         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11009         msg_conv = QueryChannelRange_clone(&msg_conv);
11010         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11011         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
11012         return tag_ptr(ret_conv, true);
11013 }
11014
11015 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) {
11016         void* this_arg_ptr = untag_ptr(this_arg);
11017         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11018         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11019         LDKPublicKey their_node_id_ref;
11020         CHECK(their_node_id->arr_len == 33);
11021         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
11022         LDKQueryShortChannelIds msg_conv;
11023         msg_conv.inner = untag_ptr(msg);
11024         msg_conv.is_owned = ptr_is_owned(msg);
11025         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11026         msg_conv = QueryShortChannelIds_clone(&msg_conv);
11027         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11028         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
11029         return tag_ptr(ret_conv, true);
11030 }
11031
11032 jboolean  __attribute__((export_name("TS_RoutingMessageHandler_processing_queue_high"))) TS_RoutingMessageHandler_processing_queue_high(uint64_t this_arg) {
11033         void* this_arg_ptr = untag_ptr(this_arg);
11034         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11035         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11036         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
11037         return ret_conv;
11038 }
11039
11040 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
11041         void* this_arg_ptr = untag_ptr(this_arg);
11042         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11043         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11044         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
11045         uint64_t ret_ref = 0;
11046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11048         return ret_ref;
11049 }
11050
11051 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
11052         void* this_arg_ptr = untag_ptr(this_arg);
11053         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11054         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11055         LDKPublicKey their_node_id_ref;
11056         CHECK(their_node_id->arr_len == 33);
11057         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
11058         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
11059         uint64_t ret_ref = 0;
11060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11062         return ret_ref;
11063 }
11064
11065 typedef struct LDKOnionMessageProvider_JCalls {
11066         atomic_size_t refcnt;
11067         uint32_t instance_ptr;
11068 } LDKOnionMessageProvider_JCalls;
11069 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
11070         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
11071         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11072                 FREE(j_calls);
11073         }
11074 }
11075 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
11076         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
11077         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
11078         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
11079         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 101, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
11080         LDKOnionMessage ret_conv;
11081         ret_conv.inner = untag_ptr(ret);
11082         ret_conv.is_owned = ptr_is_owned(ret);
11083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
11084         return ret_conv;
11085 }
11086 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
11087         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
11088         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11089 }
11090 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JSValue o) {
11091         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
11092         atomic_init(&calls->refcnt, 1);
11093         calls->instance_ptr = o;
11094
11095         LDKOnionMessageProvider ret = {
11096                 .this_arg = (void*) calls,
11097                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
11098                 .free = LDKOnionMessageProvider_JCalls_free,
11099         };
11100         return ret;
11101 }
11102 uint64_t  __attribute__((export_name("TS_LDKOnionMessageProvider_new"))) TS_LDKOnionMessageProvider_new(JSValue o) {
11103         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
11104         *res_ptr = LDKOnionMessageProvider_init(o);
11105         return tag_ptr(res_ptr, true);
11106 }
11107 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) {
11108         void* this_arg_ptr = untag_ptr(this_arg);
11109         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11110         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
11111         LDKPublicKey peer_node_id_ref;
11112         CHECK(peer_node_id->arr_len == 33);
11113         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
11114         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
11115         uint64_t ret_ref = 0;
11116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11118         return ret_ref;
11119 }
11120
11121 typedef struct LDKOnionMessageHandler_JCalls {
11122         atomic_size_t refcnt;
11123         uint32_t instance_ptr;
11124         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
11125 } LDKOnionMessageHandler_JCalls;
11126 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
11127         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
11128         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11129                 FREE(j_calls);
11130         }
11131 }
11132 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
11133         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
11134         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
11135         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
11136         LDKOnionMessage msg_var = *msg;
11137         uint64_t msg_ref = 0;
11138         msg_var = OnionMessage_clone(&msg_var);
11139         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11140         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11141         js_invoke_function_ubuuuu(j_calls->instance_ptr, 102, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
11142 }
11143 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
11144         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
11145         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11146         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11147         LDKInit init_var = *init;
11148         uint64_t init_ref = 0;
11149         init_var = Init_clone(&init_var);
11150         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
11151         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
11152         jboolean inbound_conv = inbound;
11153         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);
11154         void* ret_ptr = untag_ptr(ret);
11155         CHECK_ACCESS(ret_ptr);
11156         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
11157         FREE(untag_ptr(ret));
11158         return ret_conv;
11159 }
11160 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
11161         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
11162         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11163         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11164         js_invoke_function_uuuuuu(j_calls->instance_ptr, 104, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
11165 }
11166 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
11167         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
11168         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 105, 0, 0, 0, 0, 0, 0);
11169         LDKNodeFeatures ret_conv;
11170         ret_conv.inner = untag_ptr(ret);
11171         ret_conv.is_owned = ptr_is_owned(ret);
11172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
11173         return ret_conv;
11174 }
11175 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
11176         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
11177         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11178         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11179         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 106, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
11180         LDKInitFeatures ret_conv;
11181         ret_conv.inner = untag_ptr(ret);
11182         ret_conv.is_owned = ptr_is_owned(ret);
11183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
11184         return ret_conv;
11185 }
11186 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
11187         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
11188         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11189         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
11190 }
11191 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o, JSValue OnionMessageProvider) {
11192         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
11193         atomic_init(&calls->refcnt, 1);
11194         calls->instance_ptr = o;
11195
11196         LDKOnionMessageHandler ret = {
11197                 .this_arg = (void*) calls,
11198                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
11199                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
11200                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
11201                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
11202                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
11203                 .free = LDKOnionMessageHandler_JCalls_free,
11204                 .OnionMessageProvider = LDKOnionMessageProvider_init(OnionMessageProvider),
11205         };
11206         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
11207         return ret;
11208 }
11209 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o, JSValue OnionMessageProvider) {
11210         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
11211         *res_ptr = LDKOnionMessageHandler_init(o, OnionMessageProvider);
11212         return tag_ptr(res_ptr, true);
11213 }
11214 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) {
11215         void* this_arg_ptr = untag_ptr(this_arg);
11216         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11217         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11218         LDKPublicKey peer_node_id_ref;
11219         CHECK(peer_node_id->arr_len == 33);
11220         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
11221         LDKOnionMessage msg_conv;
11222         msg_conv.inner = untag_ptr(msg);
11223         msg_conv.is_owned = ptr_is_owned(msg);
11224         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11225         msg_conv.is_owned = false;
11226         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
11227 }
11228
11229 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) {
11230         void* this_arg_ptr = untag_ptr(this_arg);
11231         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11232         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11233         LDKPublicKey their_node_id_ref;
11234         CHECK(their_node_id->arr_len == 33);
11235         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
11236         LDKInit init_conv;
11237         init_conv.inner = untag_ptr(init);
11238         init_conv.is_owned = ptr_is_owned(init);
11239         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
11240         init_conv.is_owned = false;
11241         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11242         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
11243         return tag_ptr(ret_conv, true);
11244 }
11245
11246 void  __attribute__((export_name("TS_OnionMessageHandler_peer_disconnected"))) TS_OnionMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
11247         void* this_arg_ptr = untag_ptr(this_arg);
11248         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11249         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11250         LDKPublicKey their_node_id_ref;
11251         CHECK(their_node_id->arr_len == 33);
11252         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
11253         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
11254 }
11255
11256 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
11257         void* this_arg_ptr = untag_ptr(this_arg);
11258         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11259         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11260         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
11261         uint64_t ret_ref = 0;
11262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11264         return ret_ref;
11265 }
11266
11267 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
11268         void* this_arg_ptr = untag_ptr(this_arg);
11269         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11270         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
11271         LDKPublicKey their_node_id_ref;
11272         CHECK(their_node_id->arr_len == 33);
11273         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
11274         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
11275         uint64_t ret_ref = 0;
11276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11278         return ret_ref;
11279 }
11280
11281 typedef struct LDKCustomMessageReader_JCalls {
11282         atomic_size_t refcnt;
11283         uint32_t instance_ptr;
11284 } LDKCustomMessageReader_JCalls;
11285 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
11286         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
11287         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11288                 FREE(j_calls);
11289         }
11290 }
11291 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
11292         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
11293         int16_t message_type_conv = message_type;
11294         LDKu8slice buffer_var = buffer;
11295         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
11296         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
11297         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 107, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
11298         void* ret_ptr = untag_ptr(ret);
11299         CHECK_ACCESS(ret_ptr);
11300         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
11301         FREE(untag_ptr(ret));
11302         return ret_conv;
11303 }
11304 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
11305         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
11306         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11307 }
11308 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
11309         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
11310         atomic_init(&calls->refcnt, 1);
11311         calls->instance_ptr = o;
11312
11313         LDKCustomMessageReader ret = {
11314                 .this_arg = (void*) calls,
11315                 .read = read_LDKCustomMessageReader_jcall,
11316                 .free = LDKCustomMessageReader_JCalls_free,
11317         };
11318         return ret;
11319 }
11320 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
11321         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
11322         *res_ptr = LDKCustomMessageReader_init(o);
11323         return tag_ptr(res_ptr, true);
11324 }
11325 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
11326         void* this_arg_ptr = untag_ptr(this_arg);
11327         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11328         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
11329         LDKu8slice buffer_ref;
11330         buffer_ref.datalen = buffer->arr_len;
11331         buffer_ref.data = buffer->elems;
11332         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
11333         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
11334         FREE(buffer);
11335         return tag_ptr(ret_conv, true);
11336 }
11337
11338 typedef struct LDKCustomMessageHandler_JCalls {
11339         atomic_size_t refcnt;
11340         uint32_t instance_ptr;
11341         LDKCustomMessageReader_JCalls* CustomMessageReader;
11342 } LDKCustomMessageHandler_JCalls;
11343 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
11344         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
11345         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11346                 FREE(j_calls);
11347         }
11348 }
11349 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
11350         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
11351         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
11352         *msg_ret = msg;
11353         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
11354         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
11355         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);
11356         void* ret_ptr = untag_ptr(ret);
11357         CHECK_ACCESS(ret_ptr);
11358         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
11359         FREE(untag_ptr(ret));
11360         return ret_conv;
11361 }
11362 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
11363         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
11364         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 109, 0, 0, 0, 0, 0, 0);
11365         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
11366         ret_constr.datalen = ret->arr_len;
11367         if (ret_constr.datalen > 0)
11368                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
11369         else
11370                 ret_constr.data = NULL;
11371         uint64_t* ret_vals = ret->elems;
11372         for (size_t z = 0; z < ret_constr.datalen; z++) {
11373                 uint64_t ret_conv_25 = ret_vals[z];
11374                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
11375                 CHECK_ACCESS(ret_conv_25_ptr);
11376                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
11377                 FREE(untag_ptr(ret_conv_25));
11378                 ret_constr.data[z] = ret_conv_25_conv;
11379         }
11380         FREE(ret);
11381         return ret_constr;
11382 }
11383 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
11384         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
11385         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11386         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
11387 }
11388 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
11389         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
11390         atomic_init(&calls->refcnt, 1);
11391         calls->instance_ptr = o;
11392
11393         LDKCustomMessageHandler ret = {
11394                 .this_arg = (void*) calls,
11395                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
11396                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
11397                 .free = LDKCustomMessageHandler_JCalls_free,
11398                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
11399         };
11400         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
11401         return ret;
11402 }
11403 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
11404         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
11405         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
11406         return tag_ptr(res_ptr, true);
11407 }
11408 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) {
11409         void* this_arg_ptr = untag_ptr(this_arg);
11410         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11411         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
11412         void* msg_ptr = untag_ptr(msg);
11413         CHECK_ACCESS(msg_ptr);
11414         LDKType msg_conv = *(LDKType*)(msg_ptr);
11415         if (msg_conv.free == LDKType_JCalls_free) {
11416                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11417                 LDKType_JCalls_cloned(&msg_conv);
11418         }
11419         LDKPublicKey sender_node_id_ref;
11420         CHECK(sender_node_id->arr_len == 33);
11421         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
11422         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11423         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
11424         return tag_ptr(ret_conv, true);
11425 }
11426
11427 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
11428         void* this_arg_ptr = untag_ptr(this_arg);
11429         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11430         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
11431         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
11432         uint64_tArray ret_arr = NULL;
11433         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
11434         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
11435         for (size_t z = 0; z < ret_var.datalen; z++) {
11436                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11437                 *ret_conv_25_conv = ret_var.data[z];
11438                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
11439         }
11440         
11441         FREE(ret_var.data);
11442         return ret_arr;
11443 }
11444
11445 typedef struct LDKCustomOnionMessageHandler_JCalls {
11446         atomic_size_t refcnt;
11447         uint32_t instance_ptr;
11448 } LDKCustomOnionMessageHandler_JCalls;
11449 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
11450         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
11451         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11452                 FREE(j_calls);
11453         }
11454 }
11455 void handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKCustomOnionMessageContents msg) {
11456         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
11457         LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
11458         *msg_ret = msg;
11459         js_invoke_function_buuuuu(j_calls->instance_ptr, 110, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
11460 }
11461 LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
11462         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
11463         int64_t message_type_conv = message_type;
11464         LDKu8slice buffer_var = buffer;
11465         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
11466         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
11467         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 111, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
11468         void* ret_ptr = untag_ptr(ret);
11469         CHECK_ACCESS(ret_ptr);
11470         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr);
11471         FREE(untag_ptr(ret));
11472         return ret_conv;
11473 }
11474 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
11475         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
11476         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11477 }
11478 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
11479         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
11480         atomic_init(&calls->refcnt, 1);
11481         calls->instance_ptr = o;
11482
11483         LDKCustomOnionMessageHandler ret = {
11484                 .this_arg = (void*) calls,
11485                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
11486                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
11487                 .free = LDKCustomOnionMessageHandler_JCalls_free,
11488         };
11489         return ret;
11490 }
11491 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
11492         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
11493         *res_ptr = LDKCustomOnionMessageHandler_init(o);
11494         return tag_ptr(res_ptr, true);
11495 }
11496 void  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
11497         void* this_arg_ptr = untag_ptr(this_arg);
11498         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11499         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
11500         void* msg_ptr = untag_ptr(msg);
11501         CHECK_ACCESS(msg_ptr);
11502         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
11503         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
11504                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11505                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
11506         }
11507         (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
11508 }
11509
11510 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) {
11511         void* this_arg_ptr = untag_ptr(this_arg);
11512         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11513         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
11514         LDKu8slice buffer_ref;
11515         buffer_ref.datalen = buffer->arr_len;
11516         buffer_ref.data = buffer->elems;
11517         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
11518         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
11519         FREE(buffer);
11520         return tag_ptr(ret_conv, true);
11521 }
11522
11523 typedef struct LDKSocketDescriptor_JCalls {
11524         atomic_size_t refcnt;
11525         uint32_t instance_ptr;
11526 } LDKSocketDescriptor_JCalls;
11527 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
11528         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11529         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11530                 FREE(j_calls);
11531         }
11532 }
11533 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
11534         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11535         LDKu8slice data_var = data;
11536         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
11537         memcpy(data_arr->elems, data_var.data, data_var.datalen);
11538         jboolean resume_read_conv = resume_read;
11539         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 112, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
11540 }
11541 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
11542         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11543         js_invoke_function_uuuuuu(j_calls->instance_ptr, 113, 0, 0, 0, 0, 0, 0);
11544 }
11545 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
11546         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11547         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
11548         *other_arg_clone = SocketDescriptor_clone(other_arg);
11549         return js_invoke_function_buuuuu(j_calls->instance_ptr, 114, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
11550 }
11551 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
11552         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11553         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 115, 0, 0, 0, 0, 0, 0);
11554 }
11555 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
11556         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
11557         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11558 }
11559 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
11560         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
11561         atomic_init(&calls->refcnt, 1);
11562         calls->instance_ptr = o;
11563
11564         LDKSocketDescriptor ret = {
11565                 .this_arg = (void*) calls,
11566                 .send_data = send_data_LDKSocketDescriptor_jcall,
11567                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
11568                 .eq = eq_LDKSocketDescriptor_jcall,
11569                 .hash = hash_LDKSocketDescriptor_jcall,
11570                 .cloned = LDKSocketDescriptor_JCalls_cloned,
11571                 .free = LDKSocketDescriptor_JCalls_free,
11572         };
11573         return ret;
11574 }
11575 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
11576         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
11577         *res_ptr = LDKSocketDescriptor_init(o);
11578         return tag_ptr(res_ptr, true);
11579 }
11580 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
11581         void* this_arg_ptr = untag_ptr(this_arg);
11582         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11583         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
11584         LDKu8slice data_ref;
11585         data_ref.datalen = data->arr_len;
11586         data_ref.data = data->elems;
11587         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
11588         FREE(data);
11589         return ret_conv;
11590 }
11591
11592 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
11593         void* this_arg_ptr = untag_ptr(this_arg);
11594         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11595         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
11596         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
11597 }
11598
11599 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
11600         void* this_arg_ptr = untag_ptr(this_arg);
11601         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11602         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
11603         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
11604         return ret_conv;
11605 }
11606
11607 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
11608         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11609         switch(obj->tag) {
11610                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
11611                 case LDKEffectiveCapacity_MaximumHTLC: return 1;
11612                 case LDKEffectiveCapacity_Total: return 2;
11613                 case LDKEffectiveCapacity_Infinite: return 3;
11614                 case LDKEffectiveCapacity_Unknown: return 4;
11615                 default: abort();
11616         }
11617 }
11618 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
11619         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11620         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
11621                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
11622         return liquidity_msat_conv;
11623 }
11624 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat(uint64_t ptr) {
11625         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11626         assert(obj->tag == LDKEffectiveCapacity_MaximumHTLC);
11627                         int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
11628         return amount_msat_conv;
11629 }
11630 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
11631         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11632         assert(obj->tag == LDKEffectiveCapacity_Total);
11633                         int64_t capacity_msat_conv = obj->total.capacity_msat;
11634         return capacity_msat_conv;
11635 }
11636 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
11637         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
11638         assert(obj->tag == LDKEffectiveCapacity_Total);
11639                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
11640         return htlc_maximum_msat_conv;
11641 }
11642 uint32_t __attribute__((export_name("TS_LDKHints_ty_from_ptr"))) TS_LDKHints_ty_from_ptr(uint64_t ptr) {
11643         LDKHints *obj = (LDKHints*)untag_ptr(ptr);
11644         switch(obj->tag) {
11645                 case LDKHints_Blinded: return 0;
11646                 case LDKHints_Clear: return 1;
11647                 default: abort();
11648         }
11649 }
11650 uint64_tArray __attribute__((export_name("TS_LDKHints_Blinded_get_blinded"))) TS_LDKHints_Blinded_get_blinded(uint64_t ptr) {
11651         LDKHints *obj = (LDKHints*)untag_ptr(ptr);
11652         assert(obj->tag == LDKHints_Blinded);
11653                         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_var = obj->blinded;
11654                         uint64_tArray blinded_arr = NULL;
11655                         blinded_arr = init_uint64_tArray(blinded_var.datalen, __LINE__);
11656                         uint64_t *blinded_arr_ptr = (uint64_t*)(((uint8_t*)blinded_arr) + 8);
11657                         for (size_t l = 0; l < blinded_var.datalen; l++) {
11658                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* blinded_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
11659                                 *blinded_conv_37_conv = blinded_var.data[l];
11660                                 *blinded_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(blinded_conv_37_conv);
11661                                 blinded_arr_ptr[l] = tag_ptr(blinded_conv_37_conv, true);
11662                         }
11663                         
11664         return blinded_arr;
11665 }
11666 uint64_tArray __attribute__((export_name("TS_LDKHints_Clear_get_clear"))) TS_LDKHints_Clear_get_clear(uint64_t ptr) {
11667         LDKHints *obj = (LDKHints*)untag_ptr(ptr);
11668         assert(obj->tag == LDKHints_Clear);
11669                         LDKCVec_RouteHintZ clear_var = obj->clear;
11670                         uint64_tArray clear_arr = NULL;
11671                         clear_arr = init_uint64_tArray(clear_var.datalen, __LINE__);
11672                         uint64_t *clear_arr_ptr = (uint64_t*)(((uint8_t*)clear_arr) + 8);
11673                         for (size_t l = 0; l < clear_var.datalen; l++) {
11674                                 LDKRouteHint clear_conv_11_var = clear_var.data[l];
11675                                 uint64_t clear_conv_11_ref = 0;
11676                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(clear_conv_11_var);
11677                                 clear_conv_11_ref = tag_ptr(clear_conv_11_var.inner, false);
11678                                 clear_arr_ptr[l] = clear_conv_11_ref;
11679                         }
11680                         
11681         return clear_arr;
11682 }
11683 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
11684         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
11685         switch(obj->tag) {
11686                 case LDKDestination_Node: return 0;
11687                 case LDKDestination_BlindedPath: return 1;
11688                 default: abort();
11689         }
11690 }
11691 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
11692         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
11693         assert(obj->tag == LDKDestination_Node);
11694                         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
11695                         memcpy(node_arr->elems, obj->node.compressed_form, 33);
11696         return node_arr;
11697 }
11698 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedPath_get_blinded_path"))) TS_LDKDestination_BlindedPath_get_blinded_path(uint64_t ptr) {
11699         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
11700         assert(obj->tag == LDKDestination_BlindedPath);
11701                         LDKBlindedPath blinded_path_var = obj->blinded_path;
11702                         uint64_t blinded_path_ref = 0;
11703                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
11704                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
11705         return blinded_path_ref;
11706 }
11707 uint32_t __attribute__((export_name("TS_LDKOnionMessageContents_ty_from_ptr"))) TS_LDKOnionMessageContents_ty_from_ptr(uint64_t ptr) {
11708         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
11709         switch(obj->tag) {
11710                 case LDKOnionMessageContents_Custom: return 0;
11711                 default: abort();
11712         }
11713 }
11714 uint64_t __attribute__((export_name("TS_LDKOnionMessageContents_Custom_get_custom"))) TS_LDKOnionMessageContents_Custom_get_custom(uint64_t ptr) {
11715         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
11716         assert(obj->tag == LDKOnionMessageContents_Custom);
11717                         LDKCustomOnionMessageContents* custom_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
11718                         *custom_ret = CustomOnionMessageContents_clone(&obj->custom);
11719         return tag_ptr(custom_ret, true);
11720 }
11721 uint32_t __attribute__((export_name("TS_LDKGossipSync_ty_from_ptr"))) TS_LDKGossipSync_ty_from_ptr(uint64_t ptr) {
11722         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
11723         switch(obj->tag) {
11724                 case LDKGossipSync_P2P: return 0;
11725                 case LDKGossipSync_Rapid: return 1;
11726                 case LDKGossipSync_None: return 2;
11727                 default: abort();
11728         }
11729 }
11730 uint64_t __attribute__((export_name("TS_LDKGossipSync_P2P_get_p2p"))) TS_LDKGossipSync_P2P_get_p2p(uint64_t ptr) {
11731         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
11732         assert(obj->tag == LDKGossipSync_P2P);
11733                         LDKP2PGossipSync p2p_var = obj->p2p;
11734                         uint64_t p2p_ref = 0;
11735                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
11736                         p2p_ref = tag_ptr(p2p_var.inner, false);
11737         return p2p_ref;
11738 }
11739 uint64_t __attribute__((export_name("TS_LDKGossipSync_Rapid_get_rapid"))) TS_LDKGossipSync_Rapid_get_rapid(uint64_t ptr) {
11740         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
11741         assert(obj->tag == LDKGossipSync_Rapid);
11742                         LDKRapidGossipSync rapid_var = obj->rapid;
11743                         uint64_t rapid_ref = 0;
11744                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
11745                         rapid_ref = tag_ptr(rapid_var.inner, false);
11746         return rapid_ref;
11747 }
11748 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
11749         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11750         switch(obj->tag) {
11751                 case LDKFallback_SegWitProgram: return 0;
11752                 case LDKFallback_PubKeyHash: return 1;
11753                 case LDKFallback_ScriptHash: return 2;
11754                 default: abort();
11755         }
11756 }
11757 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
11758         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11759         assert(obj->tag == LDKFallback_SegWitProgram);
11760                         uint8_t version_val = obj->seg_wit_program.version._0;
11761         return version_val;
11762 }
11763 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
11764         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11765         assert(obj->tag == LDKFallback_SegWitProgram);
11766                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
11767                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
11768                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
11769         return program_arr;
11770 }
11771 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
11772         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11773         assert(obj->tag == LDKFallback_PubKeyHash);
11774                         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
11775                         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
11776         return pub_key_hash_arr;
11777 }
11778 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
11779         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11780         assert(obj->tag == LDKFallback_ScriptHash);
11781                         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
11782                         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
11783         return script_hash_arr;
11784 }
11785 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
11786         LDKStr ret_str = _ldk_get_compiled_version();
11787         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11788         Str_free(ret_str);
11789         return ret_conv;
11790 }
11791
11792 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
11793         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
11794         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11795         Str_free(ret_str);
11796         return ret_conv;
11797 }
11798
11799 int8_tArray  __attribute__((export_name("TS_U128_le_bytes"))) TS_U128_le_bytes(int8_tArray val) {
11800         LDKU128 val_ref;
11801         CHECK(val->arr_len == 16);
11802         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
11803         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
11804         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
11805         return ret_arr;
11806 }
11807
11808 int8_tArray  __attribute__((export_name("TS_U128_new"))) TS_U128_new(int8_tArray le_bytes) {
11809         LDKSixteenBytes le_bytes_ref;
11810         CHECK(le_bytes->arr_len == 16);
11811         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
11812         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
11813         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
11814         return ret_arr;
11815 }
11816
11817 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
11818         LDKThirtyTwoBytes big_endian_bytes_ref;
11819         CHECK(big_endian_bytes->arr_len == 32);
11820         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
11821         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
11822         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
11823         return tag_ptr(ret_ref, true);
11824 }
11825
11826 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
11827         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11828         *ret_copy = Bech32Error_clone(arg);
11829         uint64_t ret_ref = tag_ptr(ret_copy, true);
11830         return ret_ref;
11831 }
11832 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
11833         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
11834         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
11835         return ret_conv;
11836 }
11837
11838 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
11839         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
11840         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11841         *ret_copy = Bech32Error_clone(orig_conv);
11842         uint64_t ret_ref = tag_ptr(ret_copy, true);
11843         return ret_ref;
11844 }
11845
11846 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
11847         if (!ptr_is_owned(o)) return;
11848         void* o_ptr = untag_ptr(o);
11849         CHECK_ACCESS(o_ptr);
11850         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
11851         FREE(untag_ptr(o));
11852         Bech32Error_free(o_conv);
11853 }
11854
11855 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
11856         LDKTransaction _res_ref;
11857         _res_ref.datalen = _res->arr_len;
11858         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
11859         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
11860         _res_ref.data_is_owned = true;
11861         Transaction_free(_res_ref);
11862 }
11863
11864 void  __attribute__((export_name("TS_Witness_free"))) TS_Witness_free(int8_tArray _res) {
11865         LDKWitness _res_ref;
11866         _res_ref.datalen = _res->arr_len;
11867         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
11868         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
11869         _res_ref.data_is_owned = true;
11870         Witness_free(_res_ref);
11871 }
11872
11873 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
11874         LDKCVec_u8Z script_pubkey_ref;
11875         script_pubkey_ref.datalen = script_pubkey->arr_len;
11876         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
11877         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
11878         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11879         *ret_ref = TxOut_new(script_pubkey_ref, value);
11880         return tag_ptr(ret_ref, true);
11881 }
11882
11883 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
11884         if (!ptr_is_owned(_res)) return;
11885         void* _res_ptr = untag_ptr(_res);
11886         CHECK_ACCESS(_res_ptr);
11887         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
11888         FREE(untag_ptr(_res));
11889         TxOut_free(_res_conv);
11890 }
11891
11892 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
11893         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11894         *ret_ref = TxOut_clone(arg);
11895         return tag_ptr(ret_ref, true);
11896 }
11897 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
11898         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
11899         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
11900         return ret_conv;
11901 }
11902
11903 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
11904         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
11905         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11906         *ret_ref = TxOut_clone(orig_conv);
11907         return tag_ptr(ret_ref, true);
11908 }
11909
11910 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
11911         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
11912         Str_free(dummy);
11913 }
11914
11915 uint64_t  __attribute__((export_name("TS_COption_DurationZ_some"))) TS_COption_DurationZ_some(int64_t o) {
11916         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
11917         *ret_copy = COption_DurationZ_some(o);
11918         uint64_t ret_ref = tag_ptr(ret_copy, true);
11919         return ret_ref;
11920 }
11921
11922 uint64_t  __attribute__((export_name("TS_COption_DurationZ_none"))) TS_COption_DurationZ_none() {
11923         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
11924         *ret_copy = COption_DurationZ_none();
11925         uint64_t ret_ref = tag_ptr(ret_copy, true);
11926         return ret_ref;
11927 }
11928
11929 void  __attribute__((export_name("TS_COption_DurationZ_free"))) TS_COption_DurationZ_free(uint64_t _res) {
11930         if (!ptr_is_owned(_res)) return;
11931         void* _res_ptr = untag_ptr(_res);
11932         CHECK_ACCESS(_res_ptr);
11933         LDKCOption_DurationZ _res_conv = *(LDKCOption_DurationZ*)(_res_ptr);
11934         FREE(untag_ptr(_res));
11935         COption_DurationZ_free(_res_conv);
11936 }
11937
11938 static inline uint64_t COption_DurationZ_clone_ptr(LDKCOption_DurationZ *NONNULL_PTR arg) {
11939         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
11940         *ret_copy = COption_DurationZ_clone(arg);
11941         uint64_t ret_ref = tag_ptr(ret_copy, true);
11942         return ret_ref;
11943 }
11944 int64_t  __attribute__((export_name("TS_COption_DurationZ_clone_ptr"))) TS_COption_DurationZ_clone_ptr(uint64_t arg) {
11945         LDKCOption_DurationZ* arg_conv = (LDKCOption_DurationZ*)untag_ptr(arg);
11946         int64_t ret_conv = COption_DurationZ_clone_ptr(arg_conv);
11947         return ret_conv;
11948 }
11949
11950 uint64_t  __attribute__((export_name("TS_COption_DurationZ_clone"))) TS_COption_DurationZ_clone(uint64_t orig) {
11951         LDKCOption_DurationZ* orig_conv = (LDKCOption_DurationZ*)untag_ptr(orig);
11952         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
11953         *ret_copy = COption_DurationZ_clone(orig_conv);
11954         uint64_t ret_ref = tag_ptr(ret_copy, true);
11955         return ret_ref;
11956 }
11957
11958 void  __attribute__((export_name("TS_CVec_BlindedPathZ_free"))) TS_CVec_BlindedPathZ_free(uint64_tArray _res) {
11959         LDKCVec_BlindedPathZ _res_constr;
11960         _res_constr.datalen = _res->arr_len;
11961         if (_res_constr.datalen > 0)
11962                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
11963         else
11964                 _res_constr.data = NULL;
11965         uint64_t* _res_vals = _res->elems;
11966         for (size_t n = 0; n < _res_constr.datalen; n++) {
11967                 uint64_t _res_conv_13 = _res_vals[n];
11968                 LDKBlindedPath _res_conv_13_conv;
11969                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
11970                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
11971                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
11972                 _res_constr.data[n] = _res_conv_13_conv;
11973         }
11974         FREE(_res);
11975         CVec_BlindedPathZ_free(_res_constr);
11976 }
11977
11978 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
11979         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11980         *ret_copy = COption_u64Z_some(o);
11981         uint64_t ret_ref = tag_ptr(ret_copy, true);
11982         return ret_ref;
11983 }
11984
11985 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
11986         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11987         *ret_copy = COption_u64Z_none();
11988         uint64_t ret_ref = tag_ptr(ret_copy, true);
11989         return ret_ref;
11990 }
11991
11992 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
11993         if (!ptr_is_owned(_res)) return;
11994         void* _res_ptr = untag_ptr(_res);
11995         CHECK_ACCESS(_res_ptr);
11996         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
11997         FREE(untag_ptr(_res));
11998         COption_u64Z_free(_res_conv);
11999 }
12000
12001 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
12002         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12003         *ret_copy = COption_u64Z_clone(arg);
12004         uint64_t ret_ref = tag_ptr(ret_copy, true);
12005         return ret_ref;
12006 }
12007 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
12008         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
12009         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
12010         return ret_conv;
12011 }
12012
12013 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
12014         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
12015         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12016         *ret_copy = COption_u64Z_clone(orig_conv);
12017         uint64_t ret_ref = tag_ptr(ret_copy, true);
12018         return ret_ref;
12019 }
12020
12021 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
12022         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12023         *ret_conv = CResult_NoneAPIErrorZ_ok();
12024         return tag_ptr(ret_conv, true);
12025 }
12026
12027 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
12028         void* e_ptr = untag_ptr(e);
12029         CHECK_ACCESS(e_ptr);
12030         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
12031         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
12032         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12033         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
12034         return tag_ptr(ret_conv, true);
12035 }
12036
12037 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
12038         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
12039         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
12040         return ret_conv;
12041 }
12042
12043 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
12044         if (!ptr_is_owned(_res)) return;
12045         void* _res_ptr = untag_ptr(_res);
12046         CHECK_ACCESS(_res_ptr);
12047         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
12048         FREE(untag_ptr(_res));
12049         CResult_NoneAPIErrorZ_free(_res_conv);
12050 }
12051
12052 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
12053         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12054         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
12055         return tag_ptr(ret_conv, true);
12056 }
12057 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
12058         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
12059         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
12060         return ret_conv;
12061 }
12062
12063 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
12064         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
12065         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12066         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
12067         return tag_ptr(ret_conv, true);
12068 }
12069
12070 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
12071         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
12072         _res_constr.datalen = _res->arr_len;
12073         if (_res_constr.datalen > 0)
12074                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
12075         else
12076                 _res_constr.data = NULL;
12077         uint64_t* _res_vals = _res->elems;
12078         for (size_t w = 0; w < _res_constr.datalen; w++) {
12079                 uint64_t _res_conv_22 = _res_vals[w];
12080                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
12081                 CHECK_ACCESS(_res_conv_22_ptr);
12082                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
12083                 FREE(untag_ptr(_res_conv_22));
12084                 _res_constr.data[w] = _res_conv_22_conv;
12085         }
12086         FREE(_res);
12087         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
12088 }
12089
12090 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
12091         LDKCVec_APIErrorZ _res_constr;
12092         _res_constr.datalen = _res->arr_len;
12093         if (_res_constr.datalen > 0)
12094                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
12095         else
12096                 _res_constr.data = NULL;
12097         uint64_t* _res_vals = _res->elems;
12098         for (size_t k = 0; k < _res_constr.datalen; k++) {
12099                 uint64_t _res_conv_10 = _res_vals[k];
12100                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
12101                 CHECK_ACCESS(_res_conv_10_ptr);
12102                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
12103                 FREE(untag_ptr(_res_conv_10));
12104                 _res_constr.data[k] = _res_conv_10_conv;
12105         }
12106         FREE(_res);
12107         CVec_APIErrorZ_free(_res_constr);
12108 }
12109
12110 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
12111         LDKCVec_u8Z _res_ref;
12112         _res_ref.datalen = _res->arr_len;
12113         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
12114         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
12115         CVec_u8Z_free(_res_ref);
12116 }
12117
12118 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_some"))) TS_COption_CVec_u8ZZ_some(int8_tArray o) {
12119         LDKCVec_u8Z o_ref;
12120         o_ref.datalen = o->arr_len;
12121         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
12122         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
12123         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
12124         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
12125         uint64_t ret_ref = tag_ptr(ret_copy, true);
12126         return ret_ref;
12127 }
12128
12129 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_none"))) TS_COption_CVec_u8ZZ_none() {
12130         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
12131         *ret_copy = COption_CVec_u8ZZ_none();
12132         uint64_t ret_ref = tag_ptr(ret_copy, true);
12133         return ret_ref;
12134 }
12135
12136 void  __attribute__((export_name("TS_COption_CVec_u8ZZ_free"))) TS_COption_CVec_u8ZZ_free(uint64_t _res) {
12137         if (!ptr_is_owned(_res)) return;
12138         void* _res_ptr = untag_ptr(_res);
12139         CHECK_ACCESS(_res_ptr);
12140         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
12141         FREE(untag_ptr(_res));
12142         COption_CVec_u8ZZ_free(_res_conv);
12143 }
12144
12145 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
12146         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
12147         *ret_copy = COption_CVec_u8ZZ_clone(arg);
12148         uint64_t ret_ref = tag_ptr(ret_copy, true);
12149         return ret_ref;
12150 }
12151 int64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone_ptr"))) TS_COption_CVec_u8ZZ_clone_ptr(uint64_t arg) {
12152         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
12153         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
12154         return ret_conv;
12155 }
12156
12157 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone"))) TS_COption_CVec_u8ZZ_clone(uint64_t orig) {
12158         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
12159         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
12160         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
12161         uint64_t ret_ref = tag_ptr(ret_copy, true);
12162         return ret_ref;
12163 }
12164
12165 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok(uint64_t o) {
12166         LDKRecipientOnionFields o_conv;
12167         o_conv.inner = untag_ptr(o);
12168         o_conv.is_owned = ptr_is_owned(o);
12169         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12170         o_conv = RecipientOnionFields_clone(&o_conv);
12171         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
12172         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
12173         return tag_ptr(ret_conv, true);
12174 }
12175
12176 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_err(uint64_t e) {
12177         void* e_ptr = untag_ptr(e);
12178         CHECK_ACCESS(e_ptr);
12179         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12180         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12181         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
12182         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
12183         return tag_ptr(ret_conv, true);
12184 }
12185
12186 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(uint64_t o) {
12187         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
12188         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
12189         return ret_conv;
12190 }
12191
12192 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_free"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_free(uint64_t _res) {
12193         if (!ptr_is_owned(_res)) return;
12194         void* _res_ptr = untag_ptr(_res);
12195         CHECK_ACCESS(_res_ptr);
12196         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
12197         FREE(untag_ptr(_res));
12198         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
12199 }
12200
12201 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
12202         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
12203         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
12204         return tag_ptr(ret_conv, true);
12205 }
12206 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(uint64_t arg) {
12207         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
12208         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
12209         return ret_conv;
12210 }
12211
12212 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone(uint64_t orig) {
12213         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
12214         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
12215         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
12216         return tag_ptr(ret_conv, true);
12217 }
12218
12219 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_some"))) TS_COption_HTLCClaimZ_some(uint32_t o) {
12220         LDKHTLCClaim o_conv = LDKHTLCClaim_from_js(o);
12221         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
12222         *ret_copy = COption_HTLCClaimZ_some(o_conv);
12223         uint64_t ret_ref = tag_ptr(ret_copy, true);
12224         return ret_ref;
12225 }
12226
12227 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_none"))) TS_COption_HTLCClaimZ_none() {
12228         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
12229         *ret_copy = COption_HTLCClaimZ_none();
12230         uint64_t ret_ref = tag_ptr(ret_copy, true);
12231         return ret_ref;
12232 }
12233
12234 void  __attribute__((export_name("TS_COption_HTLCClaimZ_free"))) TS_COption_HTLCClaimZ_free(uint64_t _res) {
12235         if (!ptr_is_owned(_res)) return;
12236         void* _res_ptr = untag_ptr(_res);
12237         CHECK_ACCESS(_res_ptr);
12238         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
12239         FREE(untag_ptr(_res));
12240         COption_HTLCClaimZ_free(_res_conv);
12241 }
12242
12243 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
12244         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
12245         *ret_conv = CResult_NoneNoneZ_ok();
12246         return tag_ptr(ret_conv, true);
12247 }
12248
12249 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
12250         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
12251         *ret_conv = CResult_NoneNoneZ_err();
12252         return tag_ptr(ret_conv, true);
12253 }
12254
12255 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
12256         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
12257         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
12258         return ret_conv;
12259 }
12260
12261 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
12262         if (!ptr_is_owned(_res)) return;
12263         void* _res_ptr = untag_ptr(_res);
12264         CHECK_ACCESS(_res_ptr);
12265         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
12266         FREE(untag_ptr(_res));
12267         CResult_NoneNoneZ_free(_res_conv);
12268 }
12269
12270 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
12271         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
12272         *ret_conv = CResult_NoneNoneZ_clone(arg);
12273         return tag_ptr(ret_conv, true);
12274 }
12275 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
12276         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
12277         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
12278         return ret_conv;
12279 }
12280
12281 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
12282         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
12283         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
12284         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
12285         return tag_ptr(ret_conv, true);
12286 }
12287
12288 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
12289         LDKCounterpartyCommitmentSecrets o_conv;
12290         o_conv.inner = untag_ptr(o);
12291         o_conv.is_owned = ptr_is_owned(o);
12292         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12293         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
12294         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
12295         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
12296         return tag_ptr(ret_conv, true);
12297 }
12298
12299 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
12300         void* e_ptr = untag_ptr(e);
12301         CHECK_ACCESS(e_ptr);
12302         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12303         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12304         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
12305         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
12306         return tag_ptr(ret_conv, true);
12307 }
12308
12309 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
12310         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
12311         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
12312         return ret_conv;
12313 }
12314
12315 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
12316         if (!ptr_is_owned(_res)) return;
12317         void* _res_ptr = untag_ptr(_res);
12318         CHECK_ACCESS(_res_ptr);
12319         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
12320         FREE(untag_ptr(_res));
12321         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
12322 }
12323
12324 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
12325         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
12326         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
12327         return tag_ptr(ret_conv, true);
12328 }
12329 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
12330         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
12331         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
12332         return ret_conv;
12333 }
12334
12335 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
12336         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
12337         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
12338         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
12339         return tag_ptr(ret_conv, true);
12340 }
12341
12342 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
12343         LDKTxCreationKeys o_conv;
12344         o_conv.inner = untag_ptr(o);
12345         o_conv.is_owned = ptr_is_owned(o);
12346         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12347         o_conv = TxCreationKeys_clone(&o_conv);
12348         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
12349         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
12350         return tag_ptr(ret_conv, true);
12351 }
12352
12353 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
12354         void* e_ptr = untag_ptr(e);
12355         CHECK_ACCESS(e_ptr);
12356         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12357         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12358         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
12359         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
12360         return tag_ptr(ret_conv, true);
12361 }
12362
12363 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
12364         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
12365         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
12366         return ret_conv;
12367 }
12368
12369 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
12370         if (!ptr_is_owned(_res)) return;
12371         void* _res_ptr = untag_ptr(_res);
12372         CHECK_ACCESS(_res_ptr);
12373         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
12374         FREE(untag_ptr(_res));
12375         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
12376 }
12377
12378 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
12379         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
12380         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
12381         return tag_ptr(ret_conv, true);
12382 }
12383 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
12384         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
12385         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
12386         return ret_conv;
12387 }
12388
12389 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
12390         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
12391         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
12392         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
12393         return tag_ptr(ret_conv, true);
12394 }
12395
12396 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
12397         LDKChannelPublicKeys o_conv;
12398         o_conv.inner = untag_ptr(o);
12399         o_conv.is_owned = ptr_is_owned(o);
12400         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12401         o_conv = ChannelPublicKeys_clone(&o_conv);
12402         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
12403         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
12404         return tag_ptr(ret_conv, true);
12405 }
12406
12407 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
12408         void* e_ptr = untag_ptr(e);
12409         CHECK_ACCESS(e_ptr);
12410         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12411         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12412         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
12413         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
12414         return tag_ptr(ret_conv, true);
12415 }
12416
12417 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
12418         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
12419         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
12420         return ret_conv;
12421 }
12422
12423 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
12424         if (!ptr_is_owned(_res)) return;
12425         void* _res_ptr = untag_ptr(_res);
12426         CHECK_ACCESS(_res_ptr);
12427         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
12428         FREE(untag_ptr(_res));
12429         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
12430 }
12431
12432 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
12433         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
12434         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
12435         return tag_ptr(ret_conv, true);
12436 }
12437 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
12438         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
12439         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
12440         return ret_conv;
12441 }
12442
12443 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
12444         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
12445         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
12446         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
12447         return tag_ptr(ret_conv, true);
12448 }
12449
12450 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
12451         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
12452         *ret_copy = COption_u32Z_some(o);
12453         uint64_t ret_ref = tag_ptr(ret_copy, true);
12454         return ret_ref;
12455 }
12456
12457 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
12458         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
12459         *ret_copy = COption_u32Z_none();
12460         uint64_t ret_ref = tag_ptr(ret_copy, true);
12461         return ret_ref;
12462 }
12463
12464 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
12465         if (!ptr_is_owned(_res)) return;
12466         void* _res_ptr = untag_ptr(_res);
12467         CHECK_ACCESS(_res_ptr);
12468         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
12469         FREE(untag_ptr(_res));
12470         COption_u32Z_free(_res_conv);
12471 }
12472
12473 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
12474         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
12475         *ret_copy = COption_u32Z_clone(arg);
12476         uint64_t ret_ref = tag_ptr(ret_copy, true);
12477         return ret_ref;
12478 }
12479 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
12480         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
12481         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
12482         return ret_conv;
12483 }
12484
12485 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
12486         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
12487         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
12488         *ret_copy = COption_u32Z_clone(orig_conv);
12489         uint64_t ret_ref = tag_ptr(ret_copy, true);
12490         return ret_ref;
12491 }
12492
12493 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
12494         LDKHTLCOutputInCommitment o_conv;
12495         o_conv.inner = untag_ptr(o);
12496         o_conv.is_owned = ptr_is_owned(o);
12497         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12498         o_conv = HTLCOutputInCommitment_clone(&o_conv);
12499         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12500         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
12501         return tag_ptr(ret_conv, true);
12502 }
12503
12504 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
12505         void* e_ptr = untag_ptr(e);
12506         CHECK_ACCESS(e_ptr);
12507         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12508         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12509         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12510         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
12511         return tag_ptr(ret_conv, true);
12512 }
12513
12514 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
12515         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
12516         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
12517         return ret_conv;
12518 }
12519
12520 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
12521         if (!ptr_is_owned(_res)) return;
12522         void* _res_ptr = untag_ptr(_res);
12523         CHECK_ACCESS(_res_ptr);
12524         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
12525         FREE(untag_ptr(_res));
12526         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
12527 }
12528
12529 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
12530         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12531         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
12532         return tag_ptr(ret_conv, true);
12533 }
12534 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
12535         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
12536         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
12537         return ret_conv;
12538 }
12539
12540 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
12541         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
12542         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12543         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
12544         return tag_ptr(ret_conv, true);
12545 }
12546
12547 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
12548         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
12549         return ret_conv;
12550 }
12551
12552 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
12553         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
12554         return ret_conv;
12555 }
12556
12557 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
12558         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
12559         COption_NoneZ_free(_res_conv);
12560 }
12561
12562 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
12563         LDKCounterpartyChannelTransactionParameters o_conv;
12564         o_conv.inner = untag_ptr(o);
12565         o_conv.is_owned = ptr_is_owned(o);
12566         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12567         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
12568         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12569         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
12570         return tag_ptr(ret_conv, true);
12571 }
12572
12573 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
12574         void* e_ptr = untag_ptr(e);
12575         CHECK_ACCESS(e_ptr);
12576         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12577         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12578         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12579         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
12580         return tag_ptr(ret_conv, true);
12581 }
12582
12583 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
12584         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
12585         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
12586         return ret_conv;
12587 }
12588
12589 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
12590         if (!ptr_is_owned(_res)) return;
12591         void* _res_ptr = untag_ptr(_res);
12592         CHECK_ACCESS(_res_ptr);
12593         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
12594         FREE(untag_ptr(_res));
12595         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
12596 }
12597
12598 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
12599         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12600         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
12601         return tag_ptr(ret_conv, true);
12602 }
12603 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12604         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
12605         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
12606         return ret_conv;
12607 }
12608
12609 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
12610         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
12611         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12612         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
12613         return tag_ptr(ret_conv, true);
12614 }
12615
12616 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
12617         LDKChannelTransactionParameters o_conv;
12618         o_conv.inner = untag_ptr(o);
12619         o_conv.is_owned = ptr_is_owned(o);
12620         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12621         o_conv = ChannelTransactionParameters_clone(&o_conv);
12622         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12623         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
12624         return tag_ptr(ret_conv, true);
12625 }
12626
12627 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
12628         void* e_ptr = untag_ptr(e);
12629         CHECK_ACCESS(e_ptr);
12630         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12631         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12632         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12633         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
12634         return tag_ptr(ret_conv, true);
12635 }
12636
12637 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
12638         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
12639         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
12640         return ret_conv;
12641 }
12642
12643 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
12644         if (!ptr_is_owned(_res)) return;
12645         void* _res_ptr = untag_ptr(_res);
12646         CHECK_ACCESS(_res_ptr);
12647         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
12648         FREE(untag_ptr(_res));
12649         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
12650 }
12651
12652 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
12653         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12654         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
12655         return tag_ptr(ret_conv, true);
12656 }
12657 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12658         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
12659         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
12660         return ret_conv;
12661 }
12662
12663 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
12664         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
12665         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12666         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
12667         return tag_ptr(ret_conv, true);
12668 }
12669
12670 void  __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
12671         LDKCVec_SignatureZ _res_constr;
12672         _res_constr.datalen = _res->arr_len;
12673         if (_res_constr.datalen > 0)
12674                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12675         else
12676                 _res_constr.data = NULL;
12677         int8_tArray* _res_vals = (void*) _res->elems;
12678         for (size_t m = 0; m < _res_constr.datalen; m++) {
12679                 int8_tArray _res_conv_12 = _res_vals[m];
12680                 LDKSignature _res_conv_12_ref;
12681                 CHECK(_res_conv_12->arr_len == 64);
12682                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
12683                 _res_constr.data[m] = _res_conv_12_ref;
12684         }
12685         FREE(_res);
12686         CVec_SignatureZ_free(_res_constr);
12687 }
12688
12689 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12690         LDKHolderCommitmentTransaction o_conv;
12691         o_conv.inner = untag_ptr(o);
12692         o_conv.is_owned = ptr_is_owned(o);
12693         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12694         o_conv = HolderCommitmentTransaction_clone(&o_conv);
12695         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12696         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
12697         return tag_ptr(ret_conv, true);
12698 }
12699
12700 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12701         void* e_ptr = untag_ptr(e);
12702         CHECK_ACCESS(e_ptr);
12703         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12704         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12705         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12706         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
12707         return tag_ptr(ret_conv, true);
12708 }
12709
12710 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12711         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12712         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12713         return ret_conv;
12714 }
12715
12716 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12717         if (!ptr_is_owned(_res)) return;
12718         void* _res_ptr = untag_ptr(_res);
12719         CHECK_ACCESS(_res_ptr);
12720         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12721         FREE(untag_ptr(_res));
12722         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
12723 }
12724
12725 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12726         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12727         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
12728         return tag_ptr(ret_conv, true);
12729 }
12730 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12731         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12732         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12733         return ret_conv;
12734 }
12735
12736 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12737         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12738         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12739         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12740         return tag_ptr(ret_conv, true);
12741 }
12742
12743 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12744         LDKBuiltCommitmentTransaction o_conv;
12745         o_conv.inner = untag_ptr(o);
12746         o_conv.is_owned = ptr_is_owned(o);
12747         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12748         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
12749         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12750         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
12751         return tag_ptr(ret_conv, true);
12752 }
12753
12754 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12755         void* e_ptr = untag_ptr(e);
12756         CHECK_ACCESS(e_ptr);
12757         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12758         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12759         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12760         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
12761         return tag_ptr(ret_conv, true);
12762 }
12763
12764 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12765         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12766         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12767         return ret_conv;
12768 }
12769
12770 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12771         if (!ptr_is_owned(_res)) return;
12772         void* _res_ptr = untag_ptr(_res);
12773         CHECK_ACCESS(_res_ptr);
12774         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12775         FREE(untag_ptr(_res));
12776         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
12777 }
12778
12779 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12780         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12781         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
12782         return tag_ptr(ret_conv, true);
12783 }
12784 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12785         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12786         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12787         return ret_conv;
12788 }
12789
12790 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12791         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12792         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12793         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12794         return tag_ptr(ret_conv, true);
12795 }
12796
12797 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
12798         LDKTrustedClosingTransaction o_conv;
12799         o_conv.inner = untag_ptr(o);
12800         o_conv.is_owned = ptr_is_owned(o);
12801         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12802         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
12803         
12804         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12805         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
12806         return tag_ptr(ret_conv, true);
12807 }
12808
12809 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
12810         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12811         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
12812         return tag_ptr(ret_conv, true);
12813 }
12814
12815 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
12816         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
12817         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
12818         return ret_conv;
12819 }
12820
12821 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
12822         if (!ptr_is_owned(_res)) return;
12823         void* _res_ptr = untag_ptr(_res);
12824         CHECK_ACCESS(_res_ptr);
12825         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
12826         FREE(untag_ptr(_res));
12827         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
12828 }
12829
12830 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12831         LDKCommitmentTransaction o_conv;
12832         o_conv.inner = untag_ptr(o);
12833         o_conv.is_owned = ptr_is_owned(o);
12834         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12835         o_conv = CommitmentTransaction_clone(&o_conv);
12836         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12837         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
12838         return tag_ptr(ret_conv, true);
12839 }
12840
12841 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12842         void* e_ptr = untag_ptr(e);
12843         CHECK_ACCESS(e_ptr);
12844         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12845         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12846         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12847         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
12848         return tag_ptr(ret_conv, true);
12849 }
12850
12851 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12852         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12853         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12854         return ret_conv;
12855 }
12856
12857 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12858         if (!ptr_is_owned(_res)) return;
12859         void* _res_ptr = untag_ptr(_res);
12860         CHECK_ACCESS(_res_ptr);
12861         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
12862         FREE(untag_ptr(_res));
12863         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
12864 }
12865
12866 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12867         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12868         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
12869         return tag_ptr(ret_conv, true);
12870 }
12871 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12872         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12873         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12874         return ret_conv;
12875 }
12876
12877 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12878         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12879         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12880         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
12881         return tag_ptr(ret_conv, true);
12882 }
12883
12884 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
12885         LDKTrustedCommitmentTransaction o_conv;
12886         o_conv.inner = untag_ptr(o);
12887         o_conv.is_owned = ptr_is_owned(o);
12888         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12889         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
12890         
12891         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12892         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
12893         return tag_ptr(ret_conv, true);
12894 }
12895
12896 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
12897         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12898         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
12899         return tag_ptr(ret_conv, true);
12900 }
12901
12902 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
12903         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
12904         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
12905         return ret_conv;
12906 }
12907
12908 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
12909         if (!ptr_is_owned(_res)) return;
12910         void* _res_ptr = untag_ptr(_res);
12911         CHECK_ACCESS(_res_ptr);
12912         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
12913         FREE(untag_ptr(_res));
12914         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
12915 }
12916
12917 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
12918         LDKCVec_SignatureZ o_constr;
12919         o_constr.datalen = o->arr_len;
12920         if (o_constr.datalen > 0)
12921                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12922         else
12923                 o_constr.data = NULL;
12924         int8_tArray* o_vals = (void*) o->elems;
12925         for (size_t m = 0; m < o_constr.datalen; m++) {
12926                 int8_tArray o_conv_12 = o_vals[m];
12927                 LDKSignature o_conv_12_ref;
12928                 CHECK(o_conv_12->arr_len == 64);
12929                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
12930                 o_constr.data[m] = o_conv_12_ref;
12931         }
12932         FREE(o);
12933         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12934         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
12935         return tag_ptr(ret_conv, true);
12936 }
12937
12938 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
12939         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12940         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
12941         return tag_ptr(ret_conv, true);
12942 }
12943
12944 jboolean  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint64_t o) {
12945         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
12946         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
12947         return ret_conv;
12948 }
12949
12950 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint64_t _res) {
12951         if (!ptr_is_owned(_res)) return;
12952         void* _res_ptr = untag_ptr(_res);
12953         CHECK_ACCESS(_res_ptr);
12954         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
12955         FREE(untag_ptr(_res));
12956         CResult_CVec_SignatureZNoneZ_free(_res_conv);
12957 }
12958
12959 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
12960         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12961         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
12962         return tag_ptr(ret_conv, true);
12963 }
12964 int64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint64_t arg) {
12965         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
12966         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
12967         return ret_conv;
12968 }
12969
12970 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint64_t orig) {
12971         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
12972         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12973         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
12974         return tag_ptr(ret_conv, true);
12975 }
12976
12977 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
12978         LDKShutdownScript o_conv;
12979         o_conv.inner = untag_ptr(o);
12980         o_conv.is_owned = ptr_is_owned(o);
12981         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12982         o_conv = ShutdownScript_clone(&o_conv);
12983         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12984         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
12985         return tag_ptr(ret_conv, true);
12986 }
12987
12988 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
12989         void* e_ptr = untag_ptr(e);
12990         CHECK_ACCESS(e_ptr);
12991         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12992         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12993         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12994         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
12995         return tag_ptr(ret_conv, true);
12996 }
12997
12998 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
12999         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
13000         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
13001         return ret_conv;
13002 }
13003
13004 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
13005         if (!ptr_is_owned(_res)) return;
13006         void* _res_ptr = untag_ptr(_res);
13007         CHECK_ACCESS(_res_ptr);
13008         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
13009         FREE(untag_ptr(_res));
13010         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
13011 }
13012
13013 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
13014         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
13015         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
13016         return tag_ptr(ret_conv, true);
13017 }
13018 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
13019         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
13020         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
13021         return ret_conv;
13022 }
13023
13024 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
13025         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
13026         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
13027         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
13028         return tag_ptr(ret_conv, true);
13029 }
13030
13031 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
13032         LDKShutdownScript o_conv;
13033         o_conv.inner = untag_ptr(o);
13034         o_conv.is_owned = ptr_is_owned(o);
13035         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13036         o_conv = ShutdownScript_clone(&o_conv);
13037         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
13038         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
13039         return tag_ptr(ret_conv, true);
13040 }
13041
13042 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
13043         LDKInvalidShutdownScript e_conv;
13044         e_conv.inner = untag_ptr(e);
13045         e_conv.is_owned = ptr_is_owned(e);
13046         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13047         e_conv = InvalidShutdownScript_clone(&e_conv);
13048         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
13049         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
13050         return tag_ptr(ret_conv, true);
13051 }
13052
13053 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
13054         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
13055         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
13056         return ret_conv;
13057 }
13058
13059 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
13060         if (!ptr_is_owned(_res)) return;
13061         void* _res_ptr = untag_ptr(_res);
13062         CHECK_ACCESS(_res_ptr);
13063         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
13064         FREE(untag_ptr(_res));
13065         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
13066 }
13067
13068 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
13069         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
13070         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
13071         return tag_ptr(ret_conv, true);
13072 }
13073 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
13074         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
13075         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
13076         return ret_conv;
13077 }
13078
13079 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
13080         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
13081         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
13082         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
13083         return tag_ptr(ret_conv, true);
13084 }
13085
13086 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_ok(uint64_t o) {
13087         LDKBlindedPayInfo o_conv;
13088         o_conv.inner = untag_ptr(o);
13089         o_conv.is_owned = ptr_is_owned(o);
13090         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13091         o_conv = BlindedPayInfo_clone(&o_conv);
13092         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
13093         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
13094         return tag_ptr(ret_conv, true);
13095 }
13096
13097 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_err(uint64_t e) {
13098         void* e_ptr = untag_ptr(e);
13099         CHECK_ACCESS(e_ptr);
13100         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13101         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13102         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
13103         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
13104         return tag_ptr(ret_conv, true);
13105 }
13106
13107 jboolean  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok(uint64_t o) {
13108         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
13109         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
13110         return ret_conv;
13111 }
13112
13113 void  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_free"))) TS_CResult_BlindedPayInfoDecodeErrorZ_free(uint64_t _res) {
13114         if (!ptr_is_owned(_res)) return;
13115         void* _res_ptr = untag_ptr(_res);
13116         CHECK_ACCESS(_res_ptr);
13117         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
13118         FREE(untag_ptr(_res));
13119         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
13120 }
13121
13122 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
13123         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
13124         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
13125         return tag_ptr(ret_conv, true);
13126 }
13127 int64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
13128         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
13129         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
13130         return ret_conv;
13131 }
13132
13133 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone(uint64_t orig) {
13134         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
13135         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
13136         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
13137         return tag_ptr(ret_conv, true);
13138 }
13139
13140 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
13141         LDKCVec_ChannelDetailsZ _res_constr;
13142         _res_constr.datalen = _res->arr_len;
13143         if (_res_constr.datalen > 0)
13144                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13145         else
13146                 _res_constr.data = NULL;
13147         uint64_t* _res_vals = _res->elems;
13148         for (size_t q = 0; q < _res_constr.datalen; q++) {
13149                 uint64_t _res_conv_16 = _res_vals[q];
13150                 LDKChannelDetails _res_conv_16_conv;
13151                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
13152                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
13153                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
13154                 _res_constr.data[q] = _res_conv_16_conv;
13155         }
13156         FREE(_res);
13157         CVec_ChannelDetailsZ_free(_res_constr);
13158 }
13159
13160 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
13161         LDKRoute o_conv;
13162         o_conv.inner = untag_ptr(o);
13163         o_conv.is_owned = ptr_is_owned(o);
13164         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13165         o_conv = Route_clone(&o_conv);
13166         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13167         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
13168         return tag_ptr(ret_conv, true);
13169 }
13170
13171 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
13172         LDKLightningError e_conv;
13173         e_conv.inner = untag_ptr(e);
13174         e_conv.is_owned = ptr_is_owned(e);
13175         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13176         e_conv = LightningError_clone(&e_conv);
13177         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13178         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
13179         return tag_ptr(ret_conv, true);
13180 }
13181
13182 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
13183         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
13184         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
13185         return ret_conv;
13186 }
13187
13188 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
13189         if (!ptr_is_owned(_res)) return;
13190         void* _res_ptr = untag_ptr(_res);
13191         CHECK_ACCESS(_res_ptr);
13192         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
13193         FREE(untag_ptr(_res));
13194         CResult_RouteLightningErrorZ_free(_res_conv);
13195 }
13196
13197 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
13198         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13199         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
13200         return tag_ptr(ret_conv, true);
13201 }
13202 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
13203         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
13204         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
13205         return ret_conv;
13206 }
13207
13208 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
13209         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
13210         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13211         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
13212         return tag_ptr(ret_conv, true);
13213 }
13214
13215 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
13216         LDKInFlightHtlcs o_conv;
13217         o_conv.inner = untag_ptr(o);
13218         o_conv.is_owned = ptr_is_owned(o);
13219         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13220         o_conv = InFlightHtlcs_clone(&o_conv);
13221         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
13222         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
13223         return tag_ptr(ret_conv, true);
13224 }
13225
13226 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
13227         void* e_ptr = untag_ptr(e);
13228         CHECK_ACCESS(e_ptr);
13229         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13230         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13231         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
13232         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
13233         return tag_ptr(ret_conv, true);
13234 }
13235
13236 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
13237         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
13238         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
13239         return ret_conv;
13240 }
13241
13242 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
13243         if (!ptr_is_owned(_res)) return;
13244         void* _res_ptr = untag_ptr(_res);
13245         CHECK_ACCESS(_res_ptr);
13246         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
13247         FREE(untag_ptr(_res));
13248         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
13249 }
13250
13251 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
13252         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
13253         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
13254         return tag_ptr(ret_conv, true);
13255 }
13256 int64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(uint64_t arg) {
13257         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
13258         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
13259         return ret_conv;
13260 }
13261
13262 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone(uint64_t orig) {
13263         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
13264         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
13265         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
13266         return tag_ptr(ret_conv, true);
13267 }
13268
13269 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
13270         LDKRouteHop o_conv;
13271         o_conv.inner = untag_ptr(o);
13272         o_conv.is_owned = ptr_is_owned(o);
13273         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13274         o_conv = RouteHop_clone(&o_conv);
13275         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
13276         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
13277         return tag_ptr(ret_conv, true);
13278 }
13279
13280 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
13281         void* e_ptr = untag_ptr(e);
13282         CHECK_ACCESS(e_ptr);
13283         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13284         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13285         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
13286         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
13287         return tag_ptr(ret_conv, true);
13288 }
13289
13290 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
13291         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
13292         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
13293         return ret_conv;
13294 }
13295
13296 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
13297         if (!ptr_is_owned(_res)) return;
13298         void* _res_ptr = untag_ptr(_res);
13299         CHECK_ACCESS(_res_ptr);
13300         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
13301         FREE(untag_ptr(_res));
13302         CResult_RouteHopDecodeErrorZ_free(_res_conv);
13303 }
13304
13305 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
13306         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
13307         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
13308         return tag_ptr(ret_conv, true);
13309 }
13310 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
13311         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
13312         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
13313         return ret_conv;
13314 }
13315
13316 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
13317         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
13318         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
13319         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
13320         return tag_ptr(ret_conv, true);
13321 }
13322
13323 void  __attribute__((export_name("TS_CVec_BlindedHopZ_free"))) TS_CVec_BlindedHopZ_free(uint64_tArray _res) {
13324         LDKCVec_BlindedHopZ _res_constr;
13325         _res_constr.datalen = _res->arr_len;
13326         if (_res_constr.datalen > 0)
13327                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
13328         else
13329                 _res_constr.data = NULL;
13330         uint64_t* _res_vals = _res->elems;
13331         for (size_t m = 0; m < _res_constr.datalen; m++) {
13332                 uint64_t _res_conv_12 = _res_vals[m];
13333                 LDKBlindedHop _res_conv_12_conv;
13334                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
13335                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
13336                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
13337                 _res_constr.data[m] = _res_conv_12_conv;
13338         }
13339         FREE(_res);
13340         CVec_BlindedHopZ_free(_res_constr);
13341 }
13342
13343 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_ok"))) TS_CResult_BlindedTailDecodeErrorZ_ok(uint64_t o) {
13344         LDKBlindedTail o_conv;
13345         o_conv.inner = untag_ptr(o);
13346         o_conv.is_owned = ptr_is_owned(o);
13347         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13348         o_conv = BlindedTail_clone(&o_conv);
13349         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
13350         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
13351         return tag_ptr(ret_conv, true);
13352 }
13353
13354 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_err"))) TS_CResult_BlindedTailDecodeErrorZ_err(uint64_t e) {
13355         void* e_ptr = untag_ptr(e);
13356         CHECK_ACCESS(e_ptr);
13357         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13358         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13359         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
13360         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
13361         return tag_ptr(ret_conv, true);
13362 }
13363
13364 jboolean  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_is_ok"))) TS_CResult_BlindedTailDecodeErrorZ_is_ok(uint64_t o) {
13365         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
13366         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
13367         return ret_conv;
13368 }
13369
13370 void  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_free"))) TS_CResult_BlindedTailDecodeErrorZ_free(uint64_t _res) {
13371         if (!ptr_is_owned(_res)) return;
13372         void* _res_ptr = untag_ptr(_res);
13373         CHECK_ACCESS(_res_ptr);
13374         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
13375         FREE(untag_ptr(_res));
13376         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
13377 }
13378
13379 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
13380         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
13381         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
13382         return tag_ptr(ret_conv, true);
13383 }
13384 int64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedTailDecodeErrorZ_clone_ptr(uint64_t arg) {
13385         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
13386         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
13387         return ret_conv;
13388 }
13389
13390 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone"))) TS_CResult_BlindedTailDecodeErrorZ_clone(uint64_t orig) {
13391         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
13392         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
13393         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
13394         return tag_ptr(ret_conv, true);
13395 }
13396
13397 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
13398         LDKCVec_RouteHopZ _res_constr;
13399         _res_constr.datalen = _res->arr_len;
13400         if (_res_constr.datalen > 0)
13401                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13402         else
13403                 _res_constr.data = NULL;
13404         uint64_t* _res_vals = _res->elems;
13405         for (size_t k = 0; k < _res_constr.datalen; k++) {
13406                 uint64_t _res_conv_10 = _res_vals[k];
13407                 LDKRouteHop _res_conv_10_conv;
13408                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
13409                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
13410                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
13411                 _res_constr.data[k] = _res_conv_10_conv;
13412         }
13413         FREE(_res);
13414         CVec_RouteHopZ_free(_res_constr);
13415 }
13416
13417 void  __attribute__((export_name("TS_CVec_PathZ_free"))) TS_CVec_PathZ_free(uint64_tArray _res) {
13418         LDKCVec_PathZ _res_constr;
13419         _res_constr.datalen = _res->arr_len;
13420         if (_res_constr.datalen > 0)
13421                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
13422         else
13423                 _res_constr.data = NULL;
13424         uint64_t* _res_vals = _res->elems;
13425         for (size_t g = 0; g < _res_constr.datalen; g++) {
13426                 uint64_t _res_conv_6 = _res_vals[g];
13427                 LDKPath _res_conv_6_conv;
13428                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
13429                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
13430                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
13431                 _res_constr.data[g] = _res_conv_6_conv;
13432         }
13433         FREE(_res);
13434         CVec_PathZ_free(_res_constr);
13435 }
13436
13437 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
13438         LDKRoute o_conv;
13439         o_conv.inner = untag_ptr(o);
13440         o_conv.is_owned = ptr_is_owned(o);
13441         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13442         o_conv = Route_clone(&o_conv);
13443         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13444         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
13445         return tag_ptr(ret_conv, true);
13446 }
13447
13448 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
13449         void* e_ptr = untag_ptr(e);
13450         CHECK_ACCESS(e_ptr);
13451         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13452         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13453         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13454         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
13455         return tag_ptr(ret_conv, true);
13456 }
13457
13458 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
13459         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
13460         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
13461         return ret_conv;
13462 }
13463
13464 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
13465         if (!ptr_is_owned(_res)) return;
13466         void* _res_ptr = untag_ptr(_res);
13467         CHECK_ACCESS(_res_ptr);
13468         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
13469         FREE(untag_ptr(_res));
13470         CResult_RouteDecodeErrorZ_free(_res_conv);
13471 }
13472
13473 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
13474         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13475         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
13476         return tag_ptr(ret_conv, true);
13477 }
13478 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
13479         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
13480         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
13481         return ret_conv;
13482 }
13483
13484 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
13485         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
13486         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13487         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
13488         return tag_ptr(ret_conv, true);
13489 }
13490
13491 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
13492         LDKRouteParameters o_conv;
13493         o_conv.inner = untag_ptr(o);
13494         o_conv.is_owned = ptr_is_owned(o);
13495         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13496         o_conv = RouteParameters_clone(&o_conv);
13497         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13498         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
13499         return tag_ptr(ret_conv, true);
13500 }
13501
13502 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
13503         void* e_ptr = untag_ptr(e);
13504         CHECK_ACCESS(e_ptr);
13505         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13506         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13507         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13508         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
13509         return tag_ptr(ret_conv, true);
13510 }
13511
13512 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
13513         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
13514         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
13515         return ret_conv;
13516 }
13517
13518 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
13519         if (!ptr_is_owned(_res)) return;
13520         void* _res_ptr = untag_ptr(_res);
13521         CHECK_ACCESS(_res_ptr);
13522         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
13523         FREE(untag_ptr(_res));
13524         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
13525 }
13526
13527 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
13528         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13529         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
13530         return tag_ptr(ret_conv, true);
13531 }
13532 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
13533         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
13534         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
13535         return ret_conv;
13536 }
13537
13538 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
13539         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
13540         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13541         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
13542         return tag_ptr(ret_conv, true);
13543 }
13544
13545 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
13546         LDKCVec_u64Z _res_constr;
13547         _res_constr.datalen = _res->arr_len;
13548         if (_res_constr.datalen > 0)
13549                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
13550         else
13551                 _res_constr.data = NULL;
13552         int64_t* _res_vals = _res->elems;
13553         for (size_t i = 0; i < _res_constr.datalen; i++) {
13554                 int64_t _res_conv_8 = _res_vals[i];
13555                 _res_constr.data[i] = _res_conv_8;
13556         }
13557         FREE(_res);
13558         CVec_u64Z_free(_res_constr);
13559 }
13560
13561 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
13562         LDKPaymentParameters o_conv;
13563         o_conv.inner = untag_ptr(o);
13564         o_conv.is_owned = ptr_is_owned(o);
13565         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13566         o_conv = PaymentParameters_clone(&o_conv);
13567         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13568         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
13569         return tag_ptr(ret_conv, true);
13570 }
13571
13572 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
13573         void* e_ptr = untag_ptr(e);
13574         CHECK_ACCESS(e_ptr);
13575         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13576         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13577         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13578         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
13579         return tag_ptr(ret_conv, true);
13580 }
13581
13582 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
13583         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
13584         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
13585         return ret_conv;
13586 }
13587
13588 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
13589         if (!ptr_is_owned(_res)) return;
13590         void* _res_ptr = untag_ptr(_res);
13591         CHECK_ACCESS(_res_ptr);
13592         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
13593         FREE(untag_ptr(_res));
13594         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
13595 }
13596
13597 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
13598         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13599         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
13600         return tag_ptr(ret_conv, true);
13601 }
13602 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
13603         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
13604         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
13605         return ret_conv;
13606 }
13607
13608 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
13609         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
13610         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13611         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
13612         return tag_ptr(ret_conv, true);
13613 }
13614
13615 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
13616         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
13617         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
13618         return tag_ptr(ret_conv, true);
13619 }
13620 int64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(uint64_t arg) {
13621         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
13622         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
13623         return ret_conv;
13624 }
13625
13626 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone(uint64_t orig) {
13627         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
13628         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
13629         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
13630         return tag_ptr(ret_conv, true);
13631 }
13632
13633 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_new"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_new(uint64_t a, uint64_t b) {
13634         LDKBlindedPayInfo a_conv;
13635         a_conv.inner = untag_ptr(a);
13636         a_conv.is_owned = ptr_is_owned(a);
13637         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13638         a_conv = BlindedPayInfo_clone(&a_conv);
13639         LDKBlindedPath b_conv;
13640         b_conv.inner = untag_ptr(b);
13641         b_conv.is_owned = ptr_is_owned(b);
13642         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
13643         b_conv = BlindedPath_clone(&b_conv);
13644         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
13645         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
13646         return tag_ptr(ret_conv, true);
13647 }
13648
13649 void  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_free"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_free(uint64_t _res) {
13650         if (!ptr_is_owned(_res)) return;
13651         void* _res_ptr = untag_ptr(_res);
13652         CHECK_ACCESS(_res_ptr);
13653         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
13654         FREE(untag_ptr(_res));
13655         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
13656 }
13657
13658 void  __attribute__((export_name("TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free"))) TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(uint64_tArray _res) {
13659         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
13660         _res_constr.datalen = _res->arr_len;
13661         if (_res_constr.datalen > 0)
13662                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
13663         else
13664                 _res_constr.data = NULL;
13665         uint64_t* _res_vals = _res->elems;
13666         for (size_t l = 0; l < _res_constr.datalen; l++) {
13667                 uint64_t _res_conv_37 = _res_vals[l];
13668                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
13669                 CHECK_ACCESS(_res_conv_37_ptr);
13670                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
13671                 FREE(untag_ptr(_res_conv_37));
13672                 _res_constr.data[l] = _res_conv_37_conv;
13673         }
13674         FREE(_res);
13675         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
13676 }
13677
13678 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
13679         LDKCVec_RouteHintZ _res_constr;
13680         _res_constr.datalen = _res->arr_len;
13681         if (_res_constr.datalen > 0)
13682                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
13683         else
13684                 _res_constr.data = NULL;
13685         uint64_t* _res_vals = _res->elems;
13686         for (size_t l = 0; l < _res_constr.datalen; l++) {
13687                 uint64_t _res_conv_11 = _res_vals[l];
13688                 LDKRouteHint _res_conv_11_conv;
13689                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
13690                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
13691                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
13692                 _res_constr.data[l] = _res_conv_11_conv;
13693         }
13694         FREE(_res);
13695         CVec_RouteHintZ_free(_res_constr);
13696 }
13697
13698 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
13699         LDKCVec_RouteHintHopZ _res_constr;
13700         _res_constr.datalen = _res->arr_len;
13701         if (_res_constr.datalen > 0)
13702                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
13703         else
13704                 _res_constr.data = NULL;
13705         uint64_t* _res_vals = _res->elems;
13706         for (size_t o = 0; o < _res_constr.datalen; o++) {
13707                 uint64_t _res_conv_14 = _res_vals[o];
13708                 LDKRouteHintHop _res_conv_14_conv;
13709                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
13710                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
13711                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
13712                 _res_constr.data[o] = _res_conv_14_conv;
13713         }
13714         FREE(_res);
13715         CVec_RouteHintHopZ_free(_res_constr);
13716 }
13717
13718 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
13719         LDKRouteHint o_conv;
13720         o_conv.inner = untag_ptr(o);
13721         o_conv.is_owned = ptr_is_owned(o);
13722         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13723         o_conv = RouteHint_clone(&o_conv);
13724         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13725         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
13726         return tag_ptr(ret_conv, true);
13727 }
13728
13729 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
13730         void* e_ptr = untag_ptr(e);
13731         CHECK_ACCESS(e_ptr);
13732         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13733         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13734         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13735         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
13736         return tag_ptr(ret_conv, true);
13737 }
13738
13739 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
13740         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
13741         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
13742         return ret_conv;
13743 }
13744
13745 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
13746         if (!ptr_is_owned(_res)) return;
13747         void* _res_ptr = untag_ptr(_res);
13748         CHECK_ACCESS(_res_ptr);
13749         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
13750         FREE(untag_ptr(_res));
13751         CResult_RouteHintDecodeErrorZ_free(_res_conv);
13752 }
13753
13754 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
13755         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13756         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
13757         return tag_ptr(ret_conv, true);
13758 }
13759 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
13760         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
13761         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
13762         return ret_conv;
13763 }
13764
13765 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
13766         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
13767         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13768         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
13769         return tag_ptr(ret_conv, true);
13770 }
13771
13772 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
13773         LDKRouteHintHop o_conv;
13774         o_conv.inner = untag_ptr(o);
13775         o_conv.is_owned = ptr_is_owned(o);
13776         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13777         o_conv = RouteHintHop_clone(&o_conv);
13778         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13779         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
13780         return tag_ptr(ret_conv, true);
13781 }
13782
13783 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
13784         void* e_ptr = untag_ptr(e);
13785         CHECK_ACCESS(e_ptr);
13786         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13787         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13788         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13789         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
13790         return tag_ptr(ret_conv, true);
13791 }
13792
13793 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
13794         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
13795         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
13796         return ret_conv;
13797 }
13798
13799 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
13800         if (!ptr_is_owned(_res)) return;
13801         void* _res_ptr = untag_ptr(_res);
13802         CHECK_ACCESS(_res_ptr);
13803         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
13804         FREE(untag_ptr(_res));
13805         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
13806 }
13807
13808 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
13809         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13810         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
13811         return tag_ptr(ret_conv, true);
13812 }
13813 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
13814         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
13815         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
13816         return ret_conv;
13817 }
13818
13819 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
13820         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
13821         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13822         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
13823         return tag_ptr(ret_conv, true);
13824 }
13825
13826 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
13827         LDKCVec_PublicKeyZ _res_constr;
13828         _res_constr.datalen = _res->arr_len;
13829         if (_res_constr.datalen > 0)
13830                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
13831         else
13832                 _res_constr.data = NULL;
13833         int8_tArray* _res_vals = (void*) _res->elems;
13834         for (size_t m = 0; m < _res_constr.datalen; m++) {
13835                 int8_tArray _res_conv_12 = _res_vals[m];
13836                 LDKPublicKey _res_conv_12_ref;
13837                 CHECK(_res_conv_12->arr_len == 33);
13838                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
13839                 _res_constr.data[m] = _res_conv_12_ref;
13840         }
13841         FREE(_res);
13842         CVec_PublicKeyZ_free(_res_constr);
13843 }
13844
13845 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
13846         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13847         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
13848         return tag_ptr(ret_conv, true);
13849 }
13850 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
13851         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
13852         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
13853         return ret_conv;
13854 }
13855
13856 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
13857         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
13858         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13859         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
13860         return tag_ptr(ret_conv, true);
13861 }
13862
13863 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
13864         LDKTransaction b_ref;
13865         b_ref.datalen = b->arr_len;
13866         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
13867         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
13868         b_ref.data_is_owned = true;
13869         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13870         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
13871         return tag_ptr(ret_conv, true);
13872 }
13873
13874 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
13875         if (!ptr_is_owned(_res)) return;
13876         void* _res_ptr = untag_ptr(_res);
13877         CHECK_ACCESS(_res_ptr);
13878         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
13879         FREE(untag_ptr(_res));
13880         C2Tuple_usizeTransactionZ_free(_res_conv);
13881 }
13882
13883 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
13884         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
13885         _res_constr.datalen = _res->arr_len;
13886         if (_res_constr.datalen > 0)
13887                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13888         else
13889                 _res_constr.data = NULL;
13890         uint64_t* _res_vals = _res->elems;
13891         for (size_t c = 0; c < _res_constr.datalen; c++) {
13892                 uint64_t _res_conv_28 = _res_vals[c];
13893                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
13894                 CHECK_ACCESS(_res_conv_28_ptr);
13895                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
13896                 FREE(untag_ptr(_res_conv_28));
13897                 _res_constr.data[c] = _res_conv_28_conv;
13898         }
13899         FREE(_res);
13900         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
13901 }
13902
13903 static inline uint64_t C2Tuple_TxidBlockHashZ_clone_ptr(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR arg) {
13904         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
13905         *ret_conv = C2Tuple_TxidBlockHashZ_clone(arg);
13906         return tag_ptr(ret_conv, true);
13907 }
13908 int64_t  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_clone_ptr"))) TS_C2Tuple_TxidBlockHashZ_clone_ptr(uint64_t arg) {
13909         LDKC2Tuple_TxidBlockHashZ* arg_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(arg);
13910         int64_t ret_conv = C2Tuple_TxidBlockHashZ_clone_ptr(arg_conv);
13911         return ret_conv;
13912 }
13913
13914 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_clone"))) TS_C2Tuple_TxidBlockHashZ_clone(uint64_t orig) {
13915         LDKC2Tuple_TxidBlockHashZ* orig_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(orig);
13916         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
13917         *ret_conv = C2Tuple_TxidBlockHashZ_clone(orig_conv);
13918         return tag_ptr(ret_conv, true);
13919 }
13920
13921 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_new"))) TS_C2Tuple_TxidBlockHashZ_new(int8_tArray a, int8_tArray b) {
13922         LDKThirtyTwoBytes a_ref;
13923         CHECK(a->arr_len == 32);
13924         memcpy(a_ref.data, a->elems, 32); FREE(a);
13925         LDKThirtyTwoBytes b_ref;
13926         CHECK(b->arr_len == 32);
13927         memcpy(b_ref.data, b->elems, 32); FREE(b);
13928         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
13929         *ret_conv = C2Tuple_TxidBlockHashZ_new(a_ref, b_ref);
13930         return tag_ptr(ret_conv, true);
13931 }
13932
13933 void  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_free"))) TS_C2Tuple_TxidBlockHashZ_free(uint64_t _res) {
13934         if (!ptr_is_owned(_res)) return;
13935         void* _res_ptr = untag_ptr(_res);
13936         CHECK_ACCESS(_res_ptr);
13937         LDKC2Tuple_TxidBlockHashZ _res_conv = *(LDKC2Tuple_TxidBlockHashZ*)(_res_ptr);
13938         FREE(untag_ptr(_res));
13939         C2Tuple_TxidBlockHashZ_free(_res_conv);
13940 }
13941
13942 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidBlockHashZZ_free"))) TS_CVec_C2Tuple_TxidBlockHashZZ_free(uint64_tArray _res) {
13943         LDKCVec_C2Tuple_TxidBlockHashZZ _res_constr;
13944         _res_constr.datalen = _res->arr_len;
13945         if (_res_constr.datalen > 0)
13946                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKCVec_C2Tuple_TxidBlockHashZZ Elements");
13947         else
13948                 _res_constr.data = NULL;
13949         uint64_t* _res_vals = _res->elems;
13950         for (size_t z = 0; z < _res_constr.datalen; z++) {
13951                 uint64_t _res_conv_25 = _res_vals[z];
13952                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
13953                 CHECK_ACCESS(_res_conv_25_ptr);
13954                 LDKC2Tuple_TxidBlockHashZ _res_conv_25_conv = *(LDKC2Tuple_TxidBlockHashZ*)(_res_conv_25_ptr);
13955                 FREE(untag_ptr(_res_conv_25));
13956                 _res_constr.data[z] = _res_conv_25_conv;
13957         }
13958         FREE(_res);
13959         CVec_C2Tuple_TxidBlockHashZZ_free(_res_constr);
13960 }
13961
13962 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
13963         LDKCVec_MonitorEventZ _res_constr;
13964         _res_constr.datalen = _res->arr_len;
13965         if (_res_constr.datalen > 0)
13966                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13967         else
13968                 _res_constr.data = NULL;
13969         uint64_t* _res_vals = _res->elems;
13970         for (size_t o = 0; o < _res_constr.datalen; o++) {
13971                 uint64_t _res_conv_14 = _res_vals[o];
13972                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
13973                 CHECK_ACCESS(_res_conv_14_ptr);
13974                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
13975                 FREE(untag_ptr(_res_conv_14));
13976                 _res_constr.data[o] = _res_conv_14_conv;
13977         }
13978         FREE(_res);
13979         CVec_MonitorEventZ_free(_res_constr);
13980 }
13981
13982 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
13983         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13984         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
13985         return tag_ptr(ret_conv, true);
13986 }
13987 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
13988         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
13989         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
13990         return ret_conv;
13991 }
13992
13993 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
13994         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
13995         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13996         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
13997         return tag_ptr(ret_conv, true);
13998 }
13999
14000 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
14001         LDKOutPoint a_conv;
14002         a_conv.inner = untag_ptr(a);
14003         a_conv.is_owned = ptr_is_owned(a);
14004         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
14005         a_conv = OutPoint_clone(&a_conv);
14006         LDKCVec_MonitorEventZ b_constr;
14007         b_constr.datalen = b->arr_len;
14008         if (b_constr.datalen > 0)
14009                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
14010         else
14011                 b_constr.data = NULL;
14012         uint64_t* b_vals = b->elems;
14013         for (size_t o = 0; o < b_constr.datalen; o++) {
14014                 uint64_t b_conv_14 = b_vals[o];
14015                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
14016                 CHECK_ACCESS(b_conv_14_ptr);
14017                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
14018                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
14019                 b_constr.data[o] = b_conv_14_conv;
14020         }
14021         FREE(b);
14022         LDKPublicKey c_ref;
14023         CHECK(c->arr_len == 33);
14024         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
14025         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
14026         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
14027         return tag_ptr(ret_conv, true);
14028 }
14029
14030 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
14031         if (!ptr_is_owned(_res)) return;
14032         void* _res_ptr = untag_ptr(_res);
14033         CHECK_ACCESS(_res_ptr);
14034         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
14035         FREE(untag_ptr(_res));
14036         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
14037 }
14038
14039 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
14040         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
14041         _res_constr.datalen = _res->arr_len;
14042         if (_res_constr.datalen > 0)
14043                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
14044         else
14045                 _res_constr.data = NULL;
14046         uint64_t* _res_vals = _res->elems;
14047         for (size_t x = 0; x < _res_constr.datalen; x++) {
14048                 uint64_t _res_conv_49 = _res_vals[x];
14049                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
14050                 CHECK_ACCESS(_res_conv_49_ptr);
14051                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
14052                 FREE(untag_ptr(_res_conv_49));
14053                 _res_constr.data[x] = _res_conv_49_conv;
14054         }
14055         FREE(_res);
14056         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
14057 }
14058
14059 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
14060         LDKFixedPenaltyScorer o_conv;
14061         o_conv.inner = untag_ptr(o);
14062         o_conv.is_owned = ptr_is_owned(o);
14063         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14064         o_conv = FixedPenaltyScorer_clone(&o_conv);
14065         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14066         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
14067         return tag_ptr(ret_conv, true);
14068 }
14069
14070 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
14071         void* e_ptr = untag_ptr(e);
14072         CHECK_ACCESS(e_ptr);
14073         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14074         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14075         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14076         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
14077         return tag_ptr(ret_conv, true);
14078 }
14079
14080 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
14081         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
14082         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
14083         return ret_conv;
14084 }
14085
14086 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
14087         if (!ptr_is_owned(_res)) return;
14088         void* _res_ptr = untag_ptr(_res);
14089         CHECK_ACCESS(_res_ptr);
14090         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
14091         FREE(untag_ptr(_res));
14092         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
14093 }
14094
14095 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
14096         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14097         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
14098         return tag_ptr(ret_conv, true);
14099 }
14100 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
14101         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
14102         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
14103         return ret_conv;
14104 }
14105
14106 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
14107         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
14108         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14109         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
14110         return tag_ptr(ret_conv, true);
14111 }
14112
14113 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
14114         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
14115         *ret_conv = C2Tuple_u64u64Z_clone(arg);
14116         return tag_ptr(ret_conv, true);
14117 }
14118 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
14119         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
14120         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
14121         return ret_conv;
14122 }
14123
14124 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
14125         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
14126         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
14127         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
14128         return tag_ptr(ret_conv, true);
14129 }
14130
14131 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
14132         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
14133         *ret_conv = C2Tuple_u64u64Z_new(a, b);
14134         return tag_ptr(ret_conv, true);
14135 }
14136
14137 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
14138         if (!ptr_is_owned(_res)) return;
14139         void* _res_ptr = untag_ptr(_res);
14140         CHECK_ACCESS(_res_ptr);
14141         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
14142         FREE(untag_ptr(_res));
14143         C2Tuple_u64u64Z_free(_res_conv);
14144 }
14145
14146 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
14147         void* o_ptr = untag_ptr(o);
14148         CHECK_ACCESS(o_ptr);
14149         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
14150         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
14151         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14152         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
14153         uint64_t ret_ref = tag_ptr(ret_copy, true);
14154         return ret_ref;
14155 }
14156
14157 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
14158         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14159         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
14160         uint64_t ret_ref = tag_ptr(ret_copy, true);
14161         return ret_ref;
14162 }
14163
14164 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
14165         if (!ptr_is_owned(_res)) return;
14166         void* _res_ptr = untag_ptr(_res);
14167         CHECK_ACCESS(_res_ptr);
14168         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
14169         FREE(untag_ptr(_res));
14170         COption_C2Tuple_u64u64ZZ_free(_res_conv);
14171 }
14172
14173 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
14174         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14175         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
14176         uint64_t ret_ref = tag_ptr(ret_copy, true);
14177         return ret_ref;
14178 }
14179 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
14180         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
14181         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
14182         return ret_conv;
14183 }
14184
14185 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
14186         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
14187         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14188         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
14189         uint64_t ret_ref = tag_ptr(ret_copy, true);
14190         return ret_ref;
14191 }
14192
14193 static inline uint64_t C2Tuple_Z_clone_ptr(LDKC2Tuple_Z *NONNULL_PTR arg) {
14194         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
14195         *ret_conv = C2Tuple_Z_clone(arg);
14196         return tag_ptr(ret_conv, true);
14197 }
14198 int64_t  __attribute__((export_name("TS_C2Tuple_Z_clone_ptr"))) TS_C2Tuple_Z_clone_ptr(uint64_t arg) {
14199         LDKC2Tuple_Z* arg_conv = (LDKC2Tuple_Z*)untag_ptr(arg);
14200         int64_t ret_conv = C2Tuple_Z_clone_ptr(arg_conv);
14201         return ret_conv;
14202 }
14203
14204 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_clone"))) TS_C2Tuple_Z_clone(uint64_t orig) {
14205         LDKC2Tuple_Z* orig_conv = (LDKC2Tuple_Z*)untag_ptr(orig);
14206         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
14207         *ret_conv = C2Tuple_Z_clone(orig_conv);
14208         return tag_ptr(ret_conv, true);
14209 }
14210
14211 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_new"))) TS_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
14212         LDKEightU16s a_ref;
14213         CHECK(a->arr_len == 8);
14214         memcpy(a_ref.data, a->elems, 8 * 2); FREE(a);
14215         LDKEightU16s b_ref;
14216         CHECK(b->arr_len == 8);
14217         memcpy(b_ref.data, b->elems, 8 * 2); FREE(b);
14218         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
14219         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
14220         return tag_ptr(ret_conv, true);
14221 }
14222
14223 void  __attribute__((export_name("TS_C2Tuple_Z_free"))) TS_C2Tuple_Z_free(uint64_t _res) {
14224         if (!ptr_is_owned(_res)) return;
14225         void* _res_ptr = untag_ptr(_res);
14226         CHECK_ACCESS(_res_ptr);
14227         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
14228         FREE(untag_ptr(_res));
14229         C2Tuple_Z_free(_res_conv);
14230 }
14231
14232 static inline uint64_t C2Tuple__u168_u168Z_clone_ptr(LDKC2Tuple__u168_u168Z *NONNULL_PTR arg) {
14233         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
14234         *ret_conv = C2Tuple__u168_u168Z_clone(arg);
14235         return tag_ptr(ret_conv, true);
14236 }
14237 int64_t  __attribute__((export_name("TS_C2Tuple__u168_u168Z_clone_ptr"))) TS_C2Tuple__u168_u168Z_clone_ptr(uint64_t arg) {
14238         LDKC2Tuple__u168_u168Z* arg_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(arg);
14239         int64_t ret_conv = C2Tuple__u168_u168Z_clone_ptr(arg_conv);
14240         return ret_conv;
14241 }
14242
14243 uint64_t  __attribute__((export_name("TS_C2Tuple__u168_u168Z_clone"))) TS_C2Tuple__u168_u168Z_clone(uint64_t orig) {
14244         LDKC2Tuple__u168_u168Z* orig_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(orig);
14245         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
14246         *ret_conv = C2Tuple__u168_u168Z_clone(orig_conv);
14247         return tag_ptr(ret_conv, true);
14248 }
14249
14250 uint64_t  __attribute__((export_name("TS_C2Tuple__u168_u168Z_new"))) TS_C2Tuple__u168_u168Z_new(int16_tArray a, int16_tArray b) {
14251         LDKEightU16s a_ref;
14252         CHECK(a->arr_len == 8);
14253         memcpy(a_ref.data, a->elems, 8 * 2); FREE(a);
14254         LDKEightU16s b_ref;
14255         CHECK(b->arr_len == 8);
14256         memcpy(b_ref.data, b->elems, 8 * 2); FREE(b);
14257         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
14258         *ret_conv = C2Tuple__u168_u168Z_new(a_ref, b_ref);
14259         return tag_ptr(ret_conv, true);
14260 }
14261
14262 void  __attribute__((export_name("TS_C2Tuple__u168_u168Z_free"))) TS_C2Tuple__u168_u168Z_free(uint64_t _res) {
14263         if (!ptr_is_owned(_res)) return;
14264         void* _res_ptr = untag_ptr(_res);
14265         CHECK_ACCESS(_res_ptr);
14266         LDKC2Tuple__u168_u168Z _res_conv = *(LDKC2Tuple__u168_u168Z*)(_res_ptr);
14267         FREE(untag_ptr(_res));
14268         C2Tuple__u168_u168Z_free(_res_conv);
14269 }
14270
14271 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_some"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_some(uint64_t o) {
14272         void* o_ptr = untag_ptr(o);
14273         CHECK_ACCESS(o_ptr);
14274         LDKC2Tuple__u168_u168Z o_conv = *(LDKC2Tuple__u168_u168Z*)(o_ptr);
14275         o_conv = C2Tuple__u168_u168Z_clone((LDKC2Tuple__u168_u168Z*)untag_ptr(o));
14276         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
14277         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_some(o_conv);
14278         uint64_t ret_ref = tag_ptr(ret_copy, true);
14279         return ret_ref;
14280 }
14281
14282 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_none"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_none() {
14283         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
14284         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_none();
14285         uint64_t ret_ref = tag_ptr(ret_copy, true);
14286         return ret_ref;
14287 }
14288
14289 void  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_free"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_free(uint64_t _res) {
14290         if (!ptr_is_owned(_res)) return;
14291         void* _res_ptr = untag_ptr(_res);
14292         CHECK_ACCESS(_res_ptr);
14293         LDKCOption_C2Tuple_EightU16sEightU16sZZ _res_conv = *(LDKCOption_C2Tuple_EightU16sEightU16sZZ*)(_res_ptr);
14294         FREE(untag_ptr(_res));
14295         COption_C2Tuple_EightU16sEightU16sZZ_free(_res_conv);
14296 }
14297
14298 static inline uint64_t COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR arg) {
14299         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
14300         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(arg);
14301         uint64_t ret_ref = tag_ptr(ret_copy, true);
14302         return ret_ref;
14303 }
14304 int64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(uint64_t arg) {
14305         LDKCOption_C2Tuple_EightU16sEightU16sZZ* arg_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(arg);
14306         int64_t ret_conv = COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(arg_conv);
14307         return ret_conv;
14308 }
14309
14310 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_clone"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_clone(uint64_t orig) {
14311         LDKCOption_C2Tuple_EightU16sEightU16sZZ* orig_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(orig);
14312         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
14313         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(orig_conv);
14314         uint64_t ret_ref = tag_ptr(ret_copy, true);
14315         return ret_ref;
14316 }
14317
14318 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
14319         LDKCVec_NodeIdZ _res_constr;
14320         _res_constr.datalen = _res->arr_len;
14321         if (_res_constr.datalen > 0)
14322                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
14323         else
14324                 _res_constr.data = NULL;
14325         uint64_t* _res_vals = _res->elems;
14326         for (size_t i = 0; i < _res_constr.datalen; i++) {
14327                 uint64_t _res_conv_8 = _res_vals[i];
14328                 LDKNodeId _res_conv_8_conv;
14329                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
14330                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
14331                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
14332                 _res_constr.data[i] = _res_conv_8_conv;
14333         }
14334         FREE(_res);
14335         CVec_NodeIdZ_free(_res_constr);
14336 }
14337
14338 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
14339         LDKProbabilisticScorer o_conv;
14340         o_conv.inner = untag_ptr(o);
14341         o_conv.is_owned = ptr_is_owned(o);
14342         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14343         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
14344         
14345         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
14346         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
14347         return tag_ptr(ret_conv, true);
14348 }
14349
14350 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
14351         void* e_ptr = untag_ptr(e);
14352         CHECK_ACCESS(e_ptr);
14353         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14354         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14355         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
14356         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
14357         return tag_ptr(ret_conv, true);
14358 }
14359
14360 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
14361         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
14362         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
14363         return ret_conv;
14364 }
14365
14366 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
14367         if (!ptr_is_owned(_res)) return;
14368         void* _res_ptr = untag_ptr(_res);
14369         CHECK_ACCESS(_res_ptr);
14370         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
14371         FREE(untag_ptr(_res));
14372         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
14373 }
14374
14375 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
14376         LDKInitFeatures o_conv;
14377         o_conv.inner = untag_ptr(o);
14378         o_conv.is_owned = ptr_is_owned(o);
14379         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14380         o_conv = InitFeatures_clone(&o_conv);
14381         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14382         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
14383         return tag_ptr(ret_conv, true);
14384 }
14385
14386 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
14387         void* e_ptr = untag_ptr(e);
14388         CHECK_ACCESS(e_ptr);
14389         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14390         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14391         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14392         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
14393         return tag_ptr(ret_conv, true);
14394 }
14395
14396 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14397         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
14398         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
14399         return ret_conv;
14400 }
14401
14402 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
14403         if (!ptr_is_owned(_res)) return;
14404         void* _res_ptr = untag_ptr(_res);
14405         CHECK_ACCESS(_res_ptr);
14406         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
14407         FREE(untag_ptr(_res));
14408         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
14409 }
14410
14411 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14412         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14413         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
14414         return tag_ptr(ret_conv, true);
14415 }
14416 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14417         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
14418         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14419         return ret_conv;
14420 }
14421
14422 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
14423         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
14424         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14425         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
14426         return tag_ptr(ret_conv, true);
14427 }
14428
14429 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
14430         LDKChannelFeatures o_conv;
14431         o_conv.inner = untag_ptr(o);
14432         o_conv.is_owned = ptr_is_owned(o);
14433         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14434         o_conv = ChannelFeatures_clone(&o_conv);
14435         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14436         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
14437         return tag_ptr(ret_conv, true);
14438 }
14439
14440 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
14441         void* e_ptr = untag_ptr(e);
14442         CHECK_ACCESS(e_ptr);
14443         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14444         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14445         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14446         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
14447         return tag_ptr(ret_conv, true);
14448 }
14449
14450 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14451         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
14452         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
14453         return ret_conv;
14454 }
14455
14456 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
14457         if (!ptr_is_owned(_res)) return;
14458         void* _res_ptr = untag_ptr(_res);
14459         CHECK_ACCESS(_res_ptr);
14460         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
14461         FREE(untag_ptr(_res));
14462         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
14463 }
14464
14465 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14466         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14467         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
14468         return tag_ptr(ret_conv, true);
14469 }
14470 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14471         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
14472         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14473         return ret_conv;
14474 }
14475
14476 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
14477         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
14478         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14479         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
14480         return tag_ptr(ret_conv, true);
14481 }
14482
14483 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
14484         LDKNodeFeatures o_conv;
14485         o_conv.inner = untag_ptr(o);
14486         o_conv.is_owned = ptr_is_owned(o);
14487         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14488         o_conv = NodeFeatures_clone(&o_conv);
14489         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14490         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
14491         return tag_ptr(ret_conv, true);
14492 }
14493
14494 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
14495         void* e_ptr = untag_ptr(e);
14496         CHECK_ACCESS(e_ptr);
14497         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14498         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14499         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14500         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
14501         return tag_ptr(ret_conv, true);
14502 }
14503
14504 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14505         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
14506         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
14507         return ret_conv;
14508 }
14509
14510 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
14511         if (!ptr_is_owned(_res)) return;
14512         void* _res_ptr = untag_ptr(_res);
14513         CHECK_ACCESS(_res_ptr);
14514         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
14515         FREE(untag_ptr(_res));
14516         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
14517 }
14518
14519 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14520         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14521         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
14522         return tag_ptr(ret_conv, true);
14523 }
14524 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14525         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
14526         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14527         return ret_conv;
14528 }
14529
14530 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
14531         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
14532         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14533         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
14534         return tag_ptr(ret_conv, true);
14535 }
14536
14537 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
14538         LDKInvoiceFeatures o_conv;
14539         o_conv.inner = untag_ptr(o);
14540         o_conv.is_owned = ptr_is_owned(o);
14541         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14542         o_conv = InvoiceFeatures_clone(&o_conv);
14543         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14544         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
14545         return tag_ptr(ret_conv, true);
14546 }
14547
14548 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
14549         void* e_ptr = untag_ptr(e);
14550         CHECK_ACCESS(e_ptr);
14551         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14552         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14553         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14554         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
14555         return tag_ptr(ret_conv, true);
14556 }
14557
14558 jboolean  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14559         LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
14560         jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
14561         return ret_conv;
14562 }
14563
14564 void  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
14565         if (!ptr_is_owned(_res)) return;
14566         void* _res_ptr = untag_ptr(_res);
14567         CHECK_ACCESS(_res_ptr);
14568         LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
14569         FREE(untag_ptr(_res));
14570         CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
14571 }
14572
14573 static inline uint64_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14574         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14575         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
14576         return tag_ptr(ret_conv, true);
14577 }
14578 int64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14579         LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
14580         int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14581         return ret_conv;
14582 }
14583
14584 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
14585         LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
14586         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14587         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
14588         return tag_ptr(ret_conv, true);
14589 }
14590
14591 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok(uint64_t o) {
14592         LDKBlindedHopFeatures o_conv;
14593         o_conv.inner = untag_ptr(o);
14594         o_conv.is_owned = ptr_is_owned(o);
14595         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14596         o_conv = BlindedHopFeatures_clone(&o_conv);
14597         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
14598         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
14599         return tag_ptr(ret_conv, true);
14600 }
14601
14602 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_err(uint64_t e) {
14603         void* e_ptr = untag_ptr(e);
14604         CHECK_ACCESS(e_ptr);
14605         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14606         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14607         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
14608         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
14609         return tag_ptr(ret_conv, true);
14610 }
14611
14612 jboolean  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14613         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
14614         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
14615         return ret_conv;
14616 }
14617
14618 void  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_free"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_free(uint64_t _res) {
14619         if (!ptr_is_owned(_res)) return;
14620         void* _res_ptr = untag_ptr(_res);
14621         CHECK_ACCESS(_res_ptr);
14622         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
14623         FREE(untag_ptr(_res));
14624         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
14625 }
14626
14627 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14628         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
14629         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
14630         return tag_ptr(ret_conv, true);
14631 }
14632 int64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14633         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
14634         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14635         return ret_conv;
14636 }
14637
14638 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone(uint64_t orig) {
14639         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
14640         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
14641         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
14642         return tag_ptr(ret_conv, true);
14643 }
14644
14645 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
14646         LDKChannelTypeFeatures o_conv;
14647         o_conv.inner = untag_ptr(o);
14648         o_conv.is_owned = ptr_is_owned(o);
14649         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14650         o_conv = ChannelTypeFeatures_clone(&o_conv);
14651         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14652         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
14653         return tag_ptr(ret_conv, true);
14654 }
14655
14656 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
14657         void* e_ptr = untag_ptr(e);
14658         CHECK_ACCESS(e_ptr);
14659         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14660         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14661         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14662         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
14663         return tag_ptr(ret_conv, true);
14664 }
14665
14666 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14667         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
14668         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
14669         return ret_conv;
14670 }
14671
14672 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
14673         if (!ptr_is_owned(_res)) return;
14674         void* _res_ptr = untag_ptr(_res);
14675         CHECK_ACCESS(_res_ptr);
14676         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
14677         FREE(untag_ptr(_res));
14678         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
14679 }
14680
14681 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14682         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14683         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
14684         return tag_ptr(ret_conv, true);
14685 }
14686 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14687         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
14688         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14689         return ret_conv;
14690 }
14691
14692 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
14693         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
14694         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14695         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
14696         return tag_ptr(ret_conv, true);
14697 }
14698
14699 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
14700         void* o_ptr = untag_ptr(o);
14701         CHECK_ACCESS(o_ptr);
14702         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
14703         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
14704         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
14705         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
14706         return tag_ptr(ret_conv, true);
14707 }
14708
14709 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
14710         void* e_ptr = untag_ptr(e);
14711         CHECK_ACCESS(e_ptr);
14712         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14713         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14714         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
14715         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
14716         return tag_ptr(ret_conv, true);
14717 }
14718
14719 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
14720         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
14721         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
14722         return ret_conv;
14723 }
14724
14725 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
14726         if (!ptr_is_owned(_res)) return;
14727         void* _res_ptr = untag_ptr(_res);
14728         CHECK_ACCESS(_res_ptr);
14729         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
14730         FREE(untag_ptr(_res));
14731         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
14732 }
14733
14734 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
14735         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
14736         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
14737         return tag_ptr(ret_conv, true);
14738 }
14739 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
14740         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
14741         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
14742         return ret_conv;
14743 }
14744
14745 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
14746         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
14747         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
14748         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
14749         return tag_ptr(ret_conv, true);
14750 }
14751
14752 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
14753         void* o_ptr = untag_ptr(o);
14754         CHECK_ACCESS(o_ptr);
14755         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
14756         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
14757         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
14758         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
14759         uint64_t ret_ref = tag_ptr(ret_copy, true);
14760         return ret_ref;
14761 }
14762
14763 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
14764         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
14765         *ret_copy = COption_NetworkUpdateZ_none();
14766         uint64_t ret_ref = tag_ptr(ret_copy, true);
14767         return ret_ref;
14768 }
14769
14770 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
14771         if (!ptr_is_owned(_res)) return;
14772         void* _res_ptr = untag_ptr(_res);
14773         CHECK_ACCESS(_res_ptr);
14774         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
14775         FREE(untag_ptr(_res));
14776         COption_NetworkUpdateZ_free(_res_conv);
14777 }
14778
14779 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
14780         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
14781         *ret_copy = COption_NetworkUpdateZ_clone(arg);
14782         uint64_t ret_ref = tag_ptr(ret_copy, true);
14783         return ret_ref;
14784 }
14785 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
14786         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
14787         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
14788         return ret_conv;
14789 }
14790
14791 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
14792         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
14793         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
14794         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
14795         uint64_t ret_ref = tag_ptr(ret_copy, true);
14796         return ret_ref;
14797 }
14798
14799 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_some"))) TS_COption_PathFailureZ_some(uint64_t o) {
14800         void* o_ptr = untag_ptr(o);
14801         CHECK_ACCESS(o_ptr);
14802         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
14803         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
14804         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
14805         *ret_copy = COption_PathFailureZ_some(o_conv);
14806         uint64_t ret_ref = tag_ptr(ret_copy, true);
14807         return ret_ref;
14808 }
14809
14810 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_none"))) TS_COption_PathFailureZ_none() {
14811         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
14812         *ret_copy = COption_PathFailureZ_none();
14813         uint64_t ret_ref = tag_ptr(ret_copy, true);
14814         return ret_ref;
14815 }
14816
14817 void  __attribute__((export_name("TS_COption_PathFailureZ_free"))) TS_COption_PathFailureZ_free(uint64_t _res) {
14818         if (!ptr_is_owned(_res)) return;
14819         void* _res_ptr = untag_ptr(_res);
14820         CHECK_ACCESS(_res_ptr);
14821         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
14822         FREE(untag_ptr(_res));
14823         COption_PathFailureZ_free(_res_conv);
14824 }
14825
14826 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
14827         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
14828         *ret_copy = COption_PathFailureZ_clone(arg);
14829         uint64_t ret_ref = tag_ptr(ret_copy, true);
14830         return ret_ref;
14831 }
14832 int64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone_ptr"))) TS_COption_PathFailureZ_clone_ptr(uint64_t arg) {
14833         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
14834         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
14835         return ret_conv;
14836 }
14837
14838 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone"))) TS_COption_PathFailureZ_clone(uint64_t orig) {
14839         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
14840         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
14841         *ret_copy = COption_PathFailureZ_clone(orig_conv);
14842         uint64_t ret_ref = tag_ptr(ret_copy, true);
14843         return ret_ref;
14844 }
14845
14846 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_ok(uint64_t o) {
14847         void* o_ptr = untag_ptr(o);
14848         CHECK_ACCESS(o_ptr);
14849         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
14850         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
14851         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
14852         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
14853         return tag_ptr(ret_conv, true);
14854 }
14855
14856 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_err(uint64_t e) {
14857         void* e_ptr = untag_ptr(e);
14858         CHECK_ACCESS(e_ptr);
14859         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14860         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14861         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
14862         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
14863         return tag_ptr(ret_conv, true);
14864 }
14865
14866 jboolean  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok(uint64_t o) {
14867         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
14868         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
14869         return ret_conv;
14870 }
14871
14872 void  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_free"))) TS_CResult_COption_PathFailureZDecodeErrorZ_free(uint64_t _res) {
14873         if (!ptr_is_owned(_res)) return;
14874         void* _res_ptr = untag_ptr(_res);
14875         CHECK_ACCESS(_res_ptr);
14876         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
14877         FREE(untag_ptr(_res));
14878         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
14879 }
14880
14881 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
14882         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
14883         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
14884         return tag_ptr(ret_conv, true);
14885 }
14886 int64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(uint64_t arg) {
14887         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
14888         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
14889         return ret_conv;
14890 }
14891
14892 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone(uint64_t orig) {
14893         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
14894         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
14895         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
14896         return tag_ptr(ret_conv, true);
14897 }
14898
14899 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
14900         void* o_ptr = untag_ptr(o);
14901         CHECK_ACCESS(o_ptr);
14902         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
14903         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
14904         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
14905         *ret_copy = COption_ClosureReasonZ_some(o_conv);
14906         uint64_t ret_ref = tag_ptr(ret_copy, true);
14907         return ret_ref;
14908 }
14909
14910 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
14911         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
14912         *ret_copy = COption_ClosureReasonZ_none();
14913         uint64_t ret_ref = tag_ptr(ret_copy, true);
14914         return ret_ref;
14915 }
14916
14917 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
14918         if (!ptr_is_owned(_res)) return;
14919         void* _res_ptr = untag_ptr(_res);
14920         CHECK_ACCESS(_res_ptr);
14921         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
14922         FREE(untag_ptr(_res));
14923         COption_ClosureReasonZ_free(_res_conv);
14924 }
14925
14926 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
14927         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
14928         *ret_copy = COption_ClosureReasonZ_clone(arg);
14929         uint64_t ret_ref = tag_ptr(ret_copy, true);
14930         return ret_ref;
14931 }
14932 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
14933         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
14934         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
14935         return ret_conv;
14936 }
14937
14938 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
14939         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
14940         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
14941         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
14942         uint64_t ret_ref = tag_ptr(ret_copy, true);
14943         return ret_ref;
14944 }
14945
14946 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
14947         void* o_ptr = untag_ptr(o);
14948         CHECK_ACCESS(o_ptr);
14949         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
14950         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
14951         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
14952         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
14953         return tag_ptr(ret_conv, true);
14954 }
14955
14956 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
14957         void* e_ptr = untag_ptr(e);
14958         CHECK_ACCESS(e_ptr);
14959         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14960         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14961         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
14962         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
14963         return tag_ptr(ret_conv, true);
14964 }
14965
14966 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
14967         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
14968         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
14969         return ret_conv;
14970 }
14971
14972 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
14973         if (!ptr_is_owned(_res)) return;
14974         void* _res_ptr = untag_ptr(_res);
14975         CHECK_ACCESS(_res_ptr);
14976         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
14977         FREE(untag_ptr(_res));
14978         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
14979 }
14980
14981 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
14982         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
14983         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
14984         return tag_ptr(ret_conv, true);
14985 }
14986 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
14987         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
14988         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
14989         return ret_conv;
14990 }
14991
14992 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
14993         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
14994         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
14995         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
14996         return tag_ptr(ret_conv, true);
14997 }
14998
14999 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
15000         void* o_ptr = untag_ptr(o);
15001         CHECK_ACCESS(o_ptr);
15002         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
15003         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
15004         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15005         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
15006         uint64_t ret_ref = tag_ptr(ret_copy, true);
15007         return ret_ref;
15008 }
15009
15010 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
15011         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15012         *ret_copy = COption_HTLCDestinationZ_none();
15013         uint64_t ret_ref = tag_ptr(ret_copy, true);
15014         return ret_ref;
15015 }
15016
15017 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
15018         if (!ptr_is_owned(_res)) return;
15019         void* _res_ptr = untag_ptr(_res);
15020         CHECK_ACCESS(_res_ptr);
15021         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
15022         FREE(untag_ptr(_res));
15023         COption_HTLCDestinationZ_free(_res_conv);
15024 }
15025
15026 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
15027         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15028         *ret_copy = COption_HTLCDestinationZ_clone(arg);
15029         uint64_t ret_ref = tag_ptr(ret_copy, true);
15030         return ret_ref;
15031 }
15032 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
15033         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
15034         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
15035         return ret_conv;
15036 }
15037
15038 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
15039         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
15040         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15041         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
15042         uint64_t ret_ref = tag_ptr(ret_copy, true);
15043         return ret_ref;
15044 }
15045
15046 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
15047         void* o_ptr = untag_ptr(o);
15048         CHECK_ACCESS(o_ptr);
15049         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
15050         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
15051         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15052         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
15053         return tag_ptr(ret_conv, true);
15054 }
15055
15056 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
15057         void* e_ptr = untag_ptr(e);
15058         CHECK_ACCESS(e_ptr);
15059         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15060         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15061         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15062         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
15063         return tag_ptr(ret_conv, true);
15064 }
15065
15066 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
15067         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
15068         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
15069         return ret_conv;
15070 }
15071
15072 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
15073         if (!ptr_is_owned(_res)) return;
15074         void* _res_ptr = untag_ptr(_res);
15075         CHECK_ACCESS(_res_ptr);
15076         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
15077         FREE(untag_ptr(_res));
15078         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
15079 }
15080
15081 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
15082         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15083         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
15084         return tag_ptr(ret_conv, true);
15085 }
15086 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
15087         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
15088         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
15089         return ret_conv;
15090 }
15091
15092 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
15093         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
15094         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15095         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
15096         return tag_ptr(ret_conv, true);
15097 }
15098
15099 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_ok(uint32_t o) {
15100         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
15101         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
15102         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
15103         return tag_ptr(ret_conv, true);
15104 }
15105
15106 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_err(uint64_t e) {
15107         void* e_ptr = untag_ptr(e);
15108         CHECK_ACCESS(e_ptr);
15109         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15110         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15111         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
15112         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
15113         return tag_ptr(ret_conv, true);
15114 }
15115
15116 jboolean  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok(uint64_t o) {
15117         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
15118         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
15119         return ret_conv;
15120 }
15121
15122 void  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_free"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_free(uint64_t _res) {
15123         if (!ptr_is_owned(_res)) return;
15124         void* _res_ptr = untag_ptr(_res);
15125         CHECK_ACCESS(_res_ptr);
15126         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
15127         FREE(untag_ptr(_res));
15128         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
15129 }
15130
15131 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
15132         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
15133         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
15134         return tag_ptr(ret_conv, true);
15135 }
15136 int64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(uint64_t arg) {
15137         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
15138         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
15139         return ret_conv;
15140 }
15141
15142 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone(uint64_t orig) {
15143         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
15144         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
15145         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
15146         return tag_ptr(ret_conv, true);
15147 }
15148
15149 uint64_t  __attribute__((export_name("TS_COption_u128Z_some"))) TS_COption_u128Z_some(int8_tArray o) {
15150         LDKU128 o_ref;
15151         CHECK(o->arr_len == 16);
15152         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
15153         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
15154         *ret_copy = COption_u128Z_some(o_ref);
15155         uint64_t ret_ref = tag_ptr(ret_copy, true);
15156         return ret_ref;
15157 }
15158
15159 uint64_t  __attribute__((export_name("TS_COption_u128Z_none"))) TS_COption_u128Z_none() {
15160         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
15161         *ret_copy = COption_u128Z_none();
15162         uint64_t ret_ref = tag_ptr(ret_copy, true);
15163         return ret_ref;
15164 }
15165
15166 void  __attribute__((export_name("TS_COption_u128Z_free"))) TS_COption_u128Z_free(uint64_t _res) {
15167         if (!ptr_is_owned(_res)) return;
15168         void* _res_ptr = untag_ptr(_res);
15169         CHECK_ACCESS(_res_ptr);
15170         LDKCOption_u128Z _res_conv = *(LDKCOption_u128Z*)(_res_ptr);
15171         FREE(untag_ptr(_res));
15172         COption_u128Z_free(_res_conv);
15173 }
15174
15175 static inline uint64_t COption_u128Z_clone_ptr(LDKCOption_u128Z *NONNULL_PTR arg) {
15176         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
15177         *ret_copy = COption_u128Z_clone(arg);
15178         uint64_t ret_ref = tag_ptr(ret_copy, true);
15179         return ret_ref;
15180 }
15181 int64_t  __attribute__((export_name("TS_COption_u128Z_clone_ptr"))) TS_COption_u128Z_clone_ptr(uint64_t arg) {
15182         LDKCOption_u128Z* arg_conv = (LDKCOption_u128Z*)untag_ptr(arg);
15183         int64_t ret_conv = COption_u128Z_clone_ptr(arg_conv);
15184         return ret_conv;
15185 }
15186
15187 uint64_t  __attribute__((export_name("TS_COption_u128Z_clone"))) TS_COption_u128Z_clone(uint64_t orig) {
15188         LDKCOption_u128Z* orig_conv = (LDKCOption_u128Z*)untag_ptr(orig);
15189         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
15190         *ret_copy = COption_u128Z_clone(orig_conv);
15191         uint64_t ret_ref = tag_ptr(ret_copy, true);
15192         return ret_ref;
15193 }
15194
15195 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_some"))) TS_COption_PaymentFailureReasonZ_some(uint32_t o) {
15196         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
15197         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
15198         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
15199         uint64_t ret_ref = tag_ptr(ret_copy, true);
15200         return ret_ref;
15201 }
15202
15203 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_none"))) TS_COption_PaymentFailureReasonZ_none() {
15204         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
15205         *ret_copy = COption_PaymentFailureReasonZ_none();
15206         uint64_t ret_ref = tag_ptr(ret_copy, true);
15207         return ret_ref;
15208 }
15209
15210 void  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_free"))) TS_COption_PaymentFailureReasonZ_free(uint64_t _res) {
15211         if (!ptr_is_owned(_res)) return;
15212         void* _res_ptr = untag_ptr(_res);
15213         CHECK_ACCESS(_res_ptr);
15214         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
15215         FREE(untag_ptr(_res));
15216         COption_PaymentFailureReasonZ_free(_res_conv);
15217 }
15218
15219 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
15220         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
15221         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
15222         uint64_t ret_ref = tag_ptr(ret_copy, true);
15223         return ret_ref;
15224 }
15225 int64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone_ptr"))) TS_COption_PaymentFailureReasonZ_clone_ptr(uint64_t arg) {
15226         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
15227         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
15228         return ret_conv;
15229 }
15230
15231 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone"))) TS_COption_PaymentFailureReasonZ_clone(uint64_t orig) {
15232         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
15233         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
15234         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
15235         uint64_t ret_ref = tag_ptr(ret_copy, true);
15236         return ret_ref;
15237 }
15238
15239 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
15240         LDKCVec_SpendableOutputDescriptorZ _res_constr;
15241         _res_constr.datalen = _res->arr_len;
15242         if (_res_constr.datalen > 0)
15243                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15244         else
15245                 _res_constr.data = NULL;
15246         uint64_t* _res_vals = _res->elems;
15247         for (size_t b = 0; b < _res_constr.datalen; b++) {
15248                 uint64_t _res_conv_27 = _res_vals[b];
15249                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
15250                 CHECK_ACCESS(_res_conv_27_ptr);
15251                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
15252                 FREE(untag_ptr(_res_conv_27));
15253                 _res_constr.data[b] = _res_conv_27_conv;
15254         }
15255         FREE(_res);
15256         CVec_SpendableOutputDescriptorZ_free(_res_constr);
15257 }
15258
15259 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
15260         void* o_ptr = untag_ptr(o);
15261         CHECK_ACCESS(o_ptr);
15262         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
15263         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
15264         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15265         *ret_copy = COption_EventZ_some(o_conv);
15266         uint64_t ret_ref = tag_ptr(ret_copy, true);
15267         return ret_ref;
15268 }
15269
15270 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
15271         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15272         *ret_copy = COption_EventZ_none();
15273         uint64_t ret_ref = tag_ptr(ret_copy, true);
15274         return ret_ref;
15275 }
15276
15277 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
15278         if (!ptr_is_owned(_res)) return;
15279         void* _res_ptr = untag_ptr(_res);
15280         CHECK_ACCESS(_res_ptr);
15281         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
15282         FREE(untag_ptr(_res));
15283         COption_EventZ_free(_res_conv);
15284 }
15285
15286 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
15287         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15288         *ret_copy = COption_EventZ_clone(arg);
15289         uint64_t ret_ref = tag_ptr(ret_copy, true);
15290         return ret_ref;
15291 }
15292 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
15293         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
15294         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
15295         return ret_conv;
15296 }
15297
15298 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
15299         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
15300         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15301         *ret_copy = COption_EventZ_clone(orig_conv);
15302         uint64_t ret_ref = tag_ptr(ret_copy, true);
15303         return ret_ref;
15304 }
15305
15306 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
15307         void* o_ptr = untag_ptr(o);
15308         CHECK_ACCESS(o_ptr);
15309         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
15310         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
15311         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15312         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
15313         return tag_ptr(ret_conv, true);
15314 }
15315
15316 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
15317         void* e_ptr = untag_ptr(e);
15318         CHECK_ACCESS(e_ptr);
15319         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15320         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15321         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15322         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
15323         return tag_ptr(ret_conv, true);
15324 }
15325
15326 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
15327         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
15328         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
15329         return ret_conv;
15330 }
15331
15332 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
15333         if (!ptr_is_owned(_res)) return;
15334         void* _res_ptr = untag_ptr(_res);
15335         CHECK_ACCESS(_res_ptr);
15336         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
15337         FREE(untag_ptr(_res));
15338         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
15339 }
15340
15341 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
15342         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15343         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
15344         return tag_ptr(ret_conv, true);
15345 }
15346 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
15347         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
15348         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
15349         return ret_conv;
15350 }
15351
15352 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
15353         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
15354         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15355         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
15356         return tag_ptr(ret_conv, true);
15357 }
15358
15359 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
15360         LDKCVec_MessageSendEventZ _res_constr;
15361         _res_constr.datalen = _res->arr_len;
15362         if (_res_constr.datalen > 0)
15363                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
15364         else
15365                 _res_constr.data = NULL;
15366         uint64_t* _res_vals = _res->elems;
15367         for (size_t s = 0; s < _res_constr.datalen; s++) {
15368                 uint64_t _res_conv_18 = _res_vals[s];
15369                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
15370                 CHECK_ACCESS(_res_conv_18_ptr);
15371                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
15372                 FREE(untag_ptr(_res_conv_18));
15373                 _res_constr.data[s] = _res_conv_18_conv;
15374         }
15375         FREE(_res);
15376         CVec_MessageSendEventZ_free(_res_constr);
15377 }
15378
15379 void  __attribute__((export_name("TS_CVec_ChainHashZ_free"))) TS_CVec_ChainHashZ_free(ptrArray _res) {
15380         LDKCVec_ChainHashZ _res_constr;
15381         _res_constr.datalen = _res->arr_len;
15382         if (_res_constr.datalen > 0)
15383                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ChainHashZ Elements");
15384         else
15385                 _res_constr.data = NULL;
15386         int8_tArray* _res_vals = (void*) _res->elems;
15387         for (size_t m = 0; m < _res_constr.datalen; m++) {
15388                 int8_tArray _res_conv_12 = _res_vals[m];
15389                 LDKThirtyTwoBytes _res_conv_12_ref;
15390                 CHECK(_res_conv_12->arr_len == 32);
15391                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
15392                 _res_constr.data[m] = _res_conv_12_ref;
15393         }
15394         FREE(_res);
15395         CVec_ChainHashZ_free(_res_constr);
15396 }
15397
15398 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
15399         LDKPublicKey o_ref;
15400         CHECK(o->arr_len == 33);
15401         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
15402         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15403         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
15404         return tag_ptr(ret_conv, true);
15405 }
15406
15407 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
15408         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
15409         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15410         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
15411         return tag_ptr(ret_conv, true);
15412 }
15413
15414 jboolean  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint64_t o) {
15415         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
15416         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
15417         return ret_conv;
15418 }
15419
15420 void  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint64_t _res) {
15421         if (!ptr_is_owned(_res)) return;
15422         void* _res_ptr = untag_ptr(_res);
15423         CHECK_ACCESS(_res_ptr);
15424         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
15425         FREE(untag_ptr(_res));
15426         CResult_PublicKeyErrorZ_free(_res_conv);
15427 }
15428
15429 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
15430         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15431         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
15432         return tag_ptr(ret_conv, true);
15433 }
15434 int64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint64_t arg) {
15435         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
15436         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
15437         return ret_conv;
15438 }
15439
15440 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint64_t orig) {
15441         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
15442         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15443         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
15444         return tag_ptr(ret_conv, true);
15445 }
15446
15447 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
15448         LDKNodeId o_conv;
15449         o_conv.inner = untag_ptr(o);
15450         o_conv.is_owned = ptr_is_owned(o);
15451         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15452         o_conv = NodeId_clone(&o_conv);
15453         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
15454         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
15455         return tag_ptr(ret_conv, true);
15456 }
15457
15458 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
15459         void* e_ptr = untag_ptr(e);
15460         CHECK_ACCESS(e_ptr);
15461         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15462         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15463         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
15464         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
15465         return tag_ptr(ret_conv, true);
15466 }
15467
15468 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
15469         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
15470         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
15471         return ret_conv;
15472 }
15473
15474 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
15475         if (!ptr_is_owned(_res)) return;
15476         void* _res_ptr = untag_ptr(_res);
15477         CHECK_ACCESS(_res_ptr);
15478         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
15479         FREE(untag_ptr(_res));
15480         CResult_NodeIdDecodeErrorZ_free(_res_conv);
15481 }
15482
15483 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
15484         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
15485         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
15486         return tag_ptr(ret_conv, true);
15487 }
15488 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
15489         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
15490         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
15491         return ret_conv;
15492 }
15493
15494 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
15495         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
15496         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
15497         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
15498         return tag_ptr(ret_conv, true);
15499 }
15500
15501 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
15502         void* o_ptr = untag_ptr(o);
15503         CHECK_ACCESS(o_ptr);
15504         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
15505         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
15506         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
15507         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
15508         return tag_ptr(ret_conv, true);
15509 }
15510
15511 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
15512         void* e_ptr = untag_ptr(e);
15513         CHECK_ACCESS(e_ptr);
15514         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15515         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15516         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
15517         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
15518         return tag_ptr(ret_conv, true);
15519 }
15520
15521 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
15522         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
15523         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
15524         return ret_conv;
15525 }
15526
15527 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
15528         if (!ptr_is_owned(_res)) return;
15529         void* _res_ptr = untag_ptr(_res);
15530         CHECK_ACCESS(_res_ptr);
15531         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
15532         FREE(untag_ptr(_res));
15533         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
15534 }
15535
15536 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
15537         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
15538         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
15539         return tag_ptr(ret_conv, true);
15540 }
15541 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
15542         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
15543         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
15544         return ret_conv;
15545 }
15546
15547 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
15548         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
15549         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
15550         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
15551         return tag_ptr(ret_conv, true);
15552 }
15553
15554 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_some"))) TS_COption_UtxoLookupZ_some(uint64_t o) {
15555         void* o_ptr = untag_ptr(o);
15556         CHECK_ACCESS(o_ptr);
15557         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
15558         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
15559                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15560                 LDKUtxoLookup_JCalls_cloned(&o_conv);
15561         }
15562         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
15563         *ret_copy = COption_UtxoLookupZ_some(o_conv);
15564         uint64_t ret_ref = tag_ptr(ret_copy, true);
15565         return ret_ref;
15566 }
15567
15568 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_none"))) TS_COption_UtxoLookupZ_none() {
15569         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
15570         *ret_copy = COption_UtxoLookupZ_none();
15571         uint64_t ret_ref = tag_ptr(ret_copy, true);
15572         return ret_ref;
15573 }
15574
15575 void  __attribute__((export_name("TS_COption_UtxoLookupZ_free"))) TS_COption_UtxoLookupZ_free(uint64_t _res) {
15576         if (!ptr_is_owned(_res)) return;
15577         void* _res_ptr = untag_ptr(_res);
15578         CHECK_ACCESS(_res_ptr);
15579         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
15580         FREE(untag_ptr(_res));
15581         COption_UtxoLookupZ_free(_res_conv);
15582 }
15583
15584 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
15585         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15586         *ret_conv = CResult_boolLightningErrorZ_ok(o);
15587         return tag_ptr(ret_conv, true);
15588 }
15589
15590 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
15591         LDKLightningError e_conv;
15592         e_conv.inner = untag_ptr(e);
15593         e_conv.is_owned = ptr_is_owned(e);
15594         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15595         e_conv = LightningError_clone(&e_conv);
15596         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15597         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
15598         return tag_ptr(ret_conv, true);
15599 }
15600
15601 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
15602         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
15603         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
15604         return ret_conv;
15605 }
15606
15607 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
15608         if (!ptr_is_owned(_res)) return;
15609         void* _res_ptr = untag_ptr(_res);
15610         CHECK_ACCESS(_res_ptr);
15611         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
15612         FREE(untag_ptr(_res));
15613         CResult_boolLightningErrorZ_free(_res_conv);
15614 }
15615
15616 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
15617         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15618         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
15619         return tag_ptr(ret_conv, true);
15620 }
15621 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
15622         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
15623         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
15624         return ret_conv;
15625 }
15626
15627 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
15628         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
15629         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15630         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
15631         return tag_ptr(ret_conv, true);
15632 }
15633
15634 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
15635         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
15636         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
15637         return tag_ptr(ret_conv, true);
15638 }
15639 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
15640         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
15641         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
15642         return ret_conv;
15643 }
15644
15645 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
15646         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
15647         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
15648         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
15649         return tag_ptr(ret_conv, true);
15650 }
15651
15652 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
15653         LDKChannelAnnouncement a_conv;
15654         a_conv.inner = untag_ptr(a);
15655         a_conv.is_owned = ptr_is_owned(a);
15656         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
15657         a_conv = ChannelAnnouncement_clone(&a_conv);
15658         LDKChannelUpdate b_conv;
15659         b_conv.inner = untag_ptr(b);
15660         b_conv.is_owned = ptr_is_owned(b);
15661         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
15662         b_conv = ChannelUpdate_clone(&b_conv);
15663         LDKChannelUpdate c_conv;
15664         c_conv.inner = untag_ptr(c);
15665         c_conv.is_owned = ptr_is_owned(c);
15666         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
15667         c_conv = ChannelUpdate_clone(&c_conv);
15668         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
15669         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
15670         return tag_ptr(ret_conv, true);
15671 }
15672
15673 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
15674         if (!ptr_is_owned(_res)) return;
15675         void* _res_ptr = untag_ptr(_res);
15676         CHECK_ACCESS(_res_ptr);
15677         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
15678         FREE(untag_ptr(_res));
15679         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
15680 }
15681
15682 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
15683         void* o_ptr = untag_ptr(o);
15684         CHECK_ACCESS(o_ptr);
15685         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
15686         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
15687         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15688         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
15689         uint64_t ret_ref = tag_ptr(ret_copy, true);
15690         return ret_ref;
15691 }
15692
15693 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
15694         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15695         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
15696         uint64_t ret_ref = tag_ptr(ret_copy, true);
15697         return ret_ref;
15698 }
15699
15700 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
15701         if (!ptr_is_owned(_res)) return;
15702         void* _res_ptr = untag_ptr(_res);
15703         CHECK_ACCESS(_res_ptr);
15704         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
15705         FREE(untag_ptr(_res));
15706         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
15707 }
15708
15709 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
15710         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15711         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
15712         uint64_t ret_ref = tag_ptr(ret_copy, true);
15713         return ret_ref;
15714 }
15715 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
15716         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
15717         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
15718         return ret_conv;
15719 }
15720
15721 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
15722         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
15723         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15724         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
15725         uint64_t ret_ref = tag_ptr(ret_copy, true);
15726         return ret_ref;
15727 }
15728
15729 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
15730         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15731         *ret_conv = CResult_NoneLightningErrorZ_ok();
15732         return tag_ptr(ret_conv, true);
15733 }
15734
15735 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
15736         LDKLightningError e_conv;
15737         e_conv.inner = untag_ptr(e);
15738         e_conv.is_owned = ptr_is_owned(e);
15739         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15740         e_conv = LightningError_clone(&e_conv);
15741         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15742         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
15743         return tag_ptr(ret_conv, true);
15744 }
15745
15746 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
15747         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
15748         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
15749         return ret_conv;
15750 }
15751
15752 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
15753         if (!ptr_is_owned(_res)) return;
15754         void* _res_ptr = untag_ptr(_res);
15755         CHECK_ACCESS(_res_ptr);
15756         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
15757         FREE(untag_ptr(_res));
15758         CResult_NoneLightningErrorZ_free(_res_conv);
15759 }
15760
15761 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
15762         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15763         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
15764         return tag_ptr(ret_conv, true);
15765 }
15766 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
15767         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
15768         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
15769         return ret_conv;
15770 }
15771
15772 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
15773         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
15774         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15775         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
15776         return tag_ptr(ret_conv, true);
15777 }
15778
15779 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
15780         LDKChannelUpdateInfo o_conv;
15781         o_conv.inner = untag_ptr(o);
15782         o_conv.is_owned = ptr_is_owned(o);
15783         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15784         o_conv = ChannelUpdateInfo_clone(&o_conv);
15785         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15786         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
15787         return tag_ptr(ret_conv, true);
15788 }
15789
15790 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
15791         void* e_ptr = untag_ptr(e);
15792         CHECK_ACCESS(e_ptr);
15793         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15794         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15795         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15796         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
15797         return tag_ptr(ret_conv, true);
15798 }
15799
15800 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
15801         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
15802         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
15803         return ret_conv;
15804 }
15805
15806 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
15807         if (!ptr_is_owned(_res)) return;
15808         void* _res_ptr = untag_ptr(_res);
15809         CHECK_ACCESS(_res_ptr);
15810         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
15811         FREE(untag_ptr(_res));
15812         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
15813 }
15814
15815 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
15816         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15817         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
15818         return tag_ptr(ret_conv, true);
15819 }
15820 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15821         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
15822         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
15823         return ret_conv;
15824 }
15825
15826 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
15827         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
15828         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15829         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
15830         return tag_ptr(ret_conv, true);
15831 }
15832
15833 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
15834         LDKChannelInfo o_conv;
15835         o_conv.inner = untag_ptr(o);
15836         o_conv.is_owned = ptr_is_owned(o);
15837         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15838         o_conv = ChannelInfo_clone(&o_conv);
15839         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15840         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
15841         return tag_ptr(ret_conv, true);
15842 }
15843
15844 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
15845         void* e_ptr = untag_ptr(e);
15846         CHECK_ACCESS(e_ptr);
15847         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15848         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15849         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15850         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
15851         return tag_ptr(ret_conv, true);
15852 }
15853
15854 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
15855         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
15856         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
15857         return ret_conv;
15858 }
15859
15860 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
15861         if (!ptr_is_owned(_res)) return;
15862         void* _res_ptr = untag_ptr(_res);
15863         CHECK_ACCESS(_res_ptr);
15864         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
15865         FREE(untag_ptr(_res));
15866         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
15867 }
15868
15869 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
15870         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15871         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
15872         return tag_ptr(ret_conv, true);
15873 }
15874 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15875         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
15876         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
15877         return ret_conv;
15878 }
15879
15880 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
15881         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
15882         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15883         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
15884         return tag_ptr(ret_conv, true);
15885 }
15886
15887 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
15888         LDKRoutingFees o_conv;
15889         o_conv.inner = untag_ptr(o);
15890         o_conv.is_owned = ptr_is_owned(o);
15891         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15892         o_conv = RoutingFees_clone(&o_conv);
15893         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15894         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
15895         return tag_ptr(ret_conv, true);
15896 }
15897
15898 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
15899         void* e_ptr = untag_ptr(e);
15900         CHECK_ACCESS(e_ptr);
15901         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15902         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15903         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15904         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
15905         return tag_ptr(ret_conv, true);
15906 }
15907
15908 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
15909         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
15910         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
15911         return ret_conv;
15912 }
15913
15914 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
15915         if (!ptr_is_owned(_res)) return;
15916         void* _res_ptr = untag_ptr(_res);
15917         CHECK_ACCESS(_res_ptr);
15918         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
15919         FREE(untag_ptr(_res));
15920         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
15921 }
15922
15923 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
15924         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15925         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
15926         return tag_ptr(ret_conv, true);
15927 }
15928 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
15929         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
15930         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
15931         return ret_conv;
15932 }
15933
15934 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
15935         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
15936         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15937         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
15938         return tag_ptr(ret_conv, true);
15939 }
15940
15941 void  __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint64_tArray _res) {
15942         LDKCVec_NetAddressZ _res_constr;
15943         _res_constr.datalen = _res->arr_len;
15944         if (_res_constr.datalen > 0)
15945                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15946         else
15947                 _res_constr.data = NULL;
15948         uint64_t* _res_vals = _res->elems;
15949         for (size_t m = 0; m < _res_constr.datalen; m++) {
15950                 uint64_t _res_conv_12 = _res_vals[m];
15951                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
15952                 CHECK_ACCESS(_res_conv_12_ptr);
15953                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
15954                 FREE(untag_ptr(_res_conv_12));
15955                 _res_constr.data[m] = _res_conv_12_conv;
15956         }
15957         FREE(_res);
15958         CVec_NetAddressZ_free(_res_constr);
15959 }
15960
15961 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
15962         LDKNodeAnnouncementInfo o_conv;
15963         o_conv.inner = untag_ptr(o);
15964         o_conv.is_owned = ptr_is_owned(o);
15965         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15966         o_conv = NodeAnnouncementInfo_clone(&o_conv);
15967         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15968         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
15969         return tag_ptr(ret_conv, true);
15970 }
15971
15972 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
15973         void* e_ptr = untag_ptr(e);
15974         CHECK_ACCESS(e_ptr);
15975         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15976         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15977         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15978         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
15979         return tag_ptr(ret_conv, true);
15980 }
15981
15982 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
15983         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
15984         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
15985         return ret_conv;
15986 }
15987
15988 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
15989         if (!ptr_is_owned(_res)) return;
15990         void* _res_ptr = untag_ptr(_res);
15991         CHECK_ACCESS(_res_ptr);
15992         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
15993         FREE(untag_ptr(_res));
15994         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
15995 }
15996
15997 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
15998         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15999         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
16000         return tag_ptr(ret_conv, true);
16001 }
16002 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
16003         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
16004         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
16005         return ret_conv;
16006 }
16007
16008 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
16009         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
16010         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
16011         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
16012         return tag_ptr(ret_conv, true);
16013 }
16014
16015 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
16016         LDKNodeAlias o_conv;
16017         o_conv.inner = untag_ptr(o);
16018         o_conv.is_owned = ptr_is_owned(o);
16019         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16020         o_conv = NodeAlias_clone(&o_conv);
16021         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
16022         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
16023         return tag_ptr(ret_conv, true);
16024 }
16025
16026 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
16027         void* e_ptr = untag_ptr(e);
16028         CHECK_ACCESS(e_ptr);
16029         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16030         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16031         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
16032         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
16033         return tag_ptr(ret_conv, true);
16034 }
16035
16036 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
16037         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
16038         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
16039         return ret_conv;
16040 }
16041
16042 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
16043         if (!ptr_is_owned(_res)) return;
16044         void* _res_ptr = untag_ptr(_res);
16045         CHECK_ACCESS(_res_ptr);
16046         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
16047         FREE(untag_ptr(_res));
16048         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
16049 }
16050
16051 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
16052         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
16053         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
16054         return tag_ptr(ret_conv, true);
16055 }
16056 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
16057         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
16058         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
16059         return ret_conv;
16060 }
16061
16062 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
16063         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
16064         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
16065         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
16066         return tag_ptr(ret_conv, true);
16067 }
16068
16069 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
16070         LDKNodeInfo o_conv;
16071         o_conv.inner = untag_ptr(o);
16072         o_conv.is_owned = ptr_is_owned(o);
16073         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16074         o_conv = NodeInfo_clone(&o_conv);
16075         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
16076         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
16077         return tag_ptr(ret_conv, true);
16078 }
16079
16080 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
16081         void* e_ptr = untag_ptr(e);
16082         CHECK_ACCESS(e_ptr);
16083         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16084         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16085         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
16086         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
16087         return tag_ptr(ret_conv, true);
16088 }
16089
16090 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
16091         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
16092         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
16093         return ret_conv;
16094 }
16095
16096 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
16097         if (!ptr_is_owned(_res)) return;
16098         void* _res_ptr = untag_ptr(_res);
16099         CHECK_ACCESS(_res_ptr);
16100         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
16101         FREE(untag_ptr(_res));
16102         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
16103 }
16104
16105 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
16106         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
16107         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
16108         return tag_ptr(ret_conv, true);
16109 }
16110 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
16111         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
16112         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
16113         return ret_conv;
16114 }
16115
16116 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
16117         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
16118         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
16119         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
16120         return tag_ptr(ret_conv, true);
16121 }
16122
16123 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
16124         LDKNetworkGraph o_conv;
16125         o_conv.inner = untag_ptr(o);
16126         o_conv.is_owned = ptr_is_owned(o);
16127         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16128         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
16129         
16130         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
16131         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
16132         return tag_ptr(ret_conv, true);
16133 }
16134
16135 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
16136         void* e_ptr = untag_ptr(e);
16137         CHECK_ACCESS(e_ptr);
16138         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16139         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16140         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
16141         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
16142         return tag_ptr(ret_conv, true);
16143 }
16144
16145 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
16146         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
16147         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
16148         return ret_conv;
16149 }
16150
16151 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
16152         if (!ptr_is_owned(_res)) return;
16153         void* _res_ptr = untag_ptr(_res);
16154         CHECK_ACCESS(_res_ptr);
16155         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
16156         FREE(untag_ptr(_res));
16157         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
16158 }
16159
16160 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint64_tArray o) {
16161         LDKCVec_NetAddressZ o_constr;
16162         o_constr.datalen = o->arr_len;
16163         if (o_constr.datalen > 0)
16164                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16165         else
16166                 o_constr.data = NULL;
16167         uint64_t* o_vals = o->elems;
16168         for (size_t m = 0; m < o_constr.datalen; m++) {
16169                 uint64_t o_conv_12 = o_vals[m];
16170                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
16171                 CHECK_ACCESS(o_conv_12_ptr);
16172                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
16173                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
16174                 o_constr.data[m] = o_conv_12_conv;
16175         }
16176         FREE(o);
16177         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
16178         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
16179         uint64_t ret_ref = tag_ptr(ret_copy, true);
16180         return ret_ref;
16181 }
16182
16183 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
16184         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
16185         *ret_copy = COption_CVec_NetAddressZZ_none();
16186         uint64_t ret_ref = tag_ptr(ret_copy, true);
16187         return ret_ref;
16188 }
16189
16190 void  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint64_t _res) {
16191         if (!ptr_is_owned(_res)) return;
16192         void* _res_ptr = untag_ptr(_res);
16193         CHECK_ACCESS(_res_ptr);
16194         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
16195         FREE(untag_ptr(_res));
16196         COption_CVec_NetAddressZZ_free(_res_conv);
16197 }
16198
16199 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
16200         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
16201         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
16202         uint64_t ret_ref = tag_ptr(ret_copy, true);
16203         return ret_ref;
16204 }
16205 int64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint64_t arg) {
16206         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
16207         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
16208         return ret_conv;
16209 }
16210
16211 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint64_t orig) {
16212         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
16213         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
16214         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
16215         uint64_t ret_ref = tag_ptr(ret_copy, true);
16216         return ret_ref;
16217 }
16218
16219 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
16220         LDKDelayedPaymentOutputDescriptor o_conv;
16221         o_conv.inner = untag_ptr(o);
16222         o_conv.is_owned = ptr_is_owned(o);
16223         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16224         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
16225         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16226         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
16227         return tag_ptr(ret_conv, true);
16228 }
16229
16230 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
16231         void* e_ptr = untag_ptr(e);
16232         CHECK_ACCESS(e_ptr);
16233         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16234         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16235         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16236         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
16237         return tag_ptr(ret_conv, true);
16238 }
16239
16240 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
16241         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
16242         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16243         return ret_conv;
16244 }
16245
16246 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
16247         if (!ptr_is_owned(_res)) return;
16248         void* _res_ptr = untag_ptr(_res);
16249         CHECK_ACCESS(_res_ptr);
16250         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
16251         FREE(untag_ptr(_res));
16252         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
16253 }
16254
16255 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16256         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16257         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
16258         return tag_ptr(ret_conv, true);
16259 }
16260 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
16261         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
16262         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16263         return ret_conv;
16264 }
16265
16266 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
16267         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
16268         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16269         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
16270         return tag_ptr(ret_conv, true);
16271 }
16272
16273 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
16274         LDKStaticPaymentOutputDescriptor o_conv;
16275         o_conv.inner = untag_ptr(o);
16276         o_conv.is_owned = ptr_is_owned(o);
16277         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16278         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
16279         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16280         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
16281         return tag_ptr(ret_conv, true);
16282 }
16283
16284 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
16285         void* e_ptr = untag_ptr(e);
16286         CHECK_ACCESS(e_ptr);
16287         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16288         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16289         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16290         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
16291         return tag_ptr(ret_conv, true);
16292 }
16293
16294 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
16295         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
16296         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16297         return ret_conv;
16298 }
16299
16300 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
16301         if (!ptr_is_owned(_res)) return;
16302         void* _res_ptr = untag_ptr(_res);
16303         CHECK_ACCESS(_res_ptr);
16304         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
16305         FREE(untag_ptr(_res));
16306         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
16307 }
16308
16309 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16310         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16311         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
16312         return tag_ptr(ret_conv, true);
16313 }
16314 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
16315         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
16316         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16317         return ret_conv;
16318 }
16319
16320 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
16321         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
16322         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16323         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
16324         return tag_ptr(ret_conv, true);
16325 }
16326
16327 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
16328         void* o_ptr = untag_ptr(o);
16329         CHECK_ACCESS(o_ptr);
16330         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
16331         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
16332         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16333         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
16334         return tag_ptr(ret_conv, true);
16335 }
16336
16337 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
16338         void* e_ptr = untag_ptr(e);
16339         CHECK_ACCESS(e_ptr);
16340         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16341         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16342         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16343         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
16344         return tag_ptr(ret_conv, true);
16345 }
16346
16347 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
16348         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
16349         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16350         return ret_conv;
16351 }
16352
16353 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
16354         if (!ptr_is_owned(_res)) return;
16355         void* _res_ptr = untag_ptr(_res);
16356         CHECK_ACCESS(_res_ptr);
16357         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
16358         FREE(untag_ptr(_res));
16359         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
16360 }
16361
16362 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16363         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16364         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
16365         return tag_ptr(ret_conv, true);
16366 }
16367 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
16368         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
16369         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16370         return ret_conv;
16371 }
16372
16373 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
16374         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
16375         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16376         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
16377         return tag_ptr(ret_conv, true);
16378 }
16379
16380 void  __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
16381         LDKCVec_PaymentPreimageZ _res_constr;
16382         _res_constr.datalen = _res->arr_len;
16383         if (_res_constr.datalen > 0)
16384                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
16385         else
16386                 _res_constr.data = NULL;
16387         int8_tArray* _res_vals = (void*) _res->elems;
16388         for (size_t m = 0; m < _res_constr.datalen; m++) {
16389                 int8_tArray _res_conv_12 = _res_vals[m];
16390                 LDKThirtyTwoBytes _res_conv_12_ref;
16391                 CHECK(_res_conv_12->arr_len == 32);
16392                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
16393                 _res_constr.data[m] = _res_conv_12_ref;
16394         }
16395         FREE(_res);
16396         CVec_PaymentPreimageZ_free(_res_constr);
16397 }
16398
16399 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
16400         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16401         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
16402         return tag_ptr(ret_conv, true);
16403 }
16404 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint64_t arg) {
16405         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
16406         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
16407         return ret_conv;
16408 }
16409
16410 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint64_t orig) {
16411         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
16412         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16413         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
16414         return tag_ptr(ret_conv, true);
16415 }
16416
16417 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
16418         LDKSignature a_ref;
16419         CHECK(a->arr_len == 64);
16420         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
16421         LDKCVec_SignatureZ b_constr;
16422         b_constr.datalen = b->arr_len;
16423         if (b_constr.datalen > 0)
16424                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16425         else
16426                 b_constr.data = NULL;
16427         int8_tArray* b_vals = (void*) b->elems;
16428         for (size_t m = 0; m < b_constr.datalen; m++) {
16429                 int8_tArray b_conv_12 = b_vals[m];
16430                 LDKSignature b_conv_12_ref;
16431                 CHECK(b_conv_12->arr_len == 64);
16432                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
16433                 b_constr.data[m] = b_conv_12_ref;
16434         }
16435         FREE(b);
16436         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16437         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
16438         return tag_ptr(ret_conv, true);
16439 }
16440
16441 void  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint64_t _res) {
16442         if (!ptr_is_owned(_res)) return;
16443         void* _res_ptr = untag_ptr(_res);
16444         CHECK_ACCESS(_res_ptr);
16445         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
16446         FREE(untag_ptr(_res));
16447         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
16448 }
16449
16450 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint64_t o) {
16451         void* o_ptr = untag_ptr(o);
16452         CHECK_ACCESS(o_ptr);
16453         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
16454         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
16455         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16456         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
16457         return tag_ptr(ret_conv, true);
16458 }
16459
16460 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
16461         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16462         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
16463         return tag_ptr(ret_conv, true);
16464 }
16465
16466 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint64_t o) {
16467         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
16468         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
16469         return ret_conv;
16470 }
16471
16472 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint64_t _res) {
16473         if (!ptr_is_owned(_res)) return;
16474         void* _res_ptr = untag_ptr(_res);
16475         CHECK_ACCESS(_res_ptr);
16476         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
16477         FREE(untag_ptr(_res));
16478         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
16479 }
16480
16481 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
16482         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16483         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
16484         return tag_ptr(ret_conv, true);
16485 }
16486 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint64_t arg) {
16487         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
16488         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
16489         return ret_conv;
16490 }
16491
16492 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint64_t orig) {
16493         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
16494         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16495         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
16496         return tag_ptr(ret_conv, true);
16497 }
16498
16499 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
16500         LDKSignature o_ref;
16501         CHECK(o->arr_len == 64);
16502         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
16503         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16504         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
16505         return tag_ptr(ret_conv, true);
16506 }
16507
16508 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
16509         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16510         *ret_conv = CResult_SignatureNoneZ_err();
16511         return tag_ptr(ret_conv, true);
16512 }
16513
16514 jboolean  __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint64_t o) {
16515         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
16516         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
16517         return ret_conv;
16518 }
16519
16520 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint64_t _res) {
16521         if (!ptr_is_owned(_res)) return;
16522         void* _res_ptr = untag_ptr(_res);
16523         CHECK_ACCESS(_res_ptr);
16524         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
16525         FREE(untag_ptr(_res));
16526         CResult_SignatureNoneZ_free(_res_conv);
16527 }
16528
16529 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
16530         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16531         *ret_conv = CResult_SignatureNoneZ_clone(arg);
16532         return tag_ptr(ret_conv, true);
16533 }
16534 int64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint64_t arg) {
16535         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
16536         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
16537         return ret_conv;
16538 }
16539
16540 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint64_t orig) {
16541         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
16542         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16543         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
16544         return tag_ptr(ret_conv, true);
16545 }
16546
16547 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
16548         LDKPublicKey o_ref;
16549         CHECK(o->arr_len == 33);
16550         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
16551         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16552         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
16553         return tag_ptr(ret_conv, true);
16554 }
16555
16556 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
16557         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16558         *ret_conv = CResult_PublicKeyNoneZ_err();
16559         return tag_ptr(ret_conv, true);
16560 }
16561
16562 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
16563         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
16564         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
16565         return ret_conv;
16566 }
16567
16568 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
16569         if (!ptr_is_owned(_res)) return;
16570         void* _res_ptr = untag_ptr(_res);
16571         CHECK_ACCESS(_res_ptr);
16572         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
16573         FREE(untag_ptr(_res));
16574         CResult_PublicKeyNoneZ_free(_res_conv);
16575 }
16576
16577 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
16578         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16579         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
16580         return tag_ptr(ret_conv, true);
16581 }
16582 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
16583         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
16584         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
16585         return ret_conv;
16586 }
16587
16588 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
16589         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
16590         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16591         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
16592         return tag_ptr(ret_conv, true);
16593 }
16594
16595 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_some"))) TS_COption_ScalarZ_some(uint64_t o) {
16596         void* o_ptr = untag_ptr(o);
16597         CHECK_ACCESS(o_ptr);
16598         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
16599         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
16600         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16601         *ret_copy = COption_ScalarZ_some(o_conv);
16602         uint64_t ret_ref = tag_ptr(ret_copy, true);
16603         return ret_ref;
16604 }
16605
16606 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_none"))) TS_COption_ScalarZ_none() {
16607         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16608         *ret_copy = COption_ScalarZ_none();
16609         uint64_t ret_ref = tag_ptr(ret_copy, true);
16610         return ret_ref;
16611 }
16612
16613 void  __attribute__((export_name("TS_COption_ScalarZ_free"))) TS_COption_ScalarZ_free(uint64_t _res) {
16614         if (!ptr_is_owned(_res)) return;
16615         void* _res_ptr = untag_ptr(_res);
16616         CHECK_ACCESS(_res_ptr);
16617         LDKCOption_ScalarZ _res_conv = *(LDKCOption_ScalarZ*)(_res_ptr);
16618         FREE(untag_ptr(_res));
16619         COption_ScalarZ_free(_res_conv);
16620 }
16621
16622 static inline uint64_t COption_ScalarZ_clone_ptr(LDKCOption_ScalarZ *NONNULL_PTR arg) {
16623         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16624         *ret_copy = COption_ScalarZ_clone(arg);
16625         uint64_t ret_ref = tag_ptr(ret_copy, true);
16626         return ret_ref;
16627 }
16628 int64_t  __attribute__((export_name("TS_COption_ScalarZ_clone_ptr"))) TS_COption_ScalarZ_clone_ptr(uint64_t arg) {
16629         LDKCOption_ScalarZ* arg_conv = (LDKCOption_ScalarZ*)untag_ptr(arg);
16630         int64_t ret_conv = COption_ScalarZ_clone_ptr(arg_conv);
16631         return ret_conv;
16632 }
16633
16634 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_clone"))) TS_COption_ScalarZ_clone(uint64_t orig) {
16635         LDKCOption_ScalarZ* orig_conv = (LDKCOption_ScalarZ*)untag_ptr(orig);
16636         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16637         *ret_copy = COption_ScalarZ_clone(orig_conv);
16638         uint64_t ret_ref = tag_ptr(ret_copy, true);
16639         return ret_ref;
16640 }
16641
16642 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_ok"))) TS_CResult_SharedSecretNoneZ_ok(int8_tArray o) {
16643         LDKThirtyTwoBytes o_ref;
16644         CHECK(o->arr_len == 32);
16645         memcpy(o_ref.data, o->elems, 32); FREE(o);
16646         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16647         *ret_conv = CResult_SharedSecretNoneZ_ok(o_ref);
16648         return tag_ptr(ret_conv, true);
16649 }
16650
16651 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_err"))) TS_CResult_SharedSecretNoneZ_err() {
16652         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16653         *ret_conv = CResult_SharedSecretNoneZ_err();
16654         return tag_ptr(ret_conv, true);
16655 }
16656
16657 jboolean  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_is_ok"))) TS_CResult_SharedSecretNoneZ_is_ok(uint64_t o) {
16658         LDKCResult_SharedSecretNoneZ* o_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(o);
16659         jboolean ret_conv = CResult_SharedSecretNoneZ_is_ok(o_conv);
16660         return ret_conv;
16661 }
16662
16663 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_free"))) TS_CResult_SharedSecretNoneZ_free(uint64_t _res) {
16664         if (!ptr_is_owned(_res)) return;
16665         void* _res_ptr = untag_ptr(_res);
16666         CHECK_ACCESS(_res_ptr);
16667         LDKCResult_SharedSecretNoneZ _res_conv = *(LDKCResult_SharedSecretNoneZ*)(_res_ptr);
16668         FREE(untag_ptr(_res));
16669         CResult_SharedSecretNoneZ_free(_res_conv);
16670 }
16671
16672 static inline uint64_t CResult_SharedSecretNoneZ_clone_ptr(LDKCResult_SharedSecretNoneZ *NONNULL_PTR arg) {
16673         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16674         *ret_conv = CResult_SharedSecretNoneZ_clone(arg);
16675         return tag_ptr(ret_conv, true);
16676 }
16677 int64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone_ptr"))) TS_CResult_SharedSecretNoneZ_clone_ptr(uint64_t arg) {
16678         LDKCResult_SharedSecretNoneZ* arg_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(arg);
16679         int64_t ret_conv = CResult_SharedSecretNoneZ_clone_ptr(arg_conv);
16680         return ret_conv;
16681 }
16682
16683 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone"))) TS_CResult_SharedSecretNoneZ_clone(uint64_t orig) {
16684         LDKCResult_SharedSecretNoneZ* orig_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(orig);
16685         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16686         *ret_conv = CResult_SharedSecretNoneZ_clone(orig_conv);
16687         return tag_ptr(ret_conv, true);
16688 }
16689
16690 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
16691         LDKCVec_U5Z _res_constr;
16692         _res_constr.datalen = _res->arr_len;
16693         if (_res_constr.datalen > 0)
16694                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
16695         else
16696                 _res_constr.data = NULL;
16697         int8_t* _res_vals = (void*) _res->elems;
16698         for (size_t h = 0; h < _res_constr.datalen; h++) {
16699                 int8_t _res_conv_7 = _res_vals[h];
16700                 
16701                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
16702         }
16703         FREE(_res);
16704         CVec_U5Z_free(_res_constr);
16705 }
16706
16707 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
16708         LDKRecoverableSignature o_ref;
16709         CHECK(o->arr_len == 68);
16710         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
16711         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16712         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
16713         return tag_ptr(ret_conv, true);
16714 }
16715
16716 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
16717         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16718         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
16719         return tag_ptr(ret_conv, true);
16720 }
16721
16722 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
16723         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
16724         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
16725         return ret_conv;
16726 }
16727
16728 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
16729         if (!ptr_is_owned(_res)) return;
16730         void* _res_ptr = untag_ptr(_res);
16731         CHECK_ACCESS(_res_ptr);
16732         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
16733         FREE(untag_ptr(_res));
16734         CResult_RecoverableSignatureNoneZ_free(_res_conv);
16735 }
16736
16737 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
16738         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16739         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
16740         return tag_ptr(ret_conv, true);
16741 }
16742 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
16743         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
16744         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
16745         return ret_conv;
16746 }
16747
16748 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
16749         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
16750         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16751         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
16752         return tag_ptr(ret_conv, true);
16753 }
16754
16755 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(uint64_t o) {
16756         void* o_ptr = untag_ptr(o);
16757         CHECK_ACCESS(o_ptr);
16758         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
16759         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
16760                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16761                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
16762         }
16763         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16764         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
16765         return tag_ptr(ret_conv, true);
16766 }
16767
16768 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(uint64_t e) {
16769         void* e_ptr = untag_ptr(e);
16770         CHECK_ACCESS(e_ptr);
16771         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16772         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16773         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16774         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
16775         return tag_ptr(ret_conv, true);
16776 }
16777
16778 jboolean  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(uint64_t o) {
16779         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
16780         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
16781         return ret_conv;
16782 }
16783
16784 void  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(uint64_t _res) {
16785         if (!ptr_is_owned(_res)) return;
16786         void* _res_ptr = untag_ptr(_res);
16787         CHECK_ACCESS(_res_ptr);
16788         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
16789         FREE(untag_ptr(_res));
16790         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
16791 }
16792
16793 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
16794         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16795         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
16796         return tag_ptr(ret_conv, true);
16797 }
16798 int64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16799         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
16800         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
16801         return ret_conv;
16802 }
16803
16804 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(uint64_t orig) {
16805         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
16806         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16807         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
16808         return tag_ptr(ret_conv, true);
16809 }
16810
16811 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
16812         LDKCVec_CVec_u8ZZ _res_constr;
16813         _res_constr.datalen = _res->arr_len;
16814         if (_res_constr.datalen > 0)
16815                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16816         else
16817                 _res_constr.data = NULL;
16818         int8_tArray* _res_vals = (void*) _res->elems;
16819         for (size_t m = 0; m < _res_constr.datalen; m++) {
16820                 int8_tArray _res_conv_12 = _res_vals[m];
16821                 LDKCVec_u8Z _res_conv_12_ref;
16822                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
16823                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16824                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
16825                 _res_constr.data[m] = _res_conv_12_ref;
16826         }
16827         FREE(_res);
16828         CVec_CVec_u8ZZ_free(_res_constr);
16829 }
16830
16831 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
16832         LDKCVec_CVec_u8ZZ o_constr;
16833         o_constr.datalen = o->arr_len;
16834         if (o_constr.datalen > 0)
16835                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16836         else
16837                 o_constr.data = NULL;
16838         int8_tArray* o_vals = (void*) o->elems;
16839         for (size_t m = 0; m < o_constr.datalen; m++) {
16840                 int8_tArray o_conv_12 = o_vals[m];
16841                 LDKCVec_u8Z o_conv_12_ref;
16842                 o_conv_12_ref.datalen = o_conv_12->arr_len;
16843                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16844                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
16845                 o_constr.data[m] = o_conv_12_ref;
16846         }
16847         FREE(o);
16848         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16849         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
16850         return tag_ptr(ret_conv, true);
16851 }
16852
16853 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
16854         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16855         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
16856         return tag_ptr(ret_conv, true);
16857 }
16858
16859 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
16860         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
16861         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
16862         return ret_conv;
16863 }
16864
16865 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
16866         if (!ptr_is_owned(_res)) return;
16867         void* _res_ptr = untag_ptr(_res);
16868         CHECK_ACCESS(_res_ptr);
16869         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
16870         FREE(untag_ptr(_res));
16871         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
16872 }
16873
16874 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
16875         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16876         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
16877         return tag_ptr(ret_conv, true);
16878 }
16879 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
16880         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
16881         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
16882         return ret_conv;
16883 }
16884
16885 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
16886         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
16887         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16888         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
16889         return tag_ptr(ret_conv, true);
16890 }
16891
16892 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
16893         LDKInMemorySigner o_conv;
16894         o_conv.inner = untag_ptr(o);
16895         o_conv.is_owned = ptr_is_owned(o);
16896         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16897         o_conv = InMemorySigner_clone(&o_conv);
16898         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16899         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
16900         return tag_ptr(ret_conv, true);
16901 }
16902
16903 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
16904         void* e_ptr = untag_ptr(e);
16905         CHECK_ACCESS(e_ptr);
16906         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16907         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16908         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16909         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
16910         return tag_ptr(ret_conv, true);
16911 }
16912
16913 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
16914         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
16915         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
16916         return ret_conv;
16917 }
16918
16919 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
16920         if (!ptr_is_owned(_res)) return;
16921         void* _res_ptr = untag_ptr(_res);
16922         CHECK_ACCESS(_res_ptr);
16923         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
16924         FREE(untag_ptr(_res));
16925         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
16926 }
16927
16928 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
16929         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16930         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
16931         return tag_ptr(ret_conv, true);
16932 }
16933 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16934         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
16935         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
16936         return ret_conv;
16937 }
16938
16939 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
16940         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
16941         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16942         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
16943         return tag_ptr(ret_conv, true);
16944 }
16945
16946 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
16947         LDKCVec_TxOutZ _res_constr;
16948         _res_constr.datalen = _res->arr_len;
16949         if (_res_constr.datalen > 0)
16950                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16951         else
16952                 _res_constr.data = NULL;
16953         uint64_t* _res_vals = _res->elems;
16954         for (size_t h = 0; h < _res_constr.datalen; h++) {
16955                 uint64_t _res_conv_7 = _res_vals[h];
16956                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
16957                 CHECK_ACCESS(_res_conv_7_ptr);
16958                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
16959                 FREE(untag_ptr(_res_conv_7));
16960                 _res_constr.data[h] = _res_conv_7_conv;
16961         }
16962         FREE(_res);
16963         CVec_TxOutZ_free(_res_constr);
16964 }
16965
16966 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
16967         LDKTransaction o_ref;
16968         o_ref.datalen = o->arr_len;
16969         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
16970         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16971         o_ref.data_is_owned = true;
16972         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16973         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
16974         return tag_ptr(ret_conv, true);
16975 }
16976
16977 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
16978         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16979         *ret_conv = CResult_TransactionNoneZ_err();
16980         return tag_ptr(ret_conv, true);
16981 }
16982
16983 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
16984         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
16985         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
16986         return ret_conv;
16987 }
16988
16989 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
16990         if (!ptr_is_owned(_res)) return;
16991         void* _res_ptr = untag_ptr(_res);
16992         CHECK_ACCESS(_res_ptr);
16993         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
16994         FREE(untag_ptr(_res));
16995         CResult_TransactionNoneZ_free(_res_conv);
16996 }
16997
16998 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
16999         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17000         *ret_conv = CResult_TransactionNoneZ_clone(arg);
17001         return tag_ptr(ret_conv, true);
17002 }
17003 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
17004         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
17005         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
17006         return ret_conv;
17007 }
17008
17009 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
17010         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
17011         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17012         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
17013         return tag_ptr(ret_conv, true);
17014 }
17015
17016 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
17017         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17018         *ret_copy = COption_u16Z_some(o);
17019         uint64_t ret_ref = tag_ptr(ret_copy, true);
17020         return ret_ref;
17021 }
17022
17023 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
17024         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17025         *ret_copy = COption_u16Z_none();
17026         uint64_t ret_ref = tag_ptr(ret_copy, true);
17027         return ret_ref;
17028 }
17029
17030 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
17031         if (!ptr_is_owned(_res)) return;
17032         void* _res_ptr = untag_ptr(_res);
17033         CHECK_ACCESS(_res_ptr);
17034         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
17035         FREE(untag_ptr(_res));
17036         COption_u16Z_free(_res_conv);
17037 }
17038
17039 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
17040         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17041         *ret_copy = COption_u16Z_clone(arg);
17042         uint64_t ret_ref = tag_ptr(ret_copy, true);
17043         return ret_ref;
17044 }
17045 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
17046         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
17047         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
17048         return ret_conv;
17049 }
17050
17051 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
17052         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
17053         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17054         *ret_copy = COption_u16Z_clone(orig_conv);
17055         uint64_t ret_ref = tag_ptr(ret_copy, true);
17056         return ret_ref;
17057 }
17058
17059 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
17060         LDKThirtyTwoBytes o_ref;
17061         CHECK(o->arr_len == 32);
17062         memcpy(o_ref.data, o->elems, 32); FREE(o);
17063         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17064         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
17065         return tag_ptr(ret_conv, true);
17066 }
17067
17068 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint64_t e) {
17069         void* e_ptr = untag_ptr(e);
17070         CHECK_ACCESS(e_ptr);
17071         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17072         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17073         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17074         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
17075         return tag_ptr(ret_conv, true);
17076 }
17077
17078 jboolean  __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint64_t o) {
17079         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
17080         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
17081         return ret_conv;
17082 }
17083
17084 void  __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint64_t _res) {
17085         if (!ptr_is_owned(_res)) return;
17086         void* _res_ptr = untag_ptr(_res);
17087         CHECK_ACCESS(_res_ptr);
17088         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
17089         FREE(untag_ptr(_res));
17090         CResult__u832APIErrorZ_free(_res_conv);
17091 }
17092
17093 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
17094         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17095         *ret_conv = CResult__u832APIErrorZ_clone(arg);
17096         return tag_ptr(ret_conv, true);
17097 }
17098 int64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint64_t arg) {
17099         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
17100         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
17101         return ret_conv;
17102 }
17103
17104 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint64_t orig) {
17105         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
17106         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17107         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
17108         return tag_ptr(ret_conv, true);
17109 }
17110
17111 void  __attribute__((export_name("TS_CVec_RecentPaymentDetailsZ_free"))) TS_CVec_RecentPaymentDetailsZ_free(uint64_tArray _res) {
17112         LDKCVec_RecentPaymentDetailsZ _res_constr;
17113         _res_constr.datalen = _res->arr_len;
17114         if (_res_constr.datalen > 0)
17115                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
17116         else
17117                 _res_constr.data = NULL;
17118         uint64_t* _res_vals = _res->elems;
17119         for (size_t w = 0; w < _res_constr.datalen; w++) {
17120                 uint64_t _res_conv_22 = _res_vals[w];
17121                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
17122                 CHECK_ACCESS(_res_conv_22_ptr);
17123                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
17124                 FREE(untag_ptr(_res_conv_22));
17125                 _res_constr.data[w] = _res_conv_22_conv;
17126         }
17127         FREE(_res);
17128         CVec_RecentPaymentDetailsZ_free(_res_constr);
17129 }
17130
17131 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
17132         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17133         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
17134         return tag_ptr(ret_conv, true);
17135 }
17136
17137 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
17138         void* e_ptr = untag_ptr(e);
17139         CHECK_ACCESS(e_ptr);
17140         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17141         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
17142         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17143         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
17144         return tag_ptr(ret_conv, true);
17145 }
17146
17147 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
17148         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
17149         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
17150         return ret_conv;
17151 }
17152
17153 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
17154         if (!ptr_is_owned(_res)) return;
17155         void* _res_ptr = untag_ptr(_res);
17156         CHECK_ACCESS(_res_ptr);
17157         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
17158         FREE(untag_ptr(_res));
17159         CResult_NonePaymentSendFailureZ_free(_res_conv);
17160 }
17161
17162 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
17163         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17164         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
17165         return tag_ptr(ret_conv, true);
17166 }
17167 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
17168         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
17169         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
17170         return ret_conv;
17171 }
17172
17173 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
17174         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
17175         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17176         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
17177         return tag_ptr(ret_conv, true);
17178 }
17179
17180 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_ok"))) TS_CResult_NoneRetryableSendFailureZ_ok() {
17181         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
17182         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
17183         return tag_ptr(ret_conv, true);
17184 }
17185
17186 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_err"))) TS_CResult_NoneRetryableSendFailureZ_err(uint32_t e) {
17187         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
17188         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
17189         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
17190         return tag_ptr(ret_conv, true);
17191 }
17192
17193 jboolean  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_is_ok"))) TS_CResult_NoneRetryableSendFailureZ_is_ok(uint64_t o) {
17194         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
17195         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
17196         return ret_conv;
17197 }
17198
17199 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_free"))) TS_CResult_NoneRetryableSendFailureZ_free(uint64_t _res) {
17200         if (!ptr_is_owned(_res)) return;
17201         void* _res_ptr = untag_ptr(_res);
17202         CHECK_ACCESS(_res_ptr);
17203         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
17204         FREE(untag_ptr(_res));
17205         CResult_NoneRetryableSendFailureZ_free(_res_conv);
17206 }
17207
17208 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
17209         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
17210         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
17211         return tag_ptr(ret_conv, true);
17212 }
17213 int64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone_ptr"))) TS_CResult_NoneRetryableSendFailureZ_clone_ptr(uint64_t arg) {
17214         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
17215         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
17216         return ret_conv;
17217 }
17218
17219 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone"))) TS_CResult_NoneRetryableSendFailureZ_clone(uint64_t orig) {
17220         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
17221         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
17222         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
17223         return tag_ptr(ret_conv, true);
17224 }
17225
17226 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) {
17227         LDKThirtyTwoBytes o_ref;
17228         CHECK(o->arr_len == 32);
17229         memcpy(o_ref.data, o->elems, 32); FREE(o);
17230         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
17231         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
17232         return tag_ptr(ret_conv, true);
17233 }
17234
17235 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint64_t e) {
17236         void* e_ptr = untag_ptr(e);
17237         CHECK_ACCESS(e_ptr);
17238         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17239         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
17240         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
17241         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
17242         return tag_ptr(ret_conv, true);
17243 }
17244
17245 jboolean  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_is_ok(uint64_t o) {
17246         LDKCResult_PaymentHashPaymentSendFailureZ* o_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(o);
17247         jboolean ret_conv = CResult_PaymentHashPaymentSendFailureZ_is_ok(o_conv);
17248         return ret_conv;
17249 }
17250
17251 void  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_free"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint64_t _res) {
17252         if (!ptr_is_owned(_res)) return;
17253         void* _res_ptr = untag_ptr(_res);
17254         CHECK_ACCESS(_res_ptr);
17255         LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(_res_ptr);
17256         FREE(untag_ptr(_res));
17257         CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
17258 }
17259
17260 static inline uint64_t CResult_PaymentHashPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR arg) {
17261         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
17262         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(arg);
17263         return tag_ptr(ret_conv, true);
17264 }
17265 int64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr(uint64_t arg) {
17266         LDKCResult_PaymentHashPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(arg);
17267         int64_t ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone_ptr(arg_conv);
17268         return ret_conv;
17269 }
17270
17271 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint64_t orig) {
17272         LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(orig);
17273         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
17274         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
17275         return tag_ptr(ret_conv, true);
17276 }
17277
17278 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_ok(int8_tArray o) {
17279         LDKThirtyTwoBytes o_ref;
17280         CHECK(o->arr_len == 32);
17281         memcpy(o_ref.data, o->elems, 32); FREE(o);
17282         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
17283         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_ok(o_ref);
17284         return tag_ptr(ret_conv, true);
17285 }
17286
17287 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_err"))) TS_CResult_PaymentHashRetryableSendFailureZ_err(uint32_t e) {
17288         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
17289         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
17290         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_err(e_conv);
17291         return tag_ptr(ret_conv, true);
17292 }
17293
17294 jboolean  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_is_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_is_ok(uint64_t o) {
17295         LDKCResult_PaymentHashRetryableSendFailureZ* o_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(o);
17296         jboolean ret_conv = CResult_PaymentHashRetryableSendFailureZ_is_ok(o_conv);
17297         return ret_conv;
17298 }
17299
17300 void  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_free"))) TS_CResult_PaymentHashRetryableSendFailureZ_free(uint64_t _res) {
17301         if (!ptr_is_owned(_res)) return;
17302         void* _res_ptr = untag_ptr(_res);
17303         CHECK_ACCESS(_res_ptr);
17304         LDKCResult_PaymentHashRetryableSendFailureZ _res_conv = *(LDKCResult_PaymentHashRetryableSendFailureZ*)(_res_ptr);
17305         FREE(untag_ptr(_res));
17306         CResult_PaymentHashRetryableSendFailureZ_free(_res_conv);
17307 }
17308
17309 static inline uint64_t CResult_PaymentHashRetryableSendFailureZ_clone_ptr(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR arg) {
17310         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
17311         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(arg);
17312         return tag_ptr(ret_conv, true);
17313 }
17314 int64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashRetryableSendFailureZ_clone_ptr(uint64_t arg) {
17315         LDKCResult_PaymentHashRetryableSendFailureZ* arg_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(arg);
17316         int64_t ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone_ptr(arg_conv);
17317         return ret_conv;
17318 }
17319
17320 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_clone"))) TS_CResult_PaymentHashRetryableSendFailureZ_clone(uint64_t orig) {
17321         LDKCResult_PaymentHashRetryableSendFailureZ* orig_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(orig);
17322         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
17323         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(orig_conv);
17324         return tag_ptr(ret_conv, true);
17325 }
17326
17327 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
17328         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17329         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
17330         return tag_ptr(ret_conv, true);
17331 }
17332 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint64_t arg) {
17333         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
17334         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
17335         return ret_conv;
17336 }
17337
17338 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint64_t orig) {
17339         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
17340         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17341         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
17342         return tag_ptr(ret_conv, true);
17343 }
17344
17345 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
17346         LDKThirtyTwoBytes a_ref;
17347         CHECK(a->arr_len == 32);
17348         memcpy(a_ref.data, a->elems, 32); FREE(a);
17349         LDKThirtyTwoBytes b_ref;
17350         CHECK(b->arr_len == 32);
17351         memcpy(b_ref.data, b->elems, 32); FREE(b);
17352         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17353         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
17354         return tag_ptr(ret_conv, true);
17355 }
17356
17357 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint64_t _res) {
17358         if (!ptr_is_owned(_res)) return;
17359         void* _res_ptr = untag_ptr(_res);
17360         CHECK_ACCESS(_res_ptr);
17361         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
17362         FREE(untag_ptr(_res));
17363         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
17364 }
17365
17366 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint64_t o) {
17367         void* o_ptr = untag_ptr(o);
17368         CHECK_ACCESS(o_ptr);
17369         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
17370         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
17371         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17372         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
17373         return tag_ptr(ret_conv, true);
17374 }
17375
17376 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint64_t e) {
17377         void* e_ptr = untag_ptr(e);
17378         CHECK_ACCESS(e_ptr);
17379         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17380         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
17381         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17382         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
17383         return tag_ptr(ret_conv, true);
17384 }
17385
17386 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint64_t o) {
17387         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
17388         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
17389         return ret_conv;
17390 }
17391
17392 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint64_t _res) {
17393         if (!ptr_is_owned(_res)) return;
17394         void* _res_ptr = untag_ptr(_res);
17395         CHECK_ACCESS(_res_ptr);
17396         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
17397         FREE(untag_ptr(_res));
17398         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
17399 }
17400
17401 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
17402         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17403         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
17404         return tag_ptr(ret_conv, true);
17405 }
17406 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
17407         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
17408         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
17409         return ret_conv;
17410 }
17411
17412 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint64_t orig) {
17413         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
17414         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17415         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
17416         return tag_ptr(ret_conv, true);
17417 }
17418
17419 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
17420         LDKCVec_ThirtyTwoBytesZ _res_constr;
17421         _res_constr.datalen = _res->arr_len;
17422         if (_res_constr.datalen > 0)
17423                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
17424         else
17425                 _res_constr.data = NULL;
17426         int8_tArray* _res_vals = (void*) _res->elems;
17427         for (size_t m = 0; m < _res_constr.datalen; m++) {
17428                 int8_tArray _res_conv_12 = _res_vals[m];
17429                 LDKThirtyTwoBytes _res_conv_12_ref;
17430                 CHECK(_res_conv_12->arr_len == 32);
17431                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
17432                 _res_constr.data[m] = _res_conv_12_ref;
17433         }
17434         FREE(_res);
17435         CVec_ThirtyTwoBytesZ_free(_res_constr);
17436 }
17437
17438 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
17439         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17440         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
17441         return tag_ptr(ret_conv, true);
17442 }
17443 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint64_t arg) {
17444         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
17445         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
17446         return ret_conv;
17447 }
17448
17449 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint64_t orig) {
17450         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
17451         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17452         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
17453         return tag_ptr(ret_conv, true);
17454 }
17455
17456 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
17457         LDKThirtyTwoBytes a_ref;
17458         CHECK(a->arr_len == 32);
17459         memcpy(a_ref.data, a->elems, 32); FREE(a);
17460         LDKThirtyTwoBytes b_ref;
17461         CHECK(b->arr_len == 32);
17462         memcpy(b_ref.data, b->elems, 32); FREE(b);
17463         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17464         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
17465         return tag_ptr(ret_conv, true);
17466 }
17467
17468 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint64_t _res) {
17469         if (!ptr_is_owned(_res)) return;
17470         void* _res_ptr = untag_ptr(_res);
17471         CHECK_ACCESS(_res_ptr);
17472         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
17473         FREE(untag_ptr(_res));
17474         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
17475 }
17476
17477 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint64_t o) {
17478         void* o_ptr = untag_ptr(o);
17479         CHECK_ACCESS(o_ptr);
17480         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
17481         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
17482         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17483         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
17484         return tag_ptr(ret_conv, true);
17485 }
17486
17487 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
17488         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17489         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
17490         return tag_ptr(ret_conv, true);
17491 }
17492
17493 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint64_t o) {
17494         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
17495         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
17496         return ret_conv;
17497 }
17498
17499 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint64_t _res) {
17500         if (!ptr_is_owned(_res)) return;
17501         void* _res_ptr = untag_ptr(_res);
17502         CHECK_ACCESS(_res_ptr);
17503         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
17504         FREE(untag_ptr(_res));
17505         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
17506 }
17507
17508 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
17509         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17510         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
17511         return tag_ptr(ret_conv, true);
17512 }
17513 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint64_t arg) {
17514         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
17515         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
17516         return ret_conv;
17517 }
17518
17519 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint64_t orig) {
17520         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
17521         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17522         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
17523         return tag_ptr(ret_conv, true);
17524 }
17525
17526 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint64_t o) {
17527         void* o_ptr = untag_ptr(o);
17528         CHECK_ACCESS(o_ptr);
17529         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
17530         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
17531         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17532         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
17533         return tag_ptr(ret_conv, true);
17534 }
17535
17536 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint64_t e) {
17537         void* e_ptr = untag_ptr(e);
17538         CHECK_ACCESS(e_ptr);
17539         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17540         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17541         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17542         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
17543         return tag_ptr(ret_conv, true);
17544 }
17545
17546 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint64_t o) {
17547         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
17548         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
17549         return ret_conv;
17550 }
17551
17552 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint64_t _res) {
17553         if (!ptr_is_owned(_res)) return;
17554         void* _res_ptr = untag_ptr(_res);
17555         CHECK_ACCESS(_res_ptr);
17556         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
17557         FREE(untag_ptr(_res));
17558         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
17559 }
17560
17561 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
17562         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17563         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
17564         return tag_ptr(ret_conv, true);
17565 }
17566 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint64_t arg) {
17567         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
17568         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
17569         return ret_conv;
17570 }
17571
17572 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint64_t orig) {
17573         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
17574         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17575         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
17576         return tag_ptr(ret_conv, true);
17577 }
17578
17579 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
17580         LDKThirtyTwoBytes o_ref;
17581         CHECK(o->arr_len == 32);
17582         memcpy(o_ref.data, o->elems, 32); FREE(o);
17583         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17584         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
17585         return tag_ptr(ret_conv, true);
17586 }
17587
17588 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
17589         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17590         *ret_conv = CResult_PaymentSecretNoneZ_err();
17591         return tag_ptr(ret_conv, true);
17592 }
17593
17594 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint64_t o) {
17595         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
17596         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
17597         return ret_conv;
17598 }
17599
17600 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint64_t _res) {
17601         if (!ptr_is_owned(_res)) return;
17602         void* _res_ptr = untag_ptr(_res);
17603         CHECK_ACCESS(_res_ptr);
17604         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
17605         FREE(untag_ptr(_res));
17606         CResult_PaymentSecretNoneZ_free(_res_conv);
17607 }
17608
17609 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
17610         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17611         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
17612         return tag_ptr(ret_conv, true);
17613 }
17614 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint64_t arg) {
17615         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
17616         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
17617         return ret_conv;
17618 }
17619
17620 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint64_t orig) {
17621         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
17622         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17623         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
17624         return tag_ptr(ret_conv, true);
17625 }
17626
17627 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
17628         LDKThirtyTwoBytes o_ref;
17629         CHECK(o->arr_len == 32);
17630         memcpy(o_ref.data, o->elems, 32); FREE(o);
17631         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17632         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
17633         return tag_ptr(ret_conv, true);
17634 }
17635
17636 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint64_t e) {
17637         void* e_ptr = untag_ptr(e);
17638         CHECK_ACCESS(e_ptr);
17639         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17640         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17641         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17642         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
17643         return tag_ptr(ret_conv, true);
17644 }
17645
17646 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint64_t o) {
17647         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
17648         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
17649         return ret_conv;
17650 }
17651
17652 void  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint64_t _res) {
17653         if (!ptr_is_owned(_res)) return;
17654         void* _res_ptr = untag_ptr(_res);
17655         CHECK_ACCESS(_res_ptr);
17656         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
17657         FREE(untag_ptr(_res));
17658         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
17659 }
17660
17661 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
17662         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17663         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
17664         return tag_ptr(ret_conv, true);
17665 }
17666 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint64_t arg) {
17667         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
17668         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
17669         return ret_conv;
17670 }
17671
17672 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint64_t orig) {
17673         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
17674         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17675         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
17676         return tag_ptr(ret_conv, true);
17677 }
17678
17679 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
17680         LDKThirtyTwoBytes o_ref;
17681         CHECK(o->arr_len == 32);
17682         memcpy(o_ref.data, o->elems, 32); FREE(o);
17683         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17684         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
17685         return tag_ptr(ret_conv, true);
17686 }
17687
17688 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint64_t e) {
17689         void* e_ptr = untag_ptr(e);
17690         CHECK_ACCESS(e_ptr);
17691         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17692         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17693         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17694         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
17695         return tag_ptr(ret_conv, true);
17696 }
17697
17698 jboolean  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint64_t o) {
17699         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
17700         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
17701         return ret_conv;
17702 }
17703
17704 void  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint64_t _res) {
17705         if (!ptr_is_owned(_res)) return;
17706         void* _res_ptr = untag_ptr(_res);
17707         CHECK_ACCESS(_res_ptr);
17708         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
17709         FREE(untag_ptr(_res));
17710         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
17711 }
17712
17713 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
17714         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17715         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
17716         return tag_ptr(ret_conv, true);
17717 }
17718 int64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint64_t arg) {
17719         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
17720         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
17721         return ret_conv;
17722 }
17723
17724 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint64_t orig) {
17725         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
17726         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17727         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
17728         return tag_ptr(ret_conv, true);
17729 }
17730
17731 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
17732         LDKCounterpartyForwardingInfo o_conv;
17733         o_conv.inner = untag_ptr(o);
17734         o_conv.is_owned = ptr_is_owned(o);
17735         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17736         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
17737         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17738         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
17739         return tag_ptr(ret_conv, true);
17740 }
17741
17742 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
17743         void* e_ptr = untag_ptr(e);
17744         CHECK_ACCESS(e_ptr);
17745         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17746         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17747         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17748         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
17749         return tag_ptr(ret_conv, true);
17750 }
17751
17752 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
17753         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
17754         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
17755         return ret_conv;
17756 }
17757
17758 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
17759         if (!ptr_is_owned(_res)) return;
17760         void* _res_ptr = untag_ptr(_res);
17761         CHECK_ACCESS(_res_ptr);
17762         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
17763         FREE(untag_ptr(_res));
17764         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
17765 }
17766
17767 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
17768         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17769         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
17770         return tag_ptr(ret_conv, true);
17771 }
17772 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
17773         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
17774         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
17775         return ret_conv;
17776 }
17777
17778 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
17779         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
17780         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17781         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
17782         return tag_ptr(ret_conv, true);
17783 }
17784
17785 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
17786         LDKChannelCounterparty o_conv;
17787         o_conv.inner = untag_ptr(o);
17788         o_conv.is_owned = ptr_is_owned(o);
17789         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17790         o_conv = ChannelCounterparty_clone(&o_conv);
17791         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17792         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
17793         return tag_ptr(ret_conv, true);
17794 }
17795
17796 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
17797         void* e_ptr = untag_ptr(e);
17798         CHECK_ACCESS(e_ptr);
17799         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17800         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17801         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17802         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
17803         return tag_ptr(ret_conv, true);
17804 }
17805
17806 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
17807         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
17808         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
17809         return ret_conv;
17810 }
17811
17812 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
17813         if (!ptr_is_owned(_res)) return;
17814         void* _res_ptr = untag_ptr(_res);
17815         CHECK_ACCESS(_res_ptr);
17816         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
17817         FREE(untag_ptr(_res));
17818         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
17819 }
17820
17821 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
17822         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17823         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
17824         return tag_ptr(ret_conv, true);
17825 }
17826 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
17827         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
17828         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
17829         return ret_conv;
17830 }
17831
17832 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
17833         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
17834         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17835         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
17836         return tag_ptr(ret_conv, true);
17837 }
17838
17839 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
17840         LDKChannelDetails o_conv;
17841         o_conv.inner = untag_ptr(o);
17842         o_conv.is_owned = ptr_is_owned(o);
17843         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17844         o_conv = ChannelDetails_clone(&o_conv);
17845         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17846         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
17847         return tag_ptr(ret_conv, true);
17848 }
17849
17850 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
17851         void* e_ptr = untag_ptr(e);
17852         CHECK_ACCESS(e_ptr);
17853         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17854         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17855         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17856         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
17857         return tag_ptr(ret_conv, true);
17858 }
17859
17860 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
17861         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
17862         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
17863         return ret_conv;
17864 }
17865
17866 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
17867         if (!ptr_is_owned(_res)) return;
17868         void* _res_ptr = untag_ptr(_res);
17869         CHECK_ACCESS(_res_ptr);
17870         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
17871         FREE(untag_ptr(_res));
17872         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
17873 }
17874
17875 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
17876         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17877         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
17878         return tag_ptr(ret_conv, true);
17879 }
17880 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
17881         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
17882         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
17883         return ret_conv;
17884 }
17885
17886 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
17887         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
17888         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17889         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
17890         return tag_ptr(ret_conv, true);
17891 }
17892
17893 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
17894         LDKPhantomRouteHints o_conv;
17895         o_conv.inner = untag_ptr(o);
17896         o_conv.is_owned = ptr_is_owned(o);
17897         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17898         o_conv = PhantomRouteHints_clone(&o_conv);
17899         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17900         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
17901         return tag_ptr(ret_conv, true);
17902 }
17903
17904 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
17905         void* e_ptr = untag_ptr(e);
17906         CHECK_ACCESS(e_ptr);
17907         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17908         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17909         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17910         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
17911         return tag_ptr(ret_conv, true);
17912 }
17913
17914 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
17915         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
17916         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
17917         return ret_conv;
17918 }
17919
17920 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
17921         if (!ptr_is_owned(_res)) return;
17922         void* _res_ptr = untag_ptr(_res);
17923         CHECK_ACCESS(_res_ptr);
17924         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
17925         FREE(untag_ptr(_res));
17926         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
17927 }
17928
17929 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
17930         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17931         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
17932         return tag_ptr(ret_conv, true);
17933 }
17934 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
17935         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
17936         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
17937         return ret_conv;
17938 }
17939
17940 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
17941         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
17942         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17943         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
17944         return tag_ptr(ret_conv, true);
17945 }
17946
17947 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
17948         LDKCVec_ChannelMonitorZ _res_constr;
17949         _res_constr.datalen = _res->arr_len;
17950         if (_res_constr.datalen > 0)
17951                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
17952         else
17953                 _res_constr.data = NULL;
17954         uint64_t* _res_vals = _res->elems;
17955         for (size_t q = 0; q < _res_constr.datalen; q++) {
17956                 uint64_t _res_conv_16 = _res_vals[q];
17957                 LDKChannelMonitor _res_conv_16_conv;
17958                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
17959                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
17960                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17961                 _res_constr.data[q] = _res_conv_16_conv;
17962         }
17963         FREE(_res);
17964         CVec_ChannelMonitorZ_free(_res_constr);
17965 }
17966
17967 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint64_t b) {
17968         LDKThirtyTwoBytes a_ref;
17969         CHECK(a->arr_len == 32);
17970         memcpy(a_ref.data, a->elems, 32); FREE(a);
17971         LDKChannelManager b_conv;
17972         b_conv.inner = untag_ptr(b);
17973         b_conv.is_owned = ptr_is_owned(b);
17974         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17975         // WARNING: we need a move here but no clone is available for LDKChannelManager
17976         
17977         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
17978         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
17979         return tag_ptr(ret_conv, true);
17980 }
17981
17982 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint64_t _res) {
17983         if (!ptr_is_owned(_res)) return;
17984         void* _res_ptr = untag_ptr(_res);
17985         CHECK_ACCESS(_res_ptr);
17986         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
17987         FREE(untag_ptr(_res));
17988         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
17989 }
17990
17991 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint64_t o) {
17992         void* o_ptr = untag_ptr(o);
17993         CHECK_ACCESS(o_ptr);
17994         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
17995         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
17996         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
17997         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
17998         return tag_ptr(ret_conv, true);
17999 }
18000
18001 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint64_t e) {
18002         void* e_ptr = untag_ptr(e);
18003         CHECK_ACCESS(e_ptr);
18004         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18005         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18006         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
18007         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
18008         return tag_ptr(ret_conv, true);
18009 }
18010
18011 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
18012         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
18013         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
18014         return ret_conv;
18015 }
18016
18017 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint64_t _res) {
18018         if (!ptr_is_owned(_res)) return;
18019         void* _res_ptr = untag_ptr(_res);
18020         CHECK_ACCESS(_res_ptr);
18021         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
18022         FREE(untag_ptr(_res));
18023         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
18024 }
18025
18026 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
18027         LDKChannelConfig o_conv;
18028         o_conv.inner = untag_ptr(o);
18029         o_conv.is_owned = ptr_is_owned(o);
18030         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18031         o_conv = ChannelConfig_clone(&o_conv);
18032         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18033         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
18034         return tag_ptr(ret_conv, true);
18035 }
18036
18037 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
18038         void* e_ptr = untag_ptr(e);
18039         CHECK_ACCESS(e_ptr);
18040         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18041         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18042         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18043         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
18044         return tag_ptr(ret_conv, true);
18045 }
18046
18047 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
18048         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
18049         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
18050         return ret_conv;
18051 }
18052
18053 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
18054         if (!ptr_is_owned(_res)) return;
18055         void* _res_ptr = untag_ptr(_res);
18056         CHECK_ACCESS(_res_ptr);
18057         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
18058         FREE(untag_ptr(_res));
18059         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
18060 }
18061
18062 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
18063         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18064         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
18065         return tag_ptr(ret_conv, true);
18066 }
18067 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
18068         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
18069         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
18070         return ret_conv;
18071 }
18072
18073 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
18074         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
18075         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18076         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
18077         return tag_ptr(ret_conv, true);
18078 }
18079
18080 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_some"))) TS_COption_APIErrorZ_some(uint64_t o) {
18081         void* o_ptr = untag_ptr(o);
18082         CHECK_ACCESS(o_ptr);
18083         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
18084         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
18085         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
18086         *ret_copy = COption_APIErrorZ_some(o_conv);
18087         uint64_t ret_ref = tag_ptr(ret_copy, true);
18088         return ret_ref;
18089 }
18090
18091 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_none"))) TS_COption_APIErrorZ_none() {
18092         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
18093         *ret_copy = COption_APIErrorZ_none();
18094         uint64_t ret_ref = tag_ptr(ret_copy, true);
18095         return ret_ref;
18096 }
18097
18098 void  __attribute__((export_name("TS_COption_APIErrorZ_free"))) TS_COption_APIErrorZ_free(uint64_t _res) {
18099         if (!ptr_is_owned(_res)) return;
18100         void* _res_ptr = untag_ptr(_res);
18101         CHECK_ACCESS(_res_ptr);
18102         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
18103         FREE(untag_ptr(_res));
18104         COption_APIErrorZ_free(_res_conv);
18105 }
18106
18107 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
18108         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
18109         *ret_copy = COption_APIErrorZ_clone(arg);
18110         uint64_t ret_ref = tag_ptr(ret_copy, true);
18111         return ret_ref;
18112 }
18113 int64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone_ptr"))) TS_COption_APIErrorZ_clone_ptr(uint64_t arg) {
18114         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
18115         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
18116         return ret_conv;
18117 }
18118
18119 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone"))) TS_COption_APIErrorZ_clone(uint64_t orig) {
18120         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
18121         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
18122         *ret_copy = COption_APIErrorZ_clone(orig_conv);
18123         uint64_t ret_ref = tag_ptr(ret_copy, true);
18124         return ret_ref;
18125 }
18126
18127 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_ok(uint64_t o) {
18128         void* o_ptr = untag_ptr(o);
18129         CHECK_ACCESS(o_ptr);
18130         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
18131         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
18132         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
18133         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
18134         return tag_ptr(ret_conv, true);
18135 }
18136
18137 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_err(uint64_t e) {
18138         void* e_ptr = untag_ptr(e);
18139         CHECK_ACCESS(e_ptr);
18140         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18141         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18142         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
18143         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
18144         return tag_ptr(ret_conv, true);
18145 }
18146
18147 jboolean  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok(uint64_t o) {
18148         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
18149         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
18150         return ret_conv;
18151 }
18152
18153 void  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_free"))) TS_CResult_COption_APIErrorZDecodeErrorZ_free(uint64_t _res) {
18154         if (!ptr_is_owned(_res)) return;
18155         void* _res_ptr = untag_ptr(_res);
18156         CHECK_ACCESS(_res_ptr);
18157         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
18158         FREE(untag_ptr(_res));
18159         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
18160 }
18161
18162 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
18163         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
18164         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
18165         return tag_ptr(ret_conv, true);
18166 }
18167 int64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(uint64_t arg) {
18168         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
18169         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
18170         return ret_conv;
18171 }
18172
18173 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone(uint64_t orig) {
18174         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
18175         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
18176         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
18177         return tag_ptr(ret_conv, true);
18178 }
18179
18180 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_ok(uint64_t o) {
18181         LDKUntrustedString o_conv;
18182         o_conv.inner = untag_ptr(o);
18183         o_conv.is_owned = ptr_is_owned(o);
18184         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18185         o_conv = UntrustedString_clone(&o_conv);
18186         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
18187         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
18188         return tag_ptr(ret_conv, true);
18189 }
18190
18191 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_err"))) TS_CResult_UntrustedStringDecodeErrorZ_err(uint64_t e) {
18192         void* e_ptr = untag_ptr(e);
18193         CHECK_ACCESS(e_ptr);
18194         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18195         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18196         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
18197         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
18198         return tag_ptr(ret_conv, true);
18199 }
18200
18201 jboolean  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_is_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_is_ok(uint64_t o) {
18202         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
18203         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
18204         return ret_conv;
18205 }
18206
18207 void  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_free"))) TS_CResult_UntrustedStringDecodeErrorZ_free(uint64_t _res) {
18208         if (!ptr_is_owned(_res)) return;
18209         void* _res_ptr = untag_ptr(_res);
18210         CHECK_ACCESS(_res_ptr);
18211         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
18212         FREE(untag_ptr(_res));
18213         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
18214 }
18215
18216 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
18217         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
18218         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
18219         return tag_ptr(ret_conv, true);
18220 }
18221 int64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr"))) TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr(uint64_t arg) {
18222         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
18223         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
18224         return ret_conv;
18225 }
18226
18227 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone"))) TS_CResult_UntrustedStringDecodeErrorZ_clone(uint64_t orig) {
18228         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
18229         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
18230         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
18231         return tag_ptr(ret_conv, true);
18232 }
18233
18234 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
18235         LDKOutPoint o_conv;
18236         o_conv.inner = untag_ptr(o);
18237         o_conv.is_owned = ptr_is_owned(o);
18238         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18239         o_conv = OutPoint_clone(&o_conv);
18240         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18241         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
18242         return tag_ptr(ret_conv, true);
18243 }
18244
18245 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
18246         void* e_ptr = untag_ptr(e);
18247         CHECK_ACCESS(e_ptr);
18248         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18249         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18250         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18251         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
18252         return tag_ptr(ret_conv, true);
18253 }
18254
18255 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
18256         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
18257         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
18258         return ret_conv;
18259 }
18260
18261 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
18262         if (!ptr_is_owned(_res)) return;
18263         void* _res_ptr = untag_ptr(_res);
18264         CHECK_ACCESS(_res_ptr);
18265         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
18266         FREE(untag_ptr(_res));
18267         CResult_OutPointDecodeErrorZ_free(_res_conv);
18268 }
18269
18270 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
18271         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18272         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
18273         return tag_ptr(ret_conv, true);
18274 }
18275 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
18276         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
18277         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
18278         return ret_conv;
18279 }
18280
18281 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
18282         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
18283         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18284         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
18285         return tag_ptr(ret_conv, true);
18286 }
18287
18288 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
18289         void* o_ptr = untag_ptr(o);
18290         CHECK_ACCESS(o_ptr);
18291         LDKType o_conv = *(LDKType*)(o_ptr);
18292         if (o_conv.free == LDKType_JCalls_free) {
18293                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18294                 LDKType_JCalls_cloned(&o_conv);
18295         }
18296         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18297         *ret_copy = COption_TypeZ_some(o_conv);
18298         uint64_t ret_ref = tag_ptr(ret_copy, true);
18299         return ret_ref;
18300 }
18301
18302 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
18303         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18304         *ret_copy = COption_TypeZ_none();
18305         uint64_t ret_ref = tag_ptr(ret_copy, true);
18306         return ret_ref;
18307 }
18308
18309 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
18310         if (!ptr_is_owned(_res)) return;
18311         void* _res_ptr = untag_ptr(_res);
18312         CHECK_ACCESS(_res_ptr);
18313         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
18314         FREE(untag_ptr(_res));
18315         COption_TypeZ_free(_res_conv);
18316 }
18317
18318 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
18319         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18320         *ret_copy = COption_TypeZ_clone(arg);
18321         uint64_t ret_ref = tag_ptr(ret_copy, true);
18322         return ret_ref;
18323 }
18324 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
18325         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
18326         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
18327         return ret_conv;
18328 }
18329
18330 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
18331         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
18332         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18333         *ret_copy = COption_TypeZ_clone(orig_conv);
18334         uint64_t ret_ref = tag_ptr(ret_copy, true);
18335         return ret_ref;
18336 }
18337
18338 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
18339         void* o_ptr = untag_ptr(o);
18340         CHECK_ACCESS(o_ptr);
18341         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
18342         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
18343         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18344         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
18345         return tag_ptr(ret_conv, true);
18346 }
18347
18348 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
18349         void* e_ptr = untag_ptr(e);
18350         CHECK_ACCESS(e_ptr);
18351         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18352         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18353         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18354         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
18355         return tag_ptr(ret_conv, true);
18356 }
18357
18358 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
18359         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
18360         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
18361         return ret_conv;
18362 }
18363
18364 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
18365         if (!ptr_is_owned(_res)) return;
18366         void* _res_ptr = untag_ptr(_res);
18367         CHECK_ACCESS(_res_ptr);
18368         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
18369         FREE(untag_ptr(_res));
18370         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
18371 }
18372
18373 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
18374         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18375         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
18376         return tag_ptr(ret_conv, true);
18377 }
18378 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
18379         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
18380         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
18381         return ret_conv;
18382 }
18383
18384 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
18385         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
18386         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18387         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
18388         return tag_ptr(ret_conv, true);
18389 }
18390
18391 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
18392         LDKThirtyTwoBytes o_ref;
18393         CHECK(o->arr_len == 32);
18394         memcpy(o_ref.data, o->elems, 32); FREE(o);
18395         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18396         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
18397         return tag_ptr(ret_conv, true);
18398 }
18399
18400 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint64_t e) {
18401         void* e_ptr = untag_ptr(e);
18402         CHECK_ACCESS(e_ptr);
18403         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
18404         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
18405         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18406         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
18407         return tag_ptr(ret_conv, true);
18408 }
18409
18410 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint64_t o) {
18411         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
18412         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
18413         return ret_conv;
18414 }
18415
18416 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint64_t _res) {
18417         if (!ptr_is_owned(_res)) return;
18418         void* _res_ptr = untag_ptr(_res);
18419         CHECK_ACCESS(_res_ptr);
18420         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
18421         FREE(untag_ptr(_res));
18422         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
18423 }
18424
18425 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
18426         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18427         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
18428         return tag_ptr(ret_conv, true);
18429 }
18430 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint64_t arg) {
18431         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
18432         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
18433         return ret_conv;
18434 }
18435
18436 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint64_t orig) {
18437         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
18438         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18439         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
18440         return tag_ptr(ret_conv, true);
18441 }
18442
18443 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_ok"))) TS_CResult_NonePaymentErrorZ_ok() {
18444         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
18445         *ret_conv = CResult_NonePaymentErrorZ_ok();
18446         return tag_ptr(ret_conv, true);
18447 }
18448
18449 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_err"))) TS_CResult_NonePaymentErrorZ_err(uint64_t e) {
18450         void* e_ptr = untag_ptr(e);
18451         CHECK_ACCESS(e_ptr);
18452         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
18453         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
18454         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
18455         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
18456         return tag_ptr(ret_conv, true);
18457 }
18458
18459 jboolean  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_is_ok"))) TS_CResult_NonePaymentErrorZ_is_ok(uint64_t o) {
18460         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
18461         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
18462         return ret_conv;
18463 }
18464
18465 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_free"))) TS_CResult_NonePaymentErrorZ_free(uint64_t _res) {
18466         if (!ptr_is_owned(_res)) return;
18467         void* _res_ptr = untag_ptr(_res);
18468         CHECK_ACCESS(_res_ptr);
18469         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
18470         FREE(untag_ptr(_res));
18471         CResult_NonePaymentErrorZ_free(_res_conv);
18472 }
18473
18474 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
18475         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
18476         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
18477         return tag_ptr(ret_conv, true);
18478 }
18479 int64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone_ptr"))) TS_CResult_NonePaymentErrorZ_clone_ptr(uint64_t arg) {
18480         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
18481         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
18482         return ret_conv;
18483 }
18484
18485 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone"))) TS_CResult_NonePaymentErrorZ_clone(uint64_t orig) {
18486         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
18487         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
18488         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
18489         return tag_ptr(ret_conv, true);
18490 }
18491
18492 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
18493         LDKStr o_conv = str_ref_to_owned_c(o);
18494         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18495         *ret_conv = CResult_StringErrorZ_ok(o_conv);
18496         return tag_ptr(ret_conv, true);
18497 }
18498
18499 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
18500         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
18501         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18502         *ret_conv = CResult_StringErrorZ_err(e_conv);
18503         return tag_ptr(ret_conv, true);
18504 }
18505
18506 jboolean  __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint64_t o) {
18507         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
18508         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
18509         return ret_conv;
18510 }
18511
18512 void  __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint64_t _res) {
18513         if (!ptr_is_owned(_res)) return;
18514         void* _res_ptr = untag_ptr(_res);
18515         CHECK_ACCESS(_res_ptr);
18516         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
18517         FREE(untag_ptr(_res));
18518         CResult_StringErrorZ_free(_res_conv);
18519 }
18520
18521 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
18522         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18523         *ret_conv = CResult_StringErrorZ_clone(arg);
18524         return tag_ptr(ret_conv, true);
18525 }
18526 int64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint64_t arg) {
18527         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
18528         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
18529         return ret_conv;
18530 }
18531
18532 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint64_t orig) {
18533         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
18534         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18535         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
18536         return tag_ptr(ret_conv, true);
18537 }
18538
18539 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
18540         LDKChannelMonitorUpdate o_conv;
18541         o_conv.inner = untag_ptr(o);
18542         o_conv.is_owned = ptr_is_owned(o);
18543         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18544         o_conv = ChannelMonitorUpdate_clone(&o_conv);
18545         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18546         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
18547         return tag_ptr(ret_conv, true);
18548 }
18549
18550 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
18551         void* e_ptr = untag_ptr(e);
18552         CHECK_ACCESS(e_ptr);
18553         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18554         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18555         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18556         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
18557         return tag_ptr(ret_conv, true);
18558 }
18559
18560 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
18561         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
18562         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
18563         return ret_conv;
18564 }
18565
18566 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
18567         if (!ptr_is_owned(_res)) return;
18568         void* _res_ptr = untag_ptr(_res);
18569         CHECK_ACCESS(_res_ptr);
18570         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
18571         FREE(untag_ptr(_res));
18572         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
18573 }
18574
18575 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
18576         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18577         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
18578         return tag_ptr(ret_conv, true);
18579 }
18580 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
18581         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
18582         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
18583         return ret_conv;
18584 }
18585
18586 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
18587         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
18588         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18589         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
18590         return tag_ptr(ret_conv, true);
18591 }
18592
18593 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
18594         void* o_ptr = untag_ptr(o);
18595         CHECK_ACCESS(o_ptr);
18596         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
18597         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
18598         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18599         *ret_copy = COption_MonitorEventZ_some(o_conv);
18600         uint64_t ret_ref = tag_ptr(ret_copy, true);
18601         return ret_ref;
18602 }
18603
18604 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
18605         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18606         *ret_copy = COption_MonitorEventZ_none();
18607         uint64_t ret_ref = tag_ptr(ret_copy, true);
18608         return ret_ref;
18609 }
18610
18611 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
18612         if (!ptr_is_owned(_res)) return;
18613         void* _res_ptr = untag_ptr(_res);
18614         CHECK_ACCESS(_res_ptr);
18615         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
18616         FREE(untag_ptr(_res));
18617         COption_MonitorEventZ_free(_res_conv);
18618 }
18619
18620 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
18621         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18622         *ret_copy = COption_MonitorEventZ_clone(arg);
18623         uint64_t ret_ref = tag_ptr(ret_copy, true);
18624         return ret_ref;
18625 }
18626 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
18627         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
18628         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
18629         return ret_conv;
18630 }
18631
18632 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
18633         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
18634         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18635         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
18636         uint64_t ret_ref = tag_ptr(ret_copy, true);
18637         return ret_ref;
18638 }
18639
18640 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
18641         void* o_ptr = untag_ptr(o);
18642         CHECK_ACCESS(o_ptr);
18643         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
18644         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
18645         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18646         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
18647         return tag_ptr(ret_conv, true);
18648 }
18649
18650 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
18651         void* e_ptr = untag_ptr(e);
18652         CHECK_ACCESS(e_ptr);
18653         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18654         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18655         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18656         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
18657         return tag_ptr(ret_conv, true);
18658 }
18659
18660 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
18661         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
18662         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
18663         return ret_conv;
18664 }
18665
18666 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
18667         if (!ptr_is_owned(_res)) return;
18668         void* _res_ptr = untag_ptr(_res);
18669         CHECK_ACCESS(_res_ptr);
18670         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
18671         FREE(untag_ptr(_res));
18672         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
18673 }
18674
18675 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
18676         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18677         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
18678         return tag_ptr(ret_conv, true);
18679 }
18680 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
18681         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
18682         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
18683         return ret_conv;
18684 }
18685
18686 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
18687         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
18688         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18689         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
18690         return tag_ptr(ret_conv, true);
18691 }
18692
18693 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
18694         LDKHTLCUpdate o_conv;
18695         o_conv.inner = untag_ptr(o);
18696         o_conv.is_owned = ptr_is_owned(o);
18697         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18698         o_conv = HTLCUpdate_clone(&o_conv);
18699         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18700         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
18701         return tag_ptr(ret_conv, true);
18702 }
18703
18704 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
18705         void* e_ptr = untag_ptr(e);
18706         CHECK_ACCESS(e_ptr);
18707         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18708         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18709         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18710         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
18711         return tag_ptr(ret_conv, true);
18712 }
18713
18714 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
18715         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
18716         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
18717         return ret_conv;
18718 }
18719
18720 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
18721         if (!ptr_is_owned(_res)) return;
18722         void* _res_ptr = untag_ptr(_res);
18723         CHECK_ACCESS(_res_ptr);
18724         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
18725         FREE(untag_ptr(_res));
18726         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
18727 }
18728
18729 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
18730         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18731         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
18732         return tag_ptr(ret_conv, true);
18733 }
18734 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
18735         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
18736         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
18737         return ret_conv;
18738 }
18739
18740 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
18741         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
18742         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18743         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
18744         return tag_ptr(ret_conv, true);
18745 }
18746
18747 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
18748         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18749         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
18750         return tag_ptr(ret_conv, true);
18751 }
18752 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint64_t arg) {
18753         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
18754         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
18755         return ret_conv;
18756 }
18757
18758 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint64_t orig) {
18759         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
18760         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18761         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
18762         return tag_ptr(ret_conv, true);
18763 }
18764
18765 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint64_t a, int8_tArray b) {
18766         LDKOutPoint a_conv;
18767         a_conv.inner = untag_ptr(a);
18768         a_conv.is_owned = ptr_is_owned(a);
18769         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18770         a_conv = OutPoint_clone(&a_conv);
18771         LDKCVec_u8Z b_ref;
18772         b_ref.datalen = b->arr_len;
18773         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18774         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18775         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18776         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
18777         return tag_ptr(ret_conv, true);
18778 }
18779
18780 void  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint64_t _res) {
18781         if (!ptr_is_owned(_res)) return;
18782         void* _res_ptr = untag_ptr(_res);
18783         CHECK_ACCESS(_res_ptr);
18784         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
18785         FREE(untag_ptr(_res));
18786         C2Tuple_OutPointScriptZ_free(_res_conv);
18787 }
18788
18789 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
18790         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18791         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
18792         return tag_ptr(ret_conv, true);
18793 }
18794 int64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint64_t arg) {
18795         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
18796         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
18797         return ret_conv;
18798 }
18799
18800 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint64_t orig) {
18801         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
18802         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18803         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
18804         return tag_ptr(ret_conv, true);
18805 }
18806
18807 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
18808         LDKCVec_u8Z b_ref;
18809         b_ref.datalen = b->arr_len;
18810         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18811         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18812         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18813         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
18814         return tag_ptr(ret_conv, true);
18815 }
18816
18817 void  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint64_t _res) {
18818         if (!ptr_is_owned(_res)) return;
18819         void* _res_ptr = untag_ptr(_res);
18820         CHECK_ACCESS(_res_ptr);
18821         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
18822         FREE(untag_ptr(_res));
18823         C2Tuple_u32ScriptZ_free(_res_conv);
18824 }
18825
18826 void  __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint64_tArray _res) {
18827         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
18828         _res_constr.datalen = _res->arr_len;
18829         if (_res_constr.datalen > 0)
18830                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
18831         else
18832                 _res_constr.data = NULL;
18833         uint64_t* _res_vals = _res->elems;
18834         for (size_t v = 0; v < _res_constr.datalen; v++) {
18835                 uint64_t _res_conv_21 = _res_vals[v];
18836                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
18837                 CHECK_ACCESS(_res_conv_21_ptr);
18838                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
18839                 FREE(untag_ptr(_res_conv_21));
18840                 _res_constr.data[v] = _res_conv_21_conv;
18841         }
18842         FREE(_res);
18843         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
18844 }
18845
18846 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
18847         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18848         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
18849         return tag_ptr(ret_conv, true);
18850 }
18851 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint64_t arg) {
18852         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
18853         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
18854         return ret_conv;
18855 }
18856
18857 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint64_t orig) {
18858         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
18859         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18860         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
18861         return tag_ptr(ret_conv, true);
18862 }
18863
18864 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint64_tArray b) {
18865         LDKThirtyTwoBytes a_ref;
18866         CHECK(a->arr_len == 32);
18867         memcpy(a_ref.data, a->elems, 32); FREE(a);
18868         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
18869         b_constr.datalen = b->arr_len;
18870         if (b_constr.datalen > 0)
18871                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
18872         else
18873                 b_constr.data = NULL;
18874         uint64_t* b_vals = b->elems;
18875         for (size_t v = 0; v < b_constr.datalen; v++) {
18876                 uint64_t b_conv_21 = b_vals[v];
18877                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
18878                 CHECK_ACCESS(b_conv_21_ptr);
18879                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
18880                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
18881                 b_constr.data[v] = b_conv_21_conv;
18882         }
18883         FREE(b);
18884         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18885         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
18886         return tag_ptr(ret_conv, true);
18887 }
18888
18889 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint64_t _res) {
18890         if (!ptr_is_owned(_res)) return;
18891         void* _res_ptr = untag_ptr(_res);
18892         CHECK_ACCESS(_res_ptr);
18893         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
18894         FREE(untag_ptr(_res));
18895         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
18896 }
18897
18898 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint64_tArray _res) {
18899         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
18900         _res_constr.datalen = _res->arr_len;
18901         if (_res_constr.datalen > 0)
18902                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
18903         else
18904                 _res_constr.data = NULL;
18905         uint64_t* _res_vals = _res->elems;
18906         for (size_t o = 0; o < _res_constr.datalen; o++) {
18907                 uint64_t _res_conv_40 = _res_vals[o];
18908                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
18909                 CHECK_ACCESS(_res_conv_40_ptr);
18910                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
18911                 FREE(untag_ptr(_res_conv_40));
18912                 _res_constr.data[o] = _res_conv_40_conv;
18913         }
18914         FREE(_res);
18915         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
18916 }
18917
18918 void  __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint64_tArray _res) {
18919         LDKCVec_EventZ _res_constr;
18920         _res_constr.datalen = _res->arr_len;
18921         if (_res_constr.datalen > 0)
18922                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
18923         else
18924                 _res_constr.data = NULL;
18925         uint64_t* _res_vals = _res->elems;
18926         for (size_t h = 0; h < _res_constr.datalen; h++) {
18927                 uint64_t _res_conv_7 = _res_vals[h];
18928                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
18929                 CHECK_ACCESS(_res_conv_7_ptr);
18930                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
18931                 FREE(untag_ptr(_res_conv_7));
18932                 _res_constr.data[h] = _res_conv_7_conv;
18933         }
18934         FREE(_res);
18935         CVec_EventZ_free(_res_constr);
18936 }
18937
18938 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
18939         LDKCVec_TransactionZ _res_constr;
18940         _res_constr.datalen = _res->arr_len;
18941         if (_res_constr.datalen > 0)
18942                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
18943         else
18944                 _res_constr.data = NULL;
18945         int8_tArray* _res_vals = (void*) _res->elems;
18946         for (size_t m = 0; m < _res_constr.datalen; m++) {
18947                 int8_tArray _res_conv_12 = _res_vals[m];
18948                 LDKTransaction _res_conv_12_ref;
18949                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
18950                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
18951                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
18952                 _res_conv_12_ref.data_is_owned = true;
18953                 _res_constr.data[m] = _res_conv_12_ref;
18954         }
18955         FREE(_res);
18956         CVec_TransactionZ_free(_res_constr);
18957 }
18958
18959 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
18960         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18961         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
18962         return tag_ptr(ret_conv, true);
18963 }
18964 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
18965         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
18966         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
18967         return ret_conv;
18968 }
18969
18970 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
18971         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
18972         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18973         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
18974         return tag_ptr(ret_conv, true);
18975 }
18976
18977 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
18978         void* b_ptr = untag_ptr(b);
18979         CHECK_ACCESS(b_ptr);
18980         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
18981         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
18982         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18983         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
18984         return tag_ptr(ret_conv, true);
18985 }
18986
18987 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
18988         if (!ptr_is_owned(_res)) return;
18989         void* _res_ptr = untag_ptr(_res);
18990         CHECK_ACCESS(_res_ptr);
18991         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
18992         FREE(untag_ptr(_res));
18993         C2Tuple_u32TxOutZ_free(_res_conv);
18994 }
18995
18996 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
18997         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
18998         _res_constr.datalen = _res->arr_len;
18999         if (_res_constr.datalen > 0)
19000                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
19001         else
19002                 _res_constr.data = NULL;
19003         uint64_t* _res_vals = _res->elems;
19004         for (size_t u = 0; u < _res_constr.datalen; u++) {
19005                 uint64_t _res_conv_20 = _res_vals[u];
19006                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
19007                 CHECK_ACCESS(_res_conv_20_ptr);
19008                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
19009                 FREE(untag_ptr(_res_conv_20));
19010                 _res_constr.data[u] = _res_conv_20_conv;
19011         }
19012         FREE(_res);
19013         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
19014 }
19015
19016 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
19017         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19018         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
19019         return tag_ptr(ret_conv, true);
19020 }
19021 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
19022         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
19023         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
19024         return ret_conv;
19025 }
19026
19027 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
19028         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
19029         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19030         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
19031         return tag_ptr(ret_conv, true);
19032 }
19033
19034 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
19035         LDKThirtyTwoBytes a_ref;
19036         CHECK(a->arr_len == 32);
19037         memcpy(a_ref.data, a->elems, 32); FREE(a);
19038         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
19039         b_constr.datalen = b->arr_len;
19040         if (b_constr.datalen > 0)
19041                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
19042         else
19043                 b_constr.data = NULL;
19044         uint64_t* b_vals = b->elems;
19045         for (size_t u = 0; u < b_constr.datalen; u++) {
19046                 uint64_t b_conv_20 = b_vals[u];
19047                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
19048                 CHECK_ACCESS(b_conv_20_ptr);
19049                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
19050                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
19051                 b_constr.data[u] = b_conv_20_conv;
19052         }
19053         FREE(b);
19054         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19055         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
19056         return tag_ptr(ret_conv, true);
19057 }
19058
19059 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
19060         if (!ptr_is_owned(_res)) return;
19061         void* _res_ptr = untag_ptr(_res);
19062         CHECK_ACCESS(_res_ptr);
19063         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
19064         FREE(untag_ptr(_res));
19065         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
19066 }
19067
19068 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
19069         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
19070         _res_constr.datalen = _res->arr_len;
19071         if (_res_constr.datalen > 0)
19072                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
19073         else
19074                 _res_constr.data = NULL;
19075         uint64_t* _res_vals = _res->elems;
19076         for (size_t n = 0; n < _res_constr.datalen; n++) {
19077                 uint64_t _res_conv_39 = _res_vals[n];
19078                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
19079                 CHECK_ACCESS(_res_conv_39_ptr);
19080                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
19081                 FREE(untag_ptr(_res_conv_39));
19082                 _res_constr.data[n] = _res_conv_39_conv;
19083         }
19084         FREE(_res);
19085         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
19086 }
19087
19088 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
19089         LDKCVec_BalanceZ _res_constr;
19090         _res_constr.datalen = _res->arr_len;
19091         if (_res_constr.datalen > 0)
19092                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
19093         else
19094                 _res_constr.data = NULL;
19095         uint64_t* _res_vals = _res->elems;
19096         for (size_t j = 0; j < _res_constr.datalen; j++) {
19097                 uint64_t _res_conv_9 = _res_vals[j];
19098                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
19099                 CHECK_ACCESS(_res_conv_9_ptr);
19100                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
19101                 FREE(untag_ptr(_res_conv_9));
19102                 _res_constr.data[j] = _res_conv_9_conv;
19103         }
19104         FREE(_res);
19105         CVec_BalanceZ_free(_res_constr);
19106 }
19107
19108 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
19109         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19110         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
19111         return tag_ptr(ret_conv, true);
19112 }
19113 int64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint64_t arg) {
19114         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
19115         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
19116         return ret_conv;
19117 }
19118
19119 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint64_t orig) {
19120         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
19121         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19122         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
19123         return tag_ptr(ret_conv, true);
19124 }
19125
19126 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint64_t b) {
19127         LDKThirtyTwoBytes a_ref;
19128         CHECK(a->arr_len == 32);
19129         memcpy(a_ref.data, a->elems, 32); FREE(a);
19130         LDKChannelMonitor b_conv;
19131         b_conv.inner = untag_ptr(b);
19132         b_conv.is_owned = ptr_is_owned(b);
19133         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19134         b_conv = ChannelMonitor_clone(&b_conv);
19135         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19136         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
19137         return tag_ptr(ret_conv, true);
19138 }
19139
19140 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint64_t _res) {
19141         if (!ptr_is_owned(_res)) return;
19142         void* _res_ptr = untag_ptr(_res);
19143         CHECK_ACCESS(_res_ptr);
19144         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
19145         FREE(untag_ptr(_res));
19146         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
19147 }
19148
19149 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
19150         void* o_ptr = untag_ptr(o);
19151         CHECK_ACCESS(o_ptr);
19152         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
19153         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
19154         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19155         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
19156         return tag_ptr(ret_conv, true);
19157 }
19158
19159 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint64_t e) {
19160         void* e_ptr = untag_ptr(e);
19161         CHECK_ACCESS(e_ptr);
19162         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19163         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19164         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19165         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
19166         return tag_ptr(ret_conv, true);
19167 }
19168
19169 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
19170         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
19171         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
19172         return ret_conv;
19173 }
19174
19175 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
19176         if (!ptr_is_owned(_res)) return;
19177         void* _res_ptr = untag_ptr(_res);
19178         CHECK_ACCESS(_res_ptr);
19179         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
19180         FREE(untag_ptr(_res));
19181         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
19182 }
19183
19184 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
19185         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19186         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
19187         return tag_ptr(ret_conv, true);
19188 }
19189 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
19190         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
19191         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
19192         return ret_conv;
19193 }
19194
19195 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
19196         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
19197         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19198         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
19199         return tag_ptr(ret_conv, true);
19200 }
19201
19202 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
19203         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19204         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
19205         return tag_ptr(ret_conv, true);
19206 }
19207 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
19208         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
19209         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
19210         return ret_conv;
19211 }
19212
19213 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
19214         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
19215         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19216         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
19217         return tag_ptr(ret_conv, true);
19218 }
19219
19220 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
19221         LDKPublicKey a_ref;
19222         CHECK(a->arr_len == 33);
19223         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
19224         void* b_ptr = untag_ptr(b);
19225         CHECK_ACCESS(b_ptr);
19226         LDKType b_conv = *(LDKType*)(b_ptr);
19227         if (b_conv.free == LDKType_JCalls_free) {
19228                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19229                 LDKType_JCalls_cloned(&b_conv);
19230         }
19231         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19232         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
19233         return tag_ptr(ret_conv, true);
19234 }
19235
19236 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
19237         if (!ptr_is_owned(_res)) return;
19238         void* _res_ptr = untag_ptr(_res);
19239         CHECK_ACCESS(_res_ptr);
19240         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
19241         FREE(untag_ptr(_res));
19242         C2Tuple_PublicKeyTypeZ_free(_res_conv);
19243 }
19244
19245 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
19246         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
19247         _res_constr.datalen = _res->arr_len;
19248         if (_res_constr.datalen > 0)
19249                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
19250         else
19251                 _res_constr.data = NULL;
19252         uint64_t* _res_vals = _res->elems;
19253         for (size_t z = 0; z < _res_constr.datalen; z++) {
19254                 uint64_t _res_conv_25 = _res_vals[z];
19255                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
19256                 CHECK_ACCESS(_res_conv_25_ptr);
19257                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
19258                 FREE(untag_ptr(_res_conv_25));
19259                 _res_constr.data[z] = _res_conv_25_conv;
19260         }
19261         FREE(_res);
19262         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
19263 }
19264
19265 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_some"))) TS_COption_CustomOnionMessageContentsZ_some(uint64_t o) {
19266         void* o_ptr = untag_ptr(o);
19267         CHECK_ACCESS(o_ptr);
19268         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
19269         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
19270                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19271                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
19272         }
19273         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
19274         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
19275         uint64_t ret_ref = tag_ptr(ret_copy, true);
19276         return ret_ref;
19277 }
19278
19279 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_none"))) TS_COption_CustomOnionMessageContentsZ_none() {
19280         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
19281         *ret_copy = COption_CustomOnionMessageContentsZ_none();
19282         uint64_t ret_ref = tag_ptr(ret_copy, true);
19283         return ret_ref;
19284 }
19285
19286 void  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_free"))) TS_COption_CustomOnionMessageContentsZ_free(uint64_t _res) {
19287         if (!ptr_is_owned(_res)) return;
19288         void* _res_ptr = untag_ptr(_res);
19289         CHECK_ACCESS(_res_ptr);
19290         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
19291         FREE(untag_ptr(_res));
19292         COption_CustomOnionMessageContentsZ_free(_res_conv);
19293 }
19294
19295 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
19296         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
19297         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
19298         uint64_t ret_ref = tag_ptr(ret_copy, true);
19299         return ret_ref;
19300 }
19301 int64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone_ptr"))) TS_COption_CustomOnionMessageContentsZ_clone_ptr(uint64_t arg) {
19302         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
19303         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
19304         return ret_conv;
19305 }
19306
19307 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone"))) TS_COption_CustomOnionMessageContentsZ_clone(uint64_t orig) {
19308         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
19309         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
19310         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
19311         uint64_t ret_ref = tag_ptr(ret_copy, true);
19312         return ret_ref;
19313 }
19314
19315 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
19316         void* o_ptr = untag_ptr(o);
19317         CHECK_ACCESS(o_ptr);
19318         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
19319         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
19320         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
19321         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
19322         return tag_ptr(ret_conv, true);
19323 }
19324
19325 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
19326         void* e_ptr = untag_ptr(e);
19327         CHECK_ACCESS(e_ptr);
19328         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19329         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19330         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
19331         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
19332         return tag_ptr(ret_conv, true);
19333 }
19334
19335 jboolean  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
19336         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
19337         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
19338         return ret_conv;
19339 }
19340
19341 void  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
19342         if (!ptr_is_owned(_res)) return;
19343         void* _res_ptr = untag_ptr(_res);
19344         CHECK_ACCESS(_res_ptr);
19345         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
19346         FREE(untag_ptr(_res));
19347         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
19348 }
19349
19350 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
19351         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
19352         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
19353         return tag_ptr(ret_conv, true);
19354 }
19355 int64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
19356         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
19357         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
19358         return ret_conv;
19359 }
19360
19361 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
19362         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
19363         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
19364         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
19365         return tag_ptr(ret_conv, true);
19366 }
19367
19368 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint64_t o) {
19369         void* o_ptr = untag_ptr(o);
19370         CHECK_ACCESS(o_ptr);
19371         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
19372         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
19373         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
19374         *ret_copy = COption_NetAddressZ_some(o_conv);
19375         uint64_t ret_ref = tag_ptr(ret_copy, true);
19376         return ret_ref;
19377 }
19378
19379 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
19380         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
19381         *ret_copy = COption_NetAddressZ_none();
19382         uint64_t ret_ref = tag_ptr(ret_copy, true);
19383         return ret_ref;
19384 }
19385
19386 void  __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint64_t _res) {
19387         if (!ptr_is_owned(_res)) return;
19388         void* _res_ptr = untag_ptr(_res);
19389         CHECK_ACCESS(_res_ptr);
19390         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
19391         FREE(untag_ptr(_res));
19392         COption_NetAddressZ_free(_res_conv);
19393 }
19394
19395 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
19396         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
19397         *ret_copy = COption_NetAddressZ_clone(arg);
19398         uint64_t ret_ref = tag_ptr(ret_copy, true);
19399         return ret_ref;
19400 }
19401 int64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint64_t arg) {
19402         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
19403         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
19404         return ret_conv;
19405 }
19406
19407 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint64_t orig) {
19408         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
19409         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
19410         *ret_copy = COption_NetAddressZ_clone(orig_conv);
19411         uint64_t ret_ref = tag_ptr(ret_copy, true);
19412         return ret_ref;
19413 }
19414
19415 static inline uint64_t C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR arg) {
19416         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
19417         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(arg);
19418         return tag_ptr(ret_conv, true);
19419 }
19420 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(uint64_t arg) {
19421         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(arg);
19422         int64_t ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(arg_conv);
19423         return ret_conv;
19424 }
19425
19426 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone(uint64_t orig) {
19427         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(orig);
19428         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
19429         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig_conv);
19430         return tag_ptr(ret_conv, true);
19431 }
19432
19433 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_new"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_new(int8_tArray a, uint64_t b) {
19434         LDKPublicKey a_ref;
19435         CHECK(a->arr_len == 33);
19436         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
19437         void* b_ptr = untag_ptr(b);
19438         CHECK_ACCESS(b_ptr);
19439         LDKCOption_NetAddressZ b_conv = *(LDKCOption_NetAddressZ*)(b_ptr);
19440         b_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(b));
19441         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
19442         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_new(a_ref, b_conv);
19443         return tag_ptr(ret_conv, true);
19444 }
19445
19446 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_free"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_free(uint64_t _res) {
19447         if (!ptr_is_owned(_res)) return;
19448         void* _res_ptr = untag_ptr(_res);
19449         CHECK_ACCESS(_res_ptr);
19450         LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_ptr);
19451         FREE(untag_ptr(_res));
19452         C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res_conv);
19453 }
19454
19455 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(uint64_tArray _res) {
19456         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res_constr;
19457         _res_constr.datalen = _res->arr_len;
19458         if (_res_constr.datalen > 0)
19459                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ Elements");
19460         else
19461                 _res_constr.data = NULL;
19462         uint64_t* _res_vals = _res->elems;
19463         for (size_t o = 0; o < _res_constr.datalen; o++) {
19464                 uint64_t _res_conv_40 = _res_vals[o];
19465                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
19466                 CHECK_ACCESS(_res_conv_40_ptr);
19467                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_conv_40_ptr);
19468                 FREE(untag_ptr(_res_conv_40));
19469                 _res_constr.data[o] = _res_conv_40_conv;
19470         }
19471         FREE(_res);
19472         CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res_constr);
19473 }
19474
19475 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
19476         LDKCVec_u8Z o_ref;
19477         o_ref.datalen = o->arr_len;
19478         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
19479         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
19480         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19481         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
19482         return tag_ptr(ret_conv, true);
19483 }
19484
19485 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
19486         LDKPeerHandleError e_conv;
19487         e_conv.inner = untag_ptr(e);
19488         e_conv.is_owned = ptr_is_owned(e);
19489         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19490         e_conv = PeerHandleError_clone(&e_conv);
19491         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19492         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
19493         return tag_ptr(ret_conv, true);
19494 }
19495
19496 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
19497         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
19498         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
19499         return ret_conv;
19500 }
19501
19502 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
19503         if (!ptr_is_owned(_res)) return;
19504         void* _res_ptr = untag_ptr(_res);
19505         CHECK_ACCESS(_res_ptr);
19506         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
19507         FREE(untag_ptr(_res));
19508         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
19509 }
19510
19511 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
19512         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19513         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
19514         return tag_ptr(ret_conv, true);
19515 }
19516 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
19517         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
19518         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
19519         return ret_conv;
19520 }
19521
19522 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
19523         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
19524         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19525         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
19526         return tag_ptr(ret_conv, true);
19527 }
19528
19529 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
19530         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19531         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
19532         return tag_ptr(ret_conv, true);
19533 }
19534
19535 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
19536         LDKPeerHandleError e_conv;
19537         e_conv.inner = untag_ptr(e);
19538         e_conv.is_owned = ptr_is_owned(e);
19539         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19540         e_conv = PeerHandleError_clone(&e_conv);
19541         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19542         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
19543         return tag_ptr(ret_conv, true);
19544 }
19545
19546 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
19547         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
19548         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
19549         return ret_conv;
19550 }
19551
19552 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
19553         if (!ptr_is_owned(_res)) return;
19554         void* _res_ptr = untag_ptr(_res);
19555         CHECK_ACCESS(_res_ptr);
19556         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
19557         FREE(untag_ptr(_res));
19558         CResult_NonePeerHandleErrorZ_free(_res_conv);
19559 }
19560
19561 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
19562         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19563         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
19564         return tag_ptr(ret_conv, true);
19565 }
19566 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
19567         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
19568         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
19569         return ret_conv;
19570 }
19571
19572 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
19573         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
19574         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19575         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
19576         return tag_ptr(ret_conv, true);
19577 }
19578
19579 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
19580         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19581         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
19582         return tag_ptr(ret_conv, true);
19583 }
19584
19585 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
19586         LDKPeerHandleError e_conv;
19587         e_conv.inner = untag_ptr(e);
19588         e_conv.is_owned = ptr_is_owned(e);
19589         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19590         e_conv = PeerHandleError_clone(&e_conv);
19591         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19592         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
19593         return tag_ptr(ret_conv, true);
19594 }
19595
19596 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
19597         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
19598         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
19599         return ret_conv;
19600 }
19601
19602 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
19603         if (!ptr_is_owned(_res)) return;
19604         void* _res_ptr = untag_ptr(_res);
19605         CHECK_ACCESS(_res_ptr);
19606         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
19607         FREE(untag_ptr(_res));
19608         CResult_boolPeerHandleErrorZ_free(_res_conv);
19609 }
19610
19611 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
19612         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19613         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
19614         return tag_ptr(ret_conv, true);
19615 }
19616 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
19617         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
19618         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
19619         return ret_conv;
19620 }
19621
19622 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
19623         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
19624         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19625         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
19626         return tag_ptr(ret_conv, true);
19627 }
19628
19629 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_ok(uint64_t o) {
19630         void* o_ptr = untag_ptr(o);
19631         CHECK_ACCESS(o_ptr);
19632         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
19633         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
19634         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19635         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
19636         return tag_ptr(ret_conv, true);
19637 }
19638
19639 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_err"))) TS_CResult_TxOutUtxoLookupErrorZ_err(uint32_t e) {
19640         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_js(e);
19641         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19642         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
19643         return tag_ptr(ret_conv, true);
19644 }
19645
19646 jboolean  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_is_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_is_ok(uint64_t o) {
19647         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
19648         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
19649         return ret_conv;
19650 }
19651
19652 void  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_free"))) TS_CResult_TxOutUtxoLookupErrorZ_free(uint64_t _res) {
19653         if (!ptr_is_owned(_res)) return;
19654         void* _res_ptr = untag_ptr(_res);
19655         CHECK_ACCESS(_res_ptr);
19656         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
19657         FREE(untag_ptr(_res));
19658         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
19659 }
19660
19661 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
19662         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19663         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
19664         return tag_ptr(ret_conv, true);
19665 }
19666 int64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr"))) TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr(uint64_t arg) {
19667         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
19668         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
19669         return ret_conv;
19670 }
19671
19672 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone"))) TS_CResult_TxOutUtxoLookupErrorZ_clone(uint64_t orig) {
19673         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
19674         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19675         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
19676         return tag_ptr(ret_conv, true);
19677 }
19678
19679 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() {
19680         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
19681         *ret_conv = CResult_NoneSendErrorZ_ok();
19682         return tag_ptr(ret_conv, true);
19683 }
19684
19685 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) {
19686         void* e_ptr = untag_ptr(e);
19687         CHECK_ACCESS(e_ptr);
19688         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
19689         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
19690         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
19691         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
19692         return tag_ptr(ret_conv, true);
19693 }
19694
19695 jboolean  __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) {
19696         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
19697         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
19698         return ret_conv;
19699 }
19700
19701 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) {
19702         if (!ptr_is_owned(_res)) return;
19703         void* _res_ptr = untag_ptr(_res);
19704         CHECK_ACCESS(_res_ptr);
19705         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
19706         FREE(untag_ptr(_res));
19707         CResult_NoneSendErrorZ_free(_res_conv);
19708 }
19709
19710 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
19711         LDKBlindedPath o_conv;
19712         o_conv.inner = untag_ptr(o);
19713         o_conv.is_owned = ptr_is_owned(o);
19714         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19715         o_conv = BlindedPath_clone(&o_conv);
19716         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
19717         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
19718         return tag_ptr(ret_conv, true);
19719 }
19720
19721 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
19722         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
19723         *ret_conv = CResult_BlindedPathNoneZ_err();
19724         return tag_ptr(ret_conv, true);
19725 }
19726
19727 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
19728         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
19729         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
19730         return ret_conv;
19731 }
19732
19733 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
19734         if (!ptr_is_owned(_res)) return;
19735         void* _res_ptr = untag_ptr(_res);
19736         CHECK_ACCESS(_res_ptr);
19737         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
19738         FREE(untag_ptr(_res));
19739         CResult_BlindedPathNoneZ_free(_res_conv);
19740 }
19741
19742 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
19743         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
19744         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
19745         return tag_ptr(ret_conv, true);
19746 }
19747 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
19748         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
19749         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
19750         return ret_conv;
19751 }
19752
19753 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
19754         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
19755         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
19756         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
19757         return tag_ptr(ret_conv, true);
19758 }
19759
19760 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
19761         LDKBlindedPath o_conv;
19762         o_conv.inner = untag_ptr(o);
19763         o_conv.is_owned = ptr_is_owned(o);
19764         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19765         o_conv = BlindedPath_clone(&o_conv);
19766         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
19767         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
19768         return tag_ptr(ret_conv, true);
19769 }
19770
19771 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
19772         void* e_ptr = untag_ptr(e);
19773         CHECK_ACCESS(e_ptr);
19774         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19775         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19776         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
19777         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
19778         return tag_ptr(ret_conv, true);
19779 }
19780
19781 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
19782         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
19783         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
19784         return ret_conv;
19785 }
19786
19787 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
19788         if (!ptr_is_owned(_res)) return;
19789         void* _res_ptr = untag_ptr(_res);
19790         CHECK_ACCESS(_res_ptr);
19791         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
19792         FREE(untag_ptr(_res));
19793         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
19794 }
19795
19796 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
19797         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
19798         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
19799         return tag_ptr(ret_conv, true);
19800 }
19801 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
19802         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
19803         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
19804         return ret_conv;
19805 }
19806
19807 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
19808         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
19809         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
19810         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
19811         return tag_ptr(ret_conv, true);
19812 }
19813
19814 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
19815         LDKBlindedHop o_conv;
19816         o_conv.inner = untag_ptr(o);
19817         o_conv.is_owned = ptr_is_owned(o);
19818         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19819         o_conv = BlindedHop_clone(&o_conv);
19820         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
19821         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
19822         return tag_ptr(ret_conv, true);
19823 }
19824
19825 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
19826         void* e_ptr = untag_ptr(e);
19827         CHECK_ACCESS(e_ptr);
19828         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19829         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19830         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
19831         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
19832         return tag_ptr(ret_conv, true);
19833 }
19834
19835 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
19836         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
19837         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
19838         return ret_conv;
19839 }
19840
19841 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
19842         if (!ptr_is_owned(_res)) return;
19843         void* _res_ptr = untag_ptr(_res);
19844         CHECK_ACCESS(_res_ptr);
19845         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
19846         FREE(untag_ptr(_res));
19847         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
19848 }
19849
19850 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
19851         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
19852         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
19853         return tag_ptr(ret_conv, true);
19854 }
19855 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
19856         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
19857         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
19858         return ret_conv;
19859 }
19860
19861 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
19862         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
19863         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
19864         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
19865         return tag_ptr(ret_conv, true);
19866 }
19867
19868 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
19869         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
19870         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
19871         return tag_ptr(ret_conv, true);
19872 }
19873
19874 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
19875         void* e_ptr = untag_ptr(e);
19876         CHECK_ACCESS(e_ptr);
19877         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
19878         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
19879         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
19880         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
19881         return tag_ptr(ret_conv, true);
19882 }
19883
19884 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
19885         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
19886         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
19887         return ret_conv;
19888 }
19889
19890 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
19891         if (!ptr_is_owned(_res)) return;
19892         void* _res_ptr = untag_ptr(_res);
19893         CHECK_ACCESS(_res_ptr);
19894         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
19895         FREE(untag_ptr(_res));
19896         CResult_u32GraphSyncErrorZ_free(_res_conv);
19897 }
19898
19899 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
19900         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19901         *ret_conv = CResult_NoneErrorZ_ok();
19902         return tag_ptr(ret_conv, true);
19903 }
19904
19905 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
19906         LDKIOError e_conv = LDKIOError_from_js(e);
19907         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19908         *ret_conv = CResult_NoneErrorZ_err(e_conv);
19909         return tag_ptr(ret_conv, true);
19910 }
19911
19912 jboolean  __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint64_t o) {
19913         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
19914         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
19915         return ret_conv;
19916 }
19917
19918 void  __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint64_t _res) {
19919         if (!ptr_is_owned(_res)) return;
19920         void* _res_ptr = untag_ptr(_res);
19921         CHECK_ACCESS(_res_ptr);
19922         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
19923         FREE(untag_ptr(_res));
19924         CResult_NoneErrorZ_free(_res_conv);
19925 }
19926
19927 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
19928         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19929         *ret_conv = CResult_NoneErrorZ_clone(arg);
19930         return tag_ptr(ret_conv, true);
19931 }
19932 int64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint64_t arg) {
19933         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
19934         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
19935         return ret_conv;
19936 }
19937
19938 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint64_t orig) {
19939         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
19940         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19941         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
19942         return tag_ptr(ret_conv, true);
19943 }
19944
19945 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint64_t o) {
19946         void* o_ptr = untag_ptr(o);
19947         CHECK_ACCESS(o_ptr);
19948         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
19949         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
19950         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19951         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
19952         return tag_ptr(ret_conv, true);
19953 }
19954
19955 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint64_t e) {
19956         void* e_ptr = untag_ptr(e);
19957         CHECK_ACCESS(e_ptr);
19958         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19959         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19960         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19961         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
19962         return tag_ptr(ret_conv, true);
19963 }
19964
19965 jboolean  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint64_t o) {
19966         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
19967         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
19968         return ret_conv;
19969 }
19970
19971 void  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint64_t _res) {
19972         if (!ptr_is_owned(_res)) return;
19973         void* _res_ptr = untag_ptr(_res);
19974         CHECK_ACCESS(_res_ptr);
19975         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
19976         FREE(untag_ptr(_res));
19977         CResult_NetAddressDecodeErrorZ_free(_res_conv);
19978 }
19979
19980 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
19981         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19982         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
19983         return tag_ptr(ret_conv, true);
19984 }
19985 int64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
19986         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
19987         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
19988         return ret_conv;
19989 }
19990
19991 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint64_t orig) {
19992         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
19993         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19994         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
19995         return tag_ptr(ret_conv, true);
19996 }
19997
19998 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
19999         LDKCVec_UpdateAddHTLCZ _res_constr;
20000         _res_constr.datalen = _res->arr_len;
20001         if (_res_constr.datalen > 0)
20002                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
20003         else
20004                 _res_constr.data = NULL;
20005         uint64_t* _res_vals = _res->elems;
20006         for (size_t p = 0; p < _res_constr.datalen; p++) {
20007                 uint64_t _res_conv_15 = _res_vals[p];
20008                 LDKUpdateAddHTLC _res_conv_15_conv;
20009                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
20010                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
20011                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
20012                 _res_constr.data[p] = _res_conv_15_conv;
20013         }
20014         FREE(_res);
20015         CVec_UpdateAddHTLCZ_free(_res_constr);
20016 }
20017
20018 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
20019         LDKCVec_UpdateFulfillHTLCZ _res_constr;
20020         _res_constr.datalen = _res->arr_len;
20021         if (_res_constr.datalen > 0)
20022                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
20023         else
20024                 _res_constr.data = NULL;
20025         uint64_t* _res_vals = _res->elems;
20026         for (size_t t = 0; t < _res_constr.datalen; t++) {
20027                 uint64_t _res_conv_19 = _res_vals[t];
20028                 LDKUpdateFulfillHTLC _res_conv_19_conv;
20029                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
20030                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
20031                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
20032                 _res_constr.data[t] = _res_conv_19_conv;
20033         }
20034         FREE(_res);
20035         CVec_UpdateFulfillHTLCZ_free(_res_constr);
20036 }
20037
20038 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
20039         LDKCVec_UpdateFailHTLCZ _res_constr;
20040         _res_constr.datalen = _res->arr_len;
20041         if (_res_constr.datalen > 0)
20042                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
20043         else
20044                 _res_constr.data = NULL;
20045         uint64_t* _res_vals = _res->elems;
20046         for (size_t q = 0; q < _res_constr.datalen; q++) {
20047                 uint64_t _res_conv_16 = _res_vals[q];
20048                 LDKUpdateFailHTLC _res_conv_16_conv;
20049                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
20050                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
20051                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20052                 _res_constr.data[q] = _res_conv_16_conv;
20053         }
20054         FREE(_res);
20055         CVec_UpdateFailHTLCZ_free(_res_constr);
20056 }
20057
20058 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
20059         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
20060         _res_constr.datalen = _res->arr_len;
20061         if (_res_constr.datalen > 0)
20062                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
20063         else
20064                 _res_constr.data = NULL;
20065         uint64_t* _res_vals = _res->elems;
20066         for (size_t z = 0; z < _res_constr.datalen; z++) {
20067                 uint64_t _res_conv_25 = _res_vals[z];
20068                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
20069                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
20070                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
20071                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
20072                 _res_constr.data[z] = _res_conv_25_conv;
20073         }
20074         FREE(_res);
20075         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
20076 }
20077
20078 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
20079         LDKAcceptChannel o_conv;
20080         o_conv.inner = untag_ptr(o);
20081         o_conv.is_owned = ptr_is_owned(o);
20082         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20083         o_conv = AcceptChannel_clone(&o_conv);
20084         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20085         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
20086         return tag_ptr(ret_conv, true);
20087 }
20088
20089 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
20090         void* e_ptr = untag_ptr(e);
20091         CHECK_ACCESS(e_ptr);
20092         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20093         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20094         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20095         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
20096         return tag_ptr(ret_conv, true);
20097 }
20098
20099 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
20100         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
20101         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
20102         return ret_conv;
20103 }
20104
20105 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
20106         if (!ptr_is_owned(_res)) return;
20107         void* _res_ptr = untag_ptr(_res);
20108         CHECK_ACCESS(_res_ptr);
20109         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
20110         FREE(untag_ptr(_res));
20111         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
20112 }
20113
20114 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
20115         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20116         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
20117         return tag_ptr(ret_conv, true);
20118 }
20119 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
20120         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
20121         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
20122         return ret_conv;
20123 }
20124
20125 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
20126         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
20127         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20128         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
20129         return tag_ptr(ret_conv, true);
20130 }
20131
20132 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
20133         LDKAnnouncementSignatures o_conv;
20134         o_conv.inner = untag_ptr(o);
20135         o_conv.is_owned = ptr_is_owned(o);
20136         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20137         o_conv = AnnouncementSignatures_clone(&o_conv);
20138         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20139         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
20140         return tag_ptr(ret_conv, true);
20141 }
20142
20143 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
20144         void* e_ptr = untag_ptr(e);
20145         CHECK_ACCESS(e_ptr);
20146         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20147         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20148         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20149         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
20150         return tag_ptr(ret_conv, true);
20151 }
20152
20153 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
20154         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
20155         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
20156         return ret_conv;
20157 }
20158
20159 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
20160         if (!ptr_is_owned(_res)) return;
20161         void* _res_ptr = untag_ptr(_res);
20162         CHECK_ACCESS(_res_ptr);
20163         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
20164         FREE(untag_ptr(_res));
20165         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
20166 }
20167
20168 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
20169         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20170         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
20171         return tag_ptr(ret_conv, true);
20172 }
20173 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
20174         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
20175         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
20176         return ret_conv;
20177 }
20178
20179 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
20180         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
20181         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20182         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
20183         return tag_ptr(ret_conv, true);
20184 }
20185
20186 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
20187         LDKChannelReestablish o_conv;
20188         o_conv.inner = untag_ptr(o);
20189         o_conv.is_owned = ptr_is_owned(o);
20190         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20191         o_conv = ChannelReestablish_clone(&o_conv);
20192         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20193         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
20194         return tag_ptr(ret_conv, true);
20195 }
20196
20197 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
20198         void* e_ptr = untag_ptr(e);
20199         CHECK_ACCESS(e_ptr);
20200         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20201         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20202         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20203         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
20204         return tag_ptr(ret_conv, true);
20205 }
20206
20207 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
20208         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
20209         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
20210         return ret_conv;
20211 }
20212
20213 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
20214         if (!ptr_is_owned(_res)) return;
20215         void* _res_ptr = untag_ptr(_res);
20216         CHECK_ACCESS(_res_ptr);
20217         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
20218         FREE(untag_ptr(_res));
20219         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
20220 }
20221
20222 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
20223         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20224         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
20225         return tag_ptr(ret_conv, true);
20226 }
20227 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
20228         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
20229         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
20230         return ret_conv;
20231 }
20232
20233 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
20234         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
20235         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20236         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
20237         return tag_ptr(ret_conv, true);
20238 }
20239
20240 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
20241         LDKClosingSigned o_conv;
20242         o_conv.inner = untag_ptr(o);
20243         o_conv.is_owned = ptr_is_owned(o);
20244         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20245         o_conv = ClosingSigned_clone(&o_conv);
20246         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20247         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
20248         return tag_ptr(ret_conv, true);
20249 }
20250
20251 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
20252         void* e_ptr = untag_ptr(e);
20253         CHECK_ACCESS(e_ptr);
20254         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20255         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20256         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20257         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
20258         return tag_ptr(ret_conv, true);
20259 }
20260
20261 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
20262         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
20263         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
20264         return ret_conv;
20265 }
20266
20267 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
20268         if (!ptr_is_owned(_res)) return;
20269         void* _res_ptr = untag_ptr(_res);
20270         CHECK_ACCESS(_res_ptr);
20271         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
20272         FREE(untag_ptr(_res));
20273         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
20274 }
20275
20276 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
20277         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20278         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
20279         return tag_ptr(ret_conv, true);
20280 }
20281 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
20282         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
20283         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
20284         return ret_conv;
20285 }
20286
20287 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
20288         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
20289         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20290         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
20291         return tag_ptr(ret_conv, true);
20292 }
20293
20294 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
20295         LDKClosingSignedFeeRange o_conv;
20296         o_conv.inner = untag_ptr(o);
20297         o_conv.is_owned = ptr_is_owned(o);
20298         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20299         o_conv = ClosingSignedFeeRange_clone(&o_conv);
20300         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20301         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
20302         return tag_ptr(ret_conv, true);
20303 }
20304
20305 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
20306         void* e_ptr = untag_ptr(e);
20307         CHECK_ACCESS(e_ptr);
20308         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20309         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20310         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20311         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
20312         return tag_ptr(ret_conv, true);
20313 }
20314
20315 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
20316         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
20317         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
20318         return ret_conv;
20319 }
20320
20321 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
20322         if (!ptr_is_owned(_res)) return;
20323         void* _res_ptr = untag_ptr(_res);
20324         CHECK_ACCESS(_res_ptr);
20325         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
20326         FREE(untag_ptr(_res));
20327         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
20328 }
20329
20330 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
20331         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20332         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
20333         return tag_ptr(ret_conv, true);
20334 }
20335 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
20336         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
20337         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
20338         return ret_conv;
20339 }
20340
20341 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
20342         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
20343         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20344         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
20345         return tag_ptr(ret_conv, true);
20346 }
20347
20348 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
20349         LDKCommitmentSigned o_conv;
20350         o_conv.inner = untag_ptr(o);
20351         o_conv.is_owned = ptr_is_owned(o);
20352         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20353         o_conv = CommitmentSigned_clone(&o_conv);
20354         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20355         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
20356         return tag_ptr(ret_conv, true);
20357 }
20358
20359 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
20360         void* e_ptr = untag_ptr(e);
20361         CHECK_ACCESS(e_ptr);
20362         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20363         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20364         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20365         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
20366         return tag_ptr(ret_conv, true);
20367 }
20368
20369 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
20370         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
20371         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
20372         return ret_conv;
20373 }
20374
20375 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
20376         if (!ptr_is_owned(_res)) return;
20377         void* _res_ptr = untag_ptr(_res);
20378         CHECK_ACCESS(_res_ptr);
20379         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
20380         FREE(untag_ptr(_res));
20381         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
20382 }
20383
20384 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
20385         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20386         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
20387         return tag_ptr(ret_conv, true);
20388 }
20389 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
20390         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
20391         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
20392         return ret_conv;
20393 }
20394
20395 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
20396         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
20397         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20398         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
20399         return tag_ptr(ret_conv, true);
20400 }
20401
20402 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
20403         LDKFundingCreated o_conv;
20404         o_conv.inner = untag_ptr(o);
20405         o_conv.is_owned = ptr_is_owned(o);
20406         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20407         o_conv = FundingCreated_clone(&o_conv);
20408         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20409         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
20410         return tag_ptr(ret_conv, true);
20411 }
20412
20413 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
20414         void* e_ptr = untag_ptr(e);
20415         CHECK_ACCESS(e_ptr);
20416         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20417         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20418         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20419         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
20420         return tag_ptr(ret_conv, true);
20421 }
20422
20423 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
20424         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
20425         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
20426         return ret_conv;
20427 }
20428
20429 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
20430         if (!ptr_is_owned(_res)) return;
20431         void* _res_ptr = untag_ptr(_res);
20432         CHECK_ACCESS(_res_ptr);
20433         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
20434         FREE(untag_ptr(_res));
20435         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
20436 }
20437
20438 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
20439         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20440         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
20441         return tag_ptr(ret_conv, true);
20442 }
20443 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
20444         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
20445         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
20446         return ret_conv;
20447 }
20448
20449 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
20450         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
20451         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20452         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
20453         return tag_ptr(ret_conv, true);
20454 }
20455
20456 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
20457         LDKFundingSigned o_conv;
20458         o_conv.inner = untag_ptr(o);
20459         o_conv.is_owned = ptr_is_owned(o);
20460         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20461         o_conv = FundingSigned_clone(&o_conv);
20462         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20463         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
20464         return tag_ptr(ret_conv, true);
20465 }
20466
20467 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
20468         void* e_ptr = untag_ptr(e);
20469         CHECK_ACCESS(e_ptr);
20470         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20471         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20472         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20473         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
20474         return tag_ptr(ret_conv, true);
20475 }
20476
20477 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
20478         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
20479         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
20480         return ret_conv;
20481 }
20482
20483 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
20484         if (!ptr_is_owned(_res)) return;
20485         void* _res_ptr = untag_ptr(_res);
20486         CHECK_ACCESS(_res_ptr);
20487         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
20488         FREE(untag_ptr(_res));
20489         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
20490 }
20491
20492 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
20493         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20494         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
20495         return tag_ptr(ret_conv, true);
20496 }
20497 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
20498         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
20499         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
20500         return ret_conv;
20501 }
20502
20503 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
20504         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
20505         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20506         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
20507         return tag_ptr(ret_conv, true);
20508 }
20509
20510 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
20511         LDKChannelReady o_conv;
20512         o_conv.inner = untag_ptr(o);
20513         o_conv.is_owned = ptr_is_owned(o);
20514         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20515         o_conv = ChannelReady_clone(&o_conv);
20516         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20517         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
20518         return tag_ptr(ret_conv, true);
20519 }
20520
20521 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
20522         void* e_ptr = untag_ptr(e);
20523         CHECK_ACCESS(e_ptr);
20524         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20525         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20526         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20527         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
20528         return tag_ptr(ret_conv, true);
20529 }
20530
20531 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
20532         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
20533         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
20534         return ret_conv;
20535 }
20536
20537 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
20538         if (!ptr_is_owned(_res)) return;
20539         void* _res_ptr = untag_ptr(_res);
20540         CHECK_ACCESS(_res_ptr);
20541         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
20542         FREE(untag_ptr(_res));
20543         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
20544 }
20545
20546 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
20547         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20548         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
20549         return tag_ptr(ret_conv, true);
20550 }
20551 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
20552         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
20553         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
20554         return ret_conv;
20555 }
20556
20557 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
20558         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
20559         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20560         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
20561         return tag_ptr(ret_conv, true);
20562 }
20563
20564 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
20565         LDKInit o_conv;
20566         o_conv.inner = untag_ptr(o);
20567         o_conv.is_owned = ptr_is_owned(o);
20568         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20569         o_conv = Init_clone(&o_conv);
20570         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20571         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
20572         return tag_ptr(ret_conv, true);
20573 }
20574
20575 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
20576         void* e_ptr = untag_ptr(e);
20577         CHECK_ACCESS(e_ptr);
20578         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20579         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20580         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20581         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
20582         return tag_ptr(ret_conv, true);
20583 }
20584
20585 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
20586         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
20587         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
20588         return ret_conv;
20589 }
20590
20591 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
20592         if (!ptr_is_owned(_res)) return;
20593         void* _res_ptr = untag_ptr(_res);
20594         CHECK_ACCESS(_res_ptr);
20595         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
20596         FREE(untag_ptr(_res));
20597         CResult_InitDecodeErrorZ_free(_res_conv);
20598 }
20599
20600 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
20601         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20602         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
20603         return tag_ptr(ret_conv, true);
20604 }
20605 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
20606         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
20607         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
20608         return ret_conv;
20609 }
20610
20611 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
20612         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
20613         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20614         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
20615         return tag_ptr(ret_conv, true);
20616 }
20617
20618 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
20619         LDKOpenChannel o_conv;
20620         o_conv.inner = untag_ptr(o);
20621         o_conv.is_owned = ptr_is_owned(o);
20622         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20623         o_conv = OpenChannel_clone(&o_conv);
20624         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20625         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
20626         return tag_ptr(ret_conv, true);
20627 }
20628
20629 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
20630         void* e_ptr = untag_ptr(e);
20631         CHECK_ACCESS(e_ptr);
20632         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20633         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20634         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20635         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
20636         return tag_ptr(ret_conv, true);
20637 }
20638
20639 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
20640         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
20641         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
20642         return ret_conv;
20643 }
20644
20645 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
20646         if (!ptr_is_owned(_res)) return;
20647         void* _res_ptr = untag_ptr(_res);
20648         CHECK_ACCESS(_res_ptr);
20649         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
20650         FREE(untag_ptr(_res));
20651         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
20652 }
20653
20654 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
20655         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20656         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
20657         return tag_ptr(ret_conv, true);
20658 }
20659 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
20660         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
20661         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
20662         return ret_conv;
20663 }
20664
20665 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
20666         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
20667         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20668         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
20669         return tag_ptr(ret_conv, true);
20670 }
20671
20672 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
20673         LDKRevokeAndACK o_conv;
20674         o_conv.inner = untag_ptr(o);
20675         o_conv.is_owned = ptr_is_owned(o);
20676         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20677         o_conv = RevokeAndACK_clone(&o_conv);
20678         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20679         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
20680         return tag_ptr(ret_conv, true);
20681 }
20682
20683 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
20684         void* e_ptr = untag_ptr(e);
20685         CHECK_ACCESS(e_ptr);
20686         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20687         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20688         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20689         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
20690         return tag_ptr(ret_conv, true);
20691 }
20692
20693 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
20694         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
20695         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
20696         return ret_conv;
20697 }
20698
20699 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
20700         if (!ptr_is_owned(_res)) return;
20701         void* _res_ptr = untag_ptr(_res);
20702         CHECK_ACCESS(_res_ptr);
20703         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
20704         FREE(untag_ptr(_res));
20705         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
20706 }
20707
20708 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
20709         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20710         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
20711         return tag_ptr(ret_conv, true);
20712 }
20713 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
20714         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
20715         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
20716         return ret_conv;
20717 }
20718
20719 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
20720         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
20721         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20722         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
20723         return tag_ptr(ret_conv, true);
20724 }
20725
20726 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
20727         LDKShutdown o_conv;
20728         o_conv.inner = untag_ptr(o);
20729         o_conv.is_owned = ptr_is_owned(o);
20730         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20731         o_conv = Shutdown_clone(&o_conv);
20732         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20733         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
20734         return tag_ptr(ret_conv, true);
20735 }
20736
20737 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
20738         void* e_ptr = untag_ptr(e);
20739         CHECK_ACCESS(e_ptr);
20740         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20741         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20742         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20743         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
20744         return tag_ptr(ret_conv, true);
20745 }
20746
20747 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
20748         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
20749         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
20750         return ret_conv;
20751 }
20752
20753 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
20754         if (!ptr_is_owned(_res)) return;
20755         void* _res_ptr = untag_ptr(_res);
20756         CHECK_ACCESS(_res_ptr);
20757         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
20758         FREE(untag_ptr(_res));
20759         CResult_ShutdownDecodeErrorZ_free(_res_conv);
20760 }
20761
20762 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
20763         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20764         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
20765         return tag_ptr(ret_conv, true);
20766 }
20767 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
20768         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
20769         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
20770         return ret_conv;
20771 }
20772
20773 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
20774         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
20775         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20776         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
20777         return tag_ptr(ret_conv, true);
20778 }
20779
20780 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
20781         LDKUpdateFailHTLC o_conv;
20782         o_conv.inner = untag_ptr(o);
20783         o_conv.is_owned = ptr_is_owned(o);
20784         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20785         o_conv = UpdateFailHTLC_clone(&o_conv);
20786         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20787         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
20788         return tag_ptr(ret_conv, true);
20789 }
20790
20791 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
20792         void* e_ptr = untag_ptr(e);
20793         CHECK_ACCESS(e_ptr);
20794         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20795         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20796         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20797         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
20798         return tag_ptr(ret_conv, true);
20799 }
20800
20801 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
20802         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
20803         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
20804         return ret_conv;
20805 }
20806
20807 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
20808         if (!ptr_is_owned(_res)) return;
20809         void* _res_ptr = untag_ptr(_res);
20810         CHECK_ACCESS(_res_ptr);
20811         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
20812         FREE(untag_ptr(_res));
20813         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
20814 }
20815
20816 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
20817         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20818         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
20819         return tag_ptr(ret_conv, true);
20820 }
20821 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20822         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
20823         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
20824         return ret_conv;
20825 }
20826
20827 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
20828         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
20829         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20830         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
20831         return tag_ptr(ret_conv, true);
20832 }
20833
20834 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
20835         LDKUpdateFailMalformedHTLC o_conv;
20836         o_conv.inner = untag_ptr(o);
20837         o_conv.is_owned = ptr_is_owned(o);
20838         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20839         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
20840         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20841         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
20842         return tag_ptr(ret_conv, true);
20843 }
20844
20845 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
20846         void* e_ptr = untag_ptr(e);
20847         CHECK_ACCESS(e_ptr);
20848         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20849         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20850         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20851         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
20852         return tag_ptr(ret_conv, true);
20853 }
20854
20855 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
20856         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
20857         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
20858         return ret_conv;
20859 }
20860
20861 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
20862         if (!ptr_is_owned(_res)) return;
20863         void* _res_ptr = untag_ptr(_res);
20864         CHECK_ACCESS(_res_ptr);
20865         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
20866         FREE(untag_ptr(_res));
20867         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
20868 }
20869
20870 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
20871         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20872         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
20873         return tag_ptr(ret_conv, true);
20874 }
20875 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20876         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
20877         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
20878         return ret_conv;
20879 }
20880
20881 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
20882         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
20883         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20884         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
20885         return tag_ptr(ret_conv, true);
20886 }
20887
20888 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
20889         LDKUpdateFee o_conv;
20890         o_conv.inner = untag_ptr(o);
20891         o_conv.is_owned = ptr_is_owned(o);
20892         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20893         o_conv = UpdateFee_clone(&o_conv);
20894         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20895         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
20896         return tag_ptr(ret_conv, true);
20897 }
20898
20899 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
20900         void* e_ptr = untag_ptr(e);
20901         CHECK_ACCESS(e_ptr);
20902         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20903         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20904         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20905         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
20906         return tag_ptr(ret_conv, true);
20907 }
20908
20909 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
20910         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
20911         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
20912         return ret_conv;
20913 }
20914
20915 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
20916         if (!ptr_is_owned(_res)) return;
20917         void* _res_ptr = untag_ptr(_res);
20918         CHECK_ACCESS(_res_ptr);
20919         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
20920         FREE(untag_ptr(_res));
20921         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
20922 }
20923
20924 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
20925         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20926         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
20927         return tag_ptr(ret_conv, true);
20928 }
20929 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
20930         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
20931         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
20932         return ret_conv;
20933 }
20934
20935 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
20936         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
20937         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20938         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
20939         return tag_ptr(ret_conv, true);
20940 }
20941
20942 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
20943         LDKUpdateFulfillHTLC o_conv;
20944         o_conv.inner = untag_ptr(o);
20945         o_conv.is_owned = ptr_is_owned(o);
20946         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20947         o_conv = UpdateFulfillHTLC_clone(&o_conv);
20948         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20949         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
20950         return tag_ptr(ret_conv, true);
20951 }
20952
20953 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
20954         void* e_ptr = untag_ptr(e);
20955         CHECK_ACCESS(e_ptr);
20956         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20957         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20958         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20959         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
20960         return tag_ptr(ret_conv, true);
20961 }
20962
20963 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
20964         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
20965         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
20966         return ret_conv;
20967 }
20968
20969 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
20970         if (!ptr_is_owned(_res)) return;
20971         void* _res_ptr = untag_ptr(_res);
20972         CHECK_ACCESS(_res_ptr);
20973         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
20974         FREE(untag_ptr(_res));
20975         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
20976 }
20977
20978 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
20979         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20980         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
20981         return tag_ptr(ret_conv, true);
20982 }
20983 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20984         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
20985         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
20986         return ret_conv;
20987 }
20988
20989 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
20990         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
20991         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20992         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
20993         return tag_ptr(ret_conv, true);
20994 }
20995
20996 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
20997         LDKUpdateAddHTLC o_conv;
20998         o_conv.inner = untag_ptr(o);
20999         o_conv.is_owned = ptr_is_owned(o);
21000         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21001         o_conv = UpdateAddHTLC_clone(&o_conv);
21002         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21003         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
21004         return tag_ptr(ret_conv, true);
21005 }
21006
21007 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
21008         void* e_ptr = untag_ptr(e);
21009         CHECK_ACCESS(e_ptr);
21010         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21011         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21012         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21013         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
21014         return tag_ptr(ret_conv, true);
21015 }
21016
21017 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
21018         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
21019         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
21020         return ret_conv;
21021 }
21022
21023 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
21024         if (!ptr_is_owned(_res)) return;
21025         void* _res_ptr = untag_ptr(_res);
21026         CHECK_ACCESS(_res_ptr);
21027         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
21028         FREE(untag_ptr(_res));
21029         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
21030 }
21031
21032 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
21033         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21034         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
21035         return tag_ptr(ret_conv, true);
21036 }
21037 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
21038         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
21039         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
21040         return ret_conv;
21041 }
21042
21043 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
21044         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
21045         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21046         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
21047         return tag_ptr(ret_conv, true);
21048 }
21049
21050 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
21051         LDKOnionMessage o_conv;
21052         o_conv.inner = untag_ptr(o);
21053         o_conv.is_owned = ptr_is_owned(o);
21054         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21055         o_conv = OnionMessage_clone(&o_conv);
21056         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
21057         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
21058         return tag_ptr(ret_conv, true);
21059 }
21060
21061 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
21062         void* e_ptr = untag_ptr(e);
21063         CHECK_ACCESS(e_ptr);
21064         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21065         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21066         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
21067         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
21068         return tag_ptr(ret_conv, true);
21069 }
21070
21071 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
21072         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
21073         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
21074         return ret_conv;
21075 }
21076
21077 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
21078         if (!ptr_is_owned(_res)) return;
21079         void* _res_ptr = untag_ptr(_res);
21080         CHECK_ACCESS(_res_ptr);
21081         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
21082         FREE(untag_ptr(_res));
21083         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
21084 }
21085
21086 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
21087         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
21088         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
21089         return tag_ptr(ret_conv, true);
21090 }
21091 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
21092         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
21093         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
21094         return ret_conv;
21095 }
21096
21097 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
21098         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
21099         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
21100         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
21101         return tag_ptr(ret_conv, true);
21102 }
21103
21104 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
21105         LDKPing o_conv;
21106         o_conv.inner = untag_ptr(o);
21107         o_conv.is_owned = ptr_is_owned(o);
21108         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21109         o_conv = Ping_clone(&o_conv);
21110         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21111         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
21112         return tag_ptr(ret_conv, true);
21113 }
21114
21115 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
21116         void* e_ptr = untag_ptr(e);
21117         CHECK_ACCESS(e_ptr);
21118         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21119         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21120         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21121         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
21122         return tag_ptr(ret_conv, true);
21123 }
21124
21125 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
21126         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
21127         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
21128         return ret_conv;
21129 }
21130
21131 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
21132         if (!ptr_is_owned(_res)) return;
21133         void* _res_ptr = untag_ptr(_res);
21134         CHECK_ACCESS(_res_ptr);
21135         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
21136         FREE(untag_ptr(_res));
21137         CResult_PingDecodeErrorZ_free(_res_conv);
21138 }
21139
21140 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
21141         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21142         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
21143         return tag_ptr(ret_conv, true);
21144 }
21145 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
21146         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
21147         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
21148         return ret_conv;
21149 }
21150
21151 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
21152         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
21153         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21154         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
21155         return tag_ptr(ret_conv, true);
21156 }
21157
21158 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
21159         LDKPong o_conv;
21160         o_conv.inner = untag_ptr(o);
21161         o_conv.is_owned = ptr_is_owned(o);
21162         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21163         o_conv = Pong_clone(&o_conv);
21164         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21165         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
21166         return tag_ptr(ret_conv, true);
21167 }
21168
21169 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
21170         void* e_ptr = untag_ptr(e);
21171         CHECK_ACCESS(e_ptr);
21172         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21173         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21174         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21175         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
21176         return tag_ptr(ret_conv, true);
21177 }
21178
21179 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
21180         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
21181         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
21182         return ret_conv;
21183 }
21184
21185 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
21186         if (!ptr_is_owned(_res)) return;
21187         void* _res_ptr = untag_ptr(_res);
21188         CHECK_ACCESS(_res_ptr);
21189         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
21190         FREE(untag_ptr(_res));
21191         CResult_PongDecodeErrorZ_free(_res_conv);
21192 }
21193
21194 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
21195         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21196         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
21197         return tag_ptr(ret_conv, true);
21198 }
21199 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
21200         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
21201         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
21202         return ret_conv;
21203 }
21204
21205 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
21206         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
21207         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21208         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
21209         return tag_ptr(ret_conv, true);
21210 }
21211
21212 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
21213         LDKUnsignedChannelAnnouncement o_conv;
21214         o_conv.inner = untag_ptr(o);
21215         o_conv.is_owned = ptr_is_owned(o);
21216         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21217         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
21218         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21219         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
21220         return tag_ptr(ret_conv, true);
21221 }
21222
21223 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
21224         void* e_ptr = untag_ptr(e);
21225         CHECK_ACCESS(e_ptr);
21226         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21227         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21228         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21229         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
21230         return tag_ptr(ret_conv, true);
21231 }
21232
21233 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21234         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
21235         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
21236         return ret_conv;
21237 }
21238
21239 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
21240         if (!ptr_is_owned(_res)) return;
21241         void* _res_ptr = untag_ptr(_res);
21242         CHECK_ACCESS(_res_ptr);
21243         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
21244         FREE(untag_ptr(_res));
21245         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
21246 }
21247
21248 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21249         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21250         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
21251         return tag_ptr(ret_conv, true);
21252 }
21253 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21254         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
21255         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21256         return ret_conv;
21257 }
21258
21259 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21260         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
21261         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21262         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
21263         return tag_ptr(ret_conv, true);
21264 }
21265
21266 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
21267         LDKChannelAnnouncement o_conv;
21268         o_conv.inner = untag_ptr(o);
21269         o_conv.is_owned = ptr_is_owned(o);
21270         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21271         o_conv = ChannelAnnouncement_clone(&o_conv);
21272         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21273         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
21274         return tag_ptr(ret_conv, true);
21275 }
21276
21277 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
21278         void* e_ptr = untag_ptr(e);
21279         CHECK_ACCESS(e_ptr);
21280         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21281         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21282         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21283         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
21284         return tag_ptr(ret_conv, true);
21285 }
21286
21287 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21288         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
21289         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
21290         return ret_conv;
21291 }
21292
21293 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
21294         if (!ptr_is_owned(_res)) return;
21295         void* _res_ptr = untag_ptr(_res);
21296         CHECK_ACCESS(_res_ptr);
21297         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
21298         FREE(untag_ptr(_res));
21299         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
21300 }
21301
21302 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21303         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21304         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
21305         return tag_ptr(ret_conv, true);
21306 }
21307 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21308         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
21309         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21310         return ret_conv;
21311 }
21312
21313 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21314         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
21315         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21316         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
21317         return tag_ptr(ret_conv, true);
21318 }
21319
21320 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
21321         LDKUnsignedChannelUpdate o_conv;
21322         o_conv.inner = untag_ptr(o);
21323         o_conv.is_owned = ptr_is_owned(o);
21324         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21325         o_conv = UnsignedChannelUpdate_clone(&o_conv);
21326         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21327         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
21328         return tag_ptr(ret_conv, true);
21329 }
21330
21331 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
21332         void* e_ptr = untag_ptr(e);
21333         CHECK_ACCESS(e_ptr);
21334         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21335         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21336         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21337         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
21338         return tag_ptr(ret_conv, true);
21339 }
21340
21341 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
21342         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
21343         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
21344         return ret_conv;
21345 }
21346
21347 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
21348         if (!ptr_is_owned(_res)) return;
21349         void* _res_ptr = untag_ptr(_res);
21350         CHECK_ACCESS(_res_ptr);
21351         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
21352         FREE(untag_ptr(_res));
21353         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
21354 }
21355
21356 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
21357         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21358         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
21359         return tag_ptr(ret_conv, true);
21360 }
21361 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21362         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
21363         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
21364         return ret_conv;
21365 }
21366
21367 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
21368         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
21369         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21370         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
21371         return tag_ptr(ret_conv, true);
21372 }
21373
21374 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
21375         LDKChannelUpdate o_conv;
21376         o_conv.inner = untag_ptr(o);
21377         o_conv.is_owned = ptr_is_owned(o);
21378         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21379         o_conv = ChannelUpdate_clone(&o_conv);
21380         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21381         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
21382         return tag_ptr(ret_conv, true);
21383 }
21384
21385 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
21386         void* e_ptr = untag_ptr(e);
21387         CHECK_ACCESS(e_ptr);
21388         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21389         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21390         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21391         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
21392         return tag_ptr(ret_conv, true);
21393 }
21394
21395 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
21396         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
21397         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
21398         return ret_conv;
21399 }
21400
21401 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
21402         if (!ptr_is_owned(_res)) return;
21403         void* _res_ptr = untag_ptr(_res);
21404         CHECK_ACCESS(_res_ptr);
21405         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
21406         FREE(untag_ptr(_res));
21407         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
21408 }
21409
21410 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
21411         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21412         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
21413         return tag_ptr(ret_conv, true);
21414 }
21415 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21416         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
21417         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
21418         return ret_conv;
21419 }
21420
21421 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
21422         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
21423         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21424         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
21425         return tag_ptr(ret_conv, true);
21426 }
21427
21428 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
21429         LDKErrorMessage o_conv;
21430         o_conv.inner = untag_ptr(o);
21431         o_conv.is_owned = ptr_is_owned(o);
21432         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21433         o_conv = ErrorMessage_clone(&o_conv);
21434         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21435         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
21436         return tag_ptr(ret_conv, true);
21437 }
21438
21439 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
21440         void* e_ptr = untag_ptr(e);
21441         CHECK_ACCESS(e_ptr);
21442         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21443         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21444         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21445         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
21446         return tag_ptr(ret_conv, true);
21447 }
21448
21449 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
21450         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
21451         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
21452         return ret_conv;
21453 }
21454
21455 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
21456         if (!ptr_is_owned(_res)) return;
21457         void* _res_ptr = untag_ptr(_res);
21458         CHECK_ACCESS(_res_ptr);
21459         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
21460         FREE(untag_ptr(_res));
21461         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
21462 }
21463
21464 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
21465         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21466         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
21467         return tag_ptr(ret_conv, true);
21468 }
21469 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
21470         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
21471         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
21472         return ret_conv;
21473 }
21474
21475 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
21476         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
21477         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21478         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
21479         return tag_ptr(ret_conv, true);
21480 }
21481
21482 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
21483         LDKWarningMessage o_conv;
21484         o_conv.inner = untag_ptr(o);
21485         o_conv.is_owned = ptr_is_owned(o);
21486         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21487         o_conv = WarningMessage_clone(&o_conv);
21488         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21489         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
21490         return tag_ptr(ret_conv, true);
21491 }
21492
21493 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
21494         void* e_ptr = untag_ptr(e);
21495         CHECK_ACCESS(e_ptr);
21496         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21497         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21498         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21499         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
21500         return tag_ptr(ret_conv, true);
21501 }
21502
21503 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
21504         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
21505         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
21506         return ret_conv;
21507 }
21508
21509 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
21510         if (!ptr_is_owned(_res)) return;
21511         void* _res_ptr = untag_ptr(_res);
21512         CHECK_ACCESS(_res_ptr);
21513         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
21514         FREE(untag_ptr(_res));
21515         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
21516 }
21517
21518 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
21519         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21520         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
21521         return tag_ptr(ret_conv, true);
21522 }
21523 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
21524         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
21525         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
21526         return ret_conv;
21527 }
21528
21529 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
21530         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
21531         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21532         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
21533         return tag_ptr(ret_conv, true);
21534 }
21535
21536 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
21537         LDKUnsignedNodeAnnouncement o_conv;
21538         o_conv.inner = untag_ptr(o);
21539         o_conv.is_owned = ptr_is_owned(o);
21540         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21541         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
21542         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21543         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
21544         return tag_ptr(ret_conv, true);
21545 }
21546
21547 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
21548         void* e_ptr = untag_ptr(e);
21549         CHECK_ACCESS(e_ptr);
21550         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21551         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21552         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21553         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
21554         return tag_ptr(ret_conv, true);
21555 }
21556
21557 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21558         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
21559         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
21560         return ret_conv;
21561 }
21562
21563 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
21564         if (!ptr_is_owned(_res)) return;
21565         void* _res_ptr = untag_ptr(_res);
21566         CHECK_ACCESS(_res_ptr);
21567         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
21568         FREE(untag_ptr(_res));
21569         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
21570 }
21571
21572 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21573         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21574         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
21575         return tag_ptr(ret_conv, true);
21576 }
21577 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21578         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
21579         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21580         return ret_conv;
21581 }
21582
21583 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21584         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
21585         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21586         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
21587         return tag_ptr(ret_conv, true);
21588 }
21589
21590 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
21591         LDKNodeAnnouncement o_conv;
21592         o_conv.inner = untag_ptr(o);
21593         o_conv.is_owned = ptr_is_owned(o);
21594         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21595         o_conv = NodeAnnouncement_clone(&o_conv);
21596         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21597         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
21598         return tag_ptr(ret_conv, true);
21599 }
21600
21601 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
21602         void* e_ptr = untag_ptr(e);
21603         CHECK_ACCESS(e_ptr);
21604         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21605         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21606         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21607         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
21608         return tag_ptr(ret_conv, true);
21609 }
21610
21611 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21612         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
21613         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
21614         return ret_conv;
21615 }
21616
21617 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
21618         if (!ptr_is_owned(_res)) return;
21619         void* _res_ptr = untag_ptr(_res);
21620         CHECK_ACCESS(_res_ptr);
21621         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
21622         FREE(untag_ptr(_res));
21623         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
21624 }
21625
21626 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21627         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21628         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
21629         return tag_ptr(ret_conv, true);
21630 }
21631 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21632         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
21633         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21634         return ret_conv;
21635 }
21636
21637 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21638         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
21639         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21640         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
21641         return tag_ptr(ret_conv, true);
21642 }
21643
21644 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
21645         LDKQueryShortChannelIds o_conv;
21646         o_conv.inner = untag_ptr(o);
21647         o_conv.is_owned = ptr_is_owned(o);
21648         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21649         o_conv = QueryShortChannelIds_clone(&o_conv);
21650         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21651         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
21652         return tag_ptr(ret_conv, true);
21653 }
21654
21655 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
21656         void* e_ptr = untag_ptr(e);
21657         CHECK_ACCESS(e_ptr);
21658         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21659         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21660         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21661         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
21662         return tag_ptr(ret_conv, true);
21663 }
21664
21665 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
21666         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
21667         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
21668         return ret_conv;
21669 }
21670
21671 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
21672         if (!ptr_is_owned(_res)) return;
21673         void* _res_ptr = untag_ptr(_res);
21674         CHECK_ACCESS(_res_ptr);
21675         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
21676         FREE(untag_ptr(_res));
21677         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
21678 }
21679
21680 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
21681         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21682         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
21683         return tag_ptr(ret_conv, true);
21684 }
21685 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
21686         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
21687         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
21688         return ret_conv;
21689 }
21690
21691 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
21692         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
21693         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21694         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
21695         return tag_ptr(ret_conv, true);
21696 }
21697
21698 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
21699         LDKReplyShortChannelIdsEnd o_conv;
21700         o_conv.inner = untag_ptr(o);
21701         o_conv.is_owned = ptr_is_owned(o);
21702         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21703         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
21704         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21705         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
21706         return tag_ptr(ret_conv, true);
21707 }
21708
21709 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
21710         void* e_ptr = untag_ptr(e);
21711         CHECK_ACCESS(e_ptr);
21712         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21713         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21714         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21715         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
21716         return tag_ptr(ret_conv, true);
21717 }
21718
21719 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
21720         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
21721         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
21722         return ret_conv;
21723 }
21724
21725 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
21726         if (!ptr_is_owned(_res)) return;
21727         void* _res_ptr = untag_ptr(_res);
21728         CHECK_ACCESS(_res_ptr);
21729         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
21730         FREE(untag_ptr(_res));
21731         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
21732 }
21733
21734 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
21735         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21736         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
21737         return tag_ptr(ret_conv, true);
21738 }
21739 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
21740         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
21741         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
21742         return ret_conv;
21743 }
21744
21745 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
21746         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
21747         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21748         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
21749         return tag_ptr(ret_conv, true);
21750 }
21751
21752 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
21753         LDKQueryChannelRange o_conv;
21754         o_conv.inner = untag_ptr(o);
21755         o_conv.is_owned = ptr_is_owned(o);
21756         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21757         o_conv = QueryChannelRange_clone(&o_conv);
21758         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21759         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
21760         return tag_ptr(ret_conv, true);
21761 }
21762
21763 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
21764         void* e_ptr = untag_ptr(e);
21765         CHECK_ACCESS(e_ptr);
21766         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21767         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21768         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21769         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
21770         return tag_ptr(ret_conv, true);
21771 }
21772
21773 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
21774         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
21775         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
21776         return ret_conv;
21777 }
21778
21779 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
21780         if (!ptr_is_owned(_res)) return;
21781         void* _res_ptr = untag_ptr(_res);
21782         CHECK_ACCESS(_res_ptr);
21783         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
21784         FREE(untag_ptr(_res));
21785         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
21786 }
21787
21788 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
21789         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21790         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
21791         return tag_ptr(ret_conv, true);
21792 }
21793 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
21794         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
21795         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
21796         return ret_conv;
21797 }
21798
21799 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
21800         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
21801         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21802         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
21803         return tag_ptr(ret_conv, true);
21804 }
21805
21806 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
21807         LDKReplyChannelRange o_conv;
21808         o_conv.inner = untag_ptr(o);
21809         o_conv.is_owned = ptr_is_owned(o);
21810         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21811         o_conv = ReplyChannelRange_clone(&o_conv);
21812         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21813         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
21814         return tag_ptr(ret_conv, true);
21815 }
21816
21817 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
21818         void* e_ptr = untag_ptr(e);
21819         CHECK_ACCESS(e_ptr);
21820         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21821         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21822         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21823         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
21824         return tag_ptr(ret_conv, true);
21825 }
21826
21827 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
21828         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
21829         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
21830         return ret_conv;
21831 }
21832
21833 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
21834         if (!ptr_is_owned(_res)) return;
21835         void* _res_ptr = untag_ptr(_res);
21836         CHECK_ACCESS(_res_ptr);
21837         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
21838         FREE(untag_ptr(_res));
21839         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
21840 }
21841
21842 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
21843         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21844         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
21845         return tag_ptr(ret_conv, true);
21846 }
21847 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
21848         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
21849         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
21850         return ret_conv;
21851 }
21852
21853 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
21854         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
21855         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21856         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
21857         return tag_ptr(ret_conv, true);
21858 }
21859
21860 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
21861         LDKGossipTimestampFilter o_conv;
21862         o_conv.inner = untag_ptr(o);
21863         o_conv.is_owned = ptr_is_owned(o);
21864         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21865         o_conv = GossipTimestampFilter_clone(&o_conv);
21866         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21867         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
21868         return tag_ptr(ret_conv, true);
21869 }
21870
21871 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
21872         void* e_ptr = untag_ptr(e);
21873         CHECK_ACCESS(e_ptr);
21874         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21875         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21876         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21877         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
21878         return tag_ptr(ret_conv, true);
21879 }
21880
21881 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
21882         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
21883         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
21884         return ret_conv;
21885 }
21886
21887 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
21888         if (!ptr_is_owned(_res)) return;
21889         void* _res_ptr = untag_ptr(_res);
21890         CHECK_ACCESS(_res_ptr);
21891         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
21892         FREE(untag_ptr(_res));
21893         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
21894 }
21895
21896 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
21897         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21898         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
21899         return tag_ptr(ret_conv, true);
21900 }
21901 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
21902         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
21903         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
21904         return ret_conv;
21905 }
21906
21907 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
21908         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
21909         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21910         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
21911         return tag_ptr(ret_conv, true);
21912 }
21913
21914 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
21915         void* o_ptr = untag_ptr(o);
21916         CHECK_ACCESS(o_ptr);
21917         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
21918         if (o_conv.free == LDKFilter_JCalls_free) {
21919                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21920                 LDKFilter_JCalls_cloned(&o_conv);
21921         }
21922         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
21923         *ret_copy = COption_FilterZ_some(o_conv);
21924         uint64_t ret_ref = tag_ptr(ret_copy, true);
21925         return ret_ref;
21926 }
21927
21928 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
21929         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
21930         *ret_copy = COption_FilterZ_none();
21931         uint64_t ret_ref = tag_ptr(ret_copy, true);
21932         return ret_ref;
21933 }
21934
21935 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
21936         if (!ptr_is_owned(_res)) return;
21937         void* _res_ptr = untag_ptr(_res);
21938         CHECK_ACCESS(_res_ptr);
21939         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
21940         FREE(untag_ptr(_res));
21941         COption_FilterZ_free(_res_conv);
21942 }
21943
21944 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
21945         LDKLockedChannelMonitor o_conv;
21946         o_conv.inner = untag_ptr(o);
21947         o_conv.is_owned = ptr_is_owned(o);
21948         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21949         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
21950         
21951         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21952         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
21953         return tag_ptr(ret_conv, true);
21954 }
21955
21956 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
21957         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21958         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
21959         return tag_ptr(ret_conv, true);
21960 }
21961
21962 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
21963         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
21964         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
21965         return ret_conv;
21966 }
21967
21968 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
21969         if (!ptr_is_owned(_res)) return;
21970         void* _res_ptr = untag_ptr(_res);
21971         CHECK_ACCESS(_res_ptr);
21972         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
21973         FREE(untag_ptr(_res));
21974         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
21975 }
21976
21977 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
21978         LDKCVec_OutPointZ _res_constr;
21979         _res_constr.datalen = _res->arr_len;
21980         if (_res_constr.datalen > 0)
21981                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
21982         else
21983                 _res_constr.data = NULL;
21984         uint64_t* _res_vals = _res->elems;
21985         for (size_t k = 0; k < _res_constr.datalen; k++) {
21986                 uint64_t _res_conv_10 = _res_vals[k];
21987                 LDKOutPoint _res_conv_10_conv;
21988                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
21989                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
21990                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
21991                 _res_constr.data[k] = _res_conv_10_conv;
21992         }
21993         FREE(_res);
21994         CVec_OutPointZ_free(_res_constr);
21995 }
21996
21997 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
21998         LDKCVec_MonitorUpdateIdZ _res_constr;
21999         _res_constr.datalen = _res->arr_len;
22000         if (_res_constr.datalen > 0)
22001                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
22002         else
22003                 _res_constr.data = NULL;
22004         uint64_t* _res_vals = _res->elems;
22005         for (size_t r = 0; r < _res_constr.datalen; r++) {
22006                 uint64_t _res_conv_17 = _res_vals[r];
22007                 LDKMonitorUpdateId _res_conv_17_conv;
22008                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
22009                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
22010                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
22011                 _res_constr.data[r] = _res_conv_17_conv;
22012         }
22013         FREE(_res);
22014         CVec_MonitorUpdateIdZ_free(_res_constr);
22015 }
22016
22017 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
22018         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
22019         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
22020         return tag_ptr(ret_conv, true);
22021 }
22022 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
22023         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
22024         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
22025         return ret_conv;
22026 }
22027
22028 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
22029         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
22030         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
22031         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
22032         return tag_ptr(ret_conv, true);
22033 }
22034
22035 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
22036         LDKOutPoint a_conv;
22037         a_conv.inner = untag_ptr(a);
22038         a_conv.is_owned = ptr_is_owned(a);
22039         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22040         a_conv = OutPoint_clone(&a_conv);
22041         LDKCVec_MonitorUpdateIdZ b_constr;
22042         b_constr.datalen = b->arr_len;
22043         if (b_constr.datalen > 0)
22044                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
22045         else
22046                 b_constr.data = NULL;
22047         uint64_t* b_vals = b->elems;
22048         for (size_t r = 0; r < b_constr.datalen; r++) {
22049                 uint64_t b_conv_17 = b_vals[r];
22050                 LDKMonitorUpdateId b_conv_17_conv;
22051                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
22052                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
22053                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
22054                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
22055                 b_constr.data[r] = b_conv_17_conv;
22056         }
22057         FREE(b);
22058         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
22059         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
22060         return tag_ptr(ret_conv, true);
22061 }
22062
22063 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
22064         if (!ptr_is_owned(_res)) return;
22065         void* _res_ptr = untag_ptr(_res);
22066         CHECK_ACCESS(_res_ptr);
22067         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
22068         FREE(untag_ptr(_res));
22069         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
22070 }
22071
22072 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
22073         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
22074         _res_constr.datalen = _res->arr_len;
22075         if (_res_constr.datalen > 0)
22076                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
22077         else
22078                 _res_constr.data = NULL;
22079         uint64_t* _res_vals = _res->elems;
22080         for (size_t p = 0; p < _res_constr.datalen; p++) {
22081                 uint64_t _res_conv_41 = _res_vals[p];
22082                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
22083                 CHECK_ACCESS(_res_conv_41_ptr);
22084                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
22085                 FREE(untag_ptr(_res_conv_41));
22086                 _res_constr.data[p] = _res_conv_41_conv;
22087         }
22088         FREE(_res);
22089         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
22090 }
22091
22092 void  __attribute__((export_name("TS_CVec_PhantomRouteHintsZ_free"))) TS_CVec_PhantomRouteHintsZ_free(uint64_tArray _res) {
22093         LDKCVec_PhantomRouteHintsZ _res_constr;
22094         _res_constr.datalen = _res->arr_len;
22095         if (_res_constr.datalen > 0)
22096                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
22097         else
22098                 _res_constr.data = NULL;
22099         uint64_t* _res_vals = _res->elems;
22100         for (size_t t = 0; t < _res_constr.datalen; t++) {
22101                 uint64_t _res_conv_19 = _res_vals[t];
22102                 LDKPhantomRouteHints _res_conv_19_conv;
22103                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
22104                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
22105                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
22106                 _res_constr.data[t] = _res_conv_19_conv;
22107         }
22108         FREE(_res);
22109         CVec_PhantomRouteHintsZ_free(_res_constr);
22110 }
22111
22112 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
22113         LDKInvoice o_conv;
22114         o_conv.inner = untag_ptr(o);
22115         o_conv.is_owned = ptr_is_owned(o);
22116         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22117         o_conv = Invoice_clone(&o_conv);
22118         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22119         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
22120         return tag_ptr(ret_conv, true);
22121 }
22122
22123 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint64_t e) {
22124         void* e_ptr = untag_ptr(e);
22125         CHECK_ACCESS(e_ptr);
22126         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
22127         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
22128         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22129         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
22130         return tag_ptr(ret_conv, true);
22131 }
22132
22133 jboolean  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
22134         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
22135         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
22136         return ret_conv;
22137 }
22138
22139 void  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
22140         if (!ptr_is_owned(_res)) return;
22141         void* _res_ptr = untag_ptr(_res);
22142         CHECK_ACCESS(_res_ptr);
22143         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
22144         FREE(untag_ptr(_res));
22145         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
22146 }
22147
22148 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
22149         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22150         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
22151         return tag_ptr(ret_conv, true);
22152 }
22153 int64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
22154         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
22155         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
22156         return ret_conv;
22157 }
22158
22159 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
22160         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
22161         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22162         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
22163         return tag_ptr(ret_conv, true);
22164 }
22165
22166 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) {
22167         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
22168         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
22169         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
22170         return tag_ptr(ret_conv, true);
22171 }
22172
22173 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint64_t e) {
22174         void* e_ptr = untag_ptr(e);
22175         CHECK_ACCESS(e_ptr);
22176         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
22177         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
22178         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
22179         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
22180         return tag_ptr(ret_conv, true);
22181 }
22182
22183 jboolean  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint64_t o) {
22184         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
22185         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
22186         return ret_conv;
22187 }
22188
22189 void  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint64_t _res) {
22190         if (!ptr_is_owned(_res)) return;
22191         void* _res_ptr = untag_ptr(_res);
22192         CHECK_ACCESS(_res_ptr);
22193         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
22194         FREE(untag_ptr(_res));
22195         CResult_SiPrefixParseErrorZ_free(_res_conv);
22196 }
22197
22198 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
22199         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
22200         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
22201         return tag_ptr(ret_conv, true);
22202 }
22203 int64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint64_t arg) {
22204         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
22205         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
22206         return ret_conv;
22207 }
22208
22209 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint64_t orig) {
22210         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
22211         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
22212         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
22213         return tag_ptr(ret_conv, true);
22214 }
22215
22216 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
22217         LDKInvoice o_conv;
22218         o_conv.inner = untag_ptr(o);
22219         o_conv.is_owned = ptr_is_owned(o);
22220         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22221         o_conv = Invoice_clone(&o_conv);
22222         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
22223         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
22224         return tag_ptr(ret_conv, true);
22225 }
22226
22227 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
22228         void* e_ptr = untag_ptr(e);
22229         CHECK_ACCESS(e_ptr);
22230         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
22231         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
22232         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
22233         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
22234         return tag_ptr(ret_conv, true);
22235 }
22236
22237 jboolean  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
22238         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
22239         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
22240         return ret_conv;
22241 }
22242
22243 void  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
22244         if (!ptr_is_owned(_res)) return;
22245         void* _res_ptr = untag_ptr(_res);
22246         CHECK_ACCESS(_res_ptr);
22247         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
22248         FREE(untag_ptr(_res));
22249         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
22250 }
22251
22252 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
22253         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
22254         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
22255         return tag_ptr(ret_conv, true);
22256 }
22257 int64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
22258         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
22259         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
22260         return ret_conv;
22261 }
22262
22263 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
22264         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
22265         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
22266         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
22267         return tag_ptr(ret_conv, true);
22268 }
22269
22270 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint64_t o) {
22271         LDKSignedRawInvoice o_conv;
22272         o_conv.inner = untag_ptr(o);
22273         o_conv.is_owned = ptr_is_owned(o);
22274         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22275         o_conv = SignedRawInvoice_clone(&o_conv);
22276         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
22277         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
22278         return tag_ptr(ret_conv, true);
22279 }
22280
22281 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint64_t e) {
22282         void* e_ptr = untag_ptr(e);
22283         CHECK_ACCESS(e_ptr);
22284         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
22285         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
22286         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
22287         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
22288         return tag_ptr(ret_conv, true);
22289 }
22290
22291 jboolean  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint64_t o) {
22292         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
22293         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
22294         return ret_conv;
22295 }
22296
22297 void  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint64_t _res) {
22298         if (!ptr_is_owned(_res)) return;
22299         void* _res_ptr = untag_ptr(_res);
22300         CHECK_ACCESS(_res_ptr);
22301         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
22302         FREE(untag_ptr(_res));
22303         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
22304 }
22305
22306 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
22307         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
22308         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
22309         return tag_ptr(ret_conv, true);
22310 }
22311 int64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint64_t arg) {
22312         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
22313         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
22314         return ret_conv;
22315 }
22316
22317 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint64_t orig) {
22318         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
22319         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
22320         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
22321         return tag_ptr(ret_conv, true);
22322 }
22323
22324 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
22325         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
22326         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
22327         return tag_ptr(ret_conv, true);
22328 }
22329 int64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint64_t arg) {
22330         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
22331         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
22332         return ret_conv;
22333 }
22334
22335 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint64_t orig) {
22336         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
22337         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
22338         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
22339         return tag_ptr(ret_conv, true);
22340 }
22341
22342 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
22343         LDKRawInvoice a_conv;
22344         a_conv.inner = untag_ptr(a);
22345         a_conv.is_owned = ptr_is_owned(a);
22346         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22347         a_conv = RawInvoice_clone(&a_conv);
22348         LDKThirtyTwoBytes b_ref;
22349         CHECK(b->arr_len == 32);
22350         memcpy(b_ref.data, b->elems, 32); FREE(b);
22351         LDKInvoiceSignature c_conv;
22352         c_conv.inner = untag_ptr(c);
22353         c_conv.is_owned = ptr_is_owned(c);
22354         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
22355         c_conv = InvoiceSignature_clone(&c_conv);
22356         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
22357         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
22358         return tag_ptr(ret_conv, true);
22359 }
22360
22361 void  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint64_t _res) {
22362         if (!ptr_is_owned(_res)) return;
22363         void* _res_ptr = untag_ptr(_res);
22364         CHECK_ACCESS(_res_ptr);
22365         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
22366         FREE(untag_ptr(_res));
22367         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
22368 }
22369
22370 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint64_t o) {
22371         LDKPayeePubKey o_conv;
22372         o_conv.inner = untag_ptr(o);
22373         o_conv.is_owned = ptr_is_owned(o);
22374         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22375         o_conv = PayeePubKey_clone(&o_conv);
22376         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
22377         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
22378         return tag_ptr(ret_conv, true);
22379 }
22380
22381 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
22382         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
22383         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
22384         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
22385         return tag_ptr(ret_conv, true);
22386 }
22387
22388 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint64_t o) {
22389         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
22390         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
22391         return ret_conv;
22392 }
22393
22394 void  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint64_t _res) {
22395         if (!ptr_is_owned(_res)) return;
22396         void* _res_ptr = untag_ptr(_res);
22397         CHECK_ACCESS(_res_ptr);
22398         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
22399         FREE(untag_ptr(_res));
22400         CResult_PayeePubKeyErrorZ_free(_res_conv);
22401 }
22402
22403 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
22404         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
22405         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
22406         return tag_ptr(ret_conv, true);
22407 }
22408 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint64_t arg) {
22409         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
22410         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
22411         return ret_conv;
22412 }
22413
22414 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint64_t orig) {
22415         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
22416         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
22417         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
22418         return tag_ptr(ret_conv, true);
22419 }
22420
22421 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
22422         LDKCVec_PrivateRouteZ _res_constr;
22423         _res_constr.datalen = _res->arr_len;
22424         if (_res_constr.datalen > 0)
22425                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
22426         else
22427                 _res_constr.data = NULL;
22428         uint64_t* _res_vals = _res->elems;
22429         for (size_t o = 0; o < _res_constr.datalen; o++) {
22430                 uint64_t _res_conv_14 = _res_vals[o];
22431                 LDKPrivateRoute _res_conv_14_conv;
22432                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
22433                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
22434                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
22435                 _res_constr.data[o] = _res_conv_14_conv;
22436         }
22437         FREE(_res);
22438         CVec_PrivateRouteZ_free(_res_constr);
22439 }
22440
22441 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
22442         LDKPositiveTimestamp o_conv;
22443         o_conv.inner = untag_ptr(o);
22444         o_conv.is_owned = ptr_is_owned(o);
22445         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22446         o_conv = PositiveTimestamp_clone(&o_conv);
22447         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
22448         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
22449         return tag_ptr(ret_conv, true);
22450 }
22451
22452 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
22453         LDKCreationError e_conv = LDKCreationError_from_js(e);
22454         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
22455         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
22456         return tag_ptr(ret_conv, true);
22457 }
22458
22459 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
22460         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
22461         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
22462         return ret_conv;
22463 }
22464
22465 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
22466         if (!ptr_is_owned(_res)) return;
22467         void* _res_ptr = untag_ptr(_res);
22468         CHECK_ACCESS(_res_ptr);
22469         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
22470         FREE(untag_ptr(_res));
22471         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
22472 }
22473
22474 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
22475         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
22476         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
22477         return tag_ptr(ret_conv, true);
22478 }
22479 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
22480         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
22481         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
22482         return ret_conv;
22483 }
22484
22485 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
22486         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
22487         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
22488         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
22489         return tag_ptr(ret_conv, true);
22490 }
22491
22492 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
22493         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
22494         *ret_conv = CResult_NoneSemanticErrorZ_ok();
22495         return tag_ptr(ret_conv, true);
22496 }
22497
22498 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
22499         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
22500         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
22501         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
22502         return tag_ptr(ret_conv, true);
22503 }
22504
22505 jboolean  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint64_t o) {
22506         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
22507         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
22508         return ret_conv;
22509 }
22510
22511 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint64_t _res) {
22512         if (!ptr_is_owned(_res)) return;
22513         void* _res_ptr = untag_ptr(_res);
22514         CHECK_ACCESS(_res_ptr);
22515         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
22516         FREE(untag_ptr(_res));
22517         CResult_NoneSemanticErrorZ_free(_res_conv);
22518 }
22519
22520 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
22521         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
22522         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
22523         return tag_ptr(ret_conv, true);
22524 }
22525 int64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint64_t arg) {
22526         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
22527         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
22528         return ret_conv;
22529 }
22530
22531 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint64_t orig) {
22532         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
22533         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
22534         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
22535         return tag_ptr(ret_conv, true);
22536 }
22537
22538 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint64_t o) {
22539         LDKInvoice o_conv;
22540         o_conv.inner = untag_ptr(o);
22541         o_conv.is_owned = ptr_is_owned(o);
22542         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22543         o_conv = Invoice_clone(&o_conv);
22544         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
22545         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
22546         return tag_ptr(ret_conv, true);
22547 }
22548
22549 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
22550         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
22551         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
22552         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
22553         return tag_ptr(ret_conv, true);
22554 }
22555
22556 jboolean  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint64_t o) {
22557         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
22558         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
22559         return ret_conv;
22560 }
22561
22562 void  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint64_t _res) {
22563         if (!ptr_is_owned(_res)) return;
22564         void* _res_ptr = untag_ptr(_res);
22565         CHECK_ACCESS(_res_ptr);
22566         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
22567         FREE(untag_ptr(_res));
22568         CResult_InvoiceSemanticErrorZ_free(_res_conv);
22569 }
22570
22571 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
22572         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
22573         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
22574         return tag_ptr(ret_conv, true);
22575 }
22576 int64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint64_t arg) {
22577         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
22578         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
22579         return ret_conv;
22580 }
22581
22582 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint64_t orig) {
22583         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
22584         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
22585         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
22586         return tag_ptr(ret_conv, true);
22587 }
22588
22589 void  __attribute__((export_name("TS_CVec_AddressZ_free"))) TS_CVec_AddressZ_free(ptrArray _res) {
22590         LDKCVec_AddressZ _res_constr;
22591         _res_constr.datalen = _res->arr_len;
22592         if (_res_constr.datalen > 0)
22593                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_AddressZ Elements");
22594         else
22595                 _res_constr.data = NULL;
22596         jstring* _res_vals = (void*) _res->elems;
22597         for (size_t i = 0; i < _res_constr.datalen; i++) {
22598                 jstring _res_conv_8 = _res_vals[i];
22599                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
22600                 _res_constr.data[i] = dummy;
22601         }
22602         FREE(_res);
22603         CVec_AddressZ_free(_res_constr);
22604 }
22605
22606 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
22607         LDKDescription o_conv;
22608         o_conv.inner = untag_ptr(o);
22609         o_conv.is_owned = ptr_is_owned(o);
22610         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22611         o_conv = Description_clone(&o_conv);
22612         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
22613         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
22614         return tag_ptr(ret_conv, true);
22615 }
22616
22617 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
22618         LDKCreationError e_conv = LDKCreationError_from_js(e);
22619         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
22620         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
22621         return tag_ptr(ret_conv, true);
22622 }
22623
22624 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
22625         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
22626         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
22627         return ret_conv;
22628 }
22629
22630 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
22631         if (!ptr_is_owned(_res)) return;
22632         void* _res_ptr = untag_ptr(_res);
22633         CHECK_ACCESS(_res_ptr);
22634         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
22635         FREE(untag_ptr(_res));
22636         CResult_DescriptionCreationErrorZ_free(_res_conv);
22637 }
22638
22639 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
22640         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
22641         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
22642         return tag_ptr(ret_conv, true);
22643 }
22644 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
22645         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
22646         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
22647         return ret_conv;
22648 }
22649
22650 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
22651         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
22652         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
22653         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
22654         return tag_ptr(ret_conv, true);
22655 }
22656
22657 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
22658         LDKPrivateRoute o_conv;
22659         o_conv.inner = untag_ptr(o);
22660         o_conv.is_owned = ptr_is_owned(o);
22661         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22662         o_conv = PrivateRoute_clone(&o_conv);
22663         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
22664         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
22665         return tag_ptr(ret_conv, true);
22666 }
22667
22668 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
22669         LDKCreationError e_conv = LDKCreationError_from_js(e);
22670         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
22671         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
22672         return tag_ptr(ret_conv, true);
22673 }
22674
22675 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
22676         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
22677         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
22678         return ret_conv;
22679 }
22680
22681 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
22682         if (!ptr_is_owned(_res)) return;
22683         void* _res_ptr = untag_ptr(_res);
22684         CHECK_ACCESS(_res_ptr);
22685         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
22686         FREE(untag_ptr(_res));
22687         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
22688 }
22689
22690 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
22691         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
22692         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
22693         return tag_ptr(ret_conv, true);
22694 }
22695 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
22696         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
22697         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
22698         return ret_conv;
22699 }
22700
22701 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
22702         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
22703         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
22704         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
22705         return tag_ptr(ret_conv, true);
22706 }
22707
22708 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
22709         if (!ptr_is_owned(this_ptr)) return;
22710         void* this_ptr_ptr = untag_ptr(this_ptr);
22711         CHECK_ACCESS(this_ptr_ptr);
22712         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
22713         FREE(untag_ptr(this_ptr));
22714         APIError_free(this_ptr_conv);
22715 }
22716
22717 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
22718         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22719         *ret_copy = APIError_clone(arg);
22720         uint64_t ret_ref = tag_ptr(ret_copy, true);
22721         return ret_ref;
22722 }
22723 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
22724         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
22725         int64_t ret_conv = APIError_clone_ptr(arg_conv);
22726         return ret_conv;
22727 }
22728
22729 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
22730         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
22731         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22732         *ret_copy = APIError_clone(orig_conv);
22733         uint64_t ret_ref = tag_ptr(ret_copy, true);
22734         return ret_ref;
22735 }
22736
22737 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
22738         LDKStr err_conv = str_ref_to_owned_c(err);
22739         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22740         *ret_copy = APIError_apimisuse_error(err_conv);
22741         uint64_t ret_ref = tag_ptr(ret_copy, true);
22742         return ret_ref;
22743 }
22744
22745 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
22746         LDKStr err_conv = str_ref_to_owned_c(err);
22747         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22748         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
22749         uint64_t ret_ref = tag_ptr(ret_copy, true);
22750         return ret_ref;
22751 }
22752
22753 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
22754         LDKStr err_conv = str_ref_to_owned_c(err);
22755         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22756         *ret_copy = APIError_invalid_route(err_conv);
22757         uint64_t ret_ref = tag_ptr(ret_copy, true);
22758         return ret_ref;
22759 }
22760
22761 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
22762         LDKStr err_conv = str_ref_to_owned_c(err);
22763         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22764         *ret_copy = APIError_channel_unavailable(err_conv);
22765         uint64_t ret_ref = tag_ptr(ret_copy, true);
22766         return ret_ref;
22767 }
22768
22769 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
22770         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22771         *ret_copy = APIError_monitor_update_in_progress();
22772         uint64_t ret_ref = tag_ptr(ret_copy, true);
22773         return ret_ref;
22774 }
22775
22776 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
22777         LDKShutdownScript script_conv;
22778         script_conv.inner = untag_ptr(script);
22779         script_conv.is_owned = ptr_is_owned(script);
22780         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
22781         script_conv = ShutdownScript_clone(&script_conv);
22782         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22783         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
22784         uint64_t ret_ref = tag_ptr(ret_copy, true);
22785         return ret_ref;
22786 }
22787
22788 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
22789         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
22790         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
22791         jboolean ret_conv = APIError_eq(a_conv, b_conv);
22792         return ret_conv;
22793 }
22794
22795 int8_tArray  __attribute__((export_name("TS_APIError_write"))) TS_APIError_write(uint64_t obj) {
22796         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
22797         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
22798         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22799         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22800         CVec_u8Z_free(ret_var);
22801         return ret_arr;
22802 }
22803
22804 uint64_t  __attribute__((export_name("TS_APIError_read"))) TS_APIError_read(int8_tArray ser) {
22805         LDKu8slice ser_ref;
22806         ser_ref.datalen = ser->arr_len;
22807         ser_ref.data = ser->elems;
22808         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
22809         *ret_conv = APIError_read(ser_ref);
22810         FREE(ser);
22811         return tag_ptr(ret_conv, true);
22812 }
22813
22814 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
22815         LDKBigSize this_obj_conv;
22816         this_obj_conv.inner = untag_ptr(this_obj);
22817         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22819         BigSize_free(this_obj_conv);
22820 }
22821
22822 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
22823         LDKBigSize this_ptr_conv;
22824         this_ptr_conv.inner = untag_ptr(this_ptr);
22825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22827         this_ptr_conv.is_owned = false;
22828         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
22829         return ret_conv;
22830 }
22831
22832 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
22833         LDKBigSize this_ptr_conv;
22834         this_ptr_conv.inner = untag_ptr(this_ptr);
22835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22837         this_ptr_conv.is_owned = false;
22838         BigSize_set_a(&this_ptr_conv, val);
22839 }
22840
22841 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
22842         LDKBigSize ret_var = BigSize_new(a_arg);
22843         uint64_t ret_ref = 0;
22844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22846         return ret_ref;
22847 }
22848
22849 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
22850         LDKHostname this_obj_conv;
22851         this_obj_conv.inner = untag_ptr(this_obj);
22852         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22854         Hostname_free(this_obj_conv);
22855 }
22856
22857 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
22858         LDKHostname ret_var = Hostname_clone(arg);
22859         uint64_t ret_ref = 0;
22860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22862         return ret_ref;
22863 }
22864 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
22865         LDKHostname arg_conv;
22866         arg_conv.inner = untag_ptr(arg);
22867         arg_conv.is_owned = ptr_is_owned(arg);
22868         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22869         arg_conv.is_owned = false;
22870         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
22871         return ret_conv;
22872 }
22873
22874 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
22875         LDKHostname orig_conv;
22876         orig_conv.inner = untag_ptr(orig);
22877         orig_conv.is_owned = ptr_is_owned(orig);
22878         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22879         orig_conv.is_owned = false;
22880         LDKHostname ret_var = Hostname_clone(&orig_conv);
22881         uint64_t ret_ref = 0;
22882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22884         return ret_ref;
22885 }
22886
22887 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
22888         LDKHostname a_conv;
22889         a_conv.inner = untag_ptr(a);
22890         a_conv.is_owned = ptr_is_owned(a);
22891         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22892         a_conv.is_owned = false;
22893         LDKHostname b_conv;
22894         b_conv.inner = untag_ptr(b);
22895         b_conv.is_owned = ptr_is_owned(b);
22896         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22897         b_conv.is_owned = false;
22898         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
22899         return ret_conv;
22900 }
22901
22902 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
22903         LDKHostname this_arg_conv;
22904         this_arg_conv.inner = untag_ptr(this_arg);
22905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22907         this_arg_conv.is_owned = false;
22908         int8_t ret_conv = Hostname_len(&this_arg_conv);
22909         return ret_conv;
22910 }
22911
22912 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
22913         LDKu8slice msg_ref;
22914         msg_ref.datalen = msg->arr_len;
22915         msg_ref.data = msg->elems;
22916         uint8_t sk_arr[32];
22917         CHECK(sk->arr_len == 32);
22918         memcpy(sk_arr, sk->elems, 32); FREE(sk);
22919         uint8_t (*sk_ref)[32] = &sk_arr;
22920         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22921         *ret_conv = sign(msg_ref, sk_ref);
22922         FREE(msg);
22923         return tag_ptr(ret_conv, true);
22924 }
22925
22926 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
22927         LDKu8slice msg_ref;
22928         msg_ref.datalen = msg->arr_len;
22929         msg_ref.data = msg->elems;
22930         LDKStr sig_conv = str_ref_to_owned_c(sig);
22931         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22932         *ret_conv = recover_pk(msg_ref, sig_conv);
22933         FREE(msg);
22934         return tag_ptr(ret_conv, true);
22935 }
22936
22937 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
22938         LDKu8slice msg_ref;
22939         msg_ref.datalen = msg->arr_len;
22940         msg_ref.data = msg->elems;
22941         LDKStr sig_conv = str_ref_to_owned_c(sig);
22942         LDKPublicKey pk_ref;
22943         CHECK(pk->arr_len == 33);
22944         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
22945         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
22946         FREE(msg);
22947         return ret_conv;
22948 }
22949
22950 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
22951         LDKu8slice hrp_bytes_ref;
22952         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
22953         hrp_bytes_ref.data = hrp_bytes->elems;
22954         LDKCVec_U5Z data_without_signature_constr;
22955         data_without_signature_constr.datalen = data_without_signature->arr_len;
22956         if (data_without_signature_constr.datalen > 0)
22957                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
22958         else
22959                 data_without_signature_constr.data = NULL;
22960         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
22961         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
22962                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
22963                 
22964                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
22965         }
22966         FREE(data_without_signature);
22967         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
22968         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22969         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22970         CVec_u8Z_free(ret_var);
22971         FREE(hrp_bytes);
22972         return ret_arr;
22973 }
22974
22975 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
22976         if (!ptr_is_owned(this_ptr)) return;
22977         void* this_ptr_ptr = untag_ptr(this_ptr);
22978         CHECK_ACCESS(this_ptr_ptr);
22979         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
22980         FREE(untag_ptr(this_ptr));
22981         Persister_free(this_ptr_conv);
22982 }
22983
22984 void  __attribute__((export_name("TS_UntrustedString_free"))) TS_UntrustedString_free(uint64_t this_obj) {
22985         LDKUntrustedString this_obj_conv;
22986         this_obj_conv.inner = untag_ptr(this_obj);
22987         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22989         UntrustedString_free(this_obj_conv);
22990 }
22991
22992 jstring  __attribute__((export_name("TS_UntrustedString_get_a"))) TS_UntrustedString_get_a(uint64_t this_ptr) {
22993         LDKUntrustedString this_ptr_conv;
22994         this_ptr_conv.inner = untag_ptr(this_ptr);
22995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22997         this_ptr_conv.is_owned = false;
22998         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
22999         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23000         Str_free(ret_str);
23001         return ret_conv;
23002 }
23003
23004 void  __attribute__((export_name("TS_UntrustedString_set_a"))) TS_UntrustedString_set_a(uint64_t this_ptr, jstring val) {
23005         LDKUntrustedString this_ptr_conv;
23006         this_ptr_conv.inner = untag_ptr(this_ptr);
23007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23009         this_ptr_conv.is_owned = false;
23010         LDKStr val_conv = str_ref_to_owned_c(val);
23011         UntrustedString_set_a(&this_ptr_conv, val_conv);
23012 }
23013
23014 uint64_t  __attribute__((export_name("TS_UntrustedString_new"))) TS_UntrustedString_new(jstring a_arg) {
23015         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
23016         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
23017         uint64_t ret_ref = 0;
23018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23020         return ret_ref;
23021 }
23022
23023 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
23024         LDKUntrustedString ret_var = UntrustedString_clone(arg);
23025         uint64_t ret_ref = 0;
23026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23028         return ret_ref;
23029 }
23030 int64_t  __attribute__((export_name("TS_UntrustedString_clone_ptr"))) TS_UntrustedString_clone_ptr(uint64_t arg) {
23031         LDKUntrustedString arg_conv;
23032         arg_conv.inner = untag_ptr(arg);
23033         arg_conv.is_owned = ptr_is_owned(arg);
23034         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23035         arg_conv.is_owned = false;
23036         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
23037         return ret_conv;
23038 }
23039
23040 uint64_t  __attribute__((export_name("TS_UntrustedString_clone"))) TS_UntrustedString_clone(uint64_t orig) {
23041         LDKUntrustedString orig_conv;
23042         orig_conv.inner = untag_ptr(orig);
23043         orig_conv.is_owned = ptr_is_owned(orig);
23044         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23045         orig_conv.is_owned = false;
23046         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
23047         uint64_t ret_ref = 0;
23048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23050         return ret_ref;
23051 }
23052
23053 jboolean  __attribute__((export_name("TS_UntrustedString_eq"))) TS_UntrustedString_eq(uint64_t a, uint64_t b) {
23054         LDKUntrustedString a_conv;
23055         a_conv.inner = untag_ptr(a);
23056         a_conv.is_owned = ptr_is_owned(a);
23057         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23058         a_conv.is_owned = false;
23059         LDKUntrustedString b_conv;
23060         b_conv.inner = untag_ptr(b);
23061         b_conv.is_owned = ptr_is_owned(b);
23062         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23063         b_conv.is_owned = false;
23064         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
23065         return ret_conv;
23066 }
23067
23068 int8_tArray  __attribute__((export_name("TS_UntrustedString_write"))) TS_UntrustedString_write(uint64_t obj) {
23069         LDKUntrustedString obj_conv;
23070         obj_conv.inner = untag_ptr(obj);
23071         obj_conv.is_owned = ptr_is_owned(obj);
23072         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23073         obj_conv.is_owned = false;
23074         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
23075         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23076         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23077         CVec_u8Z_free(ret_var);
23078         return ret_arr;
23079 }
23080
23081 uint64_t  __attribute__((export_name("TS_UntrustedString_read"))) TS_UntrustedString_read(int8_tArray ser) {
23082         LDKu8slice ser_ref;
23083         ser_ref.datalen = ser->arr_len;
23084         ser_ref.data = ser->elems;
23085         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
23086         *ret_conv = UntrustedString_read(ser_ref);
23087         FREE(ser);
23088         return tag_ptr(ret_conv, true);
23089 }
23090
23091 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
23092         LDKPrintableString this_obj_conv;
23093         this_obj_conv.inner = untag_ptr(this_obj);
23094         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23096         PrintableString_free(this_obj_conv);
23097 }
23098
23099 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
23100         LDKPrintableString this_ptr_conv;
23101         this_ptr_conv.inner = untag_ptr(this_ptr);
23102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23104         this_ptr_conv.is_owned = false;
23105         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
23106         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23107         Str_free(ret_str);
23108         return ret_conv;
23109 }
23110
23111 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
23112         LDKPrintableString this_ptr_conv;
23113         this_ptr_conv.inner = untag_ptr(this_ptr);
23114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23116         this_ptr_conv.is_owned = false;
23117         LDKStr val_conv = str_ref_to_owned_c(val);
23118         PrintableString_set_a(&this_ptr_conv, val_conv);
23119 }
23120
23121 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
23122         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
23123         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
23124         uint64_t ret_ref = 0;
23125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23127         return ret_ref;
23128 }
23129
23130 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
23131         if (!ptr_is_owned(this_ptr)) return;
23132         void* this_ptr_ptr = untag_ptr(this_ptr);
23133         CHECK_ACCESS(this_ptr_ptr);
23134         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
23135         FREE(untag_ptr(this_ptr));
23136         FutureCallback_free(this_ptr_conv);
23137 }
23138
23139 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
23140         LDKFuture this_obj_conv;
23141         this_obj_conv.inner = untag_ptr(this_obj);
23142         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23144         Future_free(this_obj_conv);
23145 }
23146
23147 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
23148         LDKFuture ret_var = Future_clone(arg);
23149         uint64_t ret_ref = 0;
23150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23152         return ret_ref;
23153 }
23154 int64_t  __attribute__((export_name("TS_Future_clone_ptr"))) TS_Future_clone_ptr(uint64_t arg) {
23155         LDKFuture arg_conv;
23156         arg_conv.inner = untag_ptr(arg);
23157         arg_conv.is_owned = ptr_is_owned(arg);
23158         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23159         arg_conv.is_owned = false;
23160         int64_t ret_conv = Future_clone_ptr(&arg_conv);
23161         return ret_conv;
23162 }
23163
23164 uint64_t  __attribute__((export_name("TS_Future_clone"))) TS_Future_clone(uint64_t orig) {
23165         LDKFuture orig_conv;
23166         orig_conv.inner = untag_ptr(orig);
23167         orig_conv.is_owned = ptr_is_owned(orig);
23168         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23169         orig_conv.is_owned = false;
23170         LDKFuture ret_var = Future_clone(&orig_conv);
23171         uint64_t ret_ref = 0;
23172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23174         return ret_ref;
23175 }
23176
23177 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
23178         LDKFuture this_arg_conv;
23179         this_arg_conv.inner = untag_ptr(this_arg);
23180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23182         this_arg_conv.is_owned = false;
23183         void* callback_ptr = untag_ptr(callback);
23184         CHECK_ACCESS(callback_ptr);
23185         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
23186         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
23187                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23188                 LDKFutureCallback_JCalls_cloned(&callback_conv);
23189         }
23190         Future_register_callback_fn(&this_arg_conv, callback_conv);
23191 }
23192
23193 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
23194         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
23195         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
23196         return ret_conv;
23197 }
23198
23199 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
23200         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
23201         return ret_conv;
23202 }
23203
23204 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
23205         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
23206         return ret_conv;
23207 }
23208
23209 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
23210         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
23211         return ret_conv;
23212 }
23213
23214 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
23215         uint32_t ret_conv = LDKLevel_to_js(Level_info());
23216         return ret_conv;
23217 }
23218
23219 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
23220         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
23221         return ret_conv;
23222 }
23223
23224 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
23225         uint32_t ret_conv = LDKLevel_to_js(Level_error());
23226         return ret_conv;
23227 }
23228
23229 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
23230         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
23231         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
23232         jboolean ret_conv = Level_eq(a_conv, b_conv);
23233         return ret_conv;
23234 }
23235
23236 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
23237         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
23238         int64_t ret_conv = Level_hash(o_conv);
23239         return ret_conv;
23240 }
23241
23242 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
23243         uint32_t ret_conv = LDKLevel_to_js(Level_max());
23244         return ret_conv;
23245 }
23246
23247 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
23248         LDKRecord this_obj_conv;
23249         this_obj_conv.inner = untag_ptr(this_obj);
23250         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23252         Record_free(this_obj_conv);
23253 }
23254
23255 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
23256         LDKRecord this_ptr_conv;
23257         this_ptr_conv.inner = untag_ptr(this_ptr);
23258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23260         this_ptr_conv.is_owned = false;
23261         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
23262         return ret_conv;
23263 }
23264
23265 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
23266         LDKRecord this_ptr_conv;
23267         this_ptr_conv.inner = untag_ptr(this_ptr);
23268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23270         this_ptr_conv.is_owned = false;
23271         LDKLevel val_conv = LDKLevel_from_js(val);
23272         Record_set_level(&this_ptr_conv, val_conv);
23273 }
23274
23275 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
23276         LDKRecord this_ptr_conv;
23277         this_ptr_conv.inner = untag_ptr(this_ptr);
23278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23280         this_ptr_conv.is_owned = false;
23281         LDKStr ret_str = Record_get_args(&this_ptr_conv);
23282         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23283         Str_free(ret_str);
23284         return ret_conv;
23285 }
23286
23287 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
23288         LDKRecord this_ptr_conv;
23289         this_ptr_conv.inner = untag_ptr(this_ptr);
23290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23292         this_ptr_conv.is_owned = false;
23293         LDKStr val_conv = str_ref_to_owned_c(val);
23294         Record_set_args(&this_ptr_conv, val_conv);
23295 }
23296
23297 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
23298         LDKRecord this_ptr_conv;
23299         this_ptr_conv.inner = untag_ptr(this_ptr);
23300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23302         this_ptr_conv.is_owned = false;
23303         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
23304         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23305         Str_free(ret_str);
23306         return ret_conv;
23307 }
23308
23309 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
23310         LDKRecord this_ptr_conv;
23311         this_ptr_conv.inner = untag_ptr(this_ptr);
23312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23314         this_ptr_conv.is_owned = false;
23315         LDKStr val_conv = str_ref_to_owned_c(val);
23316         Record_set_module_path(&this_ptr_conv, val_conv);
23317 }
23318
23319 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
23320         LDKRecord this_ptr_conv;
23321         this_ptr_conv.inner = untag_ptr(this_ptr);
23322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23324         this_ptr_conv.is_owned = false;
23325         LDKStr ret_str = Record_get_file(&this_ptr_conv);
23326         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23327         Str_free(ret_str);
23328         return ret_conv;
23329 }
23330
23331 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
23332         LDKRecord this_ptr_conv;
23333         this_ptr_conv.inner = untag_ptr(this_ptr);
23334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23336         this_ptr_conv.is_owned = false;
23337         LDKStr val_conv = str_ref_to_owned_c(val);
23338         Record_set_file(&this_ptr_conv, val_conv);
23339 }
23340
23341 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
23342         LDKRecord this_ptr_conv;
23343         this_ptr_conv.inner = untag_ptr(this_ptr);
23344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23346         this_ptr_conv.is_owned = false;
23347         int32_t ret_conv = Record_get_line(&this_ptr_conv);
23348         return ret_conv;
23349 }
23350
23351 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
23352         LDKRecord this_ptr_conv;
23353         this_ptr_conv.inner = untag_ptr(this_ptr);
23354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23356         this_ptr_conv.is_owned = false;
23357         Record_set_line(&this_ptr_conv, val);
23358 }
23359
23360 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
23361         LDKRecord ret_var = Record_clone(arg);
23362         uint64_t ret_ref = 0;
23363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23365         return ret_ref;
23366 }
23367 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
23368         LDKRecord arg_conv;
23369         arg_conv.inner = untag_ptr(arg);
23370         arg_conv.is_owned = ptr_is_owned(arg);
23371         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23372         arg_conv.is_owned = false;
23373         int64_t ret_conv = Record_clone_ptr(&arg_conv);
23374         return ret_conv;
23375 }
23376
23377 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
23378         LDKRecord orig_conv;
23379         orig_conv.inner = untag_ptr(orig);
23380         orig_conv.is_owned = ptr_is_owned(orig);
23381         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23382         orig_conv.is_owned = false;
23383         LDKRecord ret_var = Record_clone(&orig_conv);
23384         uint64_t ret_ref = 0;
23385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23387         return ret_ref;
23388 }
23389
23390 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
23391         if (!ptr_is_owned(this_ptr)) return;
23392         void* this_ptr_ptr = untag_ptr(this_ptr);
23393         CHECK_ACCESS(this_ptr_ptr);
23394         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
23395         FREE(untag_ptr(this_ptr));
23396         Logger_free(this_ptr_conv);
23397 }
23398
23399 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
23400         LDKChannelHandshakeConfig this_obj_conv;
23401         this_obj_conv.inner = untag_ptr(this_obj);
23402         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23404         ChannelHandshakeConfig_free(this_obj_conv);
23405 }
23406
23407 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
23408         LDKChannelHandshakeConfig this_ptr_conv;
23409         this_ptr_conv.inner = untag_ptr(this_ptr);
23410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23412         this_ptr_conv.is_owned = false;
23413         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
23414         return ret_conv;
23415 }
23416
23417 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
23418         LDKChannelHandshakeConfig this_ptr_conv;
23419         this_ptr_conv.inner = untag_ptr(this_ptr);
23420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23422         this_ptr_conv.is_owned = false;
23423         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
23424 }
23425
23426 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
23427         LDKChannelHandshakeConfig this_ptr_conv;
23428         this_ptr_conv.inner = untag_ptr(this_ptr);
23429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23431         this_ptr_conv.is_owned = false;
23432         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
23433         return ret_conv;
23434 }
23435
23436 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) {
23437         LDKChannelHandshakeConfig this_ptr_conv;
23438         this_ptr_conv.inner = untag_ptr(this_ptr);
23439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23441         this_ptr_conv.is_owned = false;
23442         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
23443 }
23444
23445 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
23446         LDKChannelHandshakeConfig this_ptr_conv;
23447         this_ptr_conv.inner = untag_ptr(this_ptr);
23448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23450         this_ptr_conv.is_owned = false;
23451         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
23452         return ret_conv;
23453 }
23454
23455 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) {
23456         LDKChannelHandshakeConfig this_ptr_conv;
23457         this_ptr_conv.inner = untag_ptr(this_ptr);
23458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23460         this_ptr_conv.is_owned = false;
23461         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
23462 }
23463
23464 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) {
23465         LDKChannelHandshakeConfig this_ptr_conv;
23466         this_ptr_conv.inner = untag_ptr(this_ptr);
23467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23469         this_ptr_conv.is_owned = false;
23470         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
23471         return ret_conv;
23472 }
23473
23474 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) {
23475         LDKChannelHandshakeConfig this_ptr_conv;
23476         this_ptr_conv.inner = untag_ptr(this_ptr);
23477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23479         this_ptr_conv.is_owned = false;
23480         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
23481 }
23482
23483 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
23484         LDKChannelHandshakeConfig this_ptr_conv;
23485         this_ptr_conv.inner = untag_ptr(this_ptr);
23486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23488         this_ptr_conv.is_owned = false;
23489         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
23490         return ret_conv;
23491 }
23492
23493 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
23494         LDKChannelHandshakeConfig this_ptr_conv;
23495         this_ptr_conv.inner = untag_ptr(this_ptr);
23496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23498         this_ptr_conv.is_owned = false;
23499         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
23500 }
23501
23502 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
23503         LDKChannelHandshakeConfig this_ptr_conv;
23504         this_ptr_conv.inner = untag_ptr(this_ptr);
23505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23507         this_ptr_conv.is_owned = false;
23508         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
23509         return ret_conv;
23510 }
23511
23512 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
23513         LDKChannelHandshakeConfig this_ptr_conv;
23514         this_ptr_conv.inner = untag_ptr(this_ptr);
23515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23517         this_ptr_conv.is_owned = false;
23518         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
23519 }
23520
23521 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
23522         LDKChannelHandshakeConfig this_ptr_conv;
23523         this_ptr_conv.inner = untag_ptr(this_ptr);
23524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23526         this_ptr_conv.is_owned = false;
23527         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
23528         return ret_conv;
23529 }
23530
23531 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
23532         LDKChannelHandshakeConfig this_ptr_conv;
23533         this_ptr_conv.inner = untag_ptr(this_ptr);
23534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23536         this_ptr_conv.is_owned = false;
23537         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
23538 }
23539
23540 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) {
23541         LDKChannelHandshakeConfig this_ptr_conv;
23542         this_ptr_conv.inner = untag_ptr(this_ptr);
23543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23545         this_ptr_conv.is_owned = false;
23546         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
23547         return ret_conv;
23548 }
23549
23550 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) {
23551         LDKChannelHandshakeConfig this_ptr_conv;
23552         this_ptr_conv.inner = untag_ptr(this_ptr);
23553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23555         this_ptr_conv.is_owned = false;
23556         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
23557 }
23558
23559 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs"))) TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs(uint64_t this_ptr) {
23560         LDKChannelHandshakeConfig this_ptr_conv;
23561         this_ptr_conv.inner = untag_ptr(this_ptr);
23562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23564         this_ptr_conv.is_owned = false;
23565         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
23566         return ret_conv;
23567 }
23568
23569 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_our_max_accepted_htlcs"))) TS_ChannelHandshakeConfig_set_our_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
23570         LDKChannelHandshakeConfig this_ptr_conv;
23571         this_ptr_conv.inner = untag_ptr(this_ptr);
23572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23574         this_ptr_conv.is_owned = false;
23575         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
23576 }
23577
23578 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, int16_t our_max_accepted_htlcs_arg) {
23579         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, our_max_accepted_htlcs_arg);
23580         uint64_t ret_ref = 0;
23581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23583         return ret_ref;
23584 }
23585
23586 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
23587         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
23588         uint64_t ret_ref = 0;
23589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23591         return ret_ref;
23592 }
23593 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
23594         LDKChannelHandshakeConfig arg_conv;
23595         arg_conv.inner = untag_ptr(arg);
23596         arg_conv.is_owned = ptr_is_owned(arg);
23597         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23598         arg_conv.is_owned = false;
23599         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
23600         return ret_conv;
23601 }
23602
23603 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
23604         LDKChannelHandshakeConfig orig_conv;
23605         orig_conv.inner = untag_ptr(orig);
23606         orig_conv.is_owned = ptr_is_owned(orig);
23607         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23608         orig_conv.is_owned = false;
23609         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
23610         uint64_t ret_ref = 0;
23611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23613         return ret_ref;
23614 }
23615
23616 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
23617         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
23618         uint64_t ret_ref = 0;
23619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23621         return ret_ref;
23622 }
23623
23624 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
23625         LDKChannelHandshakeLimits this_obj_conv;
23626         this_obj_conv.inner = untag_ptr(this_obj);
23627         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23629         ChannelHandshakeLimits_free(this_obj_conv);
23630 }
23631
23632 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
23633         LDKChannelHandshakeLimits this_ptr_conv;
23634         this_ptr_conv.inner = untag_ptr(this_ptr);
23635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23637         this_ptr_conv.is_owned = false;
23638         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
23639         return ret_conv;
23640 }
23641
23642 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
23643         LDKChannelHandshakeLimits this_ptr_conv;
23644         this_ptr_conv.inner = untag_ptr(this_ptr);
23645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23647         this_ptr_conv.is_owned = false;
23648         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
23649 }
23650
23651 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
23652         LDKChannelHandshakeLimits this_ptr_conv;
23653         this_ptr_conv.inner = untag_ptr(this_ptr);
23654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23656         this_ptr_conv.is_owned = false;
23657         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
23658         return ret_conv;
23659 }
23660
23661 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
23662         LDKChannelHandshakeLimits this_ptr_conv;
23663         this_ptr_conv.inner = untag_ptr(this_ptr);
23664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23666         this_ptr_conv.is_owned = false;
23667         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
23668 }
23669
23670 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
23671         LDKChannelHandshakeLimits this_ptr_conv;
23672         this_ptr_conv.inner = untag_ptr(this_ptr);
23673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23675         this_ptr_conv.is_owned = false;
23676         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
23677         return ret_conv;
23678 }
23679
23680 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) {
23681         LDKChannelHandshakeLimits this_ptr_conv;
23682         this_ptr_conv.inner = untag_ptr(this_ptr);
23683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23685         this_ptr_conv.is_owned = false;
23686         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
23687 }
23688
23689 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) {
23690         LDKChannelHandshakeLimits this_ptr_conv;
23691         this_ptr_conv.inner = untag_ptr(this_ptr);
23692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23694         this_ptr_conv.is_owned = false;
23695         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
23696         return ret_conv;
23697 }
23698
23699 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) {
23700         LDKChannelHandshakeLimits this_ptr_conv;
23701         this_ptr_conv.inner = untag_ptr(this_ptr);
23702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23704         this_ptr_conv.is_owned = false;
23705         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
23706 }
23707
23708 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
23709         LDKChannelHandshakeLimits this_ptr_conv;
23710         this_ptr_conv.inner = untag_ptr(this_ptr);
23711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23713         this_ptr_conv.is_owned = false;
23714         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
23715         return ret_conv;
23716 }
23717
23718 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) {
23719         LDKChannelHandshakeLimits this_ptr_conv;
23720         this_ptr_conv.inner = untag_ptr(this_ptr);
23721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23723         this_ptr_conv.is_owned = false;
23724         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
23725 }
23726
23727 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
23728         LDKChannelHandshakeLimits this_ptr_conv;
23729         this_ptr_conv.inner = untag_ptr(this_ptr);
23730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23732         this_ptr_conv.is_owned = false;
23733         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
23734         return ret_conv;
23735 }
23736
23737 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) {
23738         LDKChannelHandshakeLimits this_ptr_conv;
23739         this_ptr_conv.inner = untag_ptr(this_ptr);
23740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23742         this_ptr_conv.is_owned = false;
23743         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
23744 }
23745
23746 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
23747         LDKChannelHandshakeLimits this_ptr_conv;
23748         this_ptr_conv.inner = untag_ptr(this_ptr);
23749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23751         this_ptr_conv.is_owned = false;
23752         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
23753         return ret_conv;
23754 }
23755
23756 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
23757         LDKChannelHandshakeLimits this_ptr_conv;
23758         this_ptr_conv.inner = untag_ptr(this_ptr);
23759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23761         this_ptr_conv.is_owned = false;
23762         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
23763 }
23764
23765 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
23766         LDKChannelHandshakeLimits this_ptr_conv;
23767         this_ptr_conv.inner = untag_ptr(this_ptr);
23768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23770         this_ptr_conv.is_owned = false;
23771         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
23772         return ret_conv;
23773 }
23774
23775 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
23776         LDKChannelHandshakeLimits this_ptr_conv;
23777         this_ptr_conv.inner = untag_ptr(this_ptr);
23778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23780         this_ptr_conv.is_owned = false;
23781         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
23782 }
23783
23784 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
23785         LDKChannelHandshakeLimits this_ptr_conv;
23786         this_ptr_conv.inner = untag_ptr(this_ptr);
23787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23789         this_ptr_conv.is_owned = false;
23790         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
23791         return ret_conv;
23792 }
23793
23794 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
23795         LDKChannelHandshakeLimits this_ptr_conv;
23796         this_ptr_conv.inner = untag_ptr(this_ptr);
23797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23799         this_ptr_conv.is_owned = false;
23800         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
23801 }
23802
23803 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
23804         LDKChannelHandshakeLimits this_ptr_conv;
23805         this_ptr_conv.inner = untag_ptr(this_ptr);
23806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23808         this_ptr_conv.is_owned = false;
23809         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
23810         return ret_conv;
23811 }
23812
23813 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) {
23814         LDKChannelHandshakeLimits this_ptr_conv;
23815         this_ptr_conv.inner = untag_ptr(this_ptr);
23816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23818         this_ptr_conv.is_owned = false;
23819         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
23820 }
23821
23822 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) {
23823         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);
23824         uint64_t ret_ref = 0;
23825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23827         return ret_ref;
23828 }
23829
23830 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
23831         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
23832         uint64_t ret_ref = 0;
23833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23835         return ret_ref;
23836 }
23837 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
23838         LDKChannelHandshakeLimits arg_conv;
23839         arg_conv.inner = untag_ptr(arg);
23840         arg_conv.is_owned = ptr_is_owned(arg);
23841         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23842         arg_conv.is_owned = false;
23843         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
23844         return ret_conv;
23845 }
23846
23847 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
23848         LDKChannelHandshakeLimits orig_conv;
23849         orig_conv.inner = untag_ptr(orig);
23850         orig_conv.is_owned = ptr_is_owned(orig);
23851         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23852         orig_conv.is_owned = false;
23853         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
23854         uint64_t ret_ref = 0;
23855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23857         return ret_ref;
23858 }
23859
23860 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
23861         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
23862         uint64_t ret_ref = 0;
23863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23865         return ret_ref;
23866 }
23867
23868 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
23869         LDKChannelConfig this_obj_conv;
23870         this_obj_conv.inner = untag_ptr(this_obj);
23871         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23873         ChannelConfig_free(this_obj_conv);
23874 }
23875
23876 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
23877         LDKChannelConfig this_ptr_conv;
23878         this_ptr_conv.inner = untag_ptr(this_ptr);
23879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23881         this_ptr_conv.is_owned = false;
23882         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
23883         return ret_conv;
23884 }
23885
23886 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) {
23887         LDKChannelConfig this_ptr_conv;
23888         this_ptr_conv.inner = untag_ptr(this_ptr);
23889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23891         this_ptr_conv.is_owned = false;
23892         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
23893 }
23894
23895 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
23896         LDKChannelConfig this_ptr_conv;
23897         this_ptr_conv.inner = untag_ptr(this_ptr);
23898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23900         this_ptr_conv.is_owned = false;
23901         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
23902         return ret_conv;
23903 }
23904
23905 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) {
23906         LDKChannelConfig this_ptr_conv;
23907         this_ptr_conv.inner = untag_ptr(this_ptr);
23908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23910         this_ptr_conv.is_owned = false;
23911         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
23912 }
23913
23914 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
23915         LDKChannelConfig this_ptr_conv;
23916         this_ptr_conv.inner = untag_ptr(this_ptr);
23917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23919         this_ptr_conv.is_owned = false;
23920         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
23921         return ret_conv;
23922 }
23923
23924 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
23925         LDKChannelConfig this_ptr_conv;
23926         this_ptr_conv.inner = untag_ptr(this_ptr);
23927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23929         this_ptr_conv.is_owned = false;
23930         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
23931 }
23932
23933 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) {
23934         LDKChannelConfig this_ptr_conv;
23935         this_ptr_conv.inner = untag_ptr(this_ptr);
23936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23938         this_ptr_conv.is_owned = false;
23939         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
23940         return ret_conv;
23941 }
23942
23943 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) {
23944         LDKChannelConfig this_ptr_conv;
23945         this_ptr_conv.inner = untag_ptr(this_ptr);
23946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23948         this_ptr_conv.is_owned = false;
23949         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
23950 }
23951
23952 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) {
23953         LDKChannelConfig this_ptr_conv;
23954         this_ptr_conv.inner = untag_ptr(this_ptr);
23955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23957         this_ptr_conv.is_owned = false;
23958         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
23959         return ret_conv;
23960 }
23961
23962 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) {
23963         LDKChannelConfig this_ptr_conv;
23964         this_ptr_conv.inner = untag_ptr(this_ptr);
23965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23967         this_ptr_conv.is_owned = false;
23968         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
23969 }
23970
23971 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) {
23972         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);
23973         uint64_t ret_ref = 0;
23974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23976         return ret_ref;
23977 }
23978
23979 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
23980         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
23981         uint64_t ret_ref = 0;
23982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23984         return ret_ref;
23985 }
23986 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
23987         LDKChannelConfig arg_conv;
23988         arg_conv.inner = untag_ptr(arg);
23989         arg_conv.is_owned = ptr_is_owned(arg);
23990         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23991         arg_conv.is_owned = false;
23992         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
23993         return ret_conv;
23994 }
23995
23996 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
23997         LDKChannelConfig orig_conv;
23998         orig_conv.inner = untag_ptr(orig);
23999         orig_conv.is_owned = ptr_is_owned(orig);
24000         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24001         orig_conv.is_owned = false;
24002         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
24003         uint64_t ret_ref = 0;
24004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24006         return ret_ref;
24007 }
24008
24009 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
24010         LDKChannelConfig a_conv;
24011         a_conv.inner = untag_ptr(a);
24012         a_conv.is_owned = ptr_is_owned(a);
24013         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24014         a_conv.is_owned = false;
24015         LDKChannelConfig b_conv;
24016         b_conv.inner = untag_ptr(b);
24017         b_conv.is_owned = ptr_is_owned(b);
24018         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24019         b_conv.is_owned = false;
24020         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
24021         return ret_conv;
24022 }
24023
24024 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
24025         LDKChannelConfig ret_var = ChannelConfig_default();
24026         uint64_t ret_ref = 0;
24027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24029         return ret_ref;
24030 }
24031
24032 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
24033         LDKChannelConfig obj_conv;
24034         obj_conv.inner = untag_ptr(obj);
24035         obj_conv.is_owned = ptr_is_owned(obj);
24036         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24037         obj_conv.is_owned = false;
24038         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
24039         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24040         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24041         CVec_u8Z_free(ret_var);
24042         return ret_arr;
24043 }
24044
24045 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
24046         LDKu8slice ser_ref;
24047         ser_ref.datalen = ser->arr_len;
24048         ser_ref.data = ser->elems;
24049         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
24050         *ret_conv = ChannelConfig_read(ser_ref);
24051         FREE(ser);
24052         return tag_ptr(ret_conv, true);
24053 }
24054
24055 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
24056         LDKUserConfig this_obj_conv;
24057         this_obj_conv.inner = untag_ptr(this_obj);
24058         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24060         UserConfig_free(this_obj_conv);
24061 }
24062
24063 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
24064         LDKUserConfig this_ptr_conv;
24065         this_ptr_conv.inner = untag_ptr(this_ptr);
24066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24068         this_ptr_conv.is_owned = false;
24069         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
24070         uint64_t ret_ref = 0;
24071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24073         return ret_ref;
24074 }
24075
24076 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
24077         LDKUserConfig this_ptr_conv;
24078         this_ptr_conv.inner = untag_ptr(this_ptr);
24079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24081         this_ptr_conv.is_owned = false;
24082         LDKChannelHandshakeConfig val_conv;
24083         val_conv.inner = untag_ptr(val);
24084         val_conv.is_owned = ptr_is_owned(val);
24085         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24086         val_conv = ChannelHandshakeConfig_clone(&val_conv);
24087         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
24088 }
24089
24090 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
24091         LDKUserConfig this_ptr_conv;
24092         this_ptr_conv.inner = untag_ptr(this_ptr);
24093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24095         this_ptr_conv.is_owned = false;
24096         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
24097         uint64_t ret_ref = 0;
24098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24100         return ret_ref;
24101 }
24102
24103 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
24104         LDKUserConfig this_ptr_conv;
24105         this_ptr_conv.inner = untag_ptr(this_ptr);
24106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24108         this_ptr_conv.is_owned = false;
24109         LDKChannelHandshakeLimits val_conv;
24110         val_conv.inner = untag_ptr(val);
24111         val_conv.is_owned = ptr_is_owned(val);
24112         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24113         val_conv = ChannelHandshakeLimits_clone(&val_conv);
24114         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
24115 }
24116
24117 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
24118         LDKUserConfig this_ptr_conv;
24119         this_ptr_conv.inner = untag_ptr(this_ptr);
24120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24122         this_ptr_conv.is_owned = false;
24123         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
24124         uint64_t ret_ref = 0;
24125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24127         return ret_ref;
24128 }
24129
24130 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
24131         LDKUserConfig this_ptr_conv;
24132         this_ptr_conv.inner = untag_ptr(this_ptr);
24133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24135         this_ptr_conv.is_owned = false;
24136         LDKChannelConfig val_conv;
24137         val_conv.inner = untag_ptr(val);
24138         val_conv.is_owned = ptr_is_owned(val);
24139         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24140         val_conv = ChannelConfig_clone(&val_conv);
24141         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
24142 }
24143
24144 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
24145         LDKUserConfig this_ptr_conv;
24146         this_ptr_conv.inner = untag_ptr(this_ptr);
24147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24149         this_ptr_conv.is_owned = false;
24150         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
24151         return ret_conv;
24152 }
24153
24154 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) {
24155         LDKUserConfig this_ptr_conv;
24156         this_ptr_conv.inner = untag_ptr(this_ptr);
24157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24159         this_ptr_conv.is_owned = false;
24160         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
24161 }
24162
24163 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
24164         LDKUserConfig this_ptr_conv;
24165         this_ptr_conv.inner = untag_ptr(this_ptr);
24166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24168         this_ptr_conv.is_owned = false;
24169         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
24170         return ret_conv;
24171 }
24172
24173 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
24174         LDKUserConfig this_ptr_conv;
24175         this_ptr_conv.inner = untag_ptr(this_ptr);
24176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24178         this_ptr_conv.is_owned = false;
24179         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
24180 }
24181
24182 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
24183         LDKUserConfig this_ptr_conv;
24184         this_ptr_conv.inner = untag_ptr(this_ptr);
24185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24187         this_ptr_conv.is_owned = false;
24188         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
24189         return ret_conv;
24190 }
24191
24192 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
24193         LDKUserConfig this_ptr_conv;
24194         this_ptr_conv.inner = untag_ptr(this_ptr);
24195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24197         this_ptr_conv.is_owned = false;
24198         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
24199 }
24200
24201 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
24202         LDKUserConfig this_ptr_conv;
24203         this_ptr_conv.inner = untag_ptr(this_ptr);
24204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24206         this_ptr_conv.is_owned = false;
24207         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
24208         return ret_conv;
24209 }
24210
24211 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
24212         LDKUserConfig this_ptr_conv;
24213         this_ptr_conv.inner = untag_ptr(this_ptr);
24214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24216         this_ptr_conv.is_owned = false;
24217         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
24218 }
24219
24220 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) {
24221         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
24222         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
24223         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
24224         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
24225         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
24226         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
24227         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
24228         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
24229         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
24230         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
24231         LDKChannelConfig channel_config_arg_conv;
24232         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
24233         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
24234         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
24235         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
24236         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);
24237         uint64_t ret_ref = 0;
24238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24240         return ret_ref;
24241 }
24242
24243 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
24244         LDKUserConfig ret_var = UserConfig_clone(arg);
24245         uint64_t ret_ref = 0;
24246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24248         return ret_ref;
24249 }
24250 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
24251         LDKUserConfig arg_conv;
24252         arg_conv.inner = untag_ptr(arg);
24253         arg_conv.is_owned = ptr_is_owned(arg);
24254         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24255         arg_conv.is_owned = false;
24256         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
24257         return ret_conv;
24258 }
24259
24260 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
24261         LDKUserConfig orig_conv;
24262         orig_conv.inner = untag_ptr(orig);
24263         orig_conv.is_owned = ptr_is_owned(orig);
24264         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24265         orig_conv.is_owned = false;
24266         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
24267         uint64_t ret_ref = 0;
24268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24270         return ret_ref;
24271 }
24272
24273 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
24274         LDKUserConfig ret_var = UserConfig_default();
24275         uint64_t ret_ref = 0;
24276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24278         return ret_ref;
24279 }
24280
24281 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
24282         LDKBestBlock this_obj_conv;
24283         this_obj_conv.inner = untag_ptr(this_obj);
24284         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24286         BestBlock_free(this_obj_conv);
24287 }
24288
24289 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
24290         LDKBestBlock ret_var = BestBlock_clone(arg);
24291         uint64_t ret_ref = 0;
24292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24294         return ret_ref;
24295 }
24296 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
24297         LDKBestBlock arg_conv;
24298         arg_conv.inner = untag_ptr(arg);
24299         arg_conv.is_owned = ptr_is_owned(arg);
24300         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24301         arg_conv.is_owned = false;
24302         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
24303         return ret_conv;
24304 }
24305
24306 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
24307         LDKBestBlock orig_conv;
24308         orig_conv.inner = untag_ptr(orig);
24309         orig_conv.is_owned = ptr_is_owned(orig);
24310         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24311         orig_conv.is_owned = false;
24312         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
24313         uint64_t ret_ref = 0;
24314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24316         return ret_ref;
24317 }
24318
24319 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
24320         LDKBestBlock a_conv;
24321         a_conv.inner = untag_ptr(a);
24322         a_conv.is_owned = ptr_is_owned(a);
24323         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24324         a_conv.is_owned = false;
24325         LDKBestBlock b_conv;
24326         b_conv.inner = untag_ptr(b);
24327         b_conv.is_owned = ptr_is_owned(b);
24328         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24329         b_conv.is_owned = false;
24330         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
24331         return ret_conv;
24332 }
24333
24334 uint64_t  __attribute__((export_name("TS_BestBlock_from_network"))) TS_BestBlock_from_network(uint32_t network) {
24335         LDKNetwork network_conv = LDKNetwork_from_js(network);
24336         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
24337         uint64_t ret_ref = 0;
24338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24340         return ret_ref;
24341 }
24342
24343 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
24344         LDKThirtyTwoBytes block_hash_ref;
24345         CHECK(block_hash->arr_len == 32);
24346         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
24347         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
24348         uint64_t ret_ref = 0;
24349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24351         return ret_ref;
24352 }
24353
24354 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
24355         LDKBestBlock this_arg_conv;
24356         this_arg_conv.inner = untag_ptr(this_arg);
24357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24359         this_arg_conv.is_owned = false;
24360         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24361         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
24362         return ret_arr;
24363 }
24364
24365 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
24366         LDKBestBlock this_arg_conv;
24367         this_arg_conv.inner = untag_ptr(this_arg);
24368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24370         this_arg_conv.is_owned = false;
24371         int32_t ret_conv = BestBlock_height(&this_arg_conv);
24372         return ret_conv;
24373 }
24374
24375 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
24376         if (!ptr_is_owned(this_ptr)) return;
24377         void* this_ptr_ptr = untag_ptr(this_ptr);
24378         CHECK_ACCESS(this_ptr_ptr);
24379         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
24380         FREE(untag_ptr(this_ptr));
24381         Listen_free(this_ptr_conv);
24382 }
24383
24384 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
24385         if (!ptr_is_owned(this_ptr)) return;
24386         void* this_ptr_ptr = untag_ptr(this_ptr);
24387         CHECK_ACCESS(this_ptr_ptr);
24388         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
24389         FREE(untag_ptr(this_ptr));
24390         Confirm_free(this_ptr_conv);
24391 }
24392
24393 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
24394         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
24395         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
24396         return ret_conv;
24397 }
24398
24399 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
24400         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
24401         return ret_conv;
24402 }
24403
24404 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
24405         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
24406         return ret_conv;
24407 }
24408
24409 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_permanent_failure"))) TS_ChannelMonitorUpdateStatus_permanent_failure() {
24410         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_permanent_failure());
24411         return ret_conv;
24412 }
24413
24414 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
24415         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
24416         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
24417         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
24418         return ret_conv;
24419 }
24420
24421 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
24422         if (!ptr_is_owned(this_ptr)) return;
24423         void* this_ptr_ptr = untag_ptr(this_ptr);
24424         CHECK_ACCESS(this_ptr_ptr);
24425         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
24426         FREE(untag_ptr(this_ptr));
24427         Watch_free(this_ptr_conv);
24428 }
24429
24430 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
24431         if (!ptr_is_owned(this_ptr)) return;
24432         void* this_ptr_ptr = untag_ptr(this_ptr);
24433         CHECK_ACCESS(this_ptr_ptr);
24434         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
24435         FREE(untag_ptr(this_ptr));
24436         Filter_free(this_ptr_conv);
24437 }
24438
24439 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
24440         LDKWatchedOutput this_obj_conv;
24441         this_obj_conv.inner = untag_ptr(this_obj);
24442         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24444         WatchedOutput_free(this_obj_conv);
24445 }
24446
24447 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
24448         LDKWatchedOutput this_ptr_conv;
24449         this_ptr_conv.inner = untag_ptr(this_ptr);
24450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24452         this_ptr_conv.is_owned = false;
24453         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24454         memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
24455         return ret_arr;
24456 }
24457
24458 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, int8_tArray val) {
24459         LDKWatchedOutput this_ptr_conv;
24460         this_ptr_conv.inner = untag_ptr(this_ptr);
24461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24463         this_ptr_conv.is_owned = false;
24464         LDKThirtyTwoBytes val_ref;
24465         CHECK(val->arr_len == 32);
24466         memcpy(val_ref.data, val->elems, 32); FREE(val);
24467         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
24468 }
24469
24470 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
24471         LDKWatchedOutput this_ptr_conv;
24472         this_ptr_conv.inner = untag_ptr(this_ptr);
24473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24475         this_ptr_conv.is_owned = false;
24476         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
24477         uint64_t ret_ref = 0;
24478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24480         return ret_ref;
24481 }
24482
24483 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
24484         LDKWatchedOutput this_ptr_conv;
24485         this_ptr_conv.inner = untag_ptr(this_ptr);
24486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24488         this_ptr_conv.is_owned = false;
24489         LDKOutPoint val_conv;
24490         val_conv.inner = untag_ptr(val);
24491         val_conv.is_owned = ptr_is_owned(val);
24492         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24493         val_conv = OutPoint_clone(&val_conv);
24494         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
24495 }
24496
24497 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
24498         LDKWatchedOutput this_ptr_conv;
24499         this_ptr_conv.inner = untag_ptr(this_ptr);
24500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24502         this_ptr_conv.is_owned = false;
24503         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
24504         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24505         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24506         return ret_arr;
24507 }
24508
24509 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
24510         LDKWatchedOutput this_ptr_conv;
24511         this_ptr_conv.inner = untag_ptr(this_ptr);
24512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24514         this_ptr_conv.is_owned = false;
24515         LDKCVec_u8Z val_ref;
24516         val_ref.datalen = val->arr_len;
24517         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
24518         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
24519         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
24520 }
24521
24522 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) {
24523         LDKThirtyTwoBytes block_hash_arg_ref;
24524         CHECK(block_hash_arg->arr_len == 32);
24525         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
24526         LDKOutPoint outpoint_arg_conv;
24527         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
24528         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
24529         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
24530         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
24531         LDKCVec_u8Z script_pubkey_arg_ref;
24532         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
24533         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
24534         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
24535         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
24536         uint64_t ret_ref = 0;
24537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24539         return ret_ref;
24540 }
24541
24542 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
24543         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
24544         uint64_t ret_ref = 0;
24545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24547         return ret_ref;
24548 }
24549 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
24550         LDKWatchedOutput arg_conv;
24551         arg_conv.inner = untag_ptr(arg);
24552         arg_conv.is_owned = ptr_is_owned(arg);
24553         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24554         arg_conv.is_owned = false;
24555         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
24556         return ret_conv;
24557 }
24558
24559 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
24560         LDKWatchedOutput orig_conv;
24561         orig_conv.inner = untag_ptr(orig);
24562         orig_conv.is_owned = ptr_is_owned(orig);
24563         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24564         orig_conv.is_owned = false;
24565         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
24566         uint64_t ret_ref = 0;
24567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24569         return ret_ref;
24570 }
24571
24572 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
24573         LDKWatchedOutput a_conv;
24574         a_conv.inner = untag_ptr(a);
24575         a_conv.is_owned = ptr_is_owned(a);
24576         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24577         a_conv.is_owned = false;
24578         LDKWatchedOutput b_conv;
24579         b_conv.inner = untag_ptr(b);
24580         b_conv.is_owned = ptr_is_owned(b);
24581         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24582         b_conv.is_owned = false;
24583         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
24584         return ret_conv;
24585 }
24586
24587 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
24588         LDKWatchedOutput o_conv;
24589         o_conv.inner = untag_ptr(o);
24590         o_conv.is_owned = ptr_is_owned(o);
24591         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24592         o_conv.is_owned = false;
24593         int64_t ret_conv = WatchedOutput_hash(&o_conv);
24594         return ret_conv;
24595 }
24596
24597 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
24598         if (!ptr_is_owned(this_ptr)) return;
24599         void* this_ptr_ptr = untag_ptr(this_ptr);
24600         CHECK_ACCESS(this_ptr_ptr);
24601         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
24602         FREE(untag_ptr(this_ptr));
24603         BroadcasterInterface_free(this_ptr_conv);
24604 }
24605
24606 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
24607         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
24608         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
24609         return ret_conv;
24610 }
24611
24612 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
24613         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
24614         return ret_conv;
24615 }
24616
24617 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
24618         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
24619         return ret_conv;
24620 }
24621
24622 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
24623         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
24624         return ret_conv;
24625 }
24626
24627 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
24628         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
24629         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
24630         return ret_conv;
24631 }
24632
24633 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
24634         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
24635         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
24636         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
24637         return ret_conv;
24638 }
24639
24640 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
24641         if (!ptr_is_owned(this_ptr)) return;
24642         void* this_ptr_ptr = untag_ptr(this_ptr);
24643         CHECK_ACCESS(this_ptr_ptr);
24644         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
24645         FREE(untag_ptr(this_ptr));
24646         FeeEstimator_free(this_ptr_conv);
24647 }
24648
24649 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
24650         LDKMonitorUpdateId this_obj_conv;
24651         this_obj_conv.inner = untag_ptr(this_obj);
24652         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24654         MonitorUpdateId_free(this_obj_conv);
24655 }
24656
24657 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
24658         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
24659         uint64_t ret_ref = 0;
24660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24662         return ret_ref;
24663 }
24664 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
24665         LDKMonitorUpdateId arg_conv;
24666         arg_conv.inner = untag_ptr(arg);
24667         arg_conv.is_owned = ptr_is_owned(arg);
24668         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24669         arg_conv.is_owned = false;
24670         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
24671         return ret_conv;
24672 }
24673
24674 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
24675         LDKMonitorUpdateId orig_conv;
24676         orig_conv.inner = untag_ptr(orig);
24677         orig_conv.is_owned = ptr_is_owned(orig);
24678         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24679         orig_conv.is_owned = false;
24680         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
24681         uint64_t ret_ref = 0;
24682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24684         return ret_ref;
24685 }
24686
24687 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
24688         LDKMonitorUpdateId o_conv;
24689         o_conv.inner = untag_ptr(o);
24690         o_conv.is_owned = ptr_is_owned(o);
24691         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24692         o_conv.is_owned = false;
24693         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
24694         return ret_conv;
24695 }
24696
24697 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
24698         LDKMonitorUpdateId a_conv;
24699         a_conv.inner = untag_ptr(a);
24700         a_conv.is_owned = ptr_is_owned(a);
24701         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24702         a_conv.is_owned = false;
24703         LDKMonitorUpdateId b_conv;
24704         b_conv.inner = untag_ptr(b);
24705         b_conv.is_owned = ptr_is_owned(b);
24706         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24707         b_conv.is_owned = false;
24708         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
24709         return ret_conv;
24710 }
24711
24712 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
24713         if (!ptr_is_owned(this_ptr)) return;
24714         void* this_ptr_ptr = untag_ptr(this_ptr);
24715         CHECK_ACCESS(this_ptr_ptr);
24716         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
24717         FREE(untag_ptr(this_ptr));
24718         Persist_free(this_ptr_conv);
24719 }
24720
24721 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
24722         LDKLockedChannelMonitor this_obj_conv;
24723         this_obj_conv.inner = untag_ptr(this_obj);
24724         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24726         LockedChannelMonitor_free(this_obj_conv);
24727 }
24728
24729 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
24730         LDKChainMonitor this_obj_conv;
24731         this_obj_conv.inner = untag_ptr(this_obj);
24732         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24734         ChainMonitor_free(this_obj_conv);
24735 }
24736
24737 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) {
24738         void* chain_source_ptr = untag_ptr(chain_source);
24739         CHECK_ACCESS(chain_source_ptr);
24740         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
24741         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
24742         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
24743                 // Manually implement clone for Java trait instances
24744                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
24745                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24746                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
24747                 }
24748         }
24749         void* broadcaster_ptr = untag_ptr(broadcaster);
24750         CHECK_ACCESS(broadcaster_ptr);
24751         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24752         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24753                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24754                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24755         }
24756         void* logger_ptr = untag_ptr(logger);
24757         CHECK_ACCESS(logger_ptr);
24758         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24759         if (logger_conv.free == LDKLogger_JCalls_free) {
24760                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24761                 LDKLogger_JCalls_cloned(&logger_conv);
24762         }
24763         void* feeest_ptr = untag_ptr(feeest);
24764         CHECK_ACCESS(feeest_ptr);
24765         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
24766         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
24767                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24768                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
24769         }
24770         void* persister_ptr = untag_ptr(persister);
24771         CHECK_ACCESS(persister_ptr);
24772         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
24773         if (persister_conv.free == LDKPersist_JCalls_free) {
24774                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24775                 LDKPersist_JCalls_cloned(&persister_conv);
24776         }
24777         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
24778         uint64_t ret_ref = 0;
24779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24781         return ret_ref;
24782 }
24783
24784 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
24785         LDKChainMonitor this_arg_conv;
24786         this_arg_conv.inner = untag_ptr(this_arg);
24787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24789         this_arg_conv.is_owned = false;
24790         LDKCVec_ChannelDetailsZ ignored_channels_constr;
24791         ignored_channels_constr.datalen = ignored_channels->arr_len;
24792         if (ignored_channels_constr.datalen > 0)
24793                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
24794         else
24795                 ignored_channels_constr.data = NULL;
24796         uint64_t* ignored_channels_vals = ignored_channels->elems;
24797         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
24798                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
24799                 LDKChannelDetails ignored_channels_conv_16_conv;
24800                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
24801                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
24802                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
24803                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
24804                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
24805         }
24806         FREE(ignored_channels);
24807         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
24808         uint64_tArray ret_arr = NULL;
24809         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24810         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24811         for (size_t j = 0; j < ret_var.datalen; j++) {
24812                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24813                 *ret_conv_9_copy = ret_var.data[j];
24814                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
24815                 ret_arr_ptr[j] = ret_conv_9_ref;
24816         }
24817         
24818         FREE(ret_var.data);
24819         return ret_arr;
24820 }
24821
24822 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
24823         LDKChainMonitor this_arg_conv;
24824         this_arg_conv.inner = untag_ptr(this_arg);
24825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24827         this_arg_conv.is_owned = false;
24828         LDKOutPoint funding_txo_conv;
24829         funding_txo_conv.inner = untag_ptr(funding_txo);
24830         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
24831         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
24832         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
24833         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
24834         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
24835         return tag_ptr(ret_conv, true);
24836 }
24837
24838 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
24839         LDKChainMonitor this_arg_conv;
24840         this_arg_conv.inner = untag_ptr(this_arg);
24841         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24843         this_arg_conv.is_owned = false;
24844         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
24845         uint64_tArray ret_arr = NULL;
24846         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24847         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24848         for (size_t k = 0; k < ret_var.datalen; k++) {
24849                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
24850                 uint64_t ret_conv_10_ref = 0;
24851                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
24852                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
24853                 ret_arr_ptr[k] = ret_conv_10_ref;
24854         }
24855         
24856         FREE(ret_var.data);
24857         return ret_arr;
24858 }
24859
24860 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
24861         LDKChainMonitor this_arg_conv;
24862         this_arg_conv.inner = untag_ptr(this_arg);
24863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24865         this_arg_conv.is_owned = false;
24866         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
24867         uint64_tArray ret_arr = NULL;
24868         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24869         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24870         for (size_t p = 0; p < ret_var.datalen; p++) {
24871                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
24872                 *ret_conv_41_conv = ret_var.data[p];
24873                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
24874         }
24875         
24876         FREE(ret_var.data);
24877         return ret_arr;
24878 }
24879
24880 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) {
24881         LDKChainMonitor this_arg_conv;
24882         this_arg_conv.inner = untag_ptr(this_arg);
24883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24885         this_arg_conv.is_owned = false;
24886         LDKOutPoint funding_txo_conv;
24887         funding_txo_conv.inner = untag_ptr(funding_txo);
24888         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
24889         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
24890         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
24891         LDKMonitorUpdateId completed_update_id_conv;
24892         completed_update_id_conv.inner = untag_ptr(completed_update_id);
24893         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
24894         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
24895         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
24896         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24897         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
24898         return tag_ptr(ret_conv, true);
24899 }
24900
24901 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_update_future"))) TS_ChainMonitor_get_update_future(uint64_t this_arg) {
24902         LDKChainMonitor this_arg_conv;
24903         this_arg_conv.inner = untag_ptr(this_arg);
24904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24906         this_arg_conv.is_owned = false;
24907         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
24908         uint64_t ret_ref = 0;
24909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24911         return ret_ref;
24912 }
24913
24914 void  __attribute__((export_name("TS_ChainMonitor_rebroadcast_pending_claims"))) TS_ChainMonitor_rebroadcast_pending_claims(uint64_t this_arg) {
24915         LDKChainMonitor this_arg_conv;
24916         this_arg_conv.inner = untag_ptr(this_arg);
24917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24919         this_arg_conv.is_owned = false;
24920         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
24921 }
24922
24923 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
24924         LDKChainMonitor this_arg_conv;
24925         this_arg_conv.inner = untag_ptr(this_arg);
24926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24928         this_arg_conv.is_owned = false;
24929         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
24930         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
24931         return tag_ptr(ret_ret, true);
24932 }
24933
24934 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
24935         LDKChainMonitor this_arg_conv;
24936         this_arg_conv.inner = untag_ptr(this_arg);
24937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24939         this_arg_conv.is_owned = false;
24940         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
24941         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
24942         return tag_ptr(ret_ret, true);
24943 }
24944
24945 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
24946         LDKChainMonitor this_arg_conv;
24947         this_arg_conv.inner = untag_ptr(this_arg);
24948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24950         this_arg_conv.is_owned = false;
24951         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
24952         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
24953         return tag_ptr(ret_ret, true);
24954 }
24955
24956 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
24957         LDKChainMonitor this_arg_conv;
24958         this_arg_conv.inner = untag_ptr(this_arg);
24959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24961         this_arg_conv.is_owned = false;
24962         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
24963         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
24964         return tag_ptr(ret_ret, true);
24965 }
24966
24967 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
24968         LDKChannelMonitorUpdate this_obj_conv;
24969         this_obj_conv.inner = untag_ptr(this_obj);
24970         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24972         ChannelMonitorUpdate_free(this_obj_conv);
24973 }
24974
24975 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
24976         LDKChannelMonitorUpdate this_ptr_conv;
24977         this_ptr_conv.inner = untag_ptr(this_ptr);
24978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24980         this_ptr_conv.is_owned = false;
24981         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
24982         return ret_conv;
24983 }
24984
24985 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
24986         LDKChannelMonitorUpdate this_ptr_conv;
24987         this_ptr_conv.inner = untag_ptr(this_ptr);
24988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24990         this_ptr_conv.is_owned = false;
24991         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
24992 }
24993
24994 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
24995         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
24996         uint64_t ret_ref = 0;
24997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24999         return ret_ref;
25000 }
25001 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
25002         LDKChannelMonitorUpdate arg_conv;
25003         arg_conv.inner = untag_ptr(arg);
25004         arg_conv.is_owned = ptr_is_owned(arg);
25005         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25006         arg_conv.is_owned = false;
25007         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
25008         return ret_conv;
25009 }
25010
25011 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
25012         LDKChannelMonitorUpdate orig_conv;
25013         orig_conv.inner = untag_ptr(orig);
25014         orig_conv.is_owned = ptr_is_owned(orig);
25015         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25016         orig_conv.is_owned = false;
25017         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
25018         uint64_t ret_ref = 0;
25019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25021         return ret_ref;
25022 }
25023
25024 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdate_eq"))) TS_ChannelMonitorUpdate_eq(uint64_t a, uint64_t b) {
25025         LDKChannelMonitorUpdate a_conv;
25026         a_conv.inner = untag_ptr(a);
25027         a_conv.is_owned = ptr_is_owned(a);
25028         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25029         a_conv.is_owned = false;
25030         LDKChannelMonitorUpdate b_conv;
25031         b_conv.inner = untag_ptr(b);
25032         b_conv.is_owned = ptr_is_owned(b);
25033         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25034         b_conv.is_owned = false;
25035         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
25036         return ret_conv;
25037 }
25038
25039 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
25040         LDKChannelMonitorUpdate obj_conv;
25041         obj_conv.inner = untag_ptr(obj);
25042         obj_conv.is_owned = ptr_is_owned(obj);
25043         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25044         obj_conv.is_owned = false;
25045         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
25046         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25047         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25048         CVec_u8Z_free(ret_var);
25049         return ret_arr;
25050 }
25051
25052 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
25053         LDKu8slice ser_ref;
25054         ser_ref.datalen = ser->arr_len;
25055         ser_ref.data = ser->elems;
25056         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25057         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
25058         FREE(ser);
25059         return tag_ptr(ret_conv, true);
25060 }
25061
25062 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
25063         if (!ptr_is_owned(this_ptr)) return;
25064         void* this_ptr_ptr = untag_ptr(this_ptr);
25065         CHECK_ACCESS(this_ptr_ptr);
25066         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
25067         FREE(untag_ptr(this_ptr));
25068         MonitorEvent_free(this_ptr_conv);
25069 }
25070
25071 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
25072         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25073         *ret_copy = MonitorEvent_clone(arg);
25074         uint64_t ret_ref = tag_ptr(ret_copy, true);
25075         return ret_ref;
25076 }
25077 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
25078         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
25079         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
25080         return ret_conv;
25081 }
25082
25083 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
25084         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
25085         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25086         *ret_copy = MonitorEvent_clone(orig_conv);
25087         uint64_t ret_ref = tag_ptr(ret_copy, true);
25088         return ret_ref;
25089 }
25090
25091 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
25092         LDKHTLCUpdate a_conv;
25093         a_conv.inner = untag_ptr(a);
25094         a_conv.is_owned = ptr_is_owned(a);
25095         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25096         a_conv = HTLCUpdate_clone(&a_conv);
25097         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25098         *ret_copy = MonitorEvent_htlcevent(a_conv);
25099         uint64_t ret_ref = tag_ptr(ret_copy, true);
25100         return ret_ref;
25101 }
25102
25103 uint64_t  __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint64_t a) {
25104         LDKOutPoint a_conv;
25105         a_conv.inner = untag_ptr(a);
25106         a_conv.is_owned = ptr_is_owned(a);
25107         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25108         a_conv = OutPoint_clone(&a_conv);
25109         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25110         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
25111         uint64_t ret_ref = tag_ptr(ret_copy, true);
25112         return ret_ref;
25113 }
25114
25115 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, int64_t monitor_update_id) {
25116         LDKOutPoint funding_txo_conv;
25117         funding_txo_conv.inner = untag_ptr(funding_txo);
25118         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
25119         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25120         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25121         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25122         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
25123         uint64_t ret_ref = tag_ptr(ret_copy, true);
25124         return ret_ref;
25125 }
25126
25127 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint64_t a) {
25128         LDKOutPoint a_conv;
25129         a_conv.inner = untag_ptr(a);
25130         a_conv.is_owned = ptr_is_owned(a);
25131         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25132         a_conv = OutPoint_clone(&a_conv);
25133         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25134         *ret_copy = MonitorEvent_update_failed(a_conv);
25135         uint64_t ret_ref = tag_ptr(ret_copy, true);
25136         return ret_ref;
25137 }
25138
25139 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
25140         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
25141         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
25142         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
25143         return ret_conv;
25144 }
25145
25146 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
25147         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
25148         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
25149         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25150         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25151         CVec_u8Z_free(ret_var);
25152         return ret_arr;
25153 }
25154
25155 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
25156         LDKu8slice ser_ref;
25157         ser_ref.datalen = ser->arr_len;
25158         ser_ref.data = ser->elems;
25159         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25160         *ret_conv = MonitorEvent_read(ser_ref);
25161         FREE(ser);
25162         return tag_ptr(ret_conv, true);
25163 }
25164
25165 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
25166         LDKHTLCUpdate this_obj_conv;
25167         this_obj_conv.inner = untag_ptr(this_obj);
25168         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25170         HTLCUpdate_free(this_obj_conv);
25171 }
25172
25173 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
25174         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
25175         uint64_t ret_ref = 0;
25176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25178         return ret_ref;
25179 }
25180 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
25181         LDKHTLCUpdate arg_conv;
25182         arg_conv.inner = untag_ptr(arg);
25183         arg_conv.is_owned = ptr_is_owned(arg);
25184         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25185         arg_conv.is_owned = false;
25186         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
25187         return ret_conv;
25188 }
25189
25190 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
25191         LDKHTLCUpdate orig_conv;
25192         orig_conv.inner = untag_ptr(orig);
25193         orig_conv.is_owned = ptr_is_owned(orig);
25194         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25195         orig_conv.is_owned = false;
25196         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
25197         uint64_t ret_ref = 0;
25198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25200         return ret_ref;
25201 }
25202
25203 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
25204         LDKHTLCUpdate a_conv;
25205         a_conv.inner = untag_ptr(a);
25206         a_conv.is_owned = ptr_is_owned(a);
25207         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25208         a_conv.is_owned = false;
25209         LDKHTLCUpdate b_conv;
25210         b_conv.inner = untag_ptr(b);
25211         b_conv.is_owned = ptr_is_owned(b);
25212         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25213         b_conv.is_owned = false;
25214         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
25215         return ret_conv;
25216 }
25217
25218 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
25219         LDKHTLCUpdate obj_conv;
25220         obj_conv.inner = untag_ptr(obj);
25221         obj_conv.is_owned = ptr_is_owned(obj);
25222         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25223         obj_conv.is_owned = false;
25224         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
25225         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25226         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25227         CVec_u8Z_free(ret_var);
25228         return ret_arr;
25229 }
25230
25231 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
25232         LDKu8slice ser_ref;
25233         ser_ref.datalen = ser->arr_len;
25234         ser_ref.data = ser->elems;
25235         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25236         *ret_conv = HTLCUpdate_read(ser_ref);
25237         FREE(ser);
25238         return tag_ptr(ret_conv, true);
25239 }
25240
25241 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
25242         if (!ptr_is_owned(this_ptr)) return;
25243         void* this_ptr_ptr = untag_ptr(this_ptr);
25244         CHECK_ACCESS(this_ptr_ptr);
25245         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
25246         FREE(untag_ptr(this_ptr));
25247         Balance_free(this_ptr_conv);
25248 }
25249
25250 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
25251         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25252         *ret_copy = Balance_clone(arg);
25253         uint64_t ret_ref = tag_ptr(ret_copy, true);
25254         return ret_ref;
25255 }
25256 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
25257         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
25258         int64_t ret_conv = Balance_clone_ptr(arg_conv);
25259         return ret_conv;
25260 }
25261
25262 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
25263         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
25264         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25265         *ret_copy = Balance_clone(orig_conv);
25266         uint64_t ret_ref = tag_ptr(ret_copy, true);
25267         return ret_ref;
25268 }
25269
25270 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
25271         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25272         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
25273         uint64_t ret_ref = tag_ptr(ret_copy, true);
25274         return ret_ref;
25275 }
25276
25277 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
25278         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25279         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
25280         uint64_t ret_ref = tag_ptr(ret_copy, true);
25281         return ret_ref;
25282 }
25283
25284 uint64_t  __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
25285         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25286         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
25287         uint64_t ret_ref = tag_ptr(ret_copy, true);
25288         return ret_ref;
25289 }
25290
25291 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) {
25292         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25293         *ret_copy = Balance_maybe_timeout_claimable_htlc(claimable_amount_satoshis, claimable_height);
25294         uint64_t ret_ref = tag_ptr(ret_copy, true);
25295         return ret_ref;
25296 }
25297
25298 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) {
25299         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25300         *ret_copy = Balance_maybe_preimage_claimable_htlc(claimable_amount_satoshis, expiry_height);
25301         uint64_t ret_ref = tag_ptr(ret_copy, true);
25302         return ret_ref;
25303 }
25304
25305 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t claimable_amount_satoshis) {
25306         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25307         *ret_copy = Balance_counterparty_revoked_output_claimable(claimable_amount_satoshis);
25308         uint64_t ret_ref = tag_ptr(ret_copy, true);
25309         return ret_ref;
25310 }
25311
25312 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
25313         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
25314         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
25315         jboolean ret_conv = Balance_eq(a_conv, b_conv);
25316         return ret_conv;
25317 }
25318
25319 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
25320         LDKChannelMonitor this_obj_conv;
25321         this_obj_conv.inner = untag_ptr(this_obj);
25322         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25324         ChannelMonitor_free(this_obj_conv);
25325 }
25326
25327 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
25328         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
25329         uint64_t ret_ref = 0;
25330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25332         return ret_ref;
25333 }
25334 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
25335         LDKChannelMonitor arg_conv;
25336         arg_conv.inner = untag_ptr(arg);
25337         arg_conv.is_owned = ptr_is_owned(arg);
25338         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25339         arg_conv.is_owned = false;
25340         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
25341         return ret_conv;
25342 }
25343
25344 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
25345         LDKChannelMonitor orig_conv;
25346         orig_conv.inner = untag_ptr(orig);
25347         orig_conv.is_owned = ptr_is_owned(orig);
25348         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25349         orig_conv.is_owned = false;
25350         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
25351         uint64_t ret_ref = 0;
25352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25354         return ret_ref;
25355 }
25356
25357 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
25358         LDKChannelMonitor obj_conv;
25359         obj_conv.inner = untag_ptr(obj);
25360         obj_conv.is_owned = ptr_is_owned(obj);
25361         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25362         obj_conv.is_owned = false;
25363         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
25364         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25365         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25366         CVec_u8Z_free(ret_var);
25367         return ret_arr;
25368 }
25369
25370 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) {
25371         LDKChannelMonitor this_arg_conv;
25372         this_arg_conv.inner = untag_ptr(this_arg);
25373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25375         this_arg_conv.is_owned = false;
25376         LDKChannelMonitorUpdate updates_conv;
25377         updates_conv.inner = untag_ptr(updates);
25378         updates_conv.is_owned = ptr_is_owned(updates);
25379         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
25380         updates_conv.is_owned = false;
25381         void* broadcaster_ptr = untag_ptr(broadcaster);
25382         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
25383         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
25384         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25385         CHECK_ACCESS(fee_estimator_ptr);
25386         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25387         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25388                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25389                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25390         }
25391         void* logger_ptr = untag_ptr(logger);
25392         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
25393         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25394         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25395         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
25396         return tag_ptr(ret_conv, true);
25397 }
25398
25399 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
25400         LDKChannelMonitor this_arg_conv;
25401         this_arg_conv.inner = untag_ptr(this_arg);
25402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25404         this_arg_conv.is_owned = false;
25405         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
25406         return ret_conv;
25407 }
25408
25409 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
25410         LDKChannelMonitor this_arg_conv;
25411         this_arg_conv.inner = untag_ptr(this_arg);
25412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25414         this_arg_conv.is_owned = false;
25415         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
25416         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
25417         return tag_ptr(ret_conv, true);
25418 }
25419
25420 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
25421         LDKChannelMonitor this_arg_conv;
25422         this_arg_conv.inner = untag_ptr(this_arg);
25423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25425         this_arg_conv.is_owned = false;
25426         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
25427         uint64_tArray ret_arr = NULL;
25428         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25429         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25430         for (size_t o = 0; o < ret_var.datalen; o++) {
25431                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
25432                 *ret_conv_40_conv = ret_var.data[o];
25433                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
25434         }
25435         
25436         FREE(ret_var.data);
25437         return ret_arr;
25438 }
25439
25440 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
25441         LDKChannelMonitor this_arg_conv;
25442         this_arg_conv.inner = untag_ptr(this_arg);
25443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25445         this_arg_conv.is_owned = false;
25446         void* filter_ptr = untag_ptr(filter);
25447         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
25448         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
25449         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
25450 }
25451
25452 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) {
25453         LDKChannelMonitor this_arg_conv;
25454         this_arg_conv.inner = untag_ptr(this_arg);
25455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25457         this_arg_conv.is_owned = false;
25458         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
25459         uint64_tArray ret_arr = NULL;
25460         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25461         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25462         for (size_t o = 0; o < ret_var.datalen; o++) {
25463                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25464                 *ret_conv_14_copy = ret_var.data[o];
25465                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
25466                 ret_arr_ptr[o] = ret_conv_14_ref;
25467         }
25468         
25469         FREE(ret_var.data);
25470         return ret_arr;
25471 }
25472
25473 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint64_t this_arg) {
25474         LDKChannelMonitor this_arg_conv;
25475         this_arg_conv.inner = untag_ptr(this_arg);
25476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25478         this_arg_conv.is_owned = false;
25479         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
25480         uint64_tArray ret_arr = NULL;
25481         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25482         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25483         for (size_t h = 0; h < ret_var.datalen; h++) {
25484                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25485                 *ret_conv_7_copy = ret_var.data[h];
25486                 uint64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
25487                 ret_arr_ptr[h] = ret_conv_7_ref;
25488         }
25489         
25490         FREE(ret_var.data);
25491         return ret_arr;
25492 }
25493
25494 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
25495         LDKChannelMonitor this_arg_conv;
25496         this_arg_conv.inner = untag_ptr(this_arg);
25497         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25499         this_arg_conv.is_owned = false;
25500         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25501         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
25502         return ret_arr;
25503 }
25504
25505 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) {
25506         LDKChannelMonitor this_arg_conv;
25507         this_arg_conv.inner = untag_ptr(this_arg);
25508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25510         this_arg_conv.is_owned = false;
25511         void* logger_ptr = untag_ptr(logger);
25512         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
25513         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25514         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
25515         ptrArray ret_arr = NULL;
25516         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
25517         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
25518         for (size_t m = 0; m < ret_var.datalen; m++) {
25519                 LDKTransaction ret_conv_12_var = ret_var.data[m];
25520                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
25521                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
25522                 Transaction_free(ret_conv_12_var);
25523                 ret_arr_ptr[m] = ret_conv_12_arr;
25524         }
25525         
25526         FREE(ret_var.data);
25527         return ret_arr;
25528 }
25529
25530 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) {
25531         LDKChannelMonitor this_arg_conv;
25532         this_arg_conv.inner = untag_ptr(this_arg);
25533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25535         this_arg_conv.is_owned = false;
25536         uint8_t header_arr[80];
25537         CHECK(header->arr_len == 80);
25538         memcpy(header_arr, header->elems, 80); FREE(header);
25539         uint8_t (*header_ref)[80] = &header_arr;
25540         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25541         txdata_constr.datalen = txdata->arr_len;
25542         if (txdata_constr.datalen > 0)
25543                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25544         else
25545                 txdata_constr.data = NULL;
25546         uint64_t* txdata_vals = txdata->elems;
25547         for (size_t c = 0; c < txdata_constr.datalen; c++) {
25548                 uint64_t txdata_conv_28 = txdata_vals[c];
25549                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
25550                 CHECK_ACCESS(txdata_conv_28_ptr);
25551                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25552                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
25553                 txdata_constr.data[c] = txdata_conv_28_conv;
25554         }
25555         FREE(txdata);
25556         void* broadcaster_ptr = untag_ptr(broadcaster);
25557         CHECK_ACCESS(broadcaster_ptr);
25558         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25559         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25560                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25561                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25562         }
25563         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25564         CHECK_ACCESS(fee_estimator_ptr);
25565         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25566         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25567                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25568                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25569         }
25570         void* logger_ptr = untag_ptr(logger);
25571         CHECK_ACCESS(logger_ptr);
25572         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25573         if (logger_conv.free == LDKLogger_JCalls_free) {
25574                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25575                 LDKLogger_JCalls_cloned(&logger_conv);
25576         }
25577         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);
25578         uint64_tArray ret_arr = NULL;
25579         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25580         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25581         for (size_t n = 0; n < ret_var.datalen; n++) {
25582                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25583                 *ret_conv_39_conv = ret_var.data[n];
25584                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25585         }
25586         
25587         FREE(ret_var.data);
25588         return ret_arr;
25589 }
25590
25591 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) {
25592         LDKChannelMonitor this_arg_conv;
25593         this_arg_conv.inner = untag_ptr(this_arg);
25594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25596         this_arg_conv.is_owned = false;
25597         uint8_t header_arr[80];
25598         CHECK(header->arr_len == 80);
25599         memcpy(header_arr, header->elems, 80); FREE(header);
25600         uint8_t (*header_ref)[80] = &header_arr;
25601         void* broadcaster_ptr = untag_ptr(broadcaster);
25602         CHECK_ACCESS(broadcaster_ptr);
25603         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25604         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25605                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25606                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25607         }
25608         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25609         CHECK_ACCESS(fee_estimator_ptr);
25610         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25611         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25612                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25613                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25614         }
25615         void* logger_ptr = untag_ptr(logger);
25616         CHECK_ACCESS(logger_ptr);
25617         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25618         if (logger_conv.free == LDKLogger_JCalls_free) {
25619                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25620                 LDKLogger_JCalls_cloned(&logger_conv);
25621         }
25622         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25623 }
25624
25625 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) {
25626         LDKChannelMonitor this_arg_conv;
25627         this_arg_conv.inner = untag_ptr(this_arg);
25628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25630         this_arg_conv.is_owned = false;
25631         uint8_t header_arr[80];
25632         CHECK(header->arr_len == 80);
25633         memcpy(header_arr, header->elems, 80); FREE(header);
25634         uint8_t (*header_ref)[80] = &header_arr;
25635         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25636         txdata_constr.datalen = txdata->arr_len;
25637         if (txdata_constr.datalen > 0)
25638                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25639         else
25640                 txdata_constr.data = NULL;
25641         uint64_t* txdata_vals = txdata->elems;
25642         for (size_t c = 0; c < txdata_constr.datalen; c++) {
25643                 uint64_t txdata_conv_28 = txdata_vals[c];
25644                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
25645                 CHECK_ACCESS(txdata_conv_28_ptr);
25646                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25647                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
25648                 txdata_constr.data[c] = txdata_conv_28_conv;
25649         }
25650         FREE(txdata);
25651         void* broadcaster_ptr = untag_ptr(broadcaster);
25652         CHECK_ACCESS(broadcaster_ptr);
25653         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25654         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25655                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25656                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25657         }
25658         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25659         CHECK_ACCESS(fee_estimator_ptr);
25660         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25661         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25662                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25663                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25664         }
25665         void* logger_ptr = untag_ptr(logger);
25666         CHECK_ACCESS(logger_ptr);
25667         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25668         if (logger_conv.free == LDKLogger_JCalls_free) {
25669                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25670                 LDKLogger_JCalls_cloned(&logger_conv);
25671         }
25672         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);
25673         uint64_tArray ret_arr = NULL;
25674         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25675         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25676         for (size_t n = 0; n < ret_var.datalen; n++) {
25677                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25678                 *ret_conv_39_conv = ret_var.data[n];
25679                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25680         }
25681         
25682         FREE(ret_var.data);
25683         return ret_arr;
25684 }
25685
25686 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) {
25687         LDKChannelMonitor this_arg_conv;
25688         this_arg_conv.inner = untag_ptr(this_arg);
25689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25691         this_arg_conv.is_owned = false;
25692         uint8_t txid_arr[32];
25693         CHECK(txid->arr_len == 32);
25694         memcpy(txid_arr, txid->elems, 32); FREE(txid);
25695         uint8_t (*txid_ref)[32] = &txid_arr;
25696         void* broadcaster_ptr = untag_ptr(broadcaster);
25697         CHECK_ACCESS(broadcaster_ptr);
25698         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25699         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25700                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25701                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25702         }
25703         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25704         CHECK_ACCESS(fee_estimator_ptr);
25705         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25706         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25707                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25708                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25709         }
25710         void* logger_ptr = untag_ptr(logger);
25711         CHECK_ACCESS(logger_ptr);
25712         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25713         if (logger_conv.free == LDKLogger_JCalls_free) {
25714                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25715                 LDKLogger_JCalls_cloned(&logger_conv);
25716         }
25717         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
25718 }
25719
25720 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) {
25721         LDKChannelMonitor this_arg_conv;
25722         this_arg_conv.inner = untag_ptr(this_arg);
25723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25725         this_arg_conv.is_owned = false;
25726         uint8_t header_arr[80];
25727         CHECK(header->arr_len == 80);
25728         memcpy(header_arr, header->elems, 80); FREE(header);
25729         uint8_t (*header_ref)[80] = &header_arr;
25730         void* broadcaster_ptr = untag_ptr(broadcaster);
25731         CHECK_ACCESS(broadcaster_ptr);
25732         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25733         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25734                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25735                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25736         }
25737         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25738         CHECK_ACCESS(fee_estimator_ptr);
25739         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25740         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25741                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25742                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25743         }
25744         void* logger_ptr = untag_ptr(logger);
25745         CHECK_ACCESS(logger_ptr);
25746         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25747         if (logger_conv.free == LDKLogger_JCalls_free) {
25748                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25749                 LDKLogger_JCalls_cloned(&logger_conv);
25750         }
25751         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25752         uint64_tArray ret_arr = NULL;
25753         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25754         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25755         for (size_t n = 0; n < ret_var.datalen; n++) {
25756                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25757                 *ret_conv_39_conv = ret_var.data[n];
25758                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25759         }
25760         
25761         FREE(ret_var.data);
25762         return ret_arr;
25763 }
25764
25765 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
25766         LDKChannelMonitor this_arg_conv;
25767         this_arg_conv.inner = untag_ptr(this_arg);
25768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25770         this_arg_conv.is_owned = false;
25771         LDKCVec_C2Tuple_TxidBlockHashZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
25772         uint64_tArray ret_arr = NULL;
25773         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25774         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25775         for (size_t z = 0; z < ret_var.datalen; z++) {
25776                 LDKC2Tuple_TxidBlockHashZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
25777                 *ret_conv_25_conv = ret_var.data[z];
25778                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
25779         }
25780         
25781         FREE(ret_var.data);
25782         return ret_arr;
25783 }
25784
25785 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
25786         LDKChannelMonitor this_arg_conv;
25787         this_arg_conv.inner = untag_ptr(this_arg);
25788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25790         this_arg_conv.is_owned = false;
25791         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
25792         uint64_t ret_ref = 0;
25793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25795         return ret_ref;
25796 }
25797
25798 void  __attribute__((export_name("TS_ChannelMonitor_rebroadcast_pending_claims"))) TS_ChannelMonitor_rebroadcast_pending_claims(uint64_t this_arg, uint64_t broadcaster, uint64_t fee_estimator, uint64_t logger) {
25799         LDKChannelMonitor this_arg_conv;
25800         this_arg_conv.inner = untag_ptr(this_arg);
25801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25803         this_arg_conv.is_owned = false;
25804         void* broadcaster_ptr = untag_ptr(broadcaster);
25805         CHECK_ACCESS(broadcaster_ptr);
25806         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25807         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25808                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25809                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25810         }
25811         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25812         CHECK_ACCESS(fee_estimator_ptr);
25813         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25814         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25815                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25816                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25817         }
25818         void* logger_ptr = untag_ptr(logger);
25819         CHECK_ACCESS(logger_ptr);
25820         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25821         if (logger_conv.free == LDKLogger_JCalls_free) {
25822                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25823                 LDKLogger_JCalls_cloned(&logger_conv);
25824         }
25825         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
25826 }
25827
25828 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
25829         LDKChannelMonitor this_arg_conv;
25830         this_arg_conv.inner = untag_ptr(this_arg);
25831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25833         this_arg_conv.is_owned = false;
25834         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
25835         uint64_tArray ret_arr = NULL;
25836         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25837         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25838         for (size_t j = 0; j < ret_var.datalen; j++) {
25839                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25840                 *ret_conv_9_copy = ret_var.data[j];
25841                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
25842                 ret_arr_ptr[j] = ret_conv_9_ref;
25843         }
25844         
25845         FREE(ret_var.data);
25846         return ret_arr;
25847 }
25848
25849 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b) {
25850         LDKu8slice ser_ref;
25851         ser_ref.datalen = ser->arr_len;
25852         ser_ref.data = ser->elems;
25853         void* arg_a_ptr = untag_ptr(arg_a);
25854         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
25855         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
25856         void* arg_b_ptr = untag_ptr(arg_b);
25857         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
25858         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
25859         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
25860         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
25861         FREE(ser);
25862         return tag_ptr(ret_conv, true);
25863 }
25864
25865 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
25866         LDKOutPoint this_obj_conv;
25867         this_obj_conv.inner = untag_ptr(this_obj);
25868         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25870         OutPoint_free(this_obj_conv);
25871 }
25872
25873 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
25874         LDKOutPoint this_ptr_conv;
25875         this_ptr_conv.inner = untag_ptr(this_ptr);
25876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25878         this_ptr_conv.is_owned = false;
25879         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25880         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
25881         return ret_arr;
25882 }
25883
25884 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
25885         LDKOutPoint this_ptr_conv;
25886         this_ptr_conv.inner = untag_ptr(this_ptr);
25887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25889         this_ptr_conv.is_owned = false;
25890         LDKThirtyTwoBytes val_ref;
25891         CHECK(val->arr_len == 32);
25892         memcpy(val_ref.data, val->elems, 32); FREE(val);
25893         OutPoint_set_txid(&this_ptr_conv, val_ref);
25894 }
25895
25896 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
25897         LDKOutPoint this_ptr_conv;
25898         this_ptr_conv.inner = untag_ptr(this_ptr);
25899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25901         this_ptr_conv.is_owned = false;
25902         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
25903         return ret_conv;
25904 }
25905
25906 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
25907         LDKOutPoint this_ptr_conv;
25908         this_ptr_conv.inner = untag_ptr(this_ptr);
25909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25911         this_ptr_conv.is_owned = false;
25912         OutPoint_set_index(&this_ptr_conv, val);
25913 }
25914
25915 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
25916         LDKThirtyTwoBytes txid_arg_ref;
25917         CHECK(txid_arg->arr_len == 32);
25918         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
25919         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
25920         uint64_t ret_ref = 0;
25921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25923         return ret_ref;
25924 }
25925
25926 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
25927         LDKOutPoint ret_var = OutPoint_clone(arg);
25928         uint64_t ret_ref = 0;
25929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25931         return ret_ref;
25932 }
25933 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
25934         LDKOutPoint arg_conv;
25935         arg_conv.inner = untag_ptr(arg);
25936         arg_conv.is_owned = ptr_is_owned(arg);
25937         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25938         arg_conv.is_owned = false;
25939         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
25940         return ret_conv;
25941 }
25942
25943 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
25944         LDKOutPoint orig_conv;
25945         orig_conv.inner = untag_ptr(orig);
25946         orig_conv.is_owned = ptr_is_owned(orig);
25947         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25948         orig_conv.is_owned = false;
25949         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
25950         uint64_t ret_ref = 0;
25951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25953         return ret_ref;
25954 }
25955
25956 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
25957         LDKOutPoint a_conv;
25958         a_conv.inner = untag_ptr(a);
25959         a_conv.is_owned = ptr_is_owned(a);
25960         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25961         a_conv.is_owned = false;
25962         LDKOutPoint b_conv;
25963         b_conv.inner = untag_ptr(b);
25964         b_conv.is_owned = ptr_is_owned(b);
25965         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25966         b_conv.is_owned = false;
25967         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
25968         return ret_conv;
25969 }
25970
25971 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
25972         LDKOutPoint o_conv;
25973         o_conv.inner = untag_ptr(o);
25974         o_conv.is_owned = ptr_is_owned(o);
25975         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25976         o_conv.is_owned = false;
25977         int64_t ret_conv = OutPoint_hash(&o_conv);
25978         return ret_conv;
25979 }
25980
25981 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
25982         LDKOutPoint 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25988         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
25989         return ret_arr;
25990 }
25991
25992 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
25993         LDKOutPoint obj_conv;
25994         obj_conv.inner = untag_ptr(obj);
25995         obj_conv.is_owned = ptr_is_owned(obj);
25996         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25997         obj_conv.is_owned = false;
25998         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
25999         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26000         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26001         CVec_u8Z_free(ret_var);
26002         return ret_arr;
26003 }
26004
26005 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
26006         LDKu8slice ser_ref;
26007         ser_ref.datalen = ser->arr_len;
26008         ser_ref.data = ser->elems;
26009         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
26010         *ret_conv = OutPoint_read(ser_ref);
26011         FREE(ser);
26012         return tag_ptr(ret_conv, true);
26013 }
26014
26015 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
26016         LDKDelayedPaymentOutputDescriptor this_obj_conv;
26017         this_obj_conv.inner = untag_ptr(this_obj);
26018         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26020         DelayedPaymentOutputDescriptor_free(this_obj_conv);
26021 }
26022
26023 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
26024         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26025         this_ptr_conv.inner = untag_ptr(this_ptr);
26026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26028         this_ptr_conv.is_owned = false;
26029         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26030         uint64_t ret_ref = 0;
26031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26033         return ret_ref;
26034 }
26035
26036 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
26037         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26038         this_ptr_conv.inner = untag_ptr(this_ptr);
26039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26041         this_ptr_conv.is_owned = false;
26042         LDKOutPoint val_conv;
26043         val_conv.inner = untag_ptr(val);
26044         val_conv.is_owned = ptr_is_owned(val);
26045         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26046         val_conv = OutPoint_clone(&val_conv);
26047         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26048 }
26049
26050 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
26051         LDKDelayedPaymentOutputDescriptor 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26057         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
26058         return ret_arr;
26059 }
26060
26061 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
26062         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26063         this_ptr_conv.inner = untag_ptr(this_ptr);
26064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26066         this_ptr_conv.is_owned = false;
26067         LDKPublicKey val_ref;
26068         CHECK(val->arr_len == 33);
26069         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26070         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
26071 }
26072
26073 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
26074         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26075         this_ptr_conv.inner = untag_ptr(this_ptr);
26076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26078         this_ptr_conv.is_owned = false;
26079         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
26080         return ret_conv;
26081 }
26082
26083 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
26084         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26085         this_ptr_conv.inner = untag_ptr(this_ptr);
26086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26088         this_ptr_conv.is_owned = false;
26089         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
26090 }
26091
26092 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
26093         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26094         this_ptr_conv.inner = untag_ptr(this_ptr);
26095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26097         this_ptr_conv.is_owned = false;
26098         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
26099         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
26100         return tag_ptr(ret_ref, true);
26101 }
26102
26103 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
26104         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26105         this_ptr_conv.inner = untag_ptr(this_ptr);
26106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26108         this_ptr_conv.is_owned = false;
26109         void* val_ptr = untag_ptr(val);
26110         CHECK_ACCESS(val_ptr);
26111         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26112         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
26113         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26114 }
26115
26116 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
26117         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26118         this_ptr_conv.inner = untag_ptr(this_ptr);
26119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26121         this_ptr_conv.is_owned = false;
26122         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26123         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
26124         return ret_arr;
26125 }
26126
26127 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
26128         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26129         this_ptr_conv.inner = untag_ptr(this_ptr);
26130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26132         this_ptr_conv.is_owned = false;
26133         LDKPublicKey val_ref;
26134         CHECK(val->arr_len == 33);
26135         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26136         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
26137 }
26138
26139 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
26140         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26141         this_ptr_conv.inner = untag_ptr(this_ptr);
26142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26144         this_ptr_conv.is_owned = false;
26145         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26146         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
26147         return ret_arr;
26148 }
26149
26150 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
26151         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26152         this_ptr_conv.inner = untag_ptr(this_ptr);
26153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26155         this_ptr_conv.is_owned = false;
26156         LDKThirtyTwoBytes val_ref;
26157         CHECK(val->arr_len == 32);
26158         memcpy(val_ref.data, val->elems, 32); FREE(val);
26159         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26160 }
26161
26162 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
26163         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26164         this_ptr_conv.inner = untag_ptr(this_ptr);
26165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26167         this_ptr_conv.is_owned = false;
26168         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26169         return ret_conv;
26170 }
26171
26172 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
26173         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26174         this_ptr_conv.inner = untag_ptr(this_ptr);
26175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26177         this_ptr_conv.is_owned = false;
26178         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26179 }
26180
26181 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) {
26182         LDKOutPoint outpoint_arg_conv;
26183         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
26184         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
26185         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26186         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26187         LDKPublicKey per_commitment_point_arg_ref;
26188         CHECK(per_commitment_point_arg->arr_len == 33);
26189         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
26190         void* output_arg_ptr = untag_ptr(output_arg);
26191         CHECK_ACCESS(output_arg_ptr);
26192         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26193         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
26194         LDKPublicKey revocation_pubkey_arg_ref;
26195         CHECK(revocation_pubkey_arg->arr_len == 33);
26196         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
26197         LDKThirtyTwoBytes channel_keys_id_arg_ref;
26198         CHECK(channel_keys_id_arg->arr_len == 32);
26199         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
26200         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);
26201         uint64_t ret_ref = 0;
26202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26204         return ret_ref;
26205 }
26206
26207 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
26208         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
26209         uint64_t ret_ref = 0;
26210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26212         return ret_ref;
26213 }
26214 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
26215         LDKDelayedPaymentOutputDescriptor arg_conv;
26216         arg_conv.inner = untag_ptr(arg);
26217         arg_conv.is_owned = ptr_is_owned(arg);
26218         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26219         arg_conv.is_owned = false;
26220         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
26221         return ret_conv;
26222 }
26223
26224 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
26225         LDKDelayedPaymentOutputDescriptor orig_conv;
26226         orig_conv.inner = untag_ptr(orig);
26227         orig_conv.is_owned = ptr_is_owned(orig);
26228         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26229         orig_conv.is_owned = false;
26230         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
26231         uint64_t ret_ref = 0;
26232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26234         return ret_ref;
26235 }
26236
26237 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
26238         LDKDelayedPaymentOutputDescriptor a_conv;
26239         a_conv.inner = untag_ptr(a);
26240         a_conv.is_owned = ptr_is_owned(a);
26241         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26242         a_conv.is_owned = false;
26243         LDKDelayedPaymentOutputDescriptor b_conv;
26244         b_conv.inner = untag_ptr(b);
26245         b_conv.is_owned = ptr_is_owned(b);
26246         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26247         b_conv.is_owned = false;
26248         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
26249         return ret_conv;
26250 }
26251
26252 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
26253         LDKDelayedPaymentOutputDescriptor obj_conv;
26254         obj_conv.inner = untag_ptr(obj);
26255         obj_conv.is_owned = ptr_is_owned(obj);
26256         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26257         obj_conv.is_owned = false;
26258         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
26259         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26260         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26261         CVec_u8Z_free(ret_var);
26262         return ret_arr;
26263 }
26264
26265 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
26266         LDKu8slice ser_ref;
26267         ser_ref.datalen = ser->arr_len;
26268         ser_ref.data = ser->elems;
26269         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
26270         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
26271         FREE(ser);
26272         return tag_ptr(ret_conv, true);
26273 }
26274
26275 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
26276         LDKStaticPaymentOutputDescriptor this_obj_conv;
26277         this_obj_conv.inner = untag_ptr(this_obj);
26278         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26280         StaticPaymentOutputDescriptor_free(this_obj_conv);
26281 }
26282
26283 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
26284         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26285         this_ptr_conv.inner = untag_ptr(this_ptr);
26286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26288         this_ptr_conv.is_owned = false;
26289         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26290         uint64_t ret_ref = 0;
26291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26293         return ret_ref;
26294 }
26295
26296 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
26297         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26298         this_ptr_conv.inner = untag_ptr(this_ptr);
26299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26301         this_ptr_conv.is_owned = false;
26302         LDKOutPoint val_conv;
26303         val_conv.inner = untag_ptr(val);
26304         val_conv.is_owned = ptr_is_owned(val);
26305         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26306         val_conv = OutPoint_clone(&val_conv);
26307         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26308 }
26309
26310 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
26311         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26312         this_ptr_conv.inner = untag_ptr(this_ptr);
26313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26315         this_ptr_conv.is_owned = false;
26316         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
26317         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
26318         return tag_ptr(ret_ref, true);
26319 }
26320
26321 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
26322         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26323         this_ptr_conv.inner = untag_ptr(this_ptr);
26324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26326         this_ptr_conv.is_owned = false;
26327         void* val_ptr = untag_ptr(val);
26328         CHECK_ACCESS(val_ptr);
26329         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26330         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
26331         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26332 }
26333
26334 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
26335         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26336         this_ptr_conv.inner = untag_ptr(this_ptr);
26337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26339         this_ptr_conv.is_owned = false;
26340         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26341         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
26342         return ret_arr;
26343 }
26344
26345 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
26346         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26347         this_ptr_conv.inner = untag_ptr(this_ptr);
26348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26350         this_ptr_conv.is_owned = false;
26351         LDKThirtyTwoBytes val_ref;
26352         CHECK(val->arr_len == 32);
26353         memcpy(val_ref.data, val->elems, 32); FREE(val);
26354         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26355 }
26356
26357 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
26358         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26359         this_ptr_conv.inner = untag_ptr(this_ptr);
26360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26362         this_ptr_conv.is_owned = false;
26363         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26364         return ret_conv;
26365 }
26366
26367 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
26368         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26369         this_ptr_conv.inner = untag_ptr(this_ptr);
26370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26372         this_ptr_conv.is_owned = false;
26373         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26374 }
26375
26376 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) {
26377         LDKOutPoint outpoint_arg_conv;
26378         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
26379         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
26380         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26381         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26382         void* output_arg_ptr = untag_ptr(output_arg);
26383         CHECK_ACCESS(output_arg_ptr);
26384         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26385         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
26386         LDKThirtyTwoBytes channel_keys_id_arg_ref;
26387         CHECK(channel_keys_id_arg->arr_len == 32);
26388         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
26389         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
26390         uint64_t ret_ref = 0;
26391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26393         return ret_ref;
26394 }
26395
26396 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
26397         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
26398         uint64_t ret_ref = 0;
26399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26401         return ret_ref;
26402 }
26403 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
26404         LDKStaticPaymentOutputDescriptor arg_conv;
26405         arg_conv.inner = untag_ptr(arg);
26406         arg_conv.is_owned = ptr_is_owned(arg);
26407         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26408         arg_conv.is_owned = false;
26409         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
26410         return ret_conv;
26411 }
26412
26413 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
26414         LDKStaticPaymentOutputDescriptor orig_conv;
26415         orig_conv.inner = untag_ptr(orig);
26416         orig_conv.is_owned = ptr_is_owned(orig);
26417         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26418         orig_conv.is_owned = false;
26419         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
26420         uint64_t ret_ref = 0;
26421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26423         return ret_ref;
26424 }
26425
26426 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
26427         LDKStaticPaymentOutputDescriptor a_conv;
26428         a_conv.inner = untag_ptr(a);
26429         a_conv.is_owned = ptr_is_owned(a);
26430         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26431         a_conv.is_owned = false;
26432         LDKStaticPaymentOutputDescriptor b_conv;
26433         b_conv.inner = untag_ptr(b);
26434         b_conv.is_owned = ptr_is_owned(b);
26435         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26436         b_conv.is_owned = false;
26437         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
26438         return ret_conv;
26439 }
26440
26441 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
26442         LDKStaticPaymentOutputDescriptor obj_conv;
26443         obj_conv.inner = untag_ptr(obj);
26444         obj_conv.is_owned = ptr_is_owned(obj);
26445         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26446         obj_conv.is_owned = false;
26447         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
26448         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26449         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26450         CVec_u8Z_free(ret_var);
26451         return ret_arr;
26452 }
26453
26454 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
26455         LDKu8slice ser_ref;
26456         ser_ref.datalen = ser->arr_len;
26457         ser_ref.data = ser->elems;
26458         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
26459         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
26460         FREE(ser);
26461         return tag_ptr(ret_conv, true);
26462 }
26463
26464 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
26465         if (!ptr_is_owned(this_ptr)) return;
26466         void* this_ptr_ptr = untag_ptr(this_ptr);
26467         CHECK_ACCESS(this_ptr_ptr);
26468         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
26469         FREE(untag_ptr(this_ptr));
26470         SpendableOutputDescriptor_free(this_ptr_conv);
26471 }
26472
26473 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
26474         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26475         *ret_copy = SpendableOutputDescriptor_clone(arg);
26476         uint64_t ret_ref = tag_ptr(ret_copy, true);
26477         return ret_ref;
26478 }
26479 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
26480         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
26481         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
26482         return ret_conv;
26483 }
26484
26485 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
26486         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
26487         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26488         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
26489         uint64_t ret_ref = tag_ptr(ret_copy, true);
26490         return ret_ref;
26491 }
26492
26493 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
26494         LDKOutPoint outpoint_conv;
26495         outpoint_conv.inner = untag_ptr(outpoint);
26496         outpoint_conv.is_owned = ptr_is_owned(outpoint);
26497         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
26498         outpoint_conv = OutPoint_clone(&outpoint_conv);
26499         void* output_ptr = untag_ptr(output);
26500         CHECK_ACCESS(output_ptr);
26501         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
26502         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
26503         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26504         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
26505         uint64_t ret_ref = tag_ptr(ret_copy, true);
26506         return ret_ref;
26507 }
26508
26509 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
26510         LDKDelayedPaymentOutputDescriptor a_conv;
26511         a_conv.inner = untag_ptr(a);
26512         a_conv.is_owned = ptr_is_owned(a);
26513         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26514         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
26515         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26516         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
26517         uint64_t ret_ref = tag_ptr(ret_copy, true);
26518         return ret_ref;
26519 }
26520
26521 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
26522         LDKStaticPaymentOutputDescriptor a_conv;
26523         a_conv.inner = untag_ptr(a);
26524         a_conv.is_owned = ptr_is_owned(a);
26525         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26526         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
26527         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26528         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
26529         uint64_t ret_ref = tag_ptr(ret_copy, true);
26530         return ret_ref;
26531 }
26532
26533 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
26534         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
26535         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
26536         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
26537         return ret_conv;
26538 }
26539
26540 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
26541         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
26542         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
26543         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26544         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26545         CVec_u8Z_free(ret_var);
26546         return ret_arr;
26547 }
26548
26549 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
26550         LDKu8slice ser_ref;
26551         ser_ref.datalen = ser->arr_len;
26552         ser_ref.data = ser->elems;
26553         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
26554         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
26555         FREE(ser);
26556         return tag_ptr(ret_conv, true);
26557 }
26558
26559 void  __attribute__((export_name("TS_ChannelSigner_free"))) TS_ChannelSigner_free(uint64_t this_ptr) {
26560         if (!ptr_is_owned(this_ptr)) return;
26561         void* this_ptr_ptr = untag_ptr(this_ptr);
26562         CHECK_ACCESS(this_ptr_ptr);
26563         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
26564         FREE(untag_ptr(this_ptr));
26565         ChannelSigner_free(this_ptr_conv);
26566 }
26567
26568 void  __attribute__((export_name("TS_EcdsaChannelSigner_free"))) TS_EcdsaChannelSigner_free(uint64_t this_ptr) {
26569         if (!ptr_is_owned(this_ptr)) return;
26570         void* this_ptr_ptr = untag_ptr(this_ptr);
26571         CHECK_ACCESS(this_ptr_ptr);
26572         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
26573         FREE(untag_ptr(this_ptr));
26574         EcdsaChannelSigner_free(this_ptr_conv);
26575 }
26576
26577 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
26578         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
26579         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
26580         return tag_ptr(ret_ret, true);
26581 }
26582 int64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone_ptr"))) TS_WriteableEcdsaChannelSigner_clone_ptr(uint64_t arg) {
26583         void* arg_ptr = untag_ptr(arg);
26584         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
26585         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
26586         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
26587         return ret_conv;
26588 }
26589
26590 uint64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone"))) TS_WriteableEcdsaChannelSigner_clone(uint64_t orig) {
26591         void* orig_ptr = untag_ptr(orig);
26592         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
26593         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
26594         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
26595         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
26596         return tag_ptr(ret_ret, true);
26597 }
26598
26599 void  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_free"))) TS_WriteableEcdsaChannelSigner_free(uint64_t this_ptr) {
26600         if (!ptr_is_owned(this_ptr)) return;
26601         void* this_ptr_ptr = untag_ptr(this_ptr);
26602         CHECK_ACCESS(this_ptr_ptr);
26603         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
26604         FREE(untag_ptr(this_ptr));
26605         WriteableEcdsaChannelSigner_free(this_ptr_conv);
26606 }
26607
26608 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
26609         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
26610         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
26611         return ret_conv;
26612 }
26613
26614 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
26615         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
26616         return ret_conv;
26617 }
26618
26619 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
26620         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
26621         return ret_conv;
26622 }
26623
26624 void  __attribute__((export_name("TS_EntropySource_free"))) TS_EntropySource_free(uint64_t this_ptr) {
26625         if (!ptr_is_owned(this_ptr)) return;
26626         void* this_ptr_ptr = untag_ptr(this_ptr);
26627         CHECK_ACCESS(this_ptr_ptr);
26628         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
26629         FREE(untag_ptr(this_ptr));
26630         EntropySource_free(this_ptr_conv);
26631 }
26632
26633 void  __attribute__((export_name("TS_NodeSigner_free"))) TS_NodeSigner_free(uint64_t this_ptr) {
26634         if (!ptr_is_owned(this_ptr)) return;
26635         void* this_ptr_ptr = untag_ptr(this_ptr);
26636         CHECK_ACCESS(this_ptr_ptr);
26637         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
26638         FREE(untag_ptr(this_ptr));
26639         NodeSigner_free(this_ptr_conv);
26640 }
26641
26642 void  __attribute__((export_name("TS_SignerProvider_free"))) TS_SignerProvider_free(uint64_t this_ptr) {
26643         if (!ptr_is_owned(this_ptr)) return;
26644         void* this_ptr_ptr = untag_ptr(this_ptr);
26645         CHECK_ACCESS(this_ptr_ptr);
26646         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
26647         FREE(untag_ptr(this_ptr));
26648         SignerProvider_free(this_ptr_conv);
26649 }
26650
26651 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
26652         LDKInMemorySigner this_obj_conv;
26653         this_obj_conv.inner = untag_ptr(this_obj);
26654         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26656         InMemorySigner_free(this_obj_conv);
26657 }
26658
26659 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
26660         LDKInMemorySigner this_ptr_conv;
26661         this_ptr_conv.inner = untag_ptr(this_ptr);
26662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26664         this_ptr_conv.is_owned = false;
26665         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26666         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
26667         return ret_arr;
26668 }
26669
26670 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
26671         LDKInMemorySigner this_ptr_conv;
26672         this_ptr_conv.inner = untag_ptr(this_ptr);
26673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26675         this_ptr_conv.is_owned = false;
26676         LDKSecretKey val_ref;
26677         CHECK(val->arr_len == 32);
26678         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26679         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
26680 }
26681
26682 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
26683         LDKInMemorySigner this_ptr_conv;
26684         this_ptr_conv.inner = untag_ptr(this_ptr);
26685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26687         this_ptr_conv.is_owned = false;
26688         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26689         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
26690         return ret_arr;
26691 }
26692
26693 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
26694         LDKInMemorySigner this_ptr_conv;
26695         this_ptr_conv.inner = untag_ptr(this_ptr);
26696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26698         this_ptr_conv.is_owned = false;
26699         LDKSecretKey val_ref;
26700         CHECK(val->arr_len == 32);
26701         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26702         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
26703 }
26704
26705 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
26706         LDKInMemorySigner this_ptr_conv;
26707         this_ptr_conv.inner = untag_ptr(this_ptr);
26708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26710         this_ptr_conv.is_owned = false;
26711         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26712         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
26713         return ret_arr;
26714 }
26715
26716 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
26717         LDKInMemorySigner this_ptr_conv;
26718         this_ptr_conv.inner = untag_ptr(this_ptr);
26719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26721         this_ptr_conv.is_owned = false;
26722         LDKSecretKey val_ref;
26723         CHECK(val->arr_len == 32);
26724         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26725         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
26726 }
26727
26728 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
26729         LDKInMemorySigner this_ptr_conv;
26730         this_ptr_conv.inner = untag_ptr(this_ptr);
26731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26733         this_ptr_conv.is_owned = false;
26734         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26735         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
26736         return ret_arr;
26737 }
26738
26739 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) {
26740         LDKInMemorySigner this_ptr_conv;
26741         this_ptr_conv.inner = untag_ptr(this_ptr);
26742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26744         this_ptr_conv.is_owned = false;
26745         LDKSecretKey val_ref;
26746         CHECK(val->arr_len == 32);
26747         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26748         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
26749 }
26750
26751 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
26752         LDKInMemorySigner this_ptr_conv;
26753         this_ptr_conv.inner = untag_ptr(this_ptr);
26754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26756         this_ptr_conv.is_owned = false;
26757         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26758         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
26759         return ret_arr;
26760 }
26761
26762 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
26763         LDKInMemorySigner this_ptr_conv;
26764         this_ptr_conv.inner = untag_ptr(this_ptr);
26765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26767         this_ptr_conv.is_owned = false;
26768         LDKSecretKey val_ref;
26769         CHECK(val->arr_len == 32);
26770         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26771         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
26772 }
26773
26774 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
26775         LDKInMemorySigner this_ptr_conv;
26776         this_ptr_conv.inner = untag_ptr(this_ptr);
26777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26779         this_ptr_conv.is_owned = false;
26780         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26781         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
26782         return ret_arr;
26783 }
26784
26785 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
26786         LDKInMemorySigner this_ptr_conv;
26787         this_ptr_conv.inner = untag_ptr(this_ptr);
26788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26790         this_ptr_conv.is_owned = false;
26791         LDKThirtyTwoBytes val_ref;
26792         CHECK(val->arr_len == 32);
26793         memcpy(val_ref.data, val->elems, 32); FREE(val);
26794         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
26795 }
26796
26797 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
26798         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
26799         uint64_t ret_ref = 0;
26800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26802         return ret_ref;
26803 }
26804 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
26805         LDKInMemorySigner arg_conv;
26806         arg_conv.inner = untag_ptr(arg);
26807         arg_conv.is_owned = ptr_is_owned(arg);
26808         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26809         arg_conv.is_owned = false;
26810         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
26811         return ret_conv;
26812 }
26813
26814 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
26815         LDKInMemorySigner orig_conv;
26816         orig_conv.inner = untag_ptr(orig);
26817         orig_conv.is_owned = ptr_is_owned(orig);
26818         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26819         orig_conv.is_owned = false;
26820         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
26821         uint64_t ret_ref = 0;
26822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26824         return ret_ref;
26825 }
26826
26827 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, int8_tArray rand_bytes_unique_start) {
26828         LDKSecretKey funding_key_ref;
26829         CHECK(funding_key->arr_len == 32);
26830         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
26831         LDKSecretKey revocation_base_key_ref;
26832         CHECK(revocation_base_key->arr_len == 32);
26833         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
26834         LDKSecretKey payment_key_ref;
26835         CHECK(payment_key->arr_len == 32);
26836         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
26837         LDKSecretKey delayed_payment_base_key_ref;
26838         CHECK(delayed_payment_base_key->arr_len == 32);
26839         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
26840         LDKSecretKey htlc_base_key_ref;
26841         CHECK(htlc_base_key->arr_len == 32);
26842         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
26843         LDKThirtyTwoBytes commitment_seed_ref;
26844         CHECK(commitment_seed->arr_len == 32);
26845         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
26846         LDKThirtyTwoBytes channel_keys_id_ref;
26847         CHECK(channel_keys_id->arr_len == 32);
26848         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
26849         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
26850         CHECK(rand_bytes_unique_start->arr_len == 32);
26851         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
26852         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, rand_bytes_unique_start_ref);
26853         uint64_t ret_ref = 0;
26854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26856         return ret_ref;
26857 }
26858
26859 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
26860         LDKInMemorySigner this_arg_conv;
26861         this_arg_conv.inner = untag_ptr(this_arg);
26862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26864         this_arg_conv.is_owned = false;
26865         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
26866         uint64_t ret_ref = 0;
26867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26869         return ret_ref;
26870 }
26871
26872 int16_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
26873         LDKInMemorySigner this_arg_conv;
26874         this_arg_conv.inner = untag_ptr(this_arg);
26875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26877         this_arg_conv.is_owned = false;
26878         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
26879         return ret_conv;
26880 }
26881
26882 int16_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
26883         LDKInMemorySigner this_arg_conv;
26884         this_arg_conv.inner = untag_ptr(this_arg);
26885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26887         this_arg_conv.is_owned = false;
26888         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
26889         return ret_conv;
26890 }
26891
26892 jboolean  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
26893         LDKInMemorySigner this_arg_conv;
26894         this_arg_conv.inner = untag_ptr(this_arg);
26895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26897         this_arg_conv.is_owned = false;
26898         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
26899         return ret_conv;
26900 }
26901
26902 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
26903         LDKInMemorySigner this_arg_conv;
26904         this_arg_conv.inner = untag_ptr(this_arg);
26905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26907         this_arg_conv.is_owned = false;
26908         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
26909         uint64_t ret_ref = 0;
26910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26912         return ret_ref;
26913 }
26914
26915 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
26916         LDKInMemorySigner this_arg_conv;
26917         this_arg_conv.inner = untag_ptr(this_arg);
26918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26920         this_arg_conv.is_owned = false;
26921         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
26922         uint64_t ret_ref = 0;
26923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26925         return ret_ref;
26926 }
26927
26928 jboolean  __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint64_t this_arg) {
26929         LDKInMemorySigner this_arg_conv;
26930         this_arg_conv.inner = untag_ptr(this_arg);
26931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26933         this_arg_conv.is_owned = false;
26934         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
26935         return ret_conv;
26936 }
26937
26938 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) {
26939         LDKInMemorySigner this_arg_conv;
26940         this_arg_conv.inner = untag_ptr(this_arg);
26941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26943         this_arg_conv.is_owned = false;
26944         LDKTransaction spend_tx_ref;
26945         spend_tx_ref.datalen = spend_tx->arr_len;
26946         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
26947         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
26948         spend_tx_ref.data_is_owned = true;
26949         LDKStaticPaymentOutputDescriptor descriptor_conv;
26950         descriptor_conv.inner = untag_ptr(descriptor);
26951         descriptor_conv.is_owned = ptr_is_owned(descriptor);
26952         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
26953         descriptor_conv.is_owned = false;
26954         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
26955         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
26956         return tag_ptr(ret_conv, true);
26957 }
26958
26959 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) {
26960         LDKInMemorySigner this_arg_conv;
26961         this_arg_conv.inner = untag_ptr(this_arg);
26962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26964         this_arg_conv.is_owned = false;
26965         LDKTransaction spend_tx_ref;
26966         spend_tx_ref.datalen = spend_tx->arr_len;
26967         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
26968         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
26969         spend_tx_ref.data_is_owned = true;
26970         LDKDelayedPaymentOutputDescriptor descriptor_conv;
26971         descriptor_conv.inner = untag_ptr(descriptor);
26972         descriptor_conv.is_owned = ptr_is_owned(descriptor);
26973         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
26974         descriptor_conv.is_owned = false;
26975         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
26976         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
26977         return tag_ptr(ret_conv, true);
26978 }
26979
26980 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EntropySource"))) TS_InMemorySigner_as_EntropySource(uint64_t this_arg) {
26981         LDKInMemorySigner this_arg_conv;
26982         this_arg_conv.inner = untag_ptr(this_arg);
26983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26985         this_arg_conv.is_owned = false;
26986         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
26987         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
26988         return tag_ptr(ret_ret, true);
26989 }
26990
26991 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_ChannelSigner"))) TS_InMemorySigner_as_ChannelSigner(uint64_t this_arg) {
26992         LDKInMemorySigner this_arg_conv;
26993         this_arg_conv.inner = untag_ptr(this_arg);
26994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26996         this_arg_conv.is_owned = false;
26997         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
26998         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
26999         return tag_ptr(ret_ret, true);
27000 }
27001
27002 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EcdsaChannelSigner"))) TS_InMemorySigner_as_EcdsaChannelSigner(uint64_t this_arg) {
27003         LDKInMemorySigner this_arg_conv;
27004         this_arg_conv.inner = untag_ptr(this_arg);
27005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27007         this_arg_conv.is_owned = false;
27008         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
27009         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
27010         return tag_ptr(ret_ret, true);
27011 }
27012
27013 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_WriteableEcdsaChannelSigner"))) TS_InMemorySigner_as_WriteableEcdsaChannelSigner(uint64_t this_arg) {
27014         LDKInMemorySigner this_arg_conv;
27015         this_arg_conv.inner = untag_ptr(this_arg);
27016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27018         this_arg_conv.is_owned = false;
27019         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
27020         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
27021         return tag_ptr(ret_ret, true);
27022 }
27023
27024 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
27025         LDKInMemorySigner obj_conv;
27026         obj_conv.inner = untag_ptr(obj);
27027         obj_conv.is_owned = ptr_is_owned(obj);
27028         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27029         obj_conv.is_owned = false;
27030         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
27031         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27032         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27033         CVec_u8Z_free(ret_var);
27034         return ret_arr;
27035 }
27036
27037 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, uint64_t arg) {
27038         LDKu8slice ser_ref;
27039         ser_ref.datalen = ser->arr_len;
27040         ser_ref.data = ser->elems;
27041         void* arg_ptr = untag_ptr(arg);
27042         CHECK_ACCESS(arg_ptr);
27043         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
27044         if (arg_conv.free == LDKEntropySource_JCalls_free) {
27045                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27046                 LDKEntropySource_JCalls_cloned(&arg_conv);
27047         }
27048         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
27049         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
27050         FREE(ser);
27051         return tag_ptr(ret_conv, true);
27052 }
27053
27054 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
27055         LDKKeysManager this_obj_conv;
27056         this_obj_conv.inner = untag_ptr(this_obj);
27057         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27059         KeysManager_free(this_obj_conv);
27060 }
27061
27062 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
27063         uint8_t seed_arr[32];
27064         CHECK(seed->arr_len == 32);
27065         memcpy(seed_arr, seed->elems, 32); FREE(seed);
27066         uint8_t (*seed_ref)[32] = &seed_arr;
27067         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
27068         uint64_t ret_ref = 0;
27069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27071         return ret_ref;
27072 }
27073
27074 int8_tArray  __attribute__((export_name("TS_KeysManager_get_node_secret_key"))) TS_KeysManager_get_node_secret_key(uint64_t this_arg) {
27075         LDKKeysManager this_arg_conv;
27076         this_arg_conv.inner = untag_ptr(this_arg);
27077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27079         this_arg_conv.is_owned = false;
27080         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27081         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
27082         return ret_arr;
27083 }
27084
27085 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) {
27086         LDKKeysManager this_arg_conv;
27087         this_arg_conv.inner = untag_ptr(this_arg);
27088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27090         this_arg_conv.is_owned = false;
27091         uint8_t params_arr[32];
27092         CHECK(params->arr_len == 32);
27093         memcpy(params_arr, params->elems, 32); FREE(params);
27094         uint8_t (*params_ref)[32] = &params_arr;
27095         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27096         uint64_t ret_ref = 0;
27097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27099         return ret_ref;
27100 }
27101
27102 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) {
27103         LDKKeysManager this_arg_conv;
27104         this_arg_conv.inner = untag_ptr(this_arg);
27105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27107         this_arg_conv.is_owned = false;
27108         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27109         descriptors_constr.datalen = descriptors->arr_len;
27110         if (descriptors_constr.datalen > 0)
27111                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27112         else
27113                 descriptors_constr.data = NULL;
27114         uint64_t* descriptors_vals = descriptors->elems;
27115         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27116                 uint64_t descriptors_conv_27 = descriptors_vals[b];
27117                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
27118                 CHECK_ACCESS(descriptors_conv_27_ptr);
27119                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27120                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
27121                 descriptors_constr.data[b] = descriptors_conv_27_conv;
27122         }
27123         FREE(descriptors);
27124         LDKCVec_TxOutZ outputs_constr;
27125         outputs_constr.datalen = outputs->arr_len;
27126         if (outputs_constr.datalen > 0)
27127                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27128         else
27129                 outputs_constr.data = NULL;
27130         uint64_t* outputs_vals = outputs->elems;
27131         for (size_t h = 0; h < outputs_constr.datalen; h++) {
27132                 uint64_t outputs_conv_7 = outputs_vals[h];
27133                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
27134                 CHECK_ACCESS(outputs_conv_7_ptr);
27135                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27136                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
27137                 outputs_constr.data[h] = outputs_conv_7_conv;
27138         }
27139         FREE(outputs);
27140         LDKCVec_u8Z change_destination_script_ref;
27141         change_destination_script_ref.datalen = change_destination_script->arr_len;
27142         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27143         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
27144         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27145         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27146         return tag_ptr(ret_conv, true);
27147 }
27148
27149 uint64_t  __attribute__((export_name("TS_KeysManager_as_EntropySource"))) TS_KeysManager_as_EntropySource(uint64_t this_arg) {
27150         LDKKeysManager this_arg_conv;
27151         this_arg_conv.inner = untag_ptr(this_arg);
27152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27154         this_arg_conv.is_owned = false;
27155         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
27156         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
27157         return tag_ptr(ret_ret, true);
27158 }
27159
27160 uint64_t  __attribute__((export_name("TS_KeysManager_as_NodeSigner"))) TS_KeysManager_as_NodeSigner(uint64_t this_arg) {
27161         LDKKeysManager this_arg_conv;
27162         this_arg_conv.inner = untag_ptr(this_arg);
27163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27165         this_arg_conv.is_owned = false;
27166         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
27167         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
27168         return tag_ptr(ret_ret, true);
27169 }
27170
27171 uint64_t  __attribute__((export_name("TS_KeysManager_as_SignerProvider"))) TS_KeysManager_as_SignerProvider(uint64_t this_arg) {
27172         LDKKeysManager this_arg_conv;
27173         this_arg_conv.inner = untag_ptr(this_arg);
27174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27176         this_arg_conv.is_owned = false;
27177         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
27178         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
27179         return tag_ptr(ret_ret, true);
27180 }
27181
27182 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
27183         LDKPhantomKeysManager this_obj_conv;
27184         this_obj_conv.inner = untag_ptr(this_obj);
27185         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27187         PhantomKeysManager_free(this_obj_conv);
27188 }
27189
27190 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_EntropySource"))) TS_PhantomKeysManager_as_EntropySource(uint64_t this_arg) {
27191         LDKPhantomKeysManager this_arg_conv;
27192         this_arg_conv.inner = untag_ptr(this_arg);
27193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27195         this_arg_conv.is_owned = false;
27196         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
27197         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
27198         return tag_ptr(ret_ret, true);
27199 }
27200
27201 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_NodeSigner"))) TS_PhantomKeysManager_as_NodeSigner(uint64_t this_arg) {
27202         LDKPhantomKeysManager this_arg_conv;
27203         this_arg_conv.inner = untag_ptr(this_arg);
27204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27206         this_arg_conv.is_owned = false;
27207         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
27208         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
27209         return tag_ptr(ret_ret, true);
27210 }
27211
27212 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_SignerProvider"))) TS_PhantomKeysManager_as_SignerProvider(uint64_t this_arg) {
27213         LDKPhantomKeysManager this_arg_conv;
27214         this_arg_conv.inner = untag_ptr(this_arg);
27215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27217         this_arg_conv.is_owned = false;
27218         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
27219         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
27220         return tag_ptr(ret_ret, true);
27221 }
27222
27223 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) {
27224         uint8_t seed_arr[32];
27225         CHECK(seed->arr_len == 32);
27226         memcpy(seed_arr, seed->elems, 32); FREE(seed);
27227         uint8_t (*seed_ref)[32] = &seed_arr;
27228         uint8_t cross_node_seed_arr[32];
27229         CHECK(cross_node_seed->arr_len == 32);
27230         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
27231         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
27232         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
27233         uint64_t ret_ref = 0;
27234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27236         return ret_ref;
27237 }
27238
27239 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) {
27240         LDKPhantomKeysManager this_arg_conv;
27241         this_arg_conv.inner = untag_ptr(this_arg);
27242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27244         this_arg_conv.is_owned = false;
27245         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27246         descriptors_constr.datalen = descriptors->arr_len;
27247         if (descriptors_constr.datalen > 0)
27248                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27249         else
27250                 descriptors_constr.data = NULL;
27251         uint64_t* descriptors_vals = descriptors->elems;
27252         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27253                 uint64_t descriptors_conv_27 = descriptors_vals[b];
27254                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
27255                 CHECK_ACCESS(descriptors_conv_27_ptr);
27256                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27257                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
27258                 descriptors_constr.data[b] = descriptors_conv_27_conv;
27259         }
27260         FREE(descriptors);
27261         LDKCVec_TxOutZ outputs_constr;
27262         outputs_constr.datalen = outputs->arr_len;
27263         if (outputs_constr.datalen > 0)
27264                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27265         else
27266                 outputs_constr.data = NULL;
27267         uint64_t* outputs_vals = outputs->elems;
27268         for (size_t h = 0; h < outputs_constr.datalen; h++) {
27269                 uint64_t outputs_conv_7 = outputs_vals[h];
27270                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
27271                 CHECK_ACCESS(outputs_conv_7_ptr);
27272                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27273                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
27274                 outputs_constr.data[h] = outputs_conv_7_conv;
27275         }
27276         FREE(outputs);
27277         LDKCVec_u8Z change_destination_script_ref;
27278         change_destination_script_ref.datalen = change_destination_script->arr_len;
27279         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27280         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
27281         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27282         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27283         return tag_ptr(ret_conv, true);
27284 }
27285
27286 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) {
27287         LDKPhantomKeysManager this_arg_conv;
27288         this_arg_conv.inner = untag_ptr(this_arg);
27289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27291         this_arg_conv.is_owned = false;
27292         uint8_t params_arr[32];
27293         CHECK(params->arr_len == 32);
27294         memcpy(params_arr, params->elems, 32); FREE(params);
27295         uint8_t (*params_ref)[32] = &params_arr;
27296         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27297         uint64_t ret_ref = 0;
27298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27300         return ret_ref;
27301 }
27302
27303 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_node_secret_key"))) TS_PhantomKeysManager_get_node_secret_key(uint64_t this_arg) {
27304         LDKPhantomKeysManager this_arg_conv;
27305         this_arg_conv.inner = untag_ptr(this_arg);
27306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27308         this_arg_conv.is_owned = false;
27309         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27310         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
27311         return ret_arr;
27312 }
27313
27314 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_phantom_node_secret_key"))) TS_PhantomKeysManager_get_phantom_node_secret_key(uint64_t this_arg) {
27315         LDKPhantomKeysManager this_arg_conv;
27316         this_arg_conv.inner = untag_ptr(this_arg);
27317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27319         this_arg_conv.is_owned = false;
27320         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27321         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
27322         return ret_arr;
27323 }
27324
27325 uint32_t  __attribute__((export_name("TS_FailureCode_clone"))) TS_FailureCode_clone(uint64_t orig) {
27326         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
27327         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_clone(orig_conv));
27328         return ret_conv;
27329 }
27330
27331 uint32_t  __attribute__((export_name("TS_FailureCode_temporary_node_failure"))) TS_FailureCode_temporary_node_failure() {
27332         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_temporary_node_failure());
27333         return ret_conv;
27334 }
27335
27336 uint32_t  __attribute__((export_name("TS_FailureCode_required_node_feature_missing"))) TS_FailureCode_required_node_feature_missing() {
27337         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_required_node_feature_missing());
27338         return ret_conv;
27339 }
27340
27341 uint32_t  __attribute__((export_name("TS_FailureCode_incorrect_or_unknown_payment_details"))) TS_FailureCode_incorrect_or_unknown_payment_details() {
27342         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_incorrect_or_unknown_payment_details());
27343         return ret_conv;
27344 }
27345
27346 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
27347         LDKChannelManager this_obj_conv;
27348         this_obj_conv.inner = untag_ptr(this_obj);
27349         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27351         ChannelManager_free(this_obj_conv);
27352 }
27353
27354 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
27355         LDKChainParameters this_obj_conv;
27356         this_obj_conv.inner = untag_ptr(this_obj);
27357         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27359         ChainParameters_free(this_obj_conv);
27360 }
27361
27362 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
27363         LDKChainParameters this_ptr_conv;
27364         this_ptr_conv.inner = untag_ptr(this_ptr);
27365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27367         this_ptr_conv.is_owned = false;
27368         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
27369         return ret_conv;
27370 }
27371
27372 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
27373         LDKChainParameters this_ptr_conv;
27374         this_ptr_conv.inner = untag_ptr(this_ptr);
27375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27377         this_ptr_conv.is_owned = false;
27378         LDKNetwork val_conv = LDKNetwork_from_js(val);
27379         ChainParameters_set_network(&this_ptr_conv, val_conv);
27380 }
27381
27382 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
27383         LDKChainParameters this_ptr_conv;
27384         this_ptr_conv.inner = untag_ptr(this_ptr);
27385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27387         this_ptr_conv.is_owned = false;
27388         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
27389         uint64_t ret_ref = 0;
27390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27392         return ret_ref;
27393 }
27394
27395 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
27396         LDKChainParameters this_ptr_conv;
27397         this_ptr_conv.inner = untag_ptr(this_ptr);
27398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27400         this_ptr_conv.is_owned = false;
27401         LDKBestBlock val_conv;
27402         val_conv.inner = untag_ptr(val);
27403         val_conv.is_owned = ptr_is_owned(val);
27404         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27405         val_conv = BestBlock_clone(&val_conv);
27406         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
27407 }
27408
27409 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
27410         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
27411         LDKBestBlock best_block_arg_conv;
27412         best_block_arg_conv.inner = untag_ptr(best_block_arg);
27413         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
27414         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
27415         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
27416         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
27417         uint64_t ret_ref = 0;
27418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27420         return ret_ref;
27421 }
27422
27423 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
27424         LDKChainParameters ret_var = ChainParameters_clone(arg);
27425         uint64_t ret_ref = 0;
27426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27428         return ret_ref;
27429 }
27430 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
27431         LDKChainParameters arg_conv;
27432         arg_conv.inner = untag_ptr(arg);
27433         arg_conv.is_owned = ptr_is_owned(arg);
27434         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27435         arg_conv.is_owned = false;
27436         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
27437         return ret_conv;
27438 }
27439
27440 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
27441         LDKChainParameters orig_conv;
27442         orig_conv.inner = untag_ptr(orig);
27443         orig_conv.is_owned = ptr_is_owned(orig);
27444         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27445         orig_conv.is_owned = false;
27446         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
27447         uint64_t ret_ref = 0;
27448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27450         return ret_ref;
27451 }
27452
27453 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
27454         LDKCounterpartyForwardingInfo this_obj_conv;
27455         this_obj_conv.inner = untag_ptr(this_obj);
27456         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27458         CounterpartyForwardingInfo_free(this_obj_conv);
27459 }
27460
27461 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
27462         LDKCounterpartyForwardingInfo this_ptr_conv;
27463         this_ptr_conv.inner = untag_ptr(this_ptr);
27464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27466         this_ptr_conv.is_owned = false;
27467         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
27468         return ret_conv;
27469 }
27470
27471 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
27472         LDKCounterpartyForwardingInfo this_ptr_conv;
27473         this_ptr_conv.inner = untag_ptr(this_ptr);
27474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27476         this_ptr_conv.is_owned = false;
27477         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
27478 }
27479
27480 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
27481         LDKCounterpartyForwardingInfo this_ptr_conv;
27482         this_ptr_conv.inner = untag_ptr(this_ptr);
27483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27485         this_ptr_conv.is_owned = false;
27486         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
27487         return ret_conv;
27488 }
27489
27490 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
27491         LDKCounterpartyForwardingInfo this_ptr_conv;
27492         this_ptr_conv.inner = untag_ptr(this_ptr);
27493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27495         this_ptr_conv.is_owned = false;
27496         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
27497 }
27498
27499 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
27500         LDKCounterpartyForwardingInfo this_ptr_conv;
27501         this_ptr_conv.inner = untag_ptr(this_ptr);
27502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27504         this_ptr_conv.is_owned = false;
27505         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
27506         return ret_conv;
27507 }
27508
27509 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
27510         LDKCounterpartyForwardingInfo this_ptr_conv;
27511         this_ptr_conv.inner = untag_ptr(this_ptr);
27512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27514         this_ptr_conv.is_owned = false;
27515         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
27516 }
27517
27518 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) {
27519         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
27520         uint64_t ret_ref = 0;
27521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27523         return ret_ref;
27524 }
27525
27526 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
27527         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
27528         uint64_t ret_ref = 0;
27529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27531         return ret_ref;
27532 }
27533 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
27534         LDKCounterpartyForwardingInfo arg_conv;
27535         arg_conv.inner = untag_ptr(arg);
27536         arg_conv.is_owned = ptr_is_owned(arg);
27537         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27538         arg_conv.is_owned = false;
27539         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
27540         return ret_conv;
27541 }
27542
27543 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
27544         LDKCounterpartyForwardingInfo orig_conv;
27545         orig_conv.inner = untag_ptr(orig);
27546         orig_conv.is_owned = ptr_is_owned(orig);
27547         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27548         orig_conv.is_owned = false;
27549         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
27550         uint64_t ret_ref = 0;
27551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27553         return ret_ref;
27554 }
27555
27556 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
27557         LDKChannelCounterparty this_obj_conv;
27558         this_obj_conv.inner = untag_ptr(this_obj);
27559         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27561         ChannelCounterparty_free(this_obj_conv);
27562 }
27563
27564 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
27565         LDKChannelCounterparty this_ptr_conv;
27566         this_ptr_conv.inner = untag_ptr(this_ptr);
27567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27569         this_ptr_conv.is_owned = false;
27570         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27571         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
27572         return ret_arr;
27573 }
27574
27575 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
27576         LDKChannelCounterparty this_ptr_conv;
27577         this_ptr_conv.inner = untag_ptr(this_ptr);
27578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27580         this_ptr_conv.is_owned = false;
27581         LDKPublicKey val_ref;
27582         CHECK(val->arr_len == 33);
27583         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27584         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
27585 }
27586
27587 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
27588         LDKChannelCounterparty this_ptr_conv;
27589         this_ptr_conv.inner = untag_ptr(this_ptr);
27590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27592         this_ptr_conv.is_owned = false;
27593         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
27594         uint64_t ret_ref = 0;
27595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27597         return ret_ref;
27598 }
27599
27600 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
27601         LDKChannelCounterparty this_ptr_conv;
27602         this_ptr_conv.inner = untag_ptr(this_ptr);
27603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27605         this_ptr_conv.is_owned = false;
27606         LDKInitFeatures val_conv;
27607         val_conv.inner = untag_ptr(val);
27608         val_conv.is_owned = ptr_is_owned(val);
27609         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27610         val_conv = InitFeatures_clone(&val_conv);
27611         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
27612 }
27613
27614 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
27615         LDKChannelCounterparty this_ptr_conv;
27616         this_ptr_conv.inner = untag_ptr(this_ptr);
27617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27619         this_ptr_conv.is_owned = false;
27620         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
27621         return ret_conv;
27622 }
27623
27624 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
27625         LDKChannelCounterparty this_ptr_conv;
27626         this_ptr_conv.inner = untag_ptr(this_ptr);
27627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27629         this_ptr_conv.is_owned = false;
27630         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
27631 }
27632
27633 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
27634         LDKChannelCounterparty this_ptr_conv;
27635         this_ptr_conv.inner = untag_ptr(this_ptr);
27636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27638         this_ptr_conv.is_owned = false;
27639         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
27640         uint64_t ret_ref = 0;
27641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27643         return ret_ref;
27644 }
27645
27646 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
27647         LDKChannelCounterparty this_ptr_conv;
27648         this_ptr_conv.inner = untag_ptr(this_ptr);
27649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27651         this_ptr_conv.is_owned = false;
27652         LDKCounterpartyForwardingInfo val_conv;
27653         val_conv.inner = untag_ptr(val);
27654         val_conv.is_owned = ptr_is_owned(val);
27655         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27656         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
27657         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
27658 }
27659
27660 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
27661         LDKChannelCounterparty this_ptr_conv;
27662         this_ptr_conv.inner = untag_ptr(this_ptr);
27663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27665         this_ptr_conv.is_owned = false;
27666         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27667         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
27668         uint64_t ret_ref = tag_ptr(ret_copy, true);
27669         return ret_ref;
27670 }
27671
27672 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) {
27673         LDKChannelCounterparty this_ptr_conv;
27674         this_ptr_conv.inner = untag_ptr(this_ptr);
27675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27677         this_ptr_conv.is_owned = false;
27678         void* val_ptr = untag_ptr(val);
27679         CHECK_ACCESS(val_ptr);
27680         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27681         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27682         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
27683 }
27684
27685 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
27686         LDKChannelCounterparty this_ptr_conv;
27687         this_ptr_conv.inner = untag_ptr(this_ptr);
27688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27690         this_ptr_conv.is_owned = false;
27691         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27692         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
27693         uint64_t ret_ref = tag_ptr(ret_copy, true);
27694         return ret_ref;
27695 }
27696
27697 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) {
27698         LDKChannelCounterparty this_ptr_conv;
27699         this_ptr_conv.inner = untag_ptr(this_ptr);
27700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27702         this_ptr_conv.is_owned = false;
27703         void* val_ptr = untag_ptr(val);
27704         CHECK_ACCESS(val_ptr);
27705         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27706         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27707         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
27708 }
27709
27710 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) {
27711         LDKPublicKey node_id_arg_ref;
27712         CHECK(node_id_arg->arr_len == 33);
27713         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
27714         LDKInitFeatures features_arg_conv;
27715         features_arg_conv.inner = untag_ptr(features_arg);
27716         features_arg_conv.is_owned = ptr_is_owned(features_arg);
27717         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
27718         features_arg_conv = InitFeatures_clone(&features_arg_conv);
27719         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
27720         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
27721         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
27722         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
27723         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
27724         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
27725         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
27726         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
27727         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
27728         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
27729         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
27730         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
27731         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
27732         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);
27733         uint64_t ret_ref = 0;
27734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27736         return ret_ref;
27737 }
27738
27739 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
27740         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
27741         uint64_t ret_ref = 0;
27742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27744         return ret_ref;
27745 }
27746 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
27747         LDKChannelCounterparty arg_conv;
27748         arg_conv.inner = untag_ptr(arg);
27749         arg_conv.is_owned = ptr_is_owned(arg);
27750         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27751         arg_conv.is_owned = false;
27752         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
27753         return ret_conv;
27754 }
27755
27756 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
27757         LDKChannelCounterparty orig_conv;
27758         orig_conv.inner = untag_ptr(orig);
27759         orig_conv.is_owned = ptr_is_owned(orig);
27760         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27761         orig_conv.is_owned = false;
27762         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
27763         uint64_t ret_ref = 0;
27764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27766         return ret_ref;
27767 }
27768
27769 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
27770         LDKChannelDetails this_obj_conv;
27771         this_obj_conv.inner = untag_ptr(this_obj);
27772         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27774         ChannelDetails_free(this_obj_conv);
27775 }
27776
27777 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
27778         LDKChannelDetails this_ptr_conv;
27779         this_ptr_conv.inner = untag_ptr(this_ptr);
27780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27782         this_ptr_conv.is_owned = false;
27783         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27784         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
27785         return ret_arr;
27786 }
27787
27788 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
27789         LDKChannelDetails this_ptr_conv;
27790         this_ptr_conv.inner = untag_ptr(this_ptr);
27791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27793         this_ptr_conv.is_owned = false;
27794         LDKThirtyTwoBytes val_ref;
27795         CHECK(val->arr_len == 32);
27796         memcpy(val_ref.data, val->elems, 32); FREE(val);
27797         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
27798 }
27799
27800 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
27801         LDKChannelDetails this_ptr_conv;
27802         this_ptr_conv.inner = untag_ptr(this_ptr);
27803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27805         this_ptr_conv.is_owned = false;
27806         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
27807         uint64_t ret_ref = 0;
27808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27810         return ret_ref;
27811 }
27812
27813 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
27814         LDKChannelDetails this_ptr_conv;
27815         this_ptr_conv.inner = untag_ptr(this_ptr);
27816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27818         this_ptr_conv.is_owned = false;
27819         LDKChannelCounterparty val_conv;
27820         val_conv.inner = untag_ptr(val);
27821         val_conv.is_owned = ptr_is_owned(val);
27822         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27823         val_conv = ChannelCounterparty_clone(&val_conv);
27824         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
27825 }
27826
27827 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
27828         LDKChannelDetails this_ptr_conv;
27829         this_ptr_conv.inner = untag_ptr(this_ptr);
27830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27832         this_ptr_conv.is_owned = false;
27833         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
27834         uint64_t ret_ref = 0;
27835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27837         return ret_ref;
27838 }
27839
27840 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
27841         LDKChannelDetails this_ptr_conv;
27842         this_ptr_conv.inner = untag_ptr(this_ptr);
27843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27845         this_ptr_conv.is_owned = false;
27846         LDKOutPoint val_conv;
27847         val_conv.inner = untag_ptr(val);
27848         val_conv.is_owned = ptr_is_owned(val);
27849         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27850         val_conv = OutPoint_clone(&val_conv);
27851         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
27852 }
27853
27854 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
27855         LDKChannelDetails this_ptr_conv;
27856         this_ptr_conv.inner = untag_ptr(this_ptr);
27857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27859         this_ptr_conv.is_owned = false;
27860         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
27861         uint64_t ret_ref = 0;
27862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27864         return ret_ref;
27865 }
27866
27867 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
27868         LDKChannelDetails this_ptr_conv;
27869         this_ptr_conv.inner = untag_ptr(this_ptr);
27870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27872         this_ptr_conv.is_owned = false;
27873         LDKChannelTypeFeatures val_conv;
27874         val_conv.inner = untag_ptr(val);
27875         val_conv.is_owned = ptr_is_owned(val);
27876         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27877         val_conv = ChannelTypeFeatures_clone(&val_conv);
27878         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
27879 }
27880
27881 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
27882         LDKChannelDetails this_ptr_conv;
27883         this_ptr_conv.inner = untag_ptr(this_ptr);
27884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27886         this_ptr_conv.is_owned = false;
27887         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27888         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
27889         uint64_t ret_ref = tag_ptr(ret_copy, true);
27890         return ret_ref;
27891 }
27892
27893 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
27894         LDKChannelDetails this_ptr_conv;
27895         this_ptr_conv.inner = untag_ptr(this_ptr);
27896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27898         this_ptr_conv.is_owned = false;
27899         void* val_ptr = untag_ptr(val);
27900         CHECK_ACCESS(val_ptr);
27901         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27902         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27903         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
27904 }
27905
27906 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
27907         LDKChannelDetails this_ptr_conv;
27908         this_ptr_conv.inner = untag_ptr(this_ptr);
27909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27911         this_ptr_conv.is_owned = false;
27912         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27913         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
27914         uint64_t ret_ref = tag_ptr(ret_copy, true);
27915         return ret_ref;
27916 }
27917
27918 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
27919         LDKChannelDetails this_ptr_conv;
27920         this_ptr_conv.inner = untag_ptr(this_ptr);
27921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27923         this_ptr_conv.is_owned = false;
27924         void* val_ptr = untag_ptr(val);
27925         CHECK_ACCESS(val_ptr);
27926         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27927         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27928         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
27929 }
27930
27931 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
27932         LDKChannelDetails this_ptr_conv;
27933         this_ptr_conv.inner = untag_ptr(this_ptr);
27934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27936         this_ptr_conv.is_owned = false;
27937         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27938         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
27939         uint64_t ret_ref = tag_ptr(ret_copy, true);
27940         return ret_ref;
27941 }
27942
27943 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
27944         LDKChannelDetails this_ptr_conv;
27945         this_ptr_conv.inner = untag_ptr(this_ptr);
27946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27948         this_ptr_conv.is_owned = false;
27949         void* val_ptr = untag_ptr(val);
27950         CHECK_ACCESS(val_ptr);
27951         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27952         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27953         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
27954 }
27955
27956 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
27957         LDKChannelDetails this_ptr_conv;
27958         this_ptr_conv.inner = untag_ptr(this_ptr);
27959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27961         this_ptr_conv.is_owned = false;
27962         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
27963         return ret_conv;
27964 }
27965
27966 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
27967         LDKChannelDetails this_ptr_conv;
27968         this_ptr_conv.inner = untag_ptr(this_ptr);
27969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27971         this_ptr_conv.is_owned = false;
27972         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
27973 }
27974
27975 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
27976         LDKChannelDetails this_ptr_conv;
27977         this_ptr_conv.inner = untag_ptr(this_ptr);
27978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27980         this_ptr_conv.is_owned = false;
27981         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27982         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
27983         uint64_t ret_ref = tag_ptr(ret_copy, true);
27984         return ret_ref;
27985 }
27986
27987 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
27988         LDKChannelDetails this_ptr_conv;
27989         this_ptr_conv.inner = untag_ptr(this_ptr);
27990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27992         this_ptr_conv.is_owned = false;
27993         void* val_ptr = untag_ptr(val);
27994         CHECK_ACCESS(val_ptr);
27995         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27996         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27997         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
27998 }
27999
28000 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
28001         LDKChannelDetails this_ptr_conv;
28002         this_ptr_conv.inner = untag_ptr(this_ptr);
28003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28005         this_ptr_conv.is_owned = false;
28006         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
28007         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
28008         return ret_arr;
28009 }
28010
28011 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
28012         LDKChannelDetails this_ptr_conv;
28013         this_ptr_conv.inner = untag_ptr(this_ptr);
28014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28016         this_ptr_conv.is_owned = false;
28017         LDKU128 val_ref;
28018         CHECK(val->arr_len == 16);
28019         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
28020         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
28021 }
28022
28023 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_feerate_sat_per_1000_weight"))) TS_ChannelDetails_get_feerate_sat_per_1000_weight(uint64_t this_ptr) {
28024         LDKChannelDetails this_ptr_conv;
28025         this_ptr_conv.inner = untag_ptr(this_ptr);
28026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28028         this_ptr_conv.is_owned = false;
28029         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28030         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
28031         uint64_t ret_ref = tag_ptr(ret_copy, true);
28032         return ret_ref;
28033 }
28034
28035 void  __attribute__((export_name("TS_ChannelDetails_set_feerate_sat_per_1000_weight"))) TS_ChannelDetails_set_feerate_sat_per_1000_weight(uint64_t this_ptr, uint64_t val) {
28036         LDKChannelDetails this_ptr_conv;
28037         this_ptr_conv.inner = untag_ptr(this_ptr);
28038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28040         this_ptr_conv.is_owned = false;
28041         void* val_ptr = untag_ptr(val);
28042         CHECK_ACCESS(val_ptr);
28043         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28044         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28045         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
28046 }
28047
28048 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
28049         LDKChannelDetails this_ptr_conv;
28050         this_ptr_conv.inner = untag_ptr(this_ptr);
28051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28053         this_ptr_conv.is_owned = false;
28054         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
28055         return ret_conv;
28056 }
28057
28058 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
28059         LDKChannelDetails this_ptr_conv;
28060         this_ptr_conv.inner = untag_ptr(this_ptr);
28061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28063         this_ptr_conv.is_owned = false;
28064         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
28065 }
28066
28067 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
28068         LDKChannelDetails this_ptr_conv;
28069         this_ptr_conv.inner = untag_ptr(this_ptr);
28070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28072         this_ptr_conv.is_owned = false;
28073         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
28074         return ret_conv;
28075 }
28076
28077 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
28078         LDKChannelDetails this_ptr_conv;
28079         this_ptr_conv.inner = untag_ptr(this_ptr);
28080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28082         this_ptr_conv.is_owned = false;
28083         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
28084 }
28085
28086 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) {
28087         LDKChannelDetails this_ptr_conv;
28088         this_ptr_conv.inner = untag_ptr(this_ptr);
28089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28091         this_ptr_conv.is_owned = false;
28092         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
28093         return ret_conv;
28094 }
28095
28096 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) {
28097         LDKChannelDetails this_ptr_conv;
28098         this_ptr_conv.inner = untag_ptr(this_ptr);
28099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28101         this_ptr_conv.is_owned = false;
28102         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
28103 }
28104
28105 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
28106         LDKChannelDetails this_ptr_conv;
28107         this_ptr_conv.inner = untag_ptr(this_ptr);
28108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28110         this_ptr_conv.is_owned = false;
28111         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
28112         return ret_conv;
28113 }
28114
28115 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
28116         LDKChannelDetails this_ptr_conv;
28117         this_ptr_conv.inner = untag_ptr(this_ptr);
28118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28120         this_ptr_conv.is_owned = false;
28121         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
28122 }
28123
28124 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
28125         LDKChannelDetails this_ptr_conv;
28126         this_ptr_conv.inner = untag_ptr(this_ptr);
28127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28129         this_ptr_conv.is_owned = false;
28130         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28131         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
28132         uint64_t ret_ref = tag_ptr(ret_copy, true);
28133         return ret_ref;
28134 }
28135
28136 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
28137         LDKChannelDetails this_ptr_conv;
28138         this_ptr_conv.inner = untag_ptr(this_ptr);
28139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28141         this_ptr_conv.is_owned = false;
28142         void* val_ptr = untag_ptr(val);
28143         CHECK_ACCESS(val_ptr);
28144         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28145         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28146         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
28147 }
28148
28149 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
28150         LDKChannelDetails this_ptr_conv;
28151         this_ptr_conv.inner = untag_ptr(this_ptr);
28152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28154         this_ptr_conv.is_owned = false;
28155         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28156         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
28157         uint64_t ret_ref = tag_ptr(ret_copy, true);
28158         return ret_ref;
28159 }
28160
28161 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
28162         LDKChannelDetails this_ptr_conv;
28163         this_ptr_conv.inner = untag_ptr(this_ptr);
28164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28166         this_ptr_conv.is_owned = false;
28167         void* val_ptr = untag_ptr(val);
28168         CHECK_ACCESS(val_ptr);
28169         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28170         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28171         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
28172 }
28173
28174 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
28175         LDKChannelDetails this_ptr_conv;
28176         this_ptr_conv.inner = untag_ptr(this_ptr);
28177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28179         this_ptr_conv.is_owned = false;
28180         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
28181         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
28182         uint64_t ret_ref = tag_ptr(ret_copy, true);
28183         return ret_ref;
28184 }
28185
28186 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) {
28187         LDKChannelDetails this_ptr_conv;
28188         this_ptr_conv.inner = untag_ptr(this_ptr);
28189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28191         this_ptr_conv.is_owned = false;
28192         void* val_ptr = untag_ptr(val);
28193         CHECK_ACCESS(val_ptr);
28194         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
28195         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
28196         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
28197 }
28198
28199 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
28200         LDKChannelDetails this_ptr_conv;
28201         this_ptr_conv.inner = untag_ptr(this_ptr);
28202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28204         this_ptr_conv.is_owned = false;
28205         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
28206         return ret_conv;
28207 }
28208
28209 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
28210         LDKChannelDetails this_ptr_conv;
28211         this_ptr_conv.inner = untag_ptr(this_ptr);
28212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28214         this_ptr_conv.is_owned = false;
28215         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
28216 }
28217
28218 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
28219         LDKChannelDetails this_ptr_conv;
28220         this_ptr_conv.inner = untag_ptr(this_ptr);
28221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28223         this_ptr_conv.is_owned = false;
28224         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
28225         return ret_conv;
28226 }
28227
28228 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
28229         LDKChannelDetails this_ptr_conv;
28230         this_ptr_conv.inner = untag_ptr(this_ptr);
28231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28233         this_ptr_conv.is_owned = false;
28234         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
28235 }
28236
28237 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
28238         LDKChannelDetails this_ptr_conv;
28239         this_ptr_conv.inner = untag_ptr(this_ptr);
28240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28242         this_ptr_conv.is_owned = false;
28243         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
28244         return ret_conv;
28245 }
28246
28247 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
28248         LDKChannelDetails this_ptr_conv;
28249         this_ptr_conv.inner = untag_ptr(this_ptr);
28250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28252         this_ptr_conv.is_owned = false;
28253         ChannelDetails_set_is_usable(&this_ptr_conv, val);
28254 }
28255
28256 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
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         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
28263         return ret_conv;
28264 }
28265
28266 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
28267         LDKChannelDetails this_ptr_conv;
28268         this_ptr_conv.inner = untag_ptr(this_ptr);
28269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28271         this_ptr_conv.is_owned = false;
28272         ChannelDetails_set_is_public(&this_ptr_conv, val);
28273 }
28274
28275 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
28276         LDKChannelDetails this_ptr_conv;
28277         this_ptr_conv.inner = untag_ptr(this_ptr);
28278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28280         this_ptr_conv.is_owned = false;
28281         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28282         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
28283         uint64_t ret_ref = tag_ptr(ret_copy, true);
28284         return ret_ref;
28285 }
28286
28287 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) {
28288         LDKChannelDetails this_ptr_conv;
28289         this_ptr_conv.inner = untag_ptr(this_ptr);
28290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28292         this_ptr_conv.is_owned = false;
28293         void* val_ptr = untag_ptr(val);
28294         CHECK_ACCESS(val_ptr);
28295         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28296         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28297         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
28298 }
28299
28300 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
28301         LDKChannelDetails this_ptr_conv;
28302         this_ptr_conv.inner = untag_ptr(this_ptr);
28303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28305         this_ptr_conv.is_owned = false;
28306         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28307         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
28308         uint64_t ret_ref = tag_ptr(ret_copy, true);
28309         return ret_ref;
28310 }
28311
28312 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) {
28313         LDKChannelDetails this_ptr_conv;
28314         this_ptr_conv.inner = untag_ptr(this_ptr);
28315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28317         this_ptr_conv.is_owned = false;
28318         void* val_ptr = untag_ptr(val);
28319         CHECK_ACCESS(val_ptr);
28320         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28321         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28322         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
28323 }
28324
28325 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
28326         LDKChannelDetails this_ptr_conv;
28327         this_ptr_conv.inner = untag_ptr(this_ptr);
28328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28330         this_ptr_conv.is_owned = false;
28331         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
28332         uint64_t ret_ref = 0;
28333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28335         return ret_ref;
28336 }
28337
28338 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
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         LDKChannelConfig val_conv;
28345         val_conv.inner = untag_ptr(val);
28346         val_conv.is_owned = ptr_is_owned(val);
28347         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28348         val_conv = ChannelConfig_clone(&val_conv);
28349         ChannelDetails_set_config(&this_ptr_conv, val_conv);
28350 }
28351
28352 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, uint64_t feerate_sat_per_1000_weight_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) {
28353         LDKThirtyTwoBytes channel_id_arg_ref;
28354         CHECK(channel_id_arg->arr_len == 32);
28355         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28356         LDKChannelCounterparty counterparty_arg_conv;
28357         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
28358         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
28359         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
28360         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
28361         LDKOutPoint funding_txo_arg_conv;
28362         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
28363         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
28364         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
28365         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
28366         LDKChannelTypeFeatures channel_type_arg_conv;
28367         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
28368         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
28369         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
28370         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
28371         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
28372         CHECK_ACCESS(short_channel_id_arg_ptr);
28373         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
28374         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
28375         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
28376         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
28377         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
28378         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
28379         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
28380         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
28381         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
28382         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
28383         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
28384         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
28385         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
28386         LDKU128 user_channel_id_arg_ref;
28387         CHECK(user_channel_id_arg->arr_len == 16);
28388         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
28389         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
28390         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
28391         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
28392         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
28393         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
28394         CHECK_ACCESS(confirmations_required_arg_ptr);
28395         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
28396         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
28397         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
28398         CHECK_ACCESS(confirmations_arg_ptr);
28399         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
28400         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
28401         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
28402         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
28403         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
28404         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
28405         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
28406         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
28407         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
28408         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
28409         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
28410         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
28411         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
28412         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
28413         LDKChannelConfig config_arg_conv;
28414         config_arg_conv.inner = untag_ptr(config_arg);
28415         config_arg_conv.is_owned = ptr_is_owned(config_arg);
28416         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
28417         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
28418         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, feerate_sat_per_1000_weight_arg_conv, 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);
28419         uint64_t ret_ref = 0;
28420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28422         return ret_ref;
28423 }
28424
28425 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
28426         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
28427         uint64_t ret_ref = 0;
28428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28430         return ret_ref;
28431 }
28432 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
28433         LDKChannelDetails arg_conv;
28434         arg_conv.inner = untag_ptr(arg);
28435         arg_conv.is_owned = ptr_is_owned(arg);
28436         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28437         arg_conv.is_owned = false;
28438         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
28439         return ret_conv;
28440 }
28441
28442 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
28443         LDKChannelDetails orig_conv;
28444         orig_conv.inner = untag_ptr(orig);
28445         orig_conv.is_owned = ptr_is_owned(orig);
28446         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28447         orig_conv.is_owned = false;
28448         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
28449         uint64_t ret_ref = 0;
28450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28452         return ret_ref;
28453 }
28454
28455 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
28456         LDKChannelDetails this_arg_conv;
28457         this_arg_conv.inner = untag_ptr(this_arg);
28458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28460         this_arg_conv.is_owned = false;
28461         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28462         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
28463         uint64_t ret_ref = tag_ptr(ret_copy, true);
28464         return ret_ref;
28465 }
28466
28467 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
28468         LDKChannelDetails this_arg_conv;
28469         this_arg_conv.inner = untag_ptr(this_arg);
28470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28472         this_arg_conv.is_owned = false;
28473         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28474         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
28475         uint64_t ret_ref = tag_ptr(ret_copy, true);
28476         return ret_ref;
28477 }
28478
28479 void  __attribute__((export_name("TS_RecentPaymentDetails_free"))) TS_RecentPaymentDetails_free(uint64_t this_ptr) {
28480         if (!ptr_is_owned(this_ptr)) return;
28481         void* this_ptr_ptr = untag_ptr(this_ptr);
28482         CHECK_ACCESS(this_ptr_ptr);
28483         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
28484         FREE(untag_ptr(this_ptr));
28485         RecentPaymentDetails_free(this_ptr_conv);
28486 }
28487
28488 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
28489         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28490         *ret_copy = RecentPaymentDetails_clone(arg);
28491         uint64_t ret_ref = tag_ptr(ret_copy, true);
28492         return ret_ref;
28493 }
28494 int64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone_ptr"))) TS_RecentPaymentDetails_clone_ptr(uint64_t arg) {
28495         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
28496         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
28497         return ret_conv;
28498 }
28499
28500 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone"))) TS_RecentPaymentDetails_clone(uint64_t orig) {
28501         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
28502         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28503         *ret_copy = RecentPaymentDetails_clone(orig_conv);
28504         uint64_t ret_ref = tag_ptr(ret_copy, true);
28505         return ret_ref;
28506 }
28507
28508 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_pending"))) TS_RecentPaymentDetails_pending(int8_tArray payment_hash, int64_t total_msat) {
28509         LDKThirtyTwoBytes payment_hash_ref;
28510         CHECK(payment_hash->arr_len == 32);
28511         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28512         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28513         *ret_copy = RecentPaymentDetails_pending(payment_hash_ref, total_msat);
28514         uint64_t ret_ref = tag_ptr(ret_copy, true);
28515         return ret_ref;
28516 }
28517
28518 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_fulfilled"))) TS_RecentPaymentDetails_fulfilled(int8_tArray payment_hash) {
28519         LDKThirtyTwoBytes payment_hash_ref;
28520         CHECK(payment_hash->arr_len == 32);
28521         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28522         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28523         *ret_copy = RecentPaymentDetails_fulfilled(payment_hash_ref);
28524         uint64_t ret_ref = tag_ptr(ret_copy, true);
28525         return ret_ref;
28526 }
28527
28528 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_abandoned"))) TS_RecentPaymentDetails_abandoned(int8_tArray payment_hash) {
28529         LDKThirtyTwoBytes payment_hash_ref;
28530         CHECK(payment_hash->arr_len == 32);
28531         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28532         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28533         *ret_copy = RecentPaymentDetails_abandoned(payment_hash_ref);
28534         uint64_t ret_ref = tag_ptr(ret_copy, true);
28535         return ret_ref;
28536 }
28537
28538 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
28539         LDKPhantomRouteHints this_obj_conv;
28540         this_obj_conv.inner = untag_ptr(this_obj);
28541         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28543         PhantomRouteHints_free(this_obj_conv);
28544 }
28545
28546 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
28547         LDKPhantomRouteHints this_ptr_conv;
28548         this_ptr_conv.inner = untag_ptr(this_ptr);
28549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28551         this_ptr_conv.is_owned = false;
28552         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
28553         uint64_tArray ret_arr = NULL;
28554         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28555         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28556         for (size_t q = 0; q < ret_var.datalen; q++) {
28557                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28558                 uint64_t ret_conv_16_ref = 0;
28559                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28560                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28561                 ret_arr_ptr[q] = ret_conv_16_ref;
28562         }
28563         
28564         FREE(ret_var.data);
28565         return ret_arr;
28566 }
28567
28568 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
28569         LDKPhantomRouteHints this_ptr_conv;
28570         this_ptr_conv.inner = untag_ptr(this_ptr);
28571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28573         this_ptr_conv.is_owned = false;
28574         LDKCVec_ChannelDetailsZ val_constr;
28575         val_constr.datalen = val->arr_len;
28576         if (val_constr.datalen > 0)
28577                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28578         else
28579                 val_constr.data = NULL;
28580         uint64_t* val_vals = val->elems;
28581         for (size_t q = 0; q < val_constr.datalen; q++) {
28582                 uint64_t val_conv_16 = val_vals[q];
28583                 LDKChannelDetails val_conv_16_conv;
28584                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
28585                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
28586                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
28587                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
28588                 val_constr.data[q] = val_conv_16_conv;
28589         }
28590         FREE(val);
28591         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
28592 }
28593
28594 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
28595         LDKPhantomRouteHints this_ptr_conv;
28596         this_ptr_conv.inner = untag_ptr(this_ptr);
28597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28599         this_ptr_conv.is_owned = false;
28600         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
28601         return ret_conv;
28602 }
28603
28604 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
28605         LDKPhantomRouteHints this_ptr_conv;
28606         this_ptr_conv.inner = untag_ptr(this_ptr);
28607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28609         this_ptr_conv.is_owned = false;
28610         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
28611 }
28612
28613 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
28614         LDKPhantomRouteHints this_ptr_conv;
28615         this_ptr_conv.inner = untag_ptr(this_ptr);
28616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28618         this_ptr_conv.is_owned = false;
28619         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28620         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
28621         return ret_arr;
28622 }
28623
28624 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
28625         LDKPhantomRouteHints this_ptr_conv;
28626         this_ptr_conv.inner = untag_ptr(this_ptr);
28627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28629         this_ptr_conv.is_owned = false;
28630         LDKPublicKey val_ref;
28631         CHECK(val->arr_len == 33);
28632         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28633         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
28634 }
28635
28636 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) {
28637         LDKCVec_ChannelDetailsZ channels_arg_constr;
28638         channels_arg_constr.datalen = channels_arg->arr_len;
28639         if (channels_arg_constr.datalen > 0)
28640                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28641         else
28642                 channels_arg_constr.data = NULL;
28643         uint64_t* channels_arg_vals = channels_arg->elems;
28644         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
28645                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
28646                 LDKChannelDetails channels_arg_conv_16_conv;
28647                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
28648                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
28649                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
28650                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
28651                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
28652         }
28653         FREE(channels_arg);
28654         LDKPublicKey real_node_pubkey_arg_ref;
28655         CHECK(real_node_pubkey_arg->arr_len == 33);
28656         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
28657         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
28658         uint64_t ret_ref = 0;
28659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28661         return ret_ref;
28662 }
28663
28664 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
28665         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
28666         uint64_t ret_ref = 0;
28667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28669         return ret_ref;
28670 }
28671 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
28672         LDKPhantomRouteHints arg_conv;
28673         arg_conv.inner = untag_ptr(arg);
28674         arg_conv.is_owned = ptr_is_owned(arg);
28675         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28676         arg_conv.is_owned = false;
28677         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
28678         return ret_conv;
28679 }
28680
28681 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
28682         LDKPhantomRouteHints orig_conv;
28683         orig_conv.inner = untag_ptr(orig);
28684         orig_conv.is_owned = ptr_is_owned(orig);
28685         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28686         orig_conv.is_owned = false;
28687         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
28688         uint64_t ret_ref = 0;
28689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28691         return ret_ref;
28692 }
28693
28694 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) {
28695         void* fee_est_ptr = untag_ptr(fee_est);
28696         CHECK_ACCESS(fee_est_ptr);
28697         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
28698         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
28699                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28700                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
28701         }
28702         void* chain_monitor_ptr = untag_ptr(chain_monitor);
28703         CHECK_ACCESS(chain_monitor_ptr);
28704         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
28705         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
28706                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28707                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
28708         }
28709         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
28710         CHECK_ACCESS(tx_broadcaster_ptr);
28711         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
28712         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28713                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28714                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
28715         }
28716         void* router_ptr = untag_ptr(router);
28717         CHECK_ACCESS(router_ptr);
28718         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
28719         if (router_conv.free == LDKRouter_JCalls_free) {
28720                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28721                 LDKRouter_JCalls_cloned(&router_conv);
28722         }
28723         void* logger_ptr = untag_ptr(logger);
28724         CHECK_ACCESS(logger_ptr);
28725         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28726         if (logger_conv.free == LDKLogger_JCalls_free) {
28727                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28728                 LDKLogger_JCalls_cloned(&logger_conv);
28729         }
28730         void* entropy_source_ptr = untag_ptr(entropy_source);
28731         CHECK_ACCESS(entropy_source_ptr);
28732         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
28733         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
28734                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28735                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
28736         }
28737         void* node_signer_ptr = untag_ptr(node_signer);
28738         CHECK_ACCESS(node_signer_ptr);
28739         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
28740         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
28741                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28742                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
28743         }
28744         void* signer_provider_ptr = untag_ptr(signer_provider);
28745         CHECK_ACCESS(signer_provider_ptr);
28746         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
28747         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
28748                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28749                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
28750         }
28751         LDKUserConfig config_conv;
28752         config_conv.inner = untag_ptr(config);
28753         config_conv.is_owned = ptr_is_owned(config);
28754         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
28755         config_conv = UserConfig_clone(&config_conv);
28756         LDKChainParameters params_conv;
28757         params_conv.inner = untag_ptr(params);
28758         params_conv.is_owned = ptr_is_owned(params);
28759         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
28760         params_conv = ChainParameters_clone(&params_conv);
28761         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);
28762         uint64_t ret_ref = 0;
28763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28765         return ret_ref;
28766 }
28767
28768 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
28769         LDKChannelManager this_arg_conv;
28770         this_arg_conv.inner = untag_ptr(this_arg);
28771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28773         this_arg_conv.is_owned = false;
28774         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
28775         uint64_t ret_ref = 0;
28776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28778         return ret_ref;
28779 }
28780
28781 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) {
28782         LDKChannelManager this_arg_conv;
28783         this_arg_conv.inner = untag_ptr(this_arg);
28784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28786         this_arg_conv.is_owned = false;
28787         LDKPublicKey their_network_key_ref;
28788         CHECK(their_network_key->arr_len == 33);
28789         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
28790         LDKU128 user_channel_id_ref;
28791         CHECK(user_channel_id->arr_len == 16);
28792         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
28793         LDKUserConfig override_config_conv;
28794         override_config_conv.inner = untag_ptr(override_config);
28795         override_config_conv.is_owned = ptr_is_owned(override_config);
28796         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
28797         override_config_conv = UserConfig_clone(&override_config_conv);
28798         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
28799         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
28800         return tag_ptr(ret_conv, true);
28801 }
28802
28803 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
28804         LDKChannelManager this_arg_conv;
28805         this_arg_conv.inner = untag_ptr(this_arg);
28806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28808         this_arg_conv.is_owned = false;
28809         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
28810         uint64_tArray ret_arr = NULL;
28811         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28812         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28813         for (size_t q = 0; q < ret_var.datalen; q++) {
28814                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28815                 uint64_t ret_conv_16_ref = 0;
28816                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28817                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28818                 ret_arr_ptr[q] = ret_conv_16_ref;
28819         }
28820         
28821         FREE(ret_var.data);
28822         return ret_arr;
28823 }
28824
28825 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
28826         LDKChannelManager this_arg_conv;
28827         this_arg_conv.inner = untag_ptr(this_arg);
28828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28830         this_arg_conv.is_owned = false;
28831         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
28832         uint64_tArray ret_arr = NULL;
28833         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28834         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28835         for (size_t q = 0; q < ret_var.datalen; q++) {
28836                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28837                 uint64_t ret_conv_16_ref = 0;
28838                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28839                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28840                 ret_arr_ptr[q] = ret_conv_16_ref;
28841         }
28842         
28843         FREE(ret_var.data);
28844         return ret_arr;
28845 }
28846
28847 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels_with_counterparty"))) TS_ChannelManager_list_channels_with_counterparty(uint64_t this_arg, int8_tArray counterparty_node_id) {
28848         LDKChannelManager this_arg_conv;
28849         this_arg_conv.inner = untag_ptr(this_arg);
28850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28852         this_arg_conv.is_owned = false;
28853         LDKPublicKey counterparty_node_id_ref;
28854         CHECK(counterparty_node_id->arr_len == 33);
28855         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28856         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
28857         uint64_tArray ret_arr = NULL;
28858         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28859         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28860         for (size_t q = 0; q < ret_var.datalen; q++) {
28861                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28862                 uint64_t ret_conv_16_ref = 0;
28863                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28864                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28865                 ret_arr_ptr[q] = ret_conv_16_ref;
28866         }
28867         
28868         FREE(ret_var.data);
28869         return ret_arr;
28870 }
28871
28872 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_recent_payments"))) TS_ChannelManager_list_recent_payments(uint64_t this_arg) {
28873         LDKChannelManager this_arg_conv;
28874         this_arg_conv.inner = untag_ptr(this_arg);
28875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28877         this_arg_conv.is_owned = false;
28878         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
28879         uint64_tArray ret_arr = NULL;
28880         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28881         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28882         for (size_t w = 0; w < ret_var.datalen; w++) {
28883                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28884                 *ret_conv_22_copy = ret_var.data[w];
28885                 uint64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
28886                 ret_arr_ptr[w] = ret_conv_22_ref;
28887         }
28888         
28889         FREE(ret_var.data);
28890         return ret_arr;
28891 }
28892
28893 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) {
28894         LDKChannelManager this_arg_conv;
28895         this_arg_conv.inner = untag_ptr(this_arg);
28896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28898         this_arg_conv.is_owned = false;
28899         uint8_t channel_id_arr[32];
28900         CHECK(channel_id->arr_len == 32);
28901         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28902         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
28903         LDKPublicKey counterparty_node_id_ref;
28904         CHECK(counterparty_node_id->arr_len == 33);
28905         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28906         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28907         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28908         return tag_ptr(ret_conv, true);
28909 }
28910
28911 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) {
28912         LDKChannelManager this_arg_conv;
28913         this_arg_conv.inner = untag_ptr(this_arg);
28914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28916         this_arg_conv.is_owned = false;
28917         uint8_t channel_id_arr[32];
28918         CHECK(channel_id->arr_len == 32);
28919         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28920         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
28921         LDKPublicKey counterparty_node_id_ref;
28922         CHECK(counterparty_node_id->arr_len == 33);
28923         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28924         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28925         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
28926         return tag_ptr(ret_conv, true);
28927 }
28928
28929 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) {
28930         LDKChannelManager this_arg_conv;
28931         this_arg_conv.inner = untag_ptr(this_arg);
28932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28934         this_arg_conv.is_owned = false;
28935         uint8_t channel_id_arr[32];
28936         CHECK(channel_id->arr_len == 32);
28937         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28938         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
28939         LDKPublicKey counterparty_node_id_ref;
28940         CHECK(counterparty_node_id->arr_len == 33);
28941         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28942         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28943         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28944         return tag_ptr(ret_conv, true);
28945 }
28946
28947 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) {
28948         LDKChannelManager this_arg_conv;
28949         this_arg_conv.inner = untag_ptr(this_arg);
28950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28952         this_arg_conv.is_owned = false;
28953         uint8_t channel_id_arr[32];
28954         CHECK(channel_id->arr_len == 32);
28955         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28956         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
28957         LDKPublicKey counterparty_node_id_ref;
28958         CHECK(counterparty_node_id->arr_len == 33);
28959         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28960         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28961         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28962         return tag_ptr(ret_conv, true);
28963 }
28964
28965 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) {
28966         LDKChannelManager this_arg_conv;
28967         this_arg_conv.inner = untag_ptr(this_arg);
28968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28970         this_arg_conv.is_owned = false;
28971         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
28972 }
28973
28974 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) {
28975         LDKChannelManager this_arg_conv;
28976         this_arg_conv.inner = untag_ptr(this_arg);
28977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28979         this_arg_conv.is_owned = false;
28980         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
28981 }
28982
28983 uint64_t  __attribute__((export_name("TS_ChannelManager_send_payment_with_route"))) TS_ChannelManager_send_payment_with_route(uint64_t this_arg, uint64_t route, int8_tArray payment_hash, uint64_t recipient_onion, int8_tArray payment_id) {
28984         LDKChannelManager this_arg_conv;
28985         this_arg_conv.inner = untag_ptr(this_arg);
28986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28988         this_arg_conv.is_owned = false;
28989         LDKRoute route_conv;
28990         route_conv.inner = untag_ptr(route);
28991         route_conv.is_owned = ptr_is_owned(route);
28992         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
28993         route_conv.is_owned = false;
28994         LDKThirtyTwoBytes payment_hash_ref;
28995         CHECK(payment_hash->arr_len == 32);
28996         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28997         LDKRecipientOnionFields recipient_onion_conv;
28998         recipient_onion_conv.inner = untag_ptr(recipient_onion);
28999         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
29000         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
29001         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
29002         LDKThirtyTwoBytes payment_id_ref;
29003         CHECK(payment_id->arr_len == 32);
29004         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29005         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
29006         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
29007         return tag_ptr(ret_conv, true);
29008 }
29009
29010 uint64_t  __attribute__((export_name("TS_ChannelManager_send_payment"))) TS_ChannelManager_send_payment(uint64_t this_arg, int8_tArray payment_hash, uint64_t recipient_onion, int8_tArray payment_id, uint64_t route_params, uint64_t retry_strategy) {
29011         LDKChannelManager this_arg_conv;
29012         this_arg_conv.inner = untag_ptr(this_arg);
29013         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29015         this_arg_conv.is_owned = false;
29016         LDKThirtyTwoBytes payment_hash_ref;
29017         CHECK(payment_hash->arr_len == 32);
29018         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29019         LDKRecipientOnionFields recipient_onion_conv;
29020         recipient_onion_conv.inner = untag_ptr(recipient_onion);
29021         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
29022         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
29023         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
29024         LDKThirtyTwoBytes payment_id_ref;
29025         CHECK(payment_id->arr_len == 32);
29026         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29027         LDKRouteParameters route_params_conv;
29028         route_params_conv.inner = untag_ptr(route_params);
29029         route_params_conv.is_owned = ptr_is_owned(route_params);
29030         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
29031         route_params_conv = RouteParameters_clone(&route_params_conv);
29032         void* retry_strategy_ptr = untag_ptr(retry_strategy);
29033         CHECK_ACCESS(retry_strategy_ptr);
29034         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
29035         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
29036         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
29037         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
29038         return tag_ptr(ret_conv, true);
29039 }
29040
29041 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
29042         LDKChannelManager this_arg_conv;
29043         this_arg_conv.inner = untag_ptr(this_arg);
29044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29046         this_arg_conv.is_owned = false;
29047         LDKThirtyTwoBytes payment_id_ref;
29048         CHECK(payment_id->arr_len == 32);
29049         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29050         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
29051 }
29052
29053 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, uint64_t recipient_onion, int8_tArray payment_id) {
29054         LDKChannelManager this_arg_conv;
29055         this_arg_conv.inner = untag_ptr(this_arg);
29056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29058         this_arg_conv.is_owned = false;
29059         LDKRoute route_conv;
29060         route_conv.inner = untag_ptr(route);
29061         route_conv.is_owned = ptr_is_owned(route);
29062         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29063         route_conv.is_owned = false;
29064         LDKThirtyTwoBytes payment_preimage_ref;
29065         CHECK(payment_preimage->arr_len == 32);
29066         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
29067         LDKRecipientOnionFields recipient_onion_conv;
29068         recipient_onion_conv.inner = untag_ptr(recipient_onion);
29069         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
29070         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
29071         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
29072         LDKThirtyTwoBytes payment_id_ref;
29073         CHECK(payment_id->arr_len == 32);
29074         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29075         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
29076         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref, recipient_onion_conv, payment_id_ref);
29077         return tag_ptr(ret_conv, true);
29078 }
29079
29080 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, uint64_t recipient_onion, int8_tArray payment_id, uint64_t route_params, uint64_t retry_strategy) {
29081         LDKChannelManager this_arg_conv;
29082         this_arg_conv.inner = untag_ptr(this_arg);
29083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29085         this_arg_conv.is_owned = false;
29086         LDKThirtyTwoBytes payment_preimage_ref;
29087         CHECK(payment_preimage->arr_len == 32);
29088         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
29089         LDKRecipientOnionFields recipient_onion_conv;
29090         recipient_onion_conv.inner = untag_ptr(recipient_onion);
29091         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
29092         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
29093         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
29094         LDKThirtyTwoBytes payment_id_ref;
29095         CHECK(payment_id->arr_len == 32);
29096         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29097         LDKRouteParameters route_params_conv;
29098         route_params_conv.inner = untag_ptr(route_params);
29099         route_params_conv.is_owned = ptr_is_owned(route_params);
29100         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
29101         route_params_conv = RouteParameters_clone(&route_params_conv);
29102         void* retry_strategy_ptr = untag_ptr(retry_strategy);
29103         CHECK_ACCESS(retry_strategy_ptr);
29104         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
29105         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
29106         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
29107         *ret_conv = ChannelManager_send_spontaneous_payment_with_retry(&this_arg_conv, payment_preimage_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
29108         return tag_ptr(ret_conv, true);
29109 }
29110
29111 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_t path) {
29112         LDKChannelManager this_arg_conv;
29113         this_arg_conv.inner = untag_ptr(this_arg);
29114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29116         this_arg_conv.is_owned = false;
29117         LDKPath path_conv;
29118         path_conv.inner = untag_ptr(path);
29119         path_conv.is_owned = ptr_is_owned(path);
29120         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
29121         path_conv = Path_clone(&path_conv);
29122         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
29123         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
29124         return tag_ptr(ret_conv, true);
29125 }
29126
29127 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) {
29128         LDKChannelManager this_arg_conv;
29129         this_arg_conv.inner = untag_ptr(this_arg);
29130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29132         this_arg_conv.is_owned = false;
29133         uint8_t temporary_channel_id_arr[32];
29134         CHECK(temporary_channel_id->arr_len == 32);
29135         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
29136         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29137         LDKPublicKey counterparty_node_id_ref;
29138         CHECK(counterparty_node_id->arr_len == 33);
29139         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29140         LDKTransaction funding_transaction_ref;
29141         funding_transaction_ref.datalen = funding_transaction->arr_len;
29142         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
29143         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
29144         funding_transaction_ref.data_is_owned = true;
29145         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29146         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
29147         return tag_ptr(ret_conv, true);
29148 }
29149
29150 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) {
29151         LDKChannelManager this_arg_conv;
29152         this_arg_conv.inner = untag_ptr(this_arg);
29153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29155         this_arg_conv.is_owned = false;
29156         LDKPublicKey counterparty_node_id_ref;
29157         CHECK(counterparty_node_id->arr_len == 33);
29158         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29159         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
29160         channel_ids_constr.datalen = channel_ids->arr_len;
29161         if (channel_ids_constr.datalen > 0)
29162                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
29163         else
29164                 channel_ids_constr.data = NULL;
29165         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
29166         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
29167                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
29168                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
29169                 CHECK(channel_ids_conv_12->arr_len == 32);
29170                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
29171                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
29172         }
29173         FREE(channel_ids);
29174         LDKChannelConfig config_conv;
29175         config_conv.inner = untag_ptr(config);
29176         config_conv.is_owned = ptr_is_owned(config);
29177         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
29178         config_conv.is_owned = false;
29179         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29180         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
29181         return tag_ptr(ret_conv, true);
29182 }
29183
29184 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) {
29185         LDKChannelManager this_arg_conv;
29186         this_arg_conv.inner = untag_ptr(this_arg);
29187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29189         this_arg_conv.is_owned = false;
29190         LDKThirtyTwoBytes intercept_id_ref;
29191         CHECK(intercept_id->arr_len == 32);
29192         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
29193         uint8_t next_hop_channel_id_arr[32];
29194         CHECK(next_hop_channel_id->arr_len == 32);
29195         memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id);
29196         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
29197         LDKPublicKey next_node_id_ref;
29198         CHECK(next_node_id->arr_len == 33);
29199         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
29200         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29201         *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);
29202         return tag_ptr(ret_conv, true);
29203 }
29204
29205 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
29206         LDKChannelManager this_arg_conv;
29207         this_arg_conv.inner = untag_ptr(this_arg);
29208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29210         this_arg_conv.is_owned = false;
29211         LDKThirtyTwoBytes intercept_id_ref;
29212         CHECK(intercept_id->arr_len == 32);
29213         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
29214         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29215         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
29216         return tag_ptr(ret_conv, true);
29217 }
29218
29219 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
29220         LDKChannelManager this_arg_conv;
29221         this_arg_conv.inner = untag_ptr(this_arg);
29222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29224         this_arg_conv.is_owned = false;
29225         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
29226 }
29227
29228 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
29229         LDKChannelManager this_arg_conv;
29230         this_arg_conv.inner = untag_ptr(this_arg);
29231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29233         this_arg_conv.is_owned = false;
29234         ChannelManager_timer_tick_occurred(&this_arg_conv);
29235 }
29236
29237 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
29238         LDKChannelManager this_arg_conv;
29239         this_arg_conv.inner = untag_ptr(this_arg);
29240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29242         this_arg_conv.is_owned = false;
29243         uint8_t payment_hash_arr[32];
29244         CHECK(payment_hash->arr_len == 32);
29245         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
29246         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
29247         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
29248 }
29249
29250 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) {
29251         LDKChannelManager this_arg_conv;
29252         this_arg_conv.inner = untag_ptr(this_arg);
29253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29255         this_arg_conv.is_owned = false;
29256         uint8_t payment_hash_arr[32];
29257         CHECK(payment_hash->arr_len == 32);
29258         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
29259         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
29260         LDKFailureCode failure_code_conv = LDKFailureCode_from_js(failure_code);
29261         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
29262 }
29263
29264 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
29265         LDKChannelManager this_arg_conv;
29266         this_arg_conv.inner = untag_ptr(this_arg);
29267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29269         this_arg_conv.is_owned = false;
29270         LDKThirtyTwoBytes payment_preimage_ref;
29271         CHECK(payment_preimage->arr_len == 32);
29272         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
29273         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
29274 }
29275
29276 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
29277         LDKChannelManager this_arg_conv;
29278         this_arg_conv.inner = untag_ptr(this_arg);
29279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29281         this_arg_conv.is_owned = false;
29282         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29283         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
29284         return ret_arr;
29285 }
29286
29287 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) {
29288         LDKChannelManager this_arg_conv;
29289         this_arg_conv.inner = untag_ptr(this_arg);
29290         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29292         this_arg_conv.is_owned = false;
29293         uint8_t temporary_channel_id_arr[32];
29294         CHECK(temporary_channel_id->arr_len == 32);
29295         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
29296         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29297         LDKPublicKey counterparty_node_id_ref;
29298         CHECK(counterparty_node_id->arr_len == 33);
29299         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29300         LDKU128 user_channel_id_ref;
29301         CHECK(user_channel_id->arr_len == 16);
29302         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
29303         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29304         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
29305         return tag_ptr(ret_conv, true);
29306 }
29307
29308 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) {
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         uint8_t temporary_channel_id_arr[32];
29315         CHECK(temporary_channel_id->arr_len == 32);
29316         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
29317         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29318         LDKPublicKey counterparty_node_id_ref;
29319         CHECK(counterparty_node_id->arr_len == 33);
29320         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29321         LDKU128 user_channel_id_ref;
29322         CHECK(user_channel_id->arr_len == 16);
29323         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
29324         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29325         *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);
29326         return tag_ptr(ret_conv, true);
29327 }
29328
29329 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) {
29330         LDKChannelManager this_arg_conv;
29331         this_arg_conv.inner = untag_ptr(this_arg);
29332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29334         this_arg_conv.is_owned = false;
29335         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29336         CHECK_ACCESS(min_value_msat_ptr);
29337         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29338         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29339         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
29340         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
29341         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
29342         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
29343         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
29344         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
29345         return tag_ptr(ret_conv, true);
29346 }
29347
29348 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) {
29349         LDKChannelManager this_arg_conv;
29350         this_arg_conv.inner = untag_ptr(this_arg);
29351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29353         this_arg_conv.is_owned = false;
29354         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29355         CHECK_ACCESS(min_value_msat_ptr);
29356         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29357         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29358         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
29359         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
29360         return tag_ptr(ret_conv, true);
29361 }
29362
29363 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) {
29364         LDKChannelManager this_arg_conv;
29365         this_arg_conv.inner = untag_ptr(this_arg);
29366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29368         this_arg_conv.is_owned = false;
29369         LDKThirtyTwoBytes payment_hash_ref;
29370         CHECK(payment_hash->arr_len == 32);
29371         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29372         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29373         CHECK_ACCESS(min_value_msat_ptr);
29374         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29375         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29376         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
29377         CHECK_ACCESS(min_final_cltv_expiry_ptr);
29378         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
29379         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
29380         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
29381         *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);
29382         return tag_ptr(ret_conv, true);
29383 }
29384
29385 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) {
29386         LDKChannelManager this_arg_conv;
29387         this_arg_conv.inner = untag_ptr(this_arg);
29388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29390         this_arg_conv.is_owned = false;
29391         LDKThirtyTwoBytes payment_hash_ref;
29392         CHECK(payment_hash->arr_len == 32);
29393         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29394         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29395         CHECK_ACCESS(min_value_msat_ptr);
29396         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29397         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29398         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
29399         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
29400         return tag_ptr(ret_conv, true);
29401 }
29402
29403 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) {
29404         LDKChannelManager this_arg_conv;
29405         this_arg_conv.inner = untag_ptr(this_arg);
29406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29408         this_arg_conv.is_owned = false;
29409         LDKThirtyTwoBytes payment_hash_ref;
29410         CHECK(payment_hash->arr_len == 32);
29411         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29412         LDKThirtyTwoBytes payment_secret_ref;
29413         CHECK(payment_secret->arr_len == 32);
29414         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
29415         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
29416         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
29417         return tag_ptr(ret_conv, true);
29418 }
29419
29420 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
29421         LDKChannelManager this_arg_conv;
29422         this_arg_conv.inner = untag_ptr(this_arg);
29423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29425         this_arg_conv.is_owned = false;
29426         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
29427         return ret_conv;
29428 }
29429
29430 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
29431         LDKChannelManager this_arg_conv;
29432         this_arg_conv.inner = untag_ptr(this_arg);
29433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29435         this_arg_conv.is_owned = false;
29436         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
29437         uint64_t ret_ref = 0;
29438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29440         return ret_ref;
29441 }
29442
29443 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
29444         LDKChannelManager this_arg_conv;
29445         this_arg_conv.inner = untag_ptr(this_arg);
29446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29448         this_arg_conv.is_owned = false;
29449         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
29450         return ret_conv;
29451 }
29452
29453 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
29454         LDKChannelManager this_arg_conv;
29455         this_arg_conv.inner = untag_ptr(this_arg);
29456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29458         this_arg_conv.is_owned = false;
29459         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
29460         uint64_t ret_ref = 0;
29461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29463         return ret_ref;
29464 }
29465
29466 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
29467         LDKChannelManager this_arg_conv;
29468         this_arg_conv.inner = untag_ptr(this_arg);
29469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29471         this_arg_conv.is_owned = false;
29472         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
29473         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
29474         return tag_ptr(ret_ret, true);
29475 }
29476
29477 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
29478         LDKChannelManager this_arg_conv;
29479         this_arg_conv.inner = untag_ptr(this_arg);
29480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29482         this_arg_conv.is_owned = false;
29483         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
29484         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
29485         return tag_ptr(ret_ret, true);
29486 }
29487
29488 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
29489         LDKChannelManager this_arg_conv;
29490         this_arg_conv.inner = untag_ptr(this_arg);
29491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29493         this_arg_conv.is_owned = false;
29494         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
29495         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
29496         return tag_ptr(ret_ret, true);
29497 }
29498
29499 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
29500         LDKChannelManager this_arg_conv;
29501         this_arg_conv.inner = untag_ptr(this_arg);
29502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29504         this_arg_conv.is_owned = false;
29505         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
29506         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
29507         return tag_ptr(ret_ret, true);
29508 }
29509
29510 uint64_t  __attribute__((export_name("TS_ChannelManager_get_persistable_update_future"))) TS_ChannelManager_get_persistable_update_future(uint64_t this_arg) {
29511         LDKChannelManager this_arg_conv;
29512         this_arg_conv.inner = untag_ptr(this_arg);
29513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29515         this_arg_conv.is_owned = false;
29516         LDKFuture ret_var = ChannelManager_get_persistable_update_future(&this_arg_conv);
29517         uint64_t ret_ref = 0;
29518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29520         return ret_ref;
29521 }
29522
29523 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
29524         LDKChannelManager this_arg_conv;
29525         this_arg_conv.inner = untag_ptr(this_arg);
29526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29528         this_arg_conv.is_owned = false;
29529         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
29530         uint64_t ret_ref = 0;
29531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29533         return ret_ref;
29534 }
29535
29536 uint64_t  __attribute__((export_name("TS_ChannelManager_node_features"))) TS_ChannelManager_node_features(uint64_t this_arg) {
29537         LDKChannelManager this_arg_conv;
29538         this_arg_conv.inner = untag_ptr(this_arg);
29539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29541         this_arg_conv.is_owned = false;
29542         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
29543         uint64_t ret_ref = 0;
29544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29546         return ret_ref;
29547 }
29548
29549 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_features"))) TS_ChannelManager_channel_features(uint64_t this_arg) {
29550         LDKChannelManager this_arg_conv;
29551         this_arg_conv.inner = untag_ptr(this_arg);
29552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29554         this_arg_conv.is_owned = false;
29555         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
29556         uint64_t ret_ref = 0;
29557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29559         return ret_ref;
29560 }
29561
29562 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_type_features"))) TS_ChannelManager_channel_type_features(uint64_t this_arg) {
29563         LDKChannelManager this_arg_conv;
29564         this_arg_conv.inner = untag_ptr(this_arg);
29565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29567         this_arg_conv.is_owned = false;
29568         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
29569         uint64_t ret_ref = 0;
29570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29572         return ret_ref;
29573 }
29574
29575 uint64_t  __attribute__((export_name("TS_ChannelManager_init_features"))) TS_ChannelManager_init_features(uint64_t this_arg) {
29576         LDKChannelManager this_arg_conv;
29577         this_arg_conv.inner = untag_ptr(this_arg);
29578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29580         this_arg_conv.is_owned = false;
29581         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
29582         uint64_t ret_ref = 0;
29583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29585         return ret_ref;
29586 }
29587
29588 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(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         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
29595         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
29596         return tag_ptr(ret_ret, true);
29597 }
29598
29599 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features(uint64_t _config) {
29600         LDKUserConfig _config_conv;
29601         _config_conv.inner = untag_ptr(_config);
29602         _config_conv.is_owned = ptr_is_owned(_config);
29603         CHECK_INNER_FIELD_ACCESS_OR_NULL(_config_conv);
29604         _config_conv.is_owned = false;
29605         LDKInitFeatures ret_var = provided_init_features(&_config_conv);
29606         uint64_t ret_ref = 0;
29607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29609         return ret_ref;
29610 }
29611
29612 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
29613         LDKCounterpartyForwardingInfo obj_conv;
29614         obj_conv.inner = untag_ptr(obj);
29615         obj_conv.is_owned = ptr_is_owned(obj);
29616         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29617         obj_conv.is_owned = false;
29618         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
29619         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29620         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29621         CVec_u8Z_free(ret_var);
29622         return ret_arr;
29623 }
29624
29625 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
29626         LDKu8slice ser_ref;
29627         ser_ref.datalen = ser->arr_len;
29628         ser_ref.data = ser->elems;
29629         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
29630         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
29631         FREE(ser);
29632         return tag_ptr(ret_conv, true);
29633 }
29634
29635 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
29636         LDKChannelCounterparty obj_conv;
29637         obj_conv.inner = untag_ptr(obj);
29638         obj_conv.is_owned = ptr_is_owned(obj);
29639         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29640         obj_conv.is_owned = false;
29641         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
29642         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29643         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29644         CVec_u8Z_free(ret_var);
29645         return ret_arr;
29646 }
29647
29648 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
29649         LDKu8slice ser_ref;
29650         ser_ref.datalen = ser->arr_len;
29651         ser_ref.data = ser->elems;
29652         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
29653         *ret_conv = ChannelCounterparty_read(ser_ref);
29654         FREE(ser);
29655         return tag_ptr(ret_conv, true);
29656 }
29657
29658 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
29659         LDKChannelDetails obj_conv;
29660         obj_conv.inner = untag_ptr(obj);
29661         obj_conv.is_owned = ptr_is_owned(obj);
29662         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29663         obj_conv.is_owned = false;
29664         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
29665         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29666         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29667         CVec_u8Z_free(ret_var);
29668         return ret_arr;
29669 }
29670
29671 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
29672         LDKu8slice ser_ref;
29673         ser_ref.datalen = ser->arr_len;
29674         ser_ref.data = ser->elems;
29675         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
29676         *ret_conv = ChannelDetails_read(ser_ref);
29677         FREE(ser);
29678         return tag_ptr(ret_conv, true);
29679 }
29680
29681 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
29682         LDKPhantomRouteHints obj_conv;
29683         obj_conv.inner = untag_ptr(obj);
29684         obj_conv.is_owned = ptr_is_owned(obj);
29685         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29686         obj_conv.is_owned = false;
29687         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
29688         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29689         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29690         CVec_u8Z_free(ret_var);
29691         return ret_arr;
29692 }
29693
29694 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
29695         LDKu8slice ser_ref;
29696         ser_ref.datalen = ser->arr_len;
29697         ser_ref.data = ser->elems;
29698         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
29699         *ret_conv = PhantomRouteHints_read(ser_ref);
29700         FREE(ser);
29701         return tag_ptr(ret_conv, true);
29702 }
29703
29704 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
29705         LDKChannelManager obj_conv;
29706         obj_conv.inner = untag_ptr(obj);
29707         obj_conv.is_owned = ptr_is_owned(obj);
29708         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29709         obj_conv.is_owned = false;
29710         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
29711         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29712         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29713         CVec_u8Z_free(ret_var);
29714         return ret_arr;
29715 }
29716
29717 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
29718         LDKChannelManagerReadArgs this_obj_conv;
29719         this_obj_conv.inner = untag_ptr(this_obj);
29720         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29722         ChannelManagerReadArgs_free(this_obj_conv);
29723 }
29724
29725 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_entropy_source"))) TS_ChannelManagerReadArgs_get_entropy_source(uint64_t this_ptr) {
29726         LDKChannelManagerReadArgs this_ptr_conv;
29727         this_ptr_conv.inner = untag_ptr(this_ptr);
29728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29730         this_ptr_conv.is_owned = false;
29731         // WARNING: This object doesn't live past this scope, needs clone!
29732         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
29733         return ret_ret;
29734 }
29735
29736 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_entropy_source"))) TS_ChannelManagerReadArgs_set_entropy_source(uint64_t this_ptr, uint64_t val) {
29737         LDKChannelManagerReadArgs this_ptr_conv;
29738         this_ptr_conv.inner = untag_ptr(this_ptr);
29739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29741         this_ptr_conv.is_owned = false;
29742         void* val_ptr = untag_ptr(val);
29743         CHECK_ACCESS(val_ptr);
29744         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
29745         if (val_conv.free == LDKEntropySource_JCalls_free) {
29746                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29747                 LDKEntropySource_JCalls_cloned(&val_conv);
29748         }
29749         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
29750 }
29751
29752 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_node_signer"))) TS_ChannelManagerReadArgs_get_node_signer(uint64_t this_ptr) {
29753         LDKChannelManagerReadArgs this_ptr_conv;
29754         this_ptr_conv.inner = untag_ptr(this_ptr);
29755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29757         this_ptr_conv.is_owned = false;
29758         // WARNING: This object doesn't live past this scope, needs clone!
29759         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
29760         return ret_ret;
29761 }
29762
29763 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_node_signer"))) TS_ChannelManagerReadArgs_set_node_signer(uint64_t this_ptr, uint64_t val) {
29764         LDKChannelManagerReadArgs this_ptr_conv;
29765         this_ptr_conv.inner = untag_ptr(this_ptr);
29766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29768         this_ptr_conv.is_owned = false;
29769         void* val_ptr = untag_ptr(val);
29770         CHECK_ACCESS(val_ptr);
29771         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
29772         if (val_conv.free == LDKNodeSigner_JCalls_free) {
29773                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29774                 LDKNodeSigner_JCalls_cloned(&val_conv);
29775         }
29776         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
29777 }
29778
29779 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_signer_provider"))) TS_ChannelManagerReadArgs_get_signer_provider(uint64_t this_ptr) {
29780         LDKChannelManagerReadArgs this_ptr_conv;
29781         this_ptr_conv.inner = untag_ptr(this_ptr);
29782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29784         this_ptr_conv.is_owned = false;
29785         // WARNING: This object doesn't live past this scope, needs clone!
29786         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
29787         return ret_ret;
29788 }
29789
29790 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_signer_provider"))) TS_ChannelManagerReadArgs_set_signer_provider(uint64_t this_ptr, uint64_t val) {
29791         LDKChannelManagerReadArgs this_ptr_conv;
29792         this_ptr_conv.inner = untag_ptr(this_ptr);
29793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29795         this_ptr_conv.is_owned = false;
29796         void* val_ptr = untag_ptr(val);
29797         CHECK_ACCESS(val_ptr);
29798         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
29799         if (val_conv.free == LDKSignerProvider_JCalls_free) {
29800                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29801                 LDKSignerProvider_JCalls_cloned(&val_conv);
29802         }
29803         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
29804 }
29805
29806 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
29807         LDKChannelManagerReadArgs this_ptr_conv;
29808         this_ptr_conv.inner = untag_ptr(this_ptr);
29809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29811         this_ptr_conv.is_owned = false;
29812         // WARNING: This object doesn't live past this scope, needs clone!
29813         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
29814         return ret_ret;
29815 }
29816
29817 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
29818         LDKChannelManagerReadArgs this_ptr_conv;
29819         this_ptr_conv.inner = untag_ptr(this_ptr);
29820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29822         this_ptr_conv.is_owned = false;
29823         void* val_ptr = untag_ptr(val);
29824         CHECK_ACCESS(val_ptr);
29825         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
29826         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
29827                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29828                 LDKFeeEstimator_JCalls_cloned(&val_conv);
29829         }
29830         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
29831 }
29832
29833 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
29834         LDKChannelManagerReadArgs this_ptr_conv;
29835         this_ptr_conv.inner = untag_ptr(this_ptr);
29836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29838         this_ptr_conv.is_owned = false;
29839         // WARNING: This object doesn't live past this scope, needs clone!
29840         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
29841         return ret_ret;
29842 }
29843
29844 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
29845         LDKChannelManagerReadArgs this_ptr_conv;
29846         this_ptr_conv.inner = untag_ptr(this_ptr);
29847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29849         this_ptr_conv.is_owned = false;
29850         void* val_ptr = untag_ptr(val);
29851         CHECK_ACCESS(val_ptr);
29852         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
29853         if (val_conv.free == LDKWatch_JCalls_free) {
29854                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29855                 LDKWatch_JCalls_cloned(&val_conv);
29856         }
29857         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
29858 }
29859
29860 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
29861         LDKChannelManagerReadArgs this_ptr_conv;
29862         this_ptr_conv.inner = untag_ptr(this_ptr);
29863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29865         this_ptr_conv.is_owned = false;
29866         // WARNING: This object doesn't live past this scope, needs clone!
29867         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
29868         return ret_ret;
29869 }
29870
29871 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
29872         LDKChannelManagerReadArgs this_ptr_conv;
29873         this_ptr_conv.inner = untag_ptr(this_ptr);
29874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29876         this_ptr_conv.is_owned = false;
29877         void* val_ptr = untag_ptr(val);
29878         CHECK_ACCESS(val_ptr);
29879         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
29880         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
29881                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29882                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
29883         }
29884         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
29885 }
29886
29887 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_router"))) TS_ChannelManagerReadArgs_get_router(uint64_t this_ptr) {
29888         LDKChannelManagerReadArgs this_ptr_conv;
29889         this_ptr_conv.inner = untag_ptr(this_ptr);
29890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29892         this_ptr_conv.is_owned = false;
29893         // WARNING: This object doesn't live past this scope, needs clone!
29894         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
29895         return ret_ret;
29896 }
29897
29898 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_router"))) TS_ChannelManagerReadArgs_set_router(uint64_t this_ptr, uint64_t val) {
29899         LDKChannelManagerReadArgs this_ptr_conv;
29900         this_ptr_conv.inner = untag_ptr(this_ptr);
29901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29903         this_ptr_conv.is_owned = false;
29904         void* val_ptr = untag_ptr(val);
29905         CHECK_ACCESS(val_ptr);
29906         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
29907         if (val_conv.free == LDKRouter_JCalls_free) {
29908                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29909                 LDKRouter_JCalls_cloned(&val_conv);
29910         }
29911         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
29912 }
29913
29914 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
29915         LDKChannelManagerReadArgs this_ptr_conv;
29916         this_ptr_conv.inner = untag_ptr(this_ptr);
29917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29919         this_ptr_conv.is_owned = false;
29920         // WARNING: This object doesn't live past this scope, needs clone!
29921         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
29922         return ret_ret;
29923 }
29924
29925 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
29926         LDKChannelManagerReadArgs this_ptr_conv;
29927         this_ptr_conv.inner = untag_ptr(this_ptr);
29928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29930         this_ptr_conv.is_owned = false;
29931         void* val_ptr = untag_ptr(val);
29932         CHECK_ACCESS(val_ptr);
29933         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
29934         if (val_conv.free == LDKLogger_JCalls_free) {
29935                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29936                 LDKLogger_JCalls_cloned(&val_conv);
29937         }
29938         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
29939 }
29940
29941 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
29942         LDKChannelManagerReadArgs this_ptr_conv;
29943         this_ptr_conv.inner = untag_ptr(this_ptr);
29944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29946         this_ptr_conv.is_owned = false;
29947         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
29948         uint64_t ret_ref = 0;
29949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29951         return ret_ref;
29952 }
29953
29954 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
29955         LDKChannelManagerReadArgs this_ptr_conv;
29956         this_ptr_conv.inner = untag_ptr(this_ptr);
29957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29959         this_ptr_conv.is_owned = false;
29960         LDKUserConfig val_conv;
29961         val_conv.inner = untag_ptr(val);
29962         val_conv.is_owned = ptr_is_owned(val);
29963         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29964         val_conv = UserConfig_clone(&val_conv);
29965         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
29966 }
29967
29968 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) {
29969         void* entropy_source_ptr = untag_ptr(entropy_source);
29970         CHECK_ACCESS(entropy_source_ptr);
29971         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
29972         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
29973                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29974                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
29975         }
29976         void* node_signer_ptr = untag_ptr(node_signer);
29977         CHECK_ACCESS(node_signer_ptr);
29978         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
29979         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
29980                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29981                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
29982         }
29983         void* signer_provider_ptr = untag_ptr(signer_provider);
29984         CHECK_ACCESS(signer_provider_ptr);
29985         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
29986         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
29987                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29988                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
29989         }
29990         void* fee_estimator_ptr = untag_ptr(fee_estimator);
29991         CHECK_ACCESS(fee_estimator_ptr);
29992         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
29993         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
29994                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29995                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
29996         }
29997         void* chain_monitor_ptr = untag_ptr(chain_monitor);
29998         CHECK_ACCESS(chain_monitor_ptr);
29999         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
30000         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
30001                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30002                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
30003         }
30004         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
30005         CHECK_ACCESS(tx_broadcaster_ptr);
30006         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
30007         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30008                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30009                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
30010         }
30011         void* router_ptr = untag_ptr(router);
30012         CHECK_ACCESS(router_ptr);
30013         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
30014         if (router_conv.free == LDKRouter_JCalls_free) {
30015                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30016                 LDKRouter_JCalls_cloned(&router_conv);
30017         }
30018         void* logger_ptr = untag_ptr(logger);
30019         CHECK_ACCESS(logger_ptr);
30020         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30021         if (logger_conv.free == LDKLogger_JCalls_free) {
30022                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30023                 LDKLogger_JCalls_cloned(&logger_conv);
30024         }
30025         LDKUserConfig default_config_conv;
30026         default_config_conv.inner = untag_ptr(default_config);
30027         default_config_conv.is_owned = ptr_is_owned(default_config);
30028         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
30029         default_config_conv = UserConfig_clone(&default_config_conv);
30030         LDKCVec_ChannelMonitorZ channel_monitors_constr;
30031         channel_monitors_constr.datalen = channel_monitors->arr_len;
30032         if (channel_monitors_constr.datalen > 0)
30033                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
30034         else
30035                 channel_monitors_constr.data = NULL;
30036         uint64_t* channel_monitors_vals = channel_monitors->elems;
30037         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
30038                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
30039                 LDKChannelMonitor channel_monitors_conv_16_conv;
30040                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
30041                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
30042                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
30043                 channel_monitors_conv_16_conv.is_owned = false;
30044                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
30045         }
30046         FREE(channel_monitors);
30047         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);
30048         uint64_t ret_ref = 0;
30049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30051         return ret_ref;
30052 }
30053
30054 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
30055         LDKu8slice ser_ref;
30056         ser_ref.datalen = ser->arr_len;
30057         ser_ref.data = ser->elems;
30058         LDKChannelManagerReadArgs arg_conv;
30059         arg_conv.inner = untag_ptr(arg);
30060         arg_conv.is_owned = ptr_is_owned(arg);
30061         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30062         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
30063         
30064         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
30065         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
30066         FREE(ser);
30067         return tag_ptr(ret_conv, true);
30068 }
30069
30070 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
30071         LDKExpandedKey this_obj_conv;
30072         this_obj_conv.inner = untag_ptr(this_obj);
30073         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30075         ExpandedKey_free(this_obj_conv);
30076 }
30077
30078 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
30079         uint8_t key_material_arr[32];
30080         CHECK(key_material->arr_len == 32);
30081         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
30082         uint8_t (*key_material_ref)[32] = &key_material_arr;
30083         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
30084         uint64_t ret_ref = 0;
30085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30087         return ret_ref;
30088 }
30089
30090 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) {
30091         LDKExpandedKey keys_conv;
30092         keys_conv.inner = untag_ptr(keys);
30093         keys_conv.is_owned = ptr_is_owned(keys);
30094         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30095         keys_conv.is_owned = false;
30096         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30097         CHECK_ACCESS(min_value_msat_ptr);
30098         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30099         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30100         void* entropy_source_ptr = untag_ptr(entropy_source);
30101         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
30102         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
30103         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
30104         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
30105         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
30106         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
30107         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
30108         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
30109         return tag_ptr(ret_conv, true);
30110 }
30111
30112 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) {
30113         LDKExpandedKey keys_conv;
30114         keys_conv.inner = untag_ptr(keys);
30115         keys_conv.is_owned = ptr_is_owned(keys);
30116         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30117         keys_conv.is_owned = false;
30118         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30119         CHECK_ACCESS(min_value_msat_ptr);
30120         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30121         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30122         LDKThirtyTwoBytes payment_hash_ref;
30123         CHECK(payment_hash->arr_len == 32);
30124         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
30125         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
30126         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
30127         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
30128         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
30129         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
30130         *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);
30131         return tag_ptr(ret_conv, true);
30132 }
30133
30134 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
30135         if (!ptr_is_owned(this_ptr)) return;
30136         void* this_ptr_ptr = untag_ptr(this_ptr);
30137         CHECK_ACCESS(this_ptr_ptr);
30138         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
30139         FREE(untag_ptr(this_ptr));
30140         DecodeError_free(this_ptr_conv);
30141 }
30142
30143 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
30144         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30145         *ret_copy = DecodeError_clone(arg);
30146         uint64_t ret_ref = tag_ptr(ret_copy, true);
30147         return ret_ref;
30148 }
30149 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
30150         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
30151         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
30152         return ret_conv;
30153 }
30154
30155 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
30156         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
30157         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30158         *ret_copy = DecodeError_clone(orig_conv);
30159         uint64_t ret_ref = tag_ptr(ret_copy, true);
30160         return ret_ref;
30161 }
30162
30163 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
30164         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30165         *ret_copy = DecodeError_unknown_version();
30166         uint64_t ret_ref = tag_ptr(ret_copy, true);
30167         return ret_ref;
30168 }
30169
30170 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
30171         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30172         *ret_copy = DecodeError_unknown_required_feature();
30173         uint64_t ret_ref = tag_ptr(ret_copy, true);
30174         return ret_ref;
30175 }
30176
30177 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
30178         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30179         *ret_copy = DecodeError_invalid_value();
30180         uint64_t ret_ref = tag_ptr(ret_copy, true);
30181         return ret_ref;
30182 }
30183
30184 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
30185         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30186         *ret_copy = DecodeError_short_read();
30187         uint64_t ret_ref = tag_ptr(ret_copy, true);
30188         return ret_ref;
30189 }
30190
30191 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
30192         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30193         *ret_copy = DecodeError_bad_length_descriptor();
30194         uint64_t ret_ref = tag_ptr(ret_copy, true);
30195         return ret_ref;
30196 }
30197
30198 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
30199         LDKIOError a_conv = LDKIOError_from_js(a);
30200         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30201         *ret_copy = DecodeError_io(a_conv);
30202         uint64_t ret_ref = tag_ptr(ret_copy, true);
30203         return ret_ref;
30204 }
30205
30206 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
30207         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30208         *ret_copy = DecodeError_unsupported_compression();
30209         uint64_t ret_ref = tag_ptr(ret_copy, true);
30210         return ret_ref;
30211 }
30212
30213 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
30214         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
30215         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
30216         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
30217         return ret_conv;
30218 }
30219
30220 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
30221         LDKInit this_obj_conv;
30222         this_obj_conv.inner = untag_ptr(this_obj);
30223         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30225         Init_free(this_obj_conv);
30226 }
30227
30228 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
30229         LDKInit this_ptr_conv;
30230         this_ptr_conv.inner = untag_ptr(this_ptr);
30231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30233         this_ptr_conv.is_owned = false;
30234         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
30235         uint64_t ret_ref = 0;
30236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30238         return ret_ref;
30239 }
30240
30241 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
30242         LDKInit this_ptr_conv;
30243         this_ptr_conv.inner = untag_ptr(this_ptr);
30244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30246         this_ptr_conv.is_owned = false;
30247         LDKInitFeatures val_conv;
30248         val_conv.inner = untag_ptr(val);
30249         val_conv.is_owned = ptr_is_owned(val);
30250         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30251         val_conv = InitFeatures_clone(&val_conv);
30252         Init_set_features(&this_ptr_conv, val_conv);
30253 }
30254
30255 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
30256         LDKInit this_ptr_conv;
30257         this_ptr_conv.inner = untag_ptr(this_ptr);
30258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30260         this_ptr_conv.is_owned = false;
30261         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
30262         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
30263         uint64_t ret_ref = tag_ptr(ret_copy, true);
30264         return ret_ref;
30265 }
30266
30267 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
30268         LDKInit this_ptr_conv;
30269         this_ptr_conv.inner = untag_ptr(this_ptr);
30270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30272         this_ptr_conv.is_owned = false;
30273         void* val_ptr = untag_ptr(val);
30274         CHECK_ACCESS(val_ptr);
30275         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
30276         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
30277         Init_set_remote_network_address(&this_ptr_conv, val_conv);
30278 }
30279
30280 uint64_t  __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint64_t features_arg, uint64_t remote_network_address_arg) {
30281         LDKInitFeatures features_arg_conv;
30282         features_arg_conv.inner = untag_ptr(features_arg);
30283         features_arg_conv.is_owned = ptr_is_owned(features_arg);
30284         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
30285         features_arg_conv = InitFeatures_clone(&features_arg_conv);
30286         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
30287         CHECK_ACCESS(remote_network_address_arg_ptr);
30288         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
30289         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
30290         uint64_t ret_ref = 0;
30291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30293         return ret_ref;
30294 }
30295
30296 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
30297         LDKInit ret_var = Init_clone(arg);
30298         uint64_t ret_ref = 0;
30299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30301         return ret_ref;
30302 }
30303 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
30304         LDKInit arg_conv;
30305         arg_conv.inner = untag_ptr(arg);
30306         arg_conv.is_owned = ptr_is_owned(arg);
30307         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30308         arg_conv.is_owned = false;
30309         int64_t ret_conv = Init_clone_ptr(&arg_conv);
30310         return ret_conv;
30311 }
30312
30313 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
30314         LDKInit orig_conv;
30315         orig_conv.inner = untag_ptr(orig);
30316         orig_conv.is_owned = ptr_is_owned(orig);
30317         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30318         orig_conv.is_owned = false;
30319         LDKInit ret_var = Init_clone(&orig_conv);
30320         uint64_t ret_ref = 0;
30321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30323         return ret_ref;
30324 }
30325
30326 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
30327         LDKInit a_conv;
30328         a_conv.inner = untag_ptr(a);
30329         a_conv.is_owned = ptr_is_owned(a);
30330         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30331         a_conv.is_owned = false;
30332         LDKInit b_conv;
30333         b_conv.inner = untag_ptr(b);
30334         b_conv.is_owned = ptr_is_owned(b);
30335         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30336         b_conv.is_owned = false;
30337         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
30338         return ret_conv;
30339 }
30340
30341 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
30342         LDKErrorMessage this_obj_conv;
30343         this_obj_conv.inner = untag_ptr(this_obj);
30344         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30346         ErrorMessage_free(this_obj_conv);
30347 }
30348
30349 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
30350         LDKErrorMessage this_ptr_conv;
30351         this_ptr_conv.inner = untag_ptr(this_ptr);
30352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30354         this_ptr_conv.is_owned = false;
30355         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30356         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
30357         return ret_arr;
30358 }
30359
30360 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30361         LDKErrorMessage this_ptr_conv;
30362         this_ptr_conv.inner = untag_ptr(this_ptr);
30363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30365         this_ptr_conv.is_owned = false;
30366         LDKThirtyTwoBytes val_ref;
30367         CHECK(val->arr_len == 32);
30368         memcpy(val_ref.data, val->elems, 32); FREE(val);
30369         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
30370 }
30371
30372 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
30373         LDKErrorMessage this_ptr_conv;
30374         this_ptr_conv.inner = untag_ptr(this_ptr);
30375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30377         this_ptr_conv.is_owned = false;
30378         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
30379         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30380         Str_free(ret_str);
30381         return ret_conv;
30382 }
30383
30384 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
30385         LDKErrorMessage this_ptr_conv;
30386         this_ptr_conv.inner = untag_ptr(this_ptr);
30387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30389         this_ptr_conv.is_owned = false;
30390         LDKStr val_conv = str_ref_to_owned_c(val);
30391         ErrorMessage_set_data(&this_ptr_conv, val_conv);
30392 }
30393
30394 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
30395         LDKThirtyTwoBytes channel_id_arg_ref;
30396         CHECK(channel_id_arg->arr_len == 32);
30397         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30398         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
30399         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
30400         uint64_t ret_ref = 0;
30401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30403         return ret_ref;
30404 }
30405
30406 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
30407         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
30408         uint64_t ret_ref = 0;
30409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30411         return ret_ref;
30412 }
30413 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
30414         LDKErrorMessage arg_conv;
30415         arg_conv.inner = untag_ptr(arg);
30416         arg_conv.is_owned = ptr_is_owned(arg);
30417         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30418         arg_conv.is_owned = false;
30419         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
30420         return ret_conv;
30421 }
30422
30423 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
30424         LDKErrorMessage orig_conv;
30425         orig_conv.inner = untag_ptr(orig);
30426         orig_conv.is_owned = ptr_is_owned(orig);
30427         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30428         orig_conv.is_owned = false;
30429         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
30430         uint64_t ret_ref = 0;
30431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30433         return ret_ref;
30434 }
30435
30436 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
30437         LDKErrorMessage a_conv;
30438         a_conv.inner = untag_ptr(a);
30439         a_conv.is_owned = ptr_is_owned(a);
30440         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30441         a_conv.is_owned = false;
30442         LDKErrorMessage b_conv;
30443         b_conv.inner = untag_ptr(b);
30444         b_conv.is_owned = ptr_is_owned(b);
30445         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30446         b_conv.is_owned = false;
30447         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
30448         return ret_conv;
30449 }
30450
30451 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
30452         LDKWarningMessage this_obj_conv;
30453         this_obj_conv.inner = untag_ptr(this_obj);
30454         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30456         WarningMessage_free(this_obj_conv);
30457 }
30458
30459 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
30460         LDKWarningMessage this_ptr_conv;
30461         this_ptr_conv.inner = untag_ptr(this_ptr);
30462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30464         this_ptr_conv.is_owned = false;
30465         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30466         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
30467         return ret_arr;
30468 }
30469
30470 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30471         LDKWarningMessage 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         LDKThirtyTwoBytes val_ref;
30477         CHECK(val->arr_len == 32);
30478         memcpy(val_ref.data, val->elems, 32); FREE(val);
30479         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
30480 }
30481
30482 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
30483         LDKWarningMessage 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 ret_str = WarningMessage_get_data(&this_ptr_conv);
30489         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30490         Str_free(ret_str);
30491         return ret_conv;
30492 }
30493
30494 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
30495         LDKWarningMessage this_ptr_conv;
30496         this_ptr_conv.inner = untag_ptr(this_ptr);
30497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30499         this_ptr_conv.is_owned = false;
30500         LDKStr val_conv = str_ref_to_owned_c(val);
30501         WarningMessage_set_data(&this_ptr_conv, val_conv);
30502 }
30503
30504 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
30505         LDKThirtyTwoBytes channel_id_arg_ref;
30506         CHECK(channel_id_arg->arr_len == 32);
30507         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30508         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
30509         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
30510         uint64_t ret_ref = 0;
30511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30513         return ret_ref;
30514 }
30515
30516 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
30517         LDKWarningMessage ret_var = WarningMessage_clone(arg);
30518         uint64_t ret_ref = 0;
30519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30521         return ret_ref;
30522 }
30523 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
30524         LDKWarningMessage arg_conv;
30525         arg_conv.inner = untag_ptr(arg);
30526         arg_conv.is_owned = ptr_is_owned(arg);
30527         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30528         arg_conv.is_owned = false;
30529         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
30530         return ret_conv;
30531 }
30532
30533 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
30534         LDKWarningMessage orig_conv;
30535         orig_conv.inner = untag_ptr(orig);
30536         orig_conv.is_owned = ptr_is_owned(orig);
30537         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30538         orig_conv.is_owned = false;
30539         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
30540         uint64_t ret_ref = 0;
30541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30543         return ret_ref;
30544 }
30545
30546 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
30547         LDKWarningMessage a_conv;
30548         a_conv.inner = untag_ptr(a);
30549         a_conv.is_owned = ptr_is_owned(a);
30550         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30551         a_conv.is_owned = false;
30552         LDKWarningMessage b_conv;
30553         b_conv.inner = untag_ptr(b);
30554         b_conv.is_owned = ptr_is_owned(b);
30555         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30556         b_conv.is_owned = false;
30557         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
30558         return ret_conv;
30559 }
30560
30561 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
30562         LDKPing this_obj_conv;
30563         this_obj_conv.inner = untag_ptr(this_obj);
30564         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30566         Ping_free(this_obj_conv);
30567 }
30568
30569 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
30570         LDKPing this_ptr_conv;
30571         this_ptr_conv.inner = untag_ptr(this_ptr);
30572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30574         this_ptr_conv.is_owned = false;
30575         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
30576         return ret_conv;
30577 }
30578
30579 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
30580         LDKPing this_ptr_conv;
30581         this_ptr_conv.inner = untag_ptr(this_ptr);
30582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30584         this_ptr_conv.is_owned = false;
30585         Ping_set_ponglen(&this_ptr_conv, val);
30586 }
30587
30588 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
30589         LDKPing this_ptr_conv;
30590         this_ptr_conv.inner = untag_ptr(this_ptr);
30591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30593         this_ptr_conv.is_owned = false;
30594         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
30595         return ret_conv;
30596 }
30597
30598 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
30599         LDKPing this_ptr_conv;
30600         this_ptr_conv.inner = untag_ptr(this_ptr);
30601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30603         this_ptr_conv.is_owned = false;
30604         Ping_set_byteslen(&this_ptr_conv, val);
30605 }
30606
30607 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
30608         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
30609         uint64_t ret_ref = 0;
30610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30612         return ret_ref;
30613 }
30614
30615 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
30616         LDKPing ret_var = Ping_clone(arg);
30617         uint64_t ret_ref = 0;
30618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30620         return ret_ref;
30621 }
30622 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
30623         LDKPing arg_conv;
30624         arg_conv.inner = untag_ptr(arg);
30625         arg_conv.is_owned = ptr_is_owned(arg);
30626         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30627         arg_conv.is_owned = false;
30628         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
30629         return ret_conv;
30630 }
30631
30632 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
30633         LDKPing orig_conv;
30634         orig_conv.inner = untag_ptr(orig);
30635         orig_conv.is_owned = ptr_is_owned(orig);
30636         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30637         orig_conv.is_owned = false;
30638         LDKPing ret_var = Ping_clone(&orig_conv);
30639         uint64_t ret_ref = 0;
30640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30642         return ret_ref;
30643 }
30644
30645 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
30646         LDKPing a_conv;
30647         a_conv.inner = untag_ptr(a);
30648         a_conv.is_owned = ptr_is_owned(a);
30649         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30650         a_conv.is_owned = false;
30651         LDKPing b_conv;
30652         b_conv.inner = untag_ptr(b);
30653         b_conv.is_owned = ptr_is_owned(b);
30654         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30655         b_conv.is_owned = false;
30656         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
30657         return ret_conv;
30658 }
30659
30660 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
30661         LDKPong this_obj_conv;
30662         this_obj_conv.inner = untag_ptr(this_obj);
30663         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30665         Pong_free(this_obj_conv);
30666 }
30667
30668 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
30669         LDKPong this_ptr_conv;
30670         this_ptr_conv.inner = untag_ptr(this_ptr);
30671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30673         this_ptr_conv.is_owned = false;
30674         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
30675         return ret_conv;
30676 }
30677
30678 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
30679         LDKPong this_ptr_conv;
30680         this_ptr_conv.inner = untag_ptr(this_ptr);
30681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30683         this_ptr_conv.is_owned = false;
30684         Pong_set_byteslen(&this_ptr_conv, val);
30685 }
30686
30687 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
30688         LDKPong ret_var = Pong_new(byteslen_arg);
30689         uint64_t ret_ref = 0;
30690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30692         return ret_ref;
30693 }
30694
30695 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
30696         LDKPong ret_var = Pong_clone(arg);
30697         uint64_t ret_ref = 0;
30698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30700         return ret_ref;
30701 }
30702 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
30703         LDKPong arg_conv;
30704         arg_conv.inner = untag_ptr(arg);
30705         arg_conv.is_owned = ptr_is_owned(arg);
30706         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30707         arg_conv.is_owned = false;
30708         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
30709         return ret_conv;
30710 }
30711
30712 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
30713         LDKPong orig_conv;
30714         orig_conv.inner = untag_ptr(orig);
30715         orig_conv.is_owned = ptr_is_owned(orig);
30716         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30717         orig_conv.is_owned = false;
30718         LDKPong ret_var = Pong_clone(&orig_conv);
30719         uint64_t ret_ref = 0;
30720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30722         return ret_ref;
30723 }
30724
30725 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
30726         LDKPong a_conv;
30727         a_conv.inner = untag_ptr(a);
30728         a_conv.is_owned = ptr_is_owned(a);
30729         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30730         a_conv.is_owned = false;
30731         LDKPong b_conv;
30732         b_conv.inner = untag_ptr(b);
30733         b_conv.is_owned = ptr_is_owned(b);
30734         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30735         b_conv.is_owned = false;
30736         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
30737         return ret_conv;
30738 }
30739
30740 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
30741         LDKOpenChannel this_obj_conv;
30742         this_obj_conv.inner = untag_ptr(this_obj);
30743         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30745         OpenChannel_free(this_obj_conv);
30746 }
30747
30748 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
30749         LDKOpenChannel this_ptr_conv;
30750         this_ptr_conv.inner = untag_ptr(this_ptr);
30751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30753         this_ptr_conv.is_owned = false;
30754         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30755         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
30756         return ret_arr;
30757 }
30758
30759 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
30760         LDKOpenChannel this_ptr_conv;
30761         this_ptr_conv.inner = untag_ptr(this_ptr);
30762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30764         this_ptr_conv.is_owned = false;
30765         LDKThirtyTwoBytes val_ref;
30766         CHECK(val->arr_len == 32);
30767         memcpy(val_ref.data, val->elems, 32); FREE(val);
30768         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
30769 }
30770
30771 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
30772         LDKOpenChannel this_ptr_conv;
30773         this_ptr_conv.inner = untag_ptr(this_ptr);
30774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30776         this_ptr_conv.is_owned = false;
30777         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30778         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
30779         return ret_arr;
30780 }
30781
30782 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
30783         LDKOpenChannel this_ptr_conv;
30784         this_ptr_conv.inner = untag_ptr(this_ptr);
30785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30787         this_ptr_conv.is_owned = false;
30788         LDKThirtyTwoBytes val_ref;
30789         CHECK(val->arr_len == 32);
30790         memcpy(val_ref.data, val->elems, 32); FREE(val);
30791         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
30792 }
30793
30794 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
30795         LDKOpenChannel this_ptr_conv;
30796         this_ptr_conv.inner = untag_ptr(this_ptr);
30797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30799         this_ptr_conv.is_owned = false;
30800         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
30801         return ret_conv;
30802 }
30803
30804 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
30805         LDKOpenChannel this_ptr_conv;
30806         this_ptr_conv.inner = untag_ptr(this_ptr);
30807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30809         this_ptr_conv.is_owned = false;
30810         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
30811 }
30812
30813 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
30814         LDKOpenChannel this_ptr_conv;
30815         this_ptr_conv.inner = untag_ptr(this_ptr);
30816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30818         this_ptr_conv.is_owned = false;
30819         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
30820         return ret_conv;
30821 }
30822
30823 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
30824         LDKOpenChannel this_ptr_conv;
30825         this_ptr_conv.inner = untag_ptr(this_ptr);
30826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30828         this_ptr_conv.is_owned = false;
30829         OpenChannel_set_push_msat(&this_ptr_conv, val);
30830 }
30831
30832 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
30833         LDKOpenChannel this_ptr_conv;
30834         this_ptr_conv.inner = untag_ptr(this_ptr);
30835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30837         this_ptr_conv.is_owned = false;
30838         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
30839         return ret_conv;
30840 }
30841
30842 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
30843         LDKOpenChannel this_ptr_conv;
30844         this_ptr_conv.inner = untag_ptr(this_ptr);
30845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30847         this_ptr_conv.is_owned = false;
30848         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
30849 }
30850
30851 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) {
30852         LDKOpenChannel this_ptr_conv;
30853         this_ptr_conv.inner = untag_ptr(this_ptr);
30854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30856         this_ptr_conv.is_owned = false;
30857         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
30858         return ret_conv;
30859 }
30860
30861 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) {
30862         LDKOpenChannel this_ptr_conv;
30863         this_ptr_conv.inner = untag_ptr(this_ptr);
30864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30866         this_ptr_conv.is_owned = false;
30867         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30868 }
30869
30870 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
30871         LDKOpenChannel this_ptr_conv;
30872         this_ptr_conv.inner = untag_ptr(this_ptr);
30873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30875         this_ptr_conv.is_owned = false;
30876         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
30877         return ret_conv;
30878 }
30879
30880 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t 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         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
30887 }
30888
30889 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
30890         LDKOpenChannel this_ptr_conv;
30891         this_ptr_conv.inner = untag_ptr(this_ptr);
30892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30894         this_ptr_conv.is_owned = false;
30895         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
30896         return ret_conv;
30897 }
30898
30899 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
30900         LDKOpenChannel this_ptr_conv;
30901         this_ptr_conv.inner = untag_ptr(this_ptr);
30902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30904         this_ptr_conv.is_owned = false;
30905         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
30906 }
30907
30908 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
30909         LDKOpenChannel this_ptr_conv;
30910         this_ptr_conv.inner = untag_ptr(this_ptr);
30911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30913         this_ptr_conv.is_owned = false;
30914         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
30915         return ret_conv;
30916 }
30917
30918 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
30919         LDKOpenChannel this_ptr_conv;
30920         this_ptr_conv.inner = untag_ptr(this_ptr);
30921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30923         this_ptr_conv.is_owned = false;
30924         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
30925 }
30926
30927 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
30928         LDKOpenChannel this_ptr_conv;
30929         this_ptr_conv.inner = untag_ptr(this_ptr);
30930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30932         this_ptr_conv.is_owned = false;
30933         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
30934         return ret_conv;
30935 }
30936
30937 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
30938         LDKOpenChannel this_ptr_conv;
30939         this_ptr_conv.inner = untag_ptr(this_ptr);
30940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30942         this_ptr_conv.is_owned = false;
30943         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
30944 }
30945
30946 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
30947         LDKOpenChannel this_ptr_conv;
30948         this_ptr_conv.inner = untag_ptr(this_ptr);
30949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30951         this_ptr_conv.is_owned = false;
30952         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
30953         return ret_conv;
30954 }
30955
30956 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
30957         LDKOpenChannel this_ptr_conv;
30958         this_ptr_conv.inner = untag_ptr(this_ptr);
30959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30961         this_ptr_conv.is_owned = false;
30962         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
30963 }
30964
30965 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
30966         LDKOpenChannel this_ptr_conv;
30967         this_ptr_conv.inner = untag_ptr(this_ptr);
30968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30970         this_ptr_conv.is_owned = false;
30971         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30972         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
30973         return ret_arr;
30974 }
30975
30976 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
30977         LDKOpenChannel this_ptr_conv;
30978         this_ptr_conv.inner = untag_ptr(this_ptr);
30979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30981         this_ptr_conv.is_owned = false;
30982         LDKPublicKey val_ref;
30983         CHECK(val->arr_len == 33);
30984         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30985         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
30986 }
30987
30988 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
30989         LDKOpenChannel this_ptr_conv;
30990         this_ptr_conv.inner = untag_ptr(this_ptr);
30991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30993         this_ptr_conv.is_owned = false;
30994         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30995         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
30996         return ret_arr;
30997 }
30998
30999 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
31000         LDKOpenChannel this_ptr_conv;
31001         this_ptr_conv.inner = untag_ptr(this_ptr);
31002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31004         this_ptr_conv.is_owned = false;
31005         LDKPublicKey val_ref;
31006         CHECK(val->arr_len == 33);
31007         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31008         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31009 }
31010
31011 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
31012         LDKOpenChannel this_ptr_conv;
31013         this_ptr_conv.inner = untag_ptr(this_ptr);
31014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31016         this_ptr_conv.is_owned = false;
31017         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31018         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
31019         return ret_arr;
31020 }
31021
31022 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
31023         LDKOpenChannel this_ptr_conv;
31024         this_ptr_conv.inner = untag_ptr(this_ptr);
31025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31027         this_ptr_conv.is_owned = false;
31028         LDKPublicKey val_ref;
31029         CHECK(val->arr_len == 33);
31030         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31031         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
31032 }
31033
31034 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
31035         LDKOpenChannel this_ptr_conv;
31036         this_ptr_conv.inner = untag_ptr(this_ptr);
31037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31039         this_ptr_conv.is_owned = false;
31040         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31041         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
31042         return ret_arr;
31043 }
31044
31045 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
31046         LDKOpenChannel this_ptr_conv;
31047         this_ptr_conv.inner = untag_ptr(this_ptr);
31048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31050         this_ptr_conv.is_owned = false;
31051         LDKPublicKey val_ref;
31052         CHECK(val->arr_len == 33);
31053         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31054         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31055 }
31056
31057 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
31058         LDKOpenChannel this_ptr_conv;
31059         this_ptr_conv.inner = untag_ptr(this_ptr);
31060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31062         this_ptr_conv.is_owned = false;
31063         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31064         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
31065         return ret_arr;
31066 }
31067
31068 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
31069         LDKOpenChannel this_ptr_conv;
31070         this_ptr_conv.inner = untag_ptr(this_ptr);
31071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31073         this_ptr_conv.is_owned = false;
31074         LDKPublicKey val_ref;
31075         CHECK(val->arr_len == 33);
31076         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31077         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31078 }
31079
31080 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
31081         LDKOpenChannel this_ptr_conv;
31082         this_ptr_conv.inner = untag_ptr(this_ptr);
31083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31085         this_ptr_conv.is_owned = false;
31086         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31087         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31088         return ret_arr;
31089 }
31090
31091 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) {
31092         LDKOpenChannel this_ptr_conv;
31093         this_ptr_conv.inner = untag_ptr(this_ptr);
31094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31096         this_ptr_conv.is_owned = false;
31097         LDKPublicKey val_ref;
31098         CHECK(val->arr_len == 33);
31099         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31100         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31101 }
31102
31103 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
31104         LDKOpenChannel this_ptr_conv;
31105         this_ptr_conv.inner = untag_ptr(this_ptr);
31106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31108         this_ptr_conv.is_owned = false;
31109         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
31110         return ret_conv;
31111 }
31112
31113 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
31114         LDKOpenChannel this_ptr_conv;
31115         this_ptr_conv.inner = untag_ptr(this_ptr);
31116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31118         this_ptr_conv.is_owned = false;
31119         OpenChannel_set_channel_flags(&this_ptr_conv, val);
31120 }
31121
31122 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
31123         LDKOpenChannel this_ptr_conv;
31124         this_ptr_conv.inner = untag_ptr(this_ptr);
31125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31127         this_ptr_conv.is_owned = false;
31128         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
31129         uint64_t ret_ref = 0;
31130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31132         return ret_ref;
31133 }
31134
31135 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
31136         LDKOpenChannel this_ptr_conv;
31137         this_ptr_conv.inner = untag_ptr(this_ptr);
31138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31140         this_ptr_conv.is_owned = false;
31141         LDKChannelTypeFeatures val_conv;
31142         val_conv.inner = untag_ptr(val);
31143         val_conv.is_owned = ptr_is_owned(val);
31144         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31145         val_conv = ChannelTypeFeatures_clone(&val_conv);
31146         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
31147 }
31148
31149 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
31150         LDKOpenChannel ret_var = OpenChannel_clone(arg);
31151         uint64_t ret_ref = 0;
31152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31154         return ret_ref;
31155 }
31156 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
31157         LDKOpenChannel arg_conv;
31158         arg_conv.inner = untag_ptr(arg);
31159         arg_conv.is_owned = ptr_is_owned(arg);
31160         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31161         arg_conv.is_owned = false;
31162         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
31163         return ret_conv;
31164 }
31165
31166 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
31167         LDKOpenChannel orig_conv;
31168         orig_conv.inner = untag_ptr(orig);
31169         orig_conv.is_owned = ptr_is_owned(orig);
31170         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31171         orig_conv.is_owned = false;
31172         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
31173         uint64_t ret_ref = 0;
31174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31176         return ret_ref;
31177 }
31178
31179 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
31180         LDKOpenChannel a_conv;
31181         a_conv.inner = untag_ptr(a);
31182         a_conv.is_owned = ptr_is_owned(a);
31183         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31184         a_conv.is_owned = false;
31185         LDKOpenChannel b_conv;
31186         b_conv.inner = untag_ptr(b);
31187         b_conv.is_owned = ptr_is_owned(b);
31188         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31189         b_conv.is_owned = false;
31190         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
31191         return ret_conv;
31192 }
31193
31194 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
31195         LDKAcceptChannel this_obj_conv;
31196         this_obj_conv.inner = untag_ptr(this_obj);
31197         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31199         AcceptChannel_free(this_obj_conv);
31200 }
31201
31202 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
31203         LDKAcceptChannel this_ptr_conv;
31204         this_ptr_conv.inner = untag_ptr(this_ptr);
31205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31207         this_ptr_conv.is_owned = false;
31208         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31209         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
31210         return ret_arr;
31211 }
31212
31213 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
31214         LDKAcceptChannel this_ptr_conv;
31215         this_ptr_conv.inner = untag_ptr(this_ptr);
31216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31218         this_ptr_conv.is_owned = false;
31219         LDKThirtyTwoBytes val_ref;
31220         CHECK(val->arr_len == 32);
31221         memcpy(val_ref.data, val->elems, 32); FREE(val);
31222         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
31223 }
31224
31225 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
31226         LDKAcceptChannel this_ptr_conv;
31227         this_ptr_conv.inner = untag_ptr(this_ptr);
31228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31230         this_ptr_conv.is_owned = false;
31231         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
31232         return ret_conv;
31233 }
31234
31235 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
31236         LDKAcceptChannel this_ptr_conv;
31237         this_ptr_conv.inner = untag_ptr(this_ptr);
31238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31240         this_ptr_conv.is_owned = false;
31241         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
31242 }
31243
31244 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) {
31245         LDKAcceptChannel this_ptr_conv;
31246         this_ptr_conv.inner = untag_ptr(this_ptr);
31247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31249         this_ptr_conv.is_owned = false;
31250         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
31251         return ret_conv;
31252 }
31253
31254 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) {
31255         LDKAcceptChannel this_ptr_conv;
31256         this_ptr_conv.inner = untag_ptr(this_ptr);
31257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31259         this_ptr_conv.is_owned = false;
31260         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
31261 }
31262
31263 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
31264         LDKAcceptChannel this_ptr_conv;
31265         this_ptr_conv.inner = untag_ptr(this_ptr);
31266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31268         this_ptr_conv.is_owned = false;
31269         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
31270         return ret_conv;
31271 }
31272
31273 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
31274         LDKAcceptChannel this_ptr_conv;
31275         this_ptr_conv.inner = untag_ptr(this_ptr);
31276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31278         this_ptr_conv.is_owned = false;
31279         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
31280 }
31281
31282 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
31283         LDKAcceptChannel this_ptr_conv;
31284         this_ptr_conv.inner = untag_ptr(this_ptr);
31285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31287         this_ptr_conv.is_owned = false;
31288         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
31289         return ret_conv;
31290 }
31291
31292 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
31293         LDKAcceptChannel this_ptr_conv;
31294         this_ptr_conv.inner = untag_ptr(this_ptr);
31295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31297         this_ptr_conv.is_owned = false;
31298         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
31299 }
31300
31301 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
31302         LDKAcceptChannel this_ptr_conv;
31303         this_ptr_conv.inner = untag_ptr(this_ptr);
31304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31306         this_ptr_conv.is_owned = false;
31307         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
31308         return ret_conv;
31309 }
31310
31311 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t 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         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
31318 }
31319
31320 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
31321         LDKAcceptChannel this_ptr_conv;
31322         this_ptr_conv.inner = untag_ptr(this_ptr);
31323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31325         this_ptr_conv.is_owned = false;
31326         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
31327         return ret_conv;
31328 }
31329
31330 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
31331         LDKAcceptChannel this_ptr_conv;
31332         this_ptr_conv.inner = untag_ptr(this_ptr);
31333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31335         this_ptr_conv.is_owned = false;
31336         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
31337 }
31338
31339 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
31340         LDKAcceptChannel this_ptr_conv;
31341         this_ptr_conv.inner = untag_ptr(this_ptr);
31342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31344         this_ptr_conv.is_owned = false;
31345         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
31346         return ret_conv;
31347 }
31348
31349 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
31350         LDKAcceptChannel this_ptr_conv;
31351         this_ptr_conv.inner = untag_ptr(this_ptr);
31352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31354         this_ptr_conv.is_owned = false;
31355         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
31356 }
31357
31358 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
31359         LDKAcceptChannel this_ptr_conv;
31360         this_ptr_conv.inner = untag_ptr(this_ptr);
31361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31363         this_ptr_conv.is_owned = false;
31364         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31365         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
31366         return ret_arr;
31367 }
31368
31369 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
31370         LDKAcceptChannel this_ptr_conv;
31371         this_ptr_conv.inner = untag_ptr(this_ptr);
31372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31374         this_ptr_conv.is_owned = false;
31375         LDKPublicKey val_ref;
31376         CHECK(val->arr_len == 33);
31377         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31378         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
31379 }
31380
31381 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
31382         LDKAcceptChannel this_ptr_conv;
31383         this_ptr_conv.inner = untag_ptr(this_ptr);
31384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31386         this_ptr_conv.is_owned = false;
31387         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31388         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
31389         return ret_arr;
31390 }
31391
31392 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
31393         LDKAcceptChannel this_ptr_conv;
31394         this_ptr_conv.inner = untag_ptr(this_ptr);
31395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31397         this_ptr_conv.is_owned = false;
31398         LDKPublicKey val_ref;
31399         CHECK(val->arr_len == 33);
31400         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31401         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31402 }
31403
31404 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
31405         LDKAcceptChannel this_ptr_conv;
31406         this_ptr_conv.inner = untag_ptr(this_ptr);
31407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31409         this_ptr_conv.is_owned = false;
31410         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31411         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
31412         return ret_arr;
31413 }
31414
31415 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
31416         LDKAcceptChannel this_ptr_conv;
31417         this_ptr_conv.inner = untag_ptr(this_ptr);
31418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31420         this_ptr_conv.is_owned = false;
31421         LDKPublicKey val_ref;
31422         CHECK(val->arr_len == 33);
31423         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31424         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
31425 }
31426
31427 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
31428         LDKAcceptChannel this_ptr_conv;
31429         this_ptr_conv.inner = untag_ptr(this_ptr);
31430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31432         this_ptr_conv.is_owned = false;
31433         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31434         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
31435         return ret_arr;
31436 }
31437
31438 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
31439         LDKAcceptChannel this_ptr_conv;
31440         this_ptr_conv.inner = untag_ptr(this_ptr);
31441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31443         this_ptr_conv.is_owned = false;
31444         LDKPublicKey val_ref;
31445         CHECK(val->arr_len == 33);
31446         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31447         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31448 }
31449
31450 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
31451         LDKAcceptChannel this_ptr_conv;
31452         this_ptr_conv.inner = untag_ptr(this_ptr);
31453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31455         this_ptr_conv.is_owned = false;
31456         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31457         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
31458         return ret_arr;
31459 }
31460
31461 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
31462         LDKAcceptChannel this_ptr_conv;
31463         this_ptr_conv.inner = untag_ptr(this_ptr);
31464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31466         this_ptr_conv.is_owned = false;
31467         LDKPublicKey val_ref;
31468         CHECK(val->arr_len == 33);
31469         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31470         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31471 }
31472
31473 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
31474         LDKAcceptChannel this_ptr_conv;
31475         this_ptr_conv.inner = untag_ptr(this_ptr);
31476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31478         this_ptr_conv.is_owned = false;
31479         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31480         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31481         return ret_arr;
31482 }
31483
31484 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) {
31485         LDKAcceptChannel this_ptr_conv;
31486         this_ptr_conv.inner = untag_ptr(this_ptr);
31487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31489         this_ptr_conv.is_owned = false;
31490         LDKPublicKey val_ref;
31491         CHECK(val->arr_len == 33);
31492         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31493         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31494 }
31495
31496 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
31497         LDKAcceptChannel this_ptr_conv;
31498         this_ptr_conv.inner = untag_ptr(this_ptr);
31499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31501         this_ptr_conv.is_owned = false;
31502         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
31503         uint64_t ret_ref = 0;
31504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31506         return ret_ref;
31507 }
31508
31509 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
31510         LDKAcceptChannel this_ptr_conv;
31511         this_ptr_conv.inner = untag_ptr(this_ptr);
31512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31514         this_ptr_conv.is_owned = false;
31515         LDKChannelTypeFeatures val_conv;
31516         val_conv.inner = untag_ptr(val);
31517         val_conv.is_owned = ptr_is_owned(val);
31518         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31519         val_conv = ChannelTypeFeatures_clone(&val_conv);
31520         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
31521 }
31522
31523 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
31524         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
31525         uint64_t ret_ref = 0;
31526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31528         return ret_ref;
31529 }
31530 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
31531         LDKAcceptChannel arg_conv;
31532         arg_conv.inner = untag_ptr(arg);
31533         arg_conv.is_owned = ptr_is_owned(arg);
31534         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31535         arg_conv.is_owned = false;
31536         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
31537         return ret_conv;
31538 }
31539
31540 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
31541         LDKAcceptChannel orig_conv;
31542         orig_conv.inner = untag_ptr(orig);
31543         orig_conv.is_owned = ptr_is_owned(orig);
31544         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31545         orig_conv.is_owned = false;
31546         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
31547         uint64_t ret_ref = 0;
31548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31550         return ret_ref;
31551 }
31552
31553 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
31554         LDKAcceptChannel a_conv;
31555         a_conv.inner = untag_ptr(a);
31556         a_conv.is_owned = ptr_is_owned(a);
31557         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31558         a_conv.is_owned = false;
31559         LDKAcceptChannel b_conv;
31560         b_conv.inner = untag_ptr(b);
31561         b_conv.is_owned = ptr_is_owned(b);
31562         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31563         b_conv.is_owned = false;
31564         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
31565         return ret_conv;
31566 }
31567
31568 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
31569         LDKFundingCreated this_obj_conv;
31570         this_obj_conv.inner = untag_ptr(this_obj);
31571         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31573         FundingCreated_free(this_obj_conv);
31574 }
31575
31576 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
31577         LDKFundingCreated this_ptr_conv;
31578         this_ptr_conv.inner = untag_ptr(this_ptr);
31579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31581         this_ptr_conv.is_owned = false;
31582         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31583         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
31584         return ret_arr;
31585 }
31586
31587 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
31588         LDKFundingCreated this_ptr_conv;
31589         this_ptr_conv.inner = untag_ptr(this_ptr);
31590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31592         this_ptr_conv.is_owned = false;
31593         LDKThirtyTwoBytes val_ref;
31594         CHECK(val->arr_len == 32);
31595         memcpy(val_ref.data, val->elems, 32); FREE(val);
31596         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
31597 }
31598
31599 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
31600         LDKFundingCreated this_ptr_conv;
31601         this_ptr_conv.inner = untag_ptr(this_ptr);
31602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31604         this_ptr_conv.is_owned = false;
31605         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31606         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
31607         return ret_arr;
31608 }
31609
31610 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
31611         LDKFundingCreated this_ptr_conv;
31612         this_ptr_conv.inner = untag_ptr(this_ptr);
31613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31615         this_ptr_conv.is_owned = false;
31616         LDKThirtyTwoBytes val_ref;
31617         CHECK(val->arr_len == 32);
31618         memcpy(val_ref.data, val->elems, 32); FREE(val);
31619         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
31620 }
31621
31622 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
31623         LDKFundingCreated this_ptr_conv;
31624         this_ptr_conv.inner = untag_ptr(this_ptr);
31625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31627         this_ptr_conv.is_owned = false;
31628         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
31629         return ret_conv;
31630 }
31631
31632 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
31633         LDKFundingCreated this_ptr_conv;
31634         this_ptr_conv.inner = untag_ptr(this_ptr);
31635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31637         this_ptr_conv.is_owned = false;
31638         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
31639 }
31640
31641 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
31642         LDKFundingCreated this_ptr_conv;
31643         this_ptr_conv.inner = untag_ptr(this_ptr);
31644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31646         this_ptr_conv.is_owned = false;
31647         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31648         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
31649         return ret_arr;
31650 }
31651
31652 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
31653         LDKFundingCreated this_ptr_conv;
31654         this_ptr_conv.inner = untag_ptr(this_ptr);
31655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31657         this_ptr_conv.is_owned = false;
31658         LDKSignature val_ref;
31659         CHECK(val->arr_len == 64);
31660         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31661         FundingCreated_set_signature(&this_ptr_conv, val_ref);
31662 }
31663
31664 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) {
31665         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
31666         CHECK(temporary_channel_id_arg->arr_len == 32);
31667         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
31668         LDKThirtyTwoBytes funding_txid_arg_ref;
31669         CHECK(funding_txid_arg->arr_len == 32);
31670         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
31671         LDKSignature signature_arg_ref;
31672         CHECK(signature_arg->arr_len == 64);
31673         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31674         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
31675         uint64_t ret_ref = 0;
31676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31678         return ret_ref;
31679 }
31680
31681 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
31682         LDKFundingCreated ret_var = FundingCreated_clone(arg);
31683         uint64_t ret_ref = 0;
31684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31686         return ret_ref;
31687 }
31688 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
31689         LDKFundingCreated arg_conv;
31690         arg_conv.inner = untag_ptr(arg);
31691         arg_conv.is_owned = ptr_is_owned(arg);
31692         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31693         arg_conv.is_owned = false;
31694         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
31695         return ret_conv;
31696 }
31697
31698 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
31699         LDKFundingCreated orig_conv;
31700         orig_conv.inner = untag_ptr(orig);
31701         orig_conv.is_owned = ptr_is_owned(orig);
31702         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31703         orig_conv.is_owned = false;
31704         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
31705         uint64_t ret_ref = 0;
31706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31708         return ret_ref;
31709 }
31710
31711 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
31712         LDKFundingCreated a_conv;
31713         a_conv.inner = untag_ptr(a);
31714         a_conv.is_owned = ptr_is_owned(a);
31715         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31716         a_conv.is_owned = false;
31717         LDKFundingCreated b_conv;
31718         b_conv.inner = untag_ptr(b);
31719         b_conv.is_owned = ptr_is_owned(b);
31720         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31721         b_conv.is_owned = false;
31722         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
31723         return ret_conv;
31724 }
31725
31726 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
31727         LDKFundingSigned this_obj_conv;
31728         this_obj_conv.inner = untag_ptr(this_obj);
31729         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31731         FundingSigned_free(this_obj_conv);
31732 }
31733
31734 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
31735         LDKFundingSigned this_ptr_conv;
31736         this_ptr_conv.inner = untag_ptr(this_ptr);
31737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31739         this_ptr_conv.is_owned = false;
31740         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31741         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
31742         return ret_arr;
31743 }
31744
31745 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31746         LDKFundingSigned this_ptr_conv;
31747         this_ptr_conv.inner = untag_ptr(this_ptr);
31748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31750         this_ptr_conv.is_owned = false;
31751         LDKThirtyTwoBytes val_ref;
31752         CHECK(val->arr_len == 32);
31753         memcpy(val_ref.data, val->elems, 32); FREE(val);
31754         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
31755 }
31756
31757 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
31758         LDKFundingSigned this_ptr_conv;
31759         this_ptr_conv.inner = untag_ptr(this_ptr);
31760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31762         this_ptr_conv.is_owned = false;
31763         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31764         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
31765         return ret_arr;
31766 }
31767
31768 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
31769         LDKFundingSigned this_ptr_conv;
31770         this_ptr_conv.inner = untag_ptr(this_ptr);
31771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31773         this_ptr_conv.is_owned = false;
31774         LDKSignature val_ref;
31775         CHECK(val->arr_len == 64);
31776         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31777         FundingSigned_set_signature(&this_ptr_conv, val_ref);
31778 }
31779
31780 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
31781         LDKThirtyTwoBytes channel_id_arg_ref;
31782         CHECK(channel_id_arg->arr_len == 32);
31783         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31784         LDKSignature signature_arg_ref;
31785         CHECK(signature_arg->arr_len == 64);
31786         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31787         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
31788         uint64_t ret_ref = 0;
31789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31791         return ret_ref;
31792 }
31793
31794 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
31795         LDKFundingSigned ret_var = FundingSigned_clone(arg);
31796         uint64_t ret_ref = 0;
31797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31799         return ret_ref;
31800 }
31801 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
31802         LDKFundingSigned arg_conv;
31803         arg_conv.inner = untag_ptr(arg);
31804         arg_conv.is_owned = ptr_is_owned(arg);
31805         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31806         arg_conv.is_owned = false;
31807         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
31808         return ret_conv;
31809 }
31810
31811 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
31812         LDKFundingSigned orig_conv;
31813         orig_conv.inner = untag_ptr(orig);
31814         orig_conv.is_owned = ptr_is_owned(orig);
31815         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31816         orig_conv.is_owned = false;
31817         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
31818         uint64_t ret_ref = 0;
31819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31821         return ret_ref;
31822 }
31823
31824 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
31825         LDKFundingSigned a_conv;
31826         a_conv.inner = untag_ptr(a);
31827         a_conv.is_owned = ptr_is_owned(a);
31828         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31829         a_conv.is_owned = false;
31830         LDKFundingSigned b_conv;
31831         b_conv.inner = untag_ptr(b);
31832         b_conv.is_owned = ptr_is_owned(b);
31833         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31834         b_conv.is_owned = false;
31835         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
31836         return ret_conv;
31837 }
31838
31839 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
31840         LDKChannelReady this_obj_conv;
31841         this_obj_conv.inner = untag_ptr(this_obj);
31842         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31844         ChannelReady_free(this_obj_conv);
31845 }
31846
31847 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
31848         LDKChannelReady this_ptr_conv;
31849         this_ptr_conv.inner = untag_ptr(this_ptr);
31850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31852         this_ptr_conv.is_owned = false;
31853         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31854         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
31855         return ret_arr;
31856 }
31857
31858 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31859         LDKChannelReady this_ptr_conv;
31860         this_ptr_conv.inner = untag_ptr(this_ptr);
31861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31863         this_ptr_conv.is_owned = false;
31864         LDKThirtyTwoBytes val_ref;
31865         CHECK(val->arr_len == 32);
31866         memcpy(val_ref.data, val->elems, 32); FREE(val);
31867         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
31868 }
31869
31870 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
31871         LDKChannelReady this_ptr_conv;
31872         this_ptr_conv.inner = untag_ptr(this_ptr);
31873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31875         this_ptr_conv.is_owned = false;
31876         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31877         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31878         return ret_arr;
31879 }
31880
31881 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) {
31882         LDKChannelReady this_ptr_conv;
31883         this_ptr_conv.inner = untag_ptr(this_ptr);
31884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31886         this_ptr_conv.is_owned = false;
31887         LDKPublicKey val_ref;
31888         CHECK(val->arr_len == 33);
31889         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31890         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
31891 }
31892
31893 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
31894         LDKChannelReady this_ptr_conv;
31895         this_ptr_conv.inner = untag_ptr(this_ptr);
31896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31898         this_ptr_conv.is_owned = false;
31899         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31900         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
31901         uint64_t ret_ref = tag_ptr(ret_copy, true);
31902         return ret_ref;
31903 }
31904
31905 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) {
31906         LDKChannelReady this_ptr_conv;
31907         this_ptr_conv.inner = untag_ptr(this_ptr);
31908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31910         this_ptr_conv.is_owned = false;
31911         void* val_ptr = untag_ptr(val);
31912         CHECK_ACCESS(val_ptr);
31913         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31914         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31915         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
31916 }
31917
31918 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) {
31919         LDKThirtyTwoBytes channel_id_arg_ref;
31920         CHECK(channel_id_arg->arr_len == 32);
31921         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31922         LDKPublicKey next_per_commitment_point_arg_ref;
31923         CHECK(next_per_commitment_point_arg->arr_len == 33);
31924         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
31925         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
31926         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
31927         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
31928         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
31929         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
31930         uint64_t ret_ref = 0;
31931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31933         return ret_ref;
31934 }
31935
31936 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
31937         LDKChannelReady ret_var = ChannelReady_clone(arg);
31938         uint64_t ret_ref = 0;
31939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31941         return ret_ref;
31942 }
31943 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
31944         LDKChannelReady arg_conv;
31945         arg_conv.inner = untag_ptr(arg);
31946         arg_conv.is_owned = ptr_is_owned(arg);
31947         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31948         arg_conv.is_owned = false;
31949         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
31950         return ret_conv;
31951 }
31952
31953 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
31954         LDKChannelReady orig_conv;
31955         orig_conv.inner = untag_ptr(orig);
31956         orig_conv.is_owned = ptr_is_owned(orig);
31957         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31958         orig_conv.is_owned = false;
31959         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
31960         uint64_t ret_ref = 0;
31961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31963         return ret_ref;
31964 }
31965
31966 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
31967         LDKChannelReady a_conv;
31968         a_conv.inner = untag_ptr(a);
31969         a_conv.is_owned = ptr_is_owned(a);
31970         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31971         a_conv.is_owned = false;
31972         LDKChannelReady b_conv;
31973         b_conv.inner = untag_ptr(b);
31974         b_conv.is_owned = ptr_is_owned(b);
31975         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31976         b_conv.is_owned = false;
31977         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
31978         return ret_conv;
31979 }
31980
31981 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
31982         LDKShutdown this_obj_conv;
31983         this_obj_conv.inner = untag_ptr(this_obj);
31984         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31986         Shutdown_free(this_obj_conv);
31987 }
31988
31989 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
31990         LDKShutdown this_ptr_conv;
31991         this_ptr_conv.inner = untag_ptr(this_ptr);
31992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31994         this_ptr_conv.is_owned = false;
31995         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31996         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
31997         return ret_arr;
31998 }
31999
32000 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32001         LDKShutdown this_ptr_conv;
32002         this_ptr_conv.inner = untag_ptr(this_ptr);
32003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32005         this_ptr_conv.is_owned = false;
32006         LDKThirtyTwoBytes val_ref;
32007         CHECK(val->arr_len == 32);
32008         memcpy(val_ref.data, val->elems, 32); FREE(val);
32009         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
32010 }
32011
32012 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
32013         LDKShutdown this_ptr_conv;
32014         this_ptr_conv.inner = untag_ptr(this_ptr);
32015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32017         this_ptr_conv.is_owned = false;
32018         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
32019         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32020         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32021         return ret_arr;
32022 }
32023
32024 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
32025         LDKShutdown this_ptr_conv;
32026         this_ptr_conv.inner = untag_ptr(this_ptr);
32027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32029         this_ptr_conv.is_owned = false;
32030         LDKCVec_u8Z val_ref;
32031         val_ref.datalen = val->arr_len;
32032         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
32033         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
32034         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
32035 }
32036
32037 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
32038         LDKThirtyTwoBytes channel_id_arg_ref;
32039         CHECK(channel_id_arg->arr_len == 32);
32040         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32041         LDKCVec_u8Z scriptpubkey_arg_ref;
32042         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
32043         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
32044         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
32045         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
32046         uint64_t ret_ref = 0;
32047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32049         return ret_ref;
32050 }
32051
32052 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
32053         LDKShutdown ret_var = Shutdown_clone(arg);
32054         uint64_t ret_ref = 0;
32055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32057         return ret_ref;
32058 }
32059 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
32060         LDKShutdown arg_conv;
32061         arg_conv.inner = untag_ptr(arg);
32062         arg_conv.is_owned = ptr_is_owned(arg);
32063         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32064         arg_conv.is_owned = false;
32065         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
32066         return ret_conv;
32067 }
32068
32069 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
32070         LDKShutdown orig_conv;
32071         orig_conv.inner = untag_ptr(orig);
32072         orig_conv.is_owned = ptr_is_owned(orig);
32073         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32074         orig_conv.is_owned = false;
32075         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
32076         uint64_t ret_ref = 0;
32077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32079         return ret_ref;
32080 }
32081
32082 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
32083         LDKShutdown a_conv;
32084         a_conv.inner = untag_ptr(a);
32085         a_conv.is_owned = ptr_is_owned(a);
32086         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32087         a_conv.is_owned = false;
32088         LDKShutdown b_conv;
32089         b_conv.inner = untag_ptr(b);
32090         b_conv.is_owned = ptr_is_owned(b);
32091         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32092         b_conv.is_owned = false;
32093         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
32094         return ret_conv;
32095 }
32096
32097 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
32098         LDKClosingSignedFeeRange this_obj_conv;
32099         this_obj_conv.inner = untag_ptr(this_obj);
32100         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32102         ClosingSignedFeeRange_free(this_obj_conv);
32103 }
32104
32105 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
32106         LDKClosingSignedFeeRange this_ptr_conv;
32107         this_ptr_conv.inner = untag_ptr(this_ptr);
32108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32110         this_ptr_conv.is_owned = false;
32111         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
32112         return ret_conv;
32113 }
32114
32115 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
32116         LDKClosingSignedFeeRange this_ptr_conv;
32117         this_ptr_conv.inner = untag_ptr(this_ptr);
32118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32120         this_ptr_conv.is_owned = false;
32121         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
32122 }
32123
32124 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
32125         LDKClosingSignedFeeRange this_ptr_conv;
32126         this_ptr_conv.inner = untag_ptr(this_ptr);
32127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32129         this_ptr_conv.is_owned = false;
32130         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
32131         return ret_conv;
32132 }
32133
32134 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
32135         LDKClosingSignedFeeRange this_ptr_conv;
32136         this_ptr_conv.inner = untag_ptr(this_ptr);
32137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32139         this_ptr_conv.is_owned = false;
32140         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
32141 }
32142
32143 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
32144         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
32145         uint64_t ret_ref = 0;
32146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32148         return ret_ref;
32149 }
32150
32151 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
32152         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
32153         uint64_t ret_ref = 0;
32154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32156         return ret_ref;
32157 }
32158 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
32159         LDKClosingSignedFeeRange arg_conv;
32160         arg_conv.inner = untag_ptr(arg);
32161         arg_conv.is_owned = ptr_is_owned(arg);
32162         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32163         arg_conv.is_owned = false;
32164         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
32165         return ret_conv;
32166 }
32167
32168 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
32169         LDKClosingSignedFeeRange orig_conv;
32170         orig_conv.inner = untag_ptr(orig);
32171         orig_conv.is_owned = ptr_is_owned(orig);
32172         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32173         orig_conv.is_owned = false;
32174         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
32175         uint64_t ret_ref = 0;
32176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32178         return ret_ref;
32179 }
32180
32181 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
32182         LDKClosingSignedFeeRange a_conv;
32183         a_conv.inner = untag_ptr(a);
32184         a_conv.is_owned = ptr_is_owned(a);
32185         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32186         a_conv.is_owned = false;
32187         LDKClosingSignedFeeRange b_conv;
32188         b_conv.inner = untag_ptr(b);
32189         b_conv.is_owned = ptr_is_owned(b);
32190         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32191         b_conv.is_owned = false;
32192         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
32193         return ret_conv;
32194 }
32195
32196 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
32197         LDKClosingSigned this_obj_conv;
32198         this_obj_conv.inner = untag_ptr(this_obj);
32199         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32201         ClosingSigned_free(this_obj_conv);
32202 }
32203
32204 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
32205         LDKClosingSigned this_ptr_conv;
32206         this_ptr_conv.inner = untag_ptr(this_ptr);
32207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32209         this_ptr_conv.is_owned = false;
32210         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32211         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
32212         return ret_arr;
32213 }
32214
32215 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32216         LDKClosingSigned this_ptr_conv;
32217         this_ptr_conv.inner = untag_ptr(this_ptr);
32218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32220         this_ptr_conv.is_owned = false;
32221         LDKThirtyTwoBytes val_ref;
32222         CHECK(val->arr_len == 32);
32223         memcpy(val_ref.data, val->elems, 32); FREE(val);
32224         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
32225 }
32226
32227 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
32228         LDKClosingSigned this_ptr_conv;
32229         this_ptr_conv.inner = untag_ptr(this_ptr);
32230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32232         this_ptr_conv.is_owned = false;
32233         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
32234         return ret_conv;
32235 }
32236
32237 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
32238         LDKClosingSigned this_ptr_conv;
32239         this_ptr_conv.inner = untag_ptr(this_ptr);
32240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32242         this_ptr_conv.is_owned = false;
32243         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
32244 }
32245
32246 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
32247         LDKClosingSigned this_ptr_conv;
32248         this_ptr_conv.inner = untag_ptr(this_ptr);
32249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32251         this_ptr_conv.is_owned = false;
32252         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32253         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
32254         return ret_arr;
32255 }
32256
32257 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
32258         LDKClosingSigned this_ptr_conv;
32259         this_ptr_conv.inner = untag_ptr(this_ptr);
32260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32262         this_ptr_conv.is_owned = false;
32263         LDKSignature val_ref;
32264         CHECK(val->arr_len == 64);
32265         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32266         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
32267 }
32268
32269 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
32270         LDKClosingSigned this_ptr_conv;
32271         this_ptr_conv.inner = untag_ptr(this_ptr);
32272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32274         this_ptr_conv.is_owned = false;
32275         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
32276         uint64_t ret_ref = 0;
32277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32279         return ret_ref;
32280 }
32281
32282 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
32283         LDKClosingSigned this_ptr_conv;
32284         this_ptr_conv.inner = untag_ptr(this_ptr);
32285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32287         this_ptr_conv.is_owned = false;
32288         LDKClosingSignedFeeRange val_conv;
32289         val_conv.inner = untag_ptr(val);
32290         val_conv.is_owned = ptr_is_owned(val);
32291         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32292         val_conv = ClosingSignedFeeRange_clone(&val_conv);
32293         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
32294 }
32295
32296 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) {
32297         LDKThirtyTwoBytes channel_id_arg_ref;
32298         CHECK(channel_id_arg->arr_len == 32);
32299         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32300         LDKSignature signature_arg_ref;
32301         CHECK(signature_arg->arr_len == 64);
32302         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
32303         LDKClosingSignedFeeRange fee_range_arg_conv;
32304         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
32305         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
32306         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
32307         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
32308         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
32309         uint64_t ret_ref = 0;
32310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32312         return ret_ref;
32313 }
32314
32315 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
32316         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
32317         uint64_t ret_ref = 0;
32318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32320         return ret_ref;
32321 }
32322 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
32323         LDKClosingSigned arg_conv;
32324         arg_conv.inner = untag_ptr(arg);
32325         arg_conv.is_owned = ptr_is_owned(arg);
32326         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32327         arg_conv.is_owned = false;
32328         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
32329         return ret_conv;
32330 }
32331
32332 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
32333         LDKClosingSigned orig_conv;
32334         orig_conv.inner = untag_ptr(orig);
32335         orig_conv.is_owned = ptr_is_owned(orig);
32336         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32337         orig_conv.is_owned = false;
32338         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
32339         uint64_t ret_ref = 0;
32340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32342         return ret_ref;
32343 }
32344
32345 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
32346         LDKClosingSigned a_conv;
32347         a_conv.inner = untag_ptr(a);
32348         a_conv.is_owned = ptr_is_owned(a);
32349         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32350         a_conv.is_owned = false;
32351         LDKClosingSigned b_conv;
32352         b_conv.inner = untag_ptr(b);
32353         b_conv.is_owned = ptr_is_owned(b);
32354         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32355         b_conv.is_owned = false;
32356         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
32357         return ret_conv;
32358 }
32359
32360 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
32361         LDKUpdateAddHTLC this_obj_conv;
32362         this_obj_conv.inner = untag_ptr(this_obj);
32363         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32365         UpdateAddHTLC_free(this_obj_conv);
32366 }
32367
32368 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
32369         LDKUpdateAddHTLC this_ptr_conv;
32370         this_ptr_conv.inner = untag_ptr(this_ptr);
32371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32373         this_ptr_conv.is_owned = false;
32374         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32375         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
32376         return ret_arr;
32377 }
32378
32379 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32380         LDKUpdateAddHTLC this_ptr_conv;
32381         this_ptr_conv.inner = untag_ptr(this_ptr);
32382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32384         this_ptr_conv.is_owned = false;
32385         LDKThirtyTwoBytes val_ref;
32386         CHECK(val->arr_len == 32);
32387         memcpy(val_ref.data, val->elems, 32); FREE(val);
32388         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
32389 }
32390
32391 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
32392         LDKUpdateAddHTLC this_ptr_conv;
32393         this_ptr_conv.inner = untag_ptr(this_ptr);
32394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32396         this_ptr_conv.is_owned = false;
32397         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
32398         return ret_conv;
32399 }
32400
32401 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32402         LDKUpdateAddHTLC this_ptr_conv;
32403         this_ptr_conv.inner = untag_ptr(this_ptr);
32404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32406         this_ptr_conv.is_owned = false;
32407         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
32408 }
32409
32410 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
32411         LDKUpdateAddHTLC this_ptr_conv;
32412         this_ptr_conv.inner = untag_ptr(this_ptr);
32413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32415         this_ptr_conv.is_owned = false;
32416         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
32417         return ret_conv;
32418 }
32419
32420 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
32421         LDKUpdateAddHTLC this_ptr_conv;
32422         this_ptr_conv.inner = untag_ptr(this_ptr);
32423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32425         this_ptr_conv.is_owned = false;
32426         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
32427 }
32428
32429 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
32430         LDKUpdateAddHTLC this_ptr_conv;
32431         this_ptr_conv.inner = untag_ptr(this_ptr);
32432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32434         this_ptr_conv.is_owned = false;
32435         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32436         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
32437         return ret_arr;
32438 }
32439
32440 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
32441         LDKUpdateAddHTLC this_ptr_conv;
32442         this_ptr_conv.inner = untag_ptr(this_ptr);
32443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32445         this_ptr_conv.is_owned = false;
32446         LDKThirtyTwoBytes val_ref;
32447         CHECK(val->arr_len == 32);
32448         memcpy(val_ref.data, val->elems, 32); FREE(val);
32449         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
32450 }
32451
32452 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
32453         LDKUpdateAddHTLC this_ptr_conv;
32454         this_ptr_conv.inner = untag_ptr(this_ptr);
32455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32457         this_ptr_conv.is_owned = false;
32458         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
32459         return ret_conv;
32460 }
32461
32462 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
32463         LDKUpdateAddHTLC this_ptr_conv;
32464         this_ptr_conv.inner = untag_ptr(this_ptr);
32465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32467         this_ptr_conv.is_owned = false;
32468         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
32469 }
32470
32471 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
32472         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
32473         uint64_t ret_ref = 0;
32474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32476         return ret_ref;
32477 }
32478 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
32479         LDKUpdateAddHTLC arg_conv;
32480         arg_conv.inner = untag_ptr(arg);
32481         arg_conv.is_owned = ptr_is_owned(arg);
32482         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32483         arg_conv.is_owned = false;
32484         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
32485         return ret_conv;
32486 }
32487
32488 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
32489         LDKUpdateAddHTLC orig_conv;
32490         orig_conv.inner = untag_ptr(orig);
32491         orig_conv.is_owned = ptr_is_owned(orig);
32492         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32493         orig_conv.is_owned = false;
32494         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
32495         uint64_t ret_ref = 0;
32496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32498         return ret_ref;
32499 }
32500
32501 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
32502         LDKUpdateAddHTLC a_conv;
32503         a_conv.inner = untag_ptr(a);
32504         a_conv.is_owned = ptr_is_owned(a);
32505         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32506         a_conv.is_owned = false;
32507         LDKUpdateAddHTLC b_conv;
32508         b_conv.inner = untag_ptr(b);
32509         b_conv.is_owned = ptr_is_owned(b);
32510         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32511         b_conv.is_owned = false;
32512         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
32513         return ret_conv;
32514 }
32515
32516 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
32517         LDKOnionMessage this_obj_conv;
32518         this_obj_conv.inner = untag_ptr(this_obj);
32519         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32521         OnionMessage_free(this_obj_conv);
32522 }
32523
32524 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
32525         LDKOnionMessage this_ptr_conv;
32526         this_ptr_conv.inner = untag_ptr(this_ptr);
32527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32529         this_ptr_conv.is_owned = false;
32530         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32531         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
32532         return ret_arr;
32533 }
32534
32535 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
32536         LDKOnionMessage this_ptr_conv;
32537         this_ptr_conv.inner = untag_ptr(this_ptr);
32538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32540         this_ptr_conv.is_owned = false;
32541         LDKPublicKey val_ref;
32542         CHECK(val->arr_len == 33);
32543         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32544         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
32545 }
32546
32547 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
32548         LDKOnionMessage ret_var = OnionMessage_clone(arg);
32549         uint64_t ret_ref = 0;
32550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32552         return ret_ref;
32553 }
32554 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
32555         LDKOnionMessage arg_conv;
32556         arg_conv.inner = untag_ptr(arg);
32557         arg_conv.is_owned = ptr_is_owned(arg);
32558         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32559         arg_conv.is_owned = false;
32560         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
32561         return ret_conv;
32562 }
32563
32564 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
32565         LDKOnionMessage orig_conv;
32566         orig_conv.inner = untag_ptr(orig);
32567         orig_conv.is_owned = ptr_is_owned(orig);
32568         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32569         orig_conv.is_owned = false;
32570         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
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
32577 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
32578         LDKOnionMessage a_conv;
32579         a_conv.inner = untag_ptr(a);
32580         a_conv.is_owned = ptr_is_owned(a);
32581         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32582         a_conv.is_owned = false;
32583         LDKOnionMessage b_conv;
32584         b_conv.inner = untag_ptr(b);
32585         b_conv.is_owned = ptr_is_owned(b);
32586         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32587         b_conv.is_owned = false;
32588         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
32589         return ret_conv;
32590 }
32591
32592 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
32593         LDKUpdateFulfillHTLC this_obj_conv;
32594         this_obj_conv.inner = untag_ptr(this_obj);
32595         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32597         UpdateFulfillHTLC_free(this_obj_conv);
32598 }
32599
32600 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
32601         LDKUpdateFulfillHTLC this_ptr_conv;
32602         this_ptr_conv.inner = untag_ptr(this_ptr);
32603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32605         this_ptr_conv.is_owned = false;
32606         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32607         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
32608         return ret_arr;
32609 }
32610
32611 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32612         LDKUpdateFulfillHTLC this_ptr_conv;
32613         this_ptr_conv.inner = untag_ptr(this_ptr);
32614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32616         this_ptr_conv.is_owned = false;
32617         LDKThirtyTwoBytes val_ref;
32618         CHECK(val->arr_len == 32);
32619         memcpy(val_ref.data, val->elems, 32); FREE(val);
32620         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
32621 }
32622
32623 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
32624         LDKUpdateFulfillHTLC this_ptr_conv;
32625         this_ptr_conv.inner = untag_ptr(this_ptr);
32626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32628         this_ptr_conv.is_owned = false;
32629         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
32630         return ret_conv;
32631 }
32632
32633 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32634         LDKUpdateFulfillHTLC 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         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
32640 }
32641
32642 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
32643         LDKUpdateFulfillHTLC this_ptr_conv;
32644         this_ptr_conv.inner = untag_ptr(this_ptr);
32645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32647         this_ptr_conv.is_owned = false;
32648         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32649         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
32650         return ret_arr;
32651 }
32652
32653 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
32654         LDKUpdateFulfillHTLC this_ptr_conv;
32655         this_ptr_conv.inner = untag_ptr(this_ptr);
32656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32658         this_ptr_conv.is_owned = false;
32659         LDKThirtyTwoBytes val_ref;
32660         CHECK(val->arr_len == 32);
32661         memcpy(val_ref.data, val->elems, 32); FREE(val);
32662         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
32663 }
32664
32665 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) {
32666         LDKThirtyTwoBytes channel_id_arg_ref;
32667         CHECK(channel_id_arg->arr_len == 32);
32668         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32669         LDKThirtyTwoBytes payment_preimage_arg_ref;
32670         CHECK(payment_preimage_arg->arr_len == 32);
32671         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
32672         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
32673         uint64_t ret_ref = 0;
32674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32676         return ret_ref;
32677 }
32678
32679 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
32680         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
32681         uint64_t ret_ref = 0;
32682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32684         return ret_ref;
32685 }
32686 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
32687         LDKUpdateFulfillHTLC arg_conv;
32688         arg_conv.inner = untag_ptr(arg);
32689         arg_conv.is_owned = ptr_is_owned(arg);
32690         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32691         arg_conv.is_owned = false;
32692         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
32693         return ret_conv;
32694 }
32695
32696 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
32697         LDKUpdateFulfillHTLC orig_conv;
32698         orig_conv.inner = untag_ptr(orig);
32699         orig_conv.is_owned = ptr_is_owned(orig);
32700         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32701         orig_conv.is_owned = false;
32702         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
32703         uint64_t ret_ref = 0;
32704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32706         return ret_ref;
32707 }
32708
32709 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
32710         LDKUpdateFulfillHTLC a_conv;
32711         a_conv.inner = untag_ptr(a);
32712         a_conv.is_owned = ptr_is_owned(a);
32713         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32714         a_conv.is_owned = false;
32715         LDKUpdateFulfillHTLC b_conv;
32716         b_conv.inner = untag_ptr(b);
32717         b_conv.is_owned = ptr_is_owned(b);
32718         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32719         b_conv.is_owned = false;
32720         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
32721         return ret_conv;
32722 }
32723
32724 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
32725         LDKUpdateFailHTLC this_obj_conv;
32726         this_obj_conv.inner = untag_ptr(this_obj);
32727         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32729         UpdateFailHTLC_free(this_obj_conv);
32730 }
32731
32732 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
32733         LDKUpdateFailHTLC this_ptr_conv;
32734         this_ptr_conv.inner = untag_ptr(this_ptr);
32735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32737         this_ptr_conv.is_owned = false;
32738         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32739         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
32740         return ret_arr;
32741 }
32742
32743 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32744         LDKUpdateFailHTLC this_ptr_conv;
32745         this_ptr_conv.inner = untag_ptr(this_ptr);
32746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32748         this_ptr_conv.is_owned = false;
32749         LDKThirtyTwoBytes val_ref;
32750         CHECK(val->arr_len == 32);
32751         memcpy(val_ref.data, val->elems, 32); FREE(val);
32752         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
32753 }
32754
32755 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
32756         LDKUpdateFailHTLC this_ptr_conv;
32757         this_ptr_conv.inner = untag_ptr(this_ptr);
32758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32760         this_ptr_conv.is_owned = false;
32761         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
32762         return ret_conv;
32763 }
32764
32765 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32766         LDKUpdateFailHTLC this_ptr_conv;
32767         this_ptr_conv.inner = untag_ptr(this_ptr);
32768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32770         this_ptr_conv.is_owned = false;
32771         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
32772 }
32773
32774 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
32775         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
32776         uint64_t ret_ref = 0;
32777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32779         return ret_ref;
32780 }
32781 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
32782         LDKUpdateFailHTLC arg_conv;
32783         arg_conv.inner = untag_ptr(arg);
32784         arg_conv.is_owned = ptr_is_owned(arg);
32785         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32786         arg_conv.is_owned = false;
32787         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
32788         return ret_conv;
32789 }
32790
32791 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
32792         LDKUpdateFailHTLC orig_conv;
32793         orig_conv.inner = untag_ptr(orig);
32794         orig_conv.is_owned = ptr_is_owned(orig);
32795         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32796         orig_conv.is_owned = false;
32797         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
32798         uint64_t ret_ref = 0;
32799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32801         return ret_ref;
32802 }
32803
32804 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
32805         LDKUpdateFailHTLC a_conv;
32806         a_conv.inner = untag_ptr(a);
32807         a_conv.is_owned = ptr_is_owned(a);
32808         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32809         a_conv.is_owned = false;
32810         LDKUpdateFailHTLC b_conv;
32811         b_conv.inner = untag_ptr(b);
32812         b_conv.is_owned = ptr_is_owned(b);
32813         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32814         b_conv.is_owned = false;
32815         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
32816         return ret_conv;
32817 }
32818
32819 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
32820         LDKUpdateFailMalformedHTLC this_obj_conv;
32821         this_obj_conv.inner = untag_ptr(this_obj);
32822         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32824         UpdateFailMalformedHTLC_free(this_obj_conv);
32825 }
32826
32827 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
32828         LDKUpdateFailMalformedHTLC this_ptr_conv;
32829         this_ptr_conv.inner = untag_ptr(this_ptr);
32830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32832         this_ptr_conv.is_owned = false;
32833         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32834         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
32835         return ret_arr;
32836 }
32837
32838 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32839         LDKUpdateFailMalformedHTLC this_ptr_conv;
32840         this_ptr_conv.inner = untag_ptr(this_ptr);
32841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32843         this_ptr_conv.is_owned = false;
32844         LDKThirtyTwoBytes val_ref;
32845         CHECK(val->arr_len == 32);
32846         memcpy(val_ref.data, val->elems, 32); FREE(val);
32847         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
32848 }
32849
32850 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
32851         LDKUpdateFailMalformedHTLC this_ptr_conv;
32852         this_ptr_conv.inner = untag_ptr(this_ptr);
32853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32855         this_ptr_conv.is_owned = false;
32856         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
32857         return ret_conv;
32858 }
32859
32860 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32861         LDKUpdateFailMalformedHTLC this_ptr_conv;
32862         this_ptr_conv.inner = untag_ptr(this_ptr);
32863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32865         this_ptr_conv.is_owned = false;
32866         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
32867 }
32868
32869 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
32870         LDKUpdateFailMalformedHTLC this_ptr_conv;
32871         this_ptr_conv.inner = untag_ptr(this_ptr);
32872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32874         this_ptr_conv.is_owned = false;
32875         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
32876         return ret_conv;
32877 }
32878
32879 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
32880         LDKUpdateFailMalformedHTLC this_ptr_conv;
32881         this_ptr_conv.inner = untag_ptr(this_ptr);
32882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32884         this_ptr_conv.is_owned = false;
32885         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
32886 }
32887
32888 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
32889         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
32890         uint64_t ret_ref = 0;
32891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32893         return ret_ref;
32894 }
32895 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
32896         LDKUpdateFailMalformedHTLC arg_conv;
32897         arg_conv.inner = untag_ptr(arg);
32898         arg_conv.is_owned = ptr_is_owned(arg);
32899         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32900         arg_conv.is_owned = false;
32901         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
32902         return ret_conv;
32903 }
32904
32905 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
32906         LDKUpdateFailMalformedHTLC orig_conv;
32907         orig_conv.inner = untag_ptr(orig);
32908         orig_conv.is_owned = ptr_is_owned(orig);
32909         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32910         orig_conv.is_owned = false;
32911         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
32912         uint64_t ret_ref = 0;
32913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32915         return ret_ref;
32916 }
32917
32918 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
32919         LDKUpdateFailMalformedHTLC a_conv;
32920         a_conv.inner = untag_ptr(a);
32921         a_conv.is_owned = ptr_is_owned(a);
32922         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32923         a_conv.is_owned = false;
32924         LDKUpdateFailMalformedHTLC b_conv;
32925         b_conv.inner = untag_ptr(b);
32926         b_conv.is_owned = ptr_is_owned(b);
32927         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32928         b_conv.is_owned = false;
32929         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
32930         return ret_conv;
32931 }
32932
32933 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
32934         LDKCommitmentSigned this_obj_conv;
32935         this_obj_conv.inner = untag_ptr(this_obj);
32936         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32938         CommitmentSigned_free(this_obj_conv);
32939 }
32940
32941 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
32942         LDKCommitmentSigned this_ptr_conv;
32943         this_ptr_conv.inner = untag_ptr(this_ptr);
32944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32946         this_ptr_conv.is_owned = false;
32947         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32948         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
32949         return ret_arr;
32950 }
32951
32952 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32953         LDKCommitmentSigned this_ptr_conv;
32954         this_ptr_conv.inner = untag_ptr(this_ptr);
32955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32957         this_ptr_conv.is_owned = false;
32958         LDKThirtyTwoBytes val_ref;
32959         CHECK(val->arr_len == 32);
32960         memcpy(val_ref.data, val->elems, 32); FREE(val);
32961         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
32962 }
32963
32964 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
32965         LDKCommitmentSigned this_ptr_conv;
32966         this_ptr_conv.inner = untag_ptr(this_ptr);
32967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32969         this_ptr_conv.is_owned = false;
32970         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32971         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
32972         return ret_arr;
32973 }
32974
32975 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
32976         LDKCommitmentSigned this_ptr_conv;
32977         this_ptr_conv.inner = untag_ptr(this_ptr);
32978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32980         this_ptr_conv.is_owned = false;
32981         LDKSignature val_ref;
32982         CHECK(val->arr_len == 64);
32983         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32984         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
32985 }
32986
32987 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
32988         LDKCommitmentSigned this_ptr_conv;
32989         this_ptr_conv.inner = untag_ptr(this_ptr);
32990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32992         this_ptr_conv.is_owned = false;
32993         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
32994         ptrArray ret_arr = NULL;
32995         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
32996         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
32997         for (size_t m = 0; m < ret_var.datalen; m++) {
32998                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
32999                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
33000                 ret_arr_ptr[m] = ret_conv_12_arr;
33001         }
33002         
33003         FREE(ret_var.data);
33004         return ret_arr;
33005 }
33006
33007 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
33008         LDKCommitmentSigned this_ptr_conv;
33009         this_ptr_conv.inner = untag_ptr(this_ptr);
33010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33012         this_ptr_conv.is_owned = false;
33013         LDKCVec_SignatureZ val_constr;
33014         val_constr.datalen = val->arr_len;
33015         if (val_constr.datalen > 0)
33016                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33017         else
33018                 val_constr.data = NULL;
33019         int8_tArray* val_vals = (void*) val->elems;
33020         for (size_t m = 0; m < val_constr.datalen; m++) {
33021                 int8_tArray val_conv_12 = val_vals[m];
33022                 LDKSignature val_conv_12_ref;
33023                 CHECK(val_conv_12->arr_len == 64);
33024                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
33025                 val_constr.data[m] = val_conv_12_ref;
33026         }
33027         FREE(val);
33028         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
33029 }
33030
33031 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
33032         LDKThirtyTwoBytes channel_id_arg_ref;
33033         CHECK(channel_id_arg->arr_len == 32);
33034         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33035         LDKSignature signature_arg_ref;
33036         CHECK(signature_arg->arr_len == 64);
33037         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
33038         LDKCVec_SignatureZ htlc_signatures_arg_constr;
33039         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
33040         if (htlc_signatures_arg_constr.datalen > 0)
33041                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33042         else
33043                 htlc_signatures_arg_constr.data = NULL;
33044         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
33045         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
33046                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
33047                 LDKSignature htlc_signatures_arg_conv_12_ref;
33048                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
33049                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
33050                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
33051         }
33052         FREE(htlc_signatures_arg);
33053         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
33054         uint64_t ret_ref = 0;
33055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33057         return ret_ref;
33058 }
33059
33060 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
33061         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
33062         uint64_t ret_ref = 0;
33063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33065         return ret_ref;
33066 }
33067 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
33068         LDKCommitmentSigned arg_conv;
33069         arg_conv.inner = untag_ptr(arg);
33070         arg_conv.is_owned = ptr_is_owned(arg);
33071         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33072         arg_conv.is_owned = false;
33073         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
33074         return ret_conv;
33075 }
33076
33077 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
33078         LDKCommitmentSigned orig_conv;
33079         orig_conv.inner = untag_ptr(orig);
33080         orig_conv.is_owned = ptr_is_owned(orig);
33081         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33082         orig_conv.is_owned = false;
33083         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
33084         uint64_t ret_ref = 0;
33085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33087         return ret_ref;
33088 }
33089
33090 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
33091         LDKCommitmentSigned a_conv;
33092         a_conv.inner = untag_ptr(a);
33093         a_conv.is_owned = ptr_is_owned(a);
33094         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33095         a_conv.is_owned = false;
33096         LDKCommitmentSigned b_conv;
33097         b_conv.inner = untag_ptr(b);
33098         b_conv.is_owned = ptr_is_owned(b);
33099         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33100         b_conv.is_owned = false;
33101         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
33102         return ret_conv;
33103 }
33104
33105 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
33106         LDKRevokeAndACK this_obj_conv;
33107         this_obj_conv.inner = untag_ptr(this_obj);
33108         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33110         RevokeAndACK_free(this_obj_conv);
33111 }
33112
33113 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
33114         LDKRevokeAndACK this_ptr_conv;
33115         this_ptr_conv.inner = untag_ptr(this_ptr);
33116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33118         this_ptr_conv.is_owned = false;
33119         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33120         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
33121         return ret_arr;
33122 }
33123
33124 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33125         LDKRevokeAndACK this_ptr_conv;
33126         this_ptr_conv.inner = untag_ptr(this_ptr);
33127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33129         this_ptr_conv.is_owned = false;
33130         LDKThirtyTwoBytes val_ref;
33131         CHECK(val->arr_len == 32);
33132         memcpy(val_ref.data, val->elems, 32); FREE(val);
33133         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
33134 }
33135
33136 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
33137         LDKRevokeAndACK this_ptr_conv;
33138         this_ptr_conv.inner = untag_ptr(this_ptr);
33139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33141         this_ptr_conv.is_owned = false;
33142         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33143         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
33144         return ret_arr;
33145 }
33146
33147 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
33148         LDKRevokeAndACK this_ptr_conv;
33149         this_ptr_conv.inner = untag_ptr(this_ptr);
33150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33152         this_ptr_conv.is_owned = false;
33153         LDKThirtyTwoBytes val_ref;
33154         CHECK(val->arr_len == 32);
33155         memcpy(val_ref.data, val->elems, 32); FREE(val);
33156         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
33157 }
33158
33159 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
33160         LDKRevokeAndACK this_ptr_conv;
33161         this_ptr_conv.inner = untag_ptr(this_ptr);
33162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33164         this_ptr_conv.is_owned = false;
33165         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33166         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
33167         return ret_arr;
33168 }
33169
33170 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) {
33171         LDKRevokeAndACK this_ptr_conv;
33172         this_ptr_conv.inner = untag_ptr(this_ptr);
33173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33175         this_ptr_conv.is_owned = false;
33176         LDKPublicKey val_ref;
33177         CHECK(val->arr_len == 33);
33178         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33179         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
33180 }
33181
33182 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) {
33183         LDKThirtyTwoBytes channel_id_arg_ref;
33184         CHECK(channel_id_arg->arr_len == 32);
33185         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33186         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
33187         CHECK(per_commitment_secret_arg->arr_len == 32);
33188         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
33189         LDKPublicKey next_per_commitment_point_arg_ref;
33190         CHECK(next_per_commitment_point_arg->arr_len == 33);
33191         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
33192         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
33193         uint64_t ret_ref = 0;
33194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33196         return ret_ref;
33197 }
33198
33199 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
33200         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
33201         uint64_t ret_ref = 0;
33202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33204         return ret_ref;
33205 }
33206 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
33207         LDKRevokeAndACK arg_conv;
33208         arg_conv.inner = untag_ptr(arg);
33209         arg_conv.is_owned = ptr_is_owned(arg);
33210         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33211         arg_conv.is_owned = false;
33212         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
33213         return ret_conv;
33214 }
33215
33216 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
33217         LDKRevokeAndACK orig_conv;
33218         orig_conv.inner = untag_ptr(orig);
33219         orig_conv.is_owned = ptr_is_owned(orig);
33220         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33221         orig_conv.is_owned = false;
33222         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
33223         uint64_t ret_ref = 0;
33224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33226         return ret_ref;
33227 }
33228
33229 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
33230         LDKRevokeAndACK a_conv;
33231         a_conv.inner = untag_ptr(a);
33232         a_conv.is_owned = ptr_is_owned(a);
33233         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33234         a_conv.is_owned = false;
33235         LDKRevokeAndACK b_conv;
33236         b_conv.inner = untag_ptr(b);
33237         b_conv.is_owned = ptr_is_owned(b);
33238         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33239         b_conv.is_owned = false;
33240         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
33241         return ret_conv;
33242 }
33243
33244 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
33245         LDKUpdateFee this_obj_conv;
33246         this_obj_conv.inner = untag_ptr(this_obj);
33247         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33249         UpdateFee_free(this_obj_conv);
33250 }
33251
33252 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
33253         LDKUpdateFee this_ptr_conv;
33254         this_ptr_conv.inner = untag_ptr(this_ptr);
33255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33257         this_ptr_conv.is_owned = false;
33258         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33259         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
33260         return ret_arr;
33261 }
33262
33263 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33264         LDKUpdateFee this_ptr_conv;
33265         this_ptr_conv.inner = untag_ptr(this_ptr);
33266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33268         this_ptr_conv.is_owned = false;
33269         LDKThirtyTwoBytes val_ref;
33270         CHECK(val->arr_len == 32);
33271         memcpy(val_ref.data, val->elems, 32); FREE(val);
33272         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
33273 }
33274
33275 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
33276         LDKUpdateFee this_ptr_conv;
33277         this_ptr_conv.inner = untag_ptr(this_ptr);
33278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33280         this_ptr_conv.is_owned = false;
33281         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
33282         return ret_conv;
33283 }
33284
33285 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
33286         LDKUpdateFee this_ptr_conv;
33287         this_ptr_conv.inner = untag_ptr(this_ptr);
33288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33290         this_ptr_conv.is_owned = false;
33291         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
33292 }
33293
33294 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
33295         LDKThirtyTwoBytes channel_id_arg_ref;
33296         CHECK(channel_id_arg->arr_len == 32);
33297         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33298         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_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
33305 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
33306         LDKUpdateFee ret_var = UpdateFee_clone(arg);
33307         uint64_t ret_ref = 0;
33308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33310         return ret_ref;
33311 }
33312 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
33313         LDKUpdateFee arg_conv;
33314         arg_conv.inner = untag_ptr(arg);
33315         arg_conv.is_owned = ptr_is_owned(arg);
33316         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33317         arg_conv.is_owned = false;
33318         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
33319         return ret_conv;
33320 }
33321
33322 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
33323         LDKUpdateFee orig_conv;
33324         orig_conv.inner = untag_ptr(orig);
33325         orig_conv.is_owned = ptr_is_owned(orig);
33326         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33327         orig_conv.is_owned = false;
33328         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
33329         uint64_t ret_ref = 0;
33330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33332         return ret_ref;
33333 }
33334
33335 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
33336         LDKUpdateFee a_conv;
33337         a_conv.inner = untag_ptr(a);
33338         a_conv.is_owned = ptr_is_owned(a);
33339         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33340         a_conv.is_owned = false;
33341         LDKUpdateFee b_conv;
33342         b_conv.inner = untag_ptr(b);
33343         b_conv.is_owned = ptr_is_owned(b);
33344         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33345         b_conv.is_owned = false;
33346         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
33347         return ret_conv;
33348 }
33349
33350 void  __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint64_t this_obj) {
33351         LDKDataLossProtect this_obj_conv;
33352         this_obj_conv.inner = untag_ptr(this_obj);
33353         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33355         DataLossProtect_free(this_obj_conv);
33356 }
33357
33358 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) {
33359         LDKDataLossProtect this_ptr_conv;
33360         this_ptr_conv.inner = untag_ptr(this_ptr);
33361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33363         this_ptr_conv.is_owned = false;
33364         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33365         memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
33366         return ret_arr;
33367 }
33368
33369 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) {
33370         LDKDataLossProtect this_ptr_conv;
33371         this_ptr_conv.inner = untag_ptr(this_ptr);
33372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33374         this_ptr_conv.is_owned = false;
33375         LDKThirtyTwoBytes val_ref;
33376         CHECK(val->arr_len == 32);
33377         memcpy(val_ref.data, val->elems, 32); FREE(val);
33378         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
33379 }
33380
33381 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) {
33382         LDKDataLossProtect this_ptr_conv;
33383         this_ptr_conv.inner = untag_ptr(this_ptr);
33384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33386         this_ptr_conv.is_owned = false;
33387         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33388         memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
33389         return ret_arr;
33390 }
33391
33392 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) {
33393         LDKDataLossProtect this_ptr_conv;
33394         this_ptr_conv.inner = untag_ptr(this_ptr);
33395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33397         this_ptr_conv.is_owned = false;
33398         LDKPublicKey val_ref;
33399         CHECK(val->arr_len == 33);
33400         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33401         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
33402 }
33403
33404 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) {
33405         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
33406         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
33407         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
33408         LDKPublicKey my_current_per_commitment_point_arg_ref;
33409         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
33410         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);
33411         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
33412         uint64_t ret_ref = 0;
33413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33415         return ret_ref;
33416 }
33417
33418 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
33419         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
33420         uint64_t ret_ref = 0;
33421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33423         return ret_ref;
33424 }
33425 int64_t  __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint64_t arg) {
33426         LDKDataLossProtect arg_conv;
33427         arg_conv.inner = untag_ptr(arg);
33428         arg_conv.is_owned = ptr_is_owned(arg);
33429         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33430         arg_conv.is_owned = false;
33431         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
33432         return ret_conv;
33433 }
33434
33435 uint64_t  __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint64_t orig) {
33436         LDKDataLossProtect orig_conv;
33437         orig_conv.inner = untag_ptr(orig);
33438         orig_conv.is_owned = ptr_is_owned(orig);
33439         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33440         orig_conv.is_owned = false;
33441         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
33442         uint64_t ret_ref = 0;
33443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33445         return ret_ref;
33446 }
33447
33448 jboolean  __attribute__((export_name("TS_DataLossProtect_eq"))) TS_DataLossProtect_eq(uint64_t a, uint64_t b) {
33449         LDKDataLossProtect a_conv;
33450         a_conv.inner = untag_ptr(a);
33451         a_conv.is_owned = ptr_is_owned(a);
33452         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33453         a_conv.is_owned = false;
33454         LDKDataLossProtect b_conv;
33455         b_conv.inner = untag_ptr(b);
33456         b_conv.is_owned = ptr_is_owned(b);
33457         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33458         b_conv.is_owned = false;
33459         jboolean ret_conv = DataLossProtect_eq(&a_conv, &b_conv);
33460         return ret_conv;
33461 }
33462
33463 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
33464         LDKChannelReestablish this_obj_conv;
33465         this_obj_conv.inner = untag_ptr(this_obj);
33466         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33468         ChannelReestablish_free(this_obj_conv);
33469 }
33470
33471 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
33472         LDKChannelReestablish this_ptr_conv;
33473         this_ptr_conv.inner = untag_ptr(this_ptr);
33474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33476         this_ptr_conv.is_owned = false;
33477         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33478         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
33479         return ret_arr;
33480 }
33481
33482 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33483         LDKChannelReestablish this_ptr_conv;
33484         this_ptr_conv.inner = untag_ptr(this_ptr);
33485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33487         this_ptr_conv.is_owned = false;
33488         LDKThirtyTwoBytes val_ref;
33489         CHECK(val->arr_len == 32);
33490         memcpy(val_ref.data, val->elems, 32); FREE(val);
33491         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
33492 }
33493
33494 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
33495         LDKChannelReestablish this_ptr_conv;
33496         this_ptr_conv.inner = untag_ptr(this_ptr);
33497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33499         this_ptr_conv.is_owned = false;
33500         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
33501         return ret_conv;
33502 }
33503
33504 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) {
33505         LDKChannelReestablish this_ptr_conv;
33506         this_ptr_conv.inner = untag_ptr(this_ptr);
33507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33509         this_ptr_conv.is_owned = false;
33510         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
33511 }
33512
33513 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
33514         LDKChannelReestablish this_ptr_conv;
33515         this_ptr_conv.inner = untag_ptr(this_ptr);
33516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33518         this_ptr_conv.is_owned = false;
33519         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
33520         return ret_conv;
33521 }
33522
33523 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) {
33524         LDKChannelReestablish this_ptr_conv;
33525         this_ptr_conv.inner = untag_ptr(this_ptr);
33526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33528         this_ptr_conv.is_owned = false;
33529         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
33530 }
33531
33532 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
33533         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
33534         uint64_t ret_ref = 0;
33535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33537         return ret_ref;
33538 }
33539 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
33540         LDKChannelReestablish arg_conv;
33541         arg_conv.inner = untag_ptr(arg);
33542         arg_conv.is_owned = ptr_is_owned(arg);
33543         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33544         arg_conv.is_owned = false;
33545         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
33546         return ret_conv;
33547 }
33548
33549 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
33550         LDKChannelReestablish orig_conv;
33551         orig_conv.inner = untag_ptr(orig);
33552         orig_conv.is_owned = ptr_is_owned(orig);
33553         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33554         orig_conv.is_owned = false;
33555         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
33556         uint64_t ret_ref = 0;
33557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33559         return ret_ref;
33560 }
33561
33562 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
33563         LDKChannelReestablish a_conv;
33564         a_conv.inner = untag_ptr(a);
33565         a_conv.is_owned = ptr_is_owned(a);
33566         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33567         a_conv.is_owned = false;
33568         LDKChannelReestablish b_conv;
33569         b_conv.inner = untag_ptr(b);
33570         b_conv.is_owned = ptr_is_owned(b);
33571         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33572         b_conv.is_owned = false;
33573         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
33574         return ret_conv;
33575 }
33576
33577 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
33578         LDKAnnouncementSignatures this_obj_conv;
33579         this_obj_conv.inner = untag_ptr(this_obj);
33580         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33582         AnnouncementSignatures_free(this_obj_conv);
33583 }
33584
33585 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
33586         LDKAnnouncementSignatures this_ptr_conv;
33587         this_ptr_conv.inner = untag_ptr(this_ptr);
33588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33590         this_ptr_conv.is_owned = false;
33591         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33592         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
33593         return ret_arr;
33594 }
33595
33596 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33597         LDKAnnouncementSignatures this_ptr_conv;
33598         this_ptr_conv.inner = untag_ptr(this_ptr);
33599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33601         this_ptr_conv.is_owned = false;
33602         LDKThirtyTwoBytes val_ref;
33603         CHECK(val->arr_len == 32);
33604         memcpy(val_ref.data, val->elems, 32); FREE(val);
33605         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
33606 }
33607
33608 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
33609         LDKAnnouncementSignatures this_ptr_conv;
33610         this_ptr_conv.inner = untag_ptr(this_ptr);
33611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33613         this_ptr_conv.is_owned = false;
33614         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
33615         return ret_conv;
33616 }
33617
33618 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
33619         LDKAnnouncementSignatures this_ptr_conv;
33620         this_ptr_conv.inner = untag_ptr(this_ptr);
33621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33623         this_ptr_conv.is_owned = false;
33624         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
33625 }
33626
33627 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
33628         LDKAnnouncementSignatures this_ptr_conv;
33629         this_ptr_conv.inner = untag_ptr(this_ptr);
33630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33632         this_ptr_conv.is_owned = false;
33633         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33634         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
33635         return ret_arr;
33636 }
33637
33638 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
33639         LDKAnnouncementSignatures this_ptr_conv;
33640         this_ptr_conv.inner = untag_ptr(this_ptr);
33641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33643         this_ptr_conv.is_owned = false;
33644         LDKSignature val_ref;
33645         CHECK(val->arr_len == 64);
33646         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33647         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
33648 }
33649
33650 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
33651         LDKAnnouncementSignatures this_ptr_conv;
33652         this_ptr_conv.inner = untag_ptr(this_ptr);
33653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33655         this_ptr_conv.is_owned = false;
33656         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33657         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
33658         return ret_arr;
33659 }
33660
33661 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
33662         LDKAnnouncementSignatures this_ptr_conv;
33663         this_ptr_conv.inner = untag_ptr(this_ptr);
33664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33666         this_ptr_conv.is_owned = false;
33667         LDKSignature val_ref;
33668         CHECK(val->arr_len == 64);
33669         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33670         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
33671 }
33672
33673 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) {
33674         LDKThirtyTwoBytes channel_id_arg_ref;
33675         CHECK(channel_id_arg->arr_len == 32);
33676         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33677         LDKSignature node_signature_arg_ref;
33678         CHECK(node_signature_arg->arr_len == 64);
33679         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
33680         LDKSignature bitcoin_signature_arg_ref;
33681         CHECK(bitcoin_signature_arg->arr_len == 64);
33682         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
33683         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
33684         uint64_t ret_ref = 0;
33685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33687         return ret_ref;
33688 }
33689
33690 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
33691         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
33692         uint64_t ret_ref = 0;
33693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33695         return ret_ref;
33696 }
33697 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
33698         LDKAnnouncementSignatures arg_conv;
33699         arg_conv.inner = untag_ptr(arg);
33700         arg_conv.is_owned = ptr_is_owned(arg);
33701         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33702         arg_conv.is_owned = false;
33703         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
33704         return ret_conv;
33705 }
33706
33707 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
33708         LDKAnnouncementSignatures orig_conv;
33709         orig_conv.inner = untag_ptr(orig);
33710         orig_conv.is_owned = ptr_is_owned(orig);
33711         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33712         orig_conv.is_owned = false;
33713         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
33714         uint64_t ret_ref = 0;
33715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33717         return ret_ref;
33718 }
33719
33720 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
33721         LDKAnnouncementSignatures a_conv;
33722         a_conv.inner = untag_ptr(a);
33723         a_conv.is_owned = ptr_is_owned(a);
33724         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33725         a_conv.is_owned = false;
33726         LDKAnnouncementSignatures b_conv;
33727         b_conv.inner = untag_ptr(b);
33728         b_conv.is_owned = ptr_is_owned(b);
33729         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33730         b_conv.is_owned = false;
33731         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
33732         return ret_conv;
33733 }
33734
33735 void  __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint64_t this_ptr) {
33736         if (!ptr_is_owned(this_ptr)) return;
33737         void* this_ptr_ptr = untag_ptr(this_ptr);
33738         CHECK_ACCESS(this_ptr_ptr);
33739         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
33740         FREE(untag_ptr(this_ptr));
33741         NetAddress_free(this_ptr_conv);
33742 }
33743
33744 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
33745         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33746         *ret_copy = NetAddress_clone(arg);
33747         uint64_t ret_ref = tag_ptr(ret_copy, true);
33748         return ret_ref;
33749 }
33750 int64_t  __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint64_t arg) {
33751         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
33752         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
33753         return ret_conv;
33754 }
33755
33756 uint64_t  __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint64_t orig) {
33757         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
33758         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33759         *ret_copy = NetAddress_clone(orig_conv);
33760         uint64_t ret_ref = tag_ptr(ret_copy, true);
33761         return ret_ref;
33762 }
33763
33764 uint64_t  __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
33765         LDKFourBytes addr_ref;
33766         CHECK(addr->arr_len == 4);
33767         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
33768         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33769         *ret_copy = NetAddress_ipv4(addr_ref, port);
33770         uint64_t ret_ref = tag_ptr(ret_copy, true);
33771         return ret_ref;
33772 }
33773
33774 uint64_t  __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
33775         LDKSixteenBytes addr_ref;
33776         CHECK(addr->arr_len == 16);
33777         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
33778         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33779         *ret_copy = NetAddress_ipv6(addr_ref, port);
33780         uint64_t ret_ref = tag_ptr(ret_copy, true);
33781         return ret_ref;
33782 }
33783
33784 uint64_t  __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
33785         LDKTwelveBytes a_ref;
33786         CHECK(a->arr_len == 12);
33787         memcpy(a_ref.data, a->elems, 12); FREE(a);
33788         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33789         *ret_copy = NetAddress_onion_v2(a_ref);
33790         uint64_t ret_ref = tag_ptr(ret_copy, true);
33791         return ret_ref;
33792 }
33793
33794 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) {
33795         LDKThirtyTwoBytes ed25519_pubkey_ref;
33796         CHECK(ed25519_pubkey->arr_len == 32);
33797         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
33798         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33799         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
33800         uint64_t ret_ref = tag_ptr(ret_copy, true);
33801         return ret_ref;
33802 }
33803
33804 uint64_t  __attribute__((export_name("TS_NetAddress_hostname"))) TS_NetAddress_hostname(uint64_t hostname, int16_t port) {
33805         LDKHostname hostname_conv;
33806         hostname_conv.inner = untag_ptr(hostname);
33807         hostname_conv.is_owned = ptr_is_owned(hostname);
33808         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
33809         hostname_conv = Hostname_clone(&hostname_conv);
33810         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33811         *ret_copy = NetAddress_hostname(hostname_conv, port);
33812         uint64_t ret_ref = tag_ptr(ret_copy, true);
33813         return ret_ref;
33814 }
33815
33816 jboolean  __attribute__((export_name("TS_NetAddress_eq"))) TS_NetAddress_eq(uint64_t a, uint64_t b) {
33817         LDKNetAddress* a_conv = (LDKNetAddress*)untag_ptr(a);
33818         LDKNetAddress* b_conv = (LDKNetAddress*)untag_ptr(b);
33819         jboolean ret_conv = NetAddress_eq(a_conv, b_conv);
33820         return ret_conv;
33821 }
33822
33823 int8_tArray  __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint64_t obj) {
33824         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
33825         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
33826         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33827         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33828         CVec_u8Z_free(ret_var);
33829         return ret_arr;
33830 }
33831
33832 uint64_t  __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
33833         LDKu8slice ser_ref;
33834         ser_ref.datalen = ser->arr_len;
33835         ser_ref.data = ser->elems;
33836         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
33837         *ret_conv = NetAddress_read(ser_ref);
33838         FREE(ser);
33839         return tag_ptr(ret_conv, true);
33840 }
33841
33842 void  __attribute__((export_name("TS_UnsignedGossipMessage_free"))) TS_UnsignedGossipMessage_free(uint64_t this_ptr) {
33843         if (!ptr_is_owned(this_ptr)) return;
33844         void* this_ptr_ptr = untag_ptr(this_ptr);
33845         CHECK_ACCESS(this_ptr_ptr);
33846         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
33847         FREE(untag_ptr(this_ptr));
33848         UnsignedGossipMessage_free(this_ptr_conv);
33849 }
33850
33851 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
33852         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33853         *ret_copy = UnsignedGossipMessage_clone(arg);
33854         uint64_t ret_ref = tag_ptr(ret_copy, true);
33855         return ret_ref;
33856 }
33857 int64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone_ptr"))) TS_UnsignedGossipMessage_clone_ptr(uint64_t arg) {
33858         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
33859         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
33860         return ret_conv;
33861 }
33862
33863 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone"))) TS_UnsignedGossipMessage_clone(uint64_t orig) {
33864         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
33865         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33866         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
33867         uint64_t ret_ref = tag_ptr(ret_copy, true);
33868         return ret_ref;
33869 }
33870
33871 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_announcement"))) TS_UnsignedGossipMessage_channel_announcement(uint64_t a) {
33872         LDKUnsignedChannelAnnouncement a_conv;
33873         a_conv.inner = untag_ptr(a);
33874         a_conv.is_owned = ptr_is_owned(a);
33875         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33876         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
33877         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33878         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
33879         uint64_t ret_ref = tag_ptr(ret_copy, true);
33880         return ret_ref;
33881 }
33882
33883 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_update"))) TS_UnsignedGossipMessage_channel_update(uint64_t a) {
33884         LDKUnsignedChannelUpdate a_conv;
33885         a_conv.inner = untag_ptr(a);
33886         a_conv.is_owned = ptr_is_owned(a);
33887         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33888         a_conv = UnsignedChannelUpdate_clone(&a_conv);
33889         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33890         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
33891         uint64_t ret_ref = tag_ptr(ret_copy, true);
33892         return ret_ref;
33893 }
33894
33895 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_node_announcement"))) TS_UnsignedGossipMessage_node_announcement(uint64_t a) {
33896         LDKUnsignedNodeAnnouncement a_conv;
33897         a_conv.inner = untag_ptr(a);
33898         a_conv.is_owned = ptr_is_owned(a);
33899         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33900         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
33901         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33902         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
33903         uint64_t ret_ref = tag_ptr(ret_copy, true);
33904         return ret_ref;
33905 }
33906
33907 int8_tArray  __attribute__((export_name("TS_UnsignedGossipMessage_write"))) TS_UnsignedGossipMessage_write(uint64_t obj) {
33908         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
33909         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
33910         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33911         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33912         CVec_u8Z_free(ret_var);
33913         return ret_arr;
33914 }
33915
33916 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
33917         LDKUnsignedNodeAnnouncement this_obj_conv;
33918         this_obj_conv.inner = untag_ptr(this_obj);
33919         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33921         UnsignedNodeAnnouncement_free(this_obj_conv);
33922 }
33923
33924 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
33925         LDKUnsignedNodeAnnouncement this_ptr_conv;
33926         this_ptr_conv.inner = untag_ptr(this_ptr);
33927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33929         this_ptr_conv.is_owned = false;
33930         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
33931         uint64_t ret_ref = 0;
33932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33934         return ret_ref;
33935 }
33936
33937 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
33938         LDKUnsignedNodeAnnouncement this_ptr_conv;
33939         this_ptr_conv.inner = untag_ptr(this_ptr);
33940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33942         this_ptr_conv.is_owned = false;
33943         LDKNodeFeatures val_conv;
33944         val_conv.inner = untag_ptr(val);
33945         val_conv.is_owned = ptr_is_owned(val);
33946         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33947         val_conv = NodeFeatures_clone(&val_conv);
33948         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
33949 }
33950
33951 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
33952         LDKUnsignedNodeAnnouncement this_ptr_conv;
33953         this_ptr_conv.inner = untag_ptr(this_ptr);
33954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33956         this_ptr_conv.is_owned = false;
33957         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
33958         return ret_conv;
33959 }
33960
33961 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
33962         LDKUnsignedNodeAnnouncement this_ptr_conv;
33963         this_ptr_conv.inner = untag_ptr(this_ptr);
33964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33966         this_ptr_conv.is_owned = false;
33967         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
33968 }
33969
33970 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
33971         LDKUnsignedNodeAnnouncement this_ptr_conv;
33972         this_ptr_conv.inner = untag_ptr(this_ptr);
33973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33975         this_ptr_conv.is_owned = false;
33976         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
33977         uint64_t ret_ref = 0;
33978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33980         return ret_ref;
33981 }
33982
33983 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, uint64_t val) {
33984         LDKUnsignedNodeAnnouncement this_ptr_conv;
33985         this_ptr_conv.inner = untag_ptr(this_ptr);
33986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33988         this_ptr_conv.is_owned = false;
33989         LDKNodeId val_conv;
33990         val_conv.inner = untag_ptr(val);
33991         val_conv.is_owned = ptr_is_owned(val);
33992         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33993         val_conv = NodeId_clone(&val_conv);
33994         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
33995 }
33996
33997 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
33998         LDKUnsignedNodeAnnouncement this_ptr_conv;
33999         this_ptr_conv.inner = untag_ptr(this_ptr);
34000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34002         this_ptr_conv.is_owned = false;
34003         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
34004         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
34005         return ret_arr;
34006 }
34007
34008 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
34009         LDKUnsignedNodeAnnouncement this_ptr_conv;
34010         this_ptr_conv.inner = untag_ptr(this_ptr);
34011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34013         this_ptr_conv.is_owned = false;
34014         LDKThreeBytes val_ref;
34015         CHECK(val->arr_len == 3);
34016         memcpy(val_ref.data, val->elems, 3); FREE(val);
34017         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
34018 }
34019
34020 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
34021         LDKUnsignedNodeAnnouncement this_ptr_conv;
34022         this_ptr_conv.inner = untag_ptr(this_ptr);
34023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34025         this_ptr_conv.is_owned = false;
34026         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
34027         uint64_t ret_ref = 0;
34028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34030         return ret_ref;
34031 }
34032
34033 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, uint64_t val) {
34034         LDKUnsignedNodeAnnouncement this_ptr_conv;
34035         this_ptr_conv.inner = untag_ptr(this_ptr);
34036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34038         this_ptr_conv.is_owned = false;
34039         LDKNodeAlias val_conv;
34040         val_conv.inner = untag_ptr(val);
34041         val_conv.is_owned = ptr_is_owned(val);
34042         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34043         val_conv = NodeAlias_clone(&val_conv);
34044         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
34045 }
34046
34047 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
34048         LDKUnsignedNodeAnnouncement this_ptr_conv;
34049         this_ptr_conv.inner = untag_ptr(this_ptr);
34050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34052         this_ptr_conv.is_owned = false;
34053         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
34054         uint64_tArray ret_arr = NULL;
34055         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34056         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34057         for (size_t m = 0; m < ret_var.datalen; m++) {
34058                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
34059                 *ret_conv_12_copy = ret_var.data[m];
34060                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
34061                 ret_arr_ptr[m] = ret_conv_12_ref;
34062         }
34063         
34064         FREE(ret_var.data);
34065         return ret_arr;
34066 }
34067
34068 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
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         LDKCVec_NetAddressZ val_constr;
34075         val_constr.datalen = val->arr_len;
34076         if (val_constr.datalen > 0)
34077                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
34078         else
34079                 val_constr.data = NULL;
34080         uint64_t* val_vals = val->elems;
34081         for (size_t m = 0; m < val_constr.datalen; m++) {
34082                 uint64_t val_conv_12 = val_vals[m];
34083                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
34084                 CHECK_ACCESS(val_conv_12_ptr);
34085                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
34086                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
34087                 val_constr.data[m] = val_conv_12_conv;
34088         }
34089         FREE(val);
34090         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
34091 }
34092
34093 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
34094         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
34095         uint64_t ret_ref = 0;
34096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34098         return ret_ref;
34099 }
34100 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
34101         LDKUnsignedNodeAnnouncement arg_conv;
34102         arg_conv.inner = untag_ptr(arg);
34103         arg_conv.is_owned = ptr_is_owned(arg);
34104         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34105         arg_conv.is_owned = false;
34106         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
34107         return ret_conv;
34108 }
34109
34110 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
34111         LDKUnsignedNodeAnnouncement orig_conv;
34112         orig_conv.inner = untag_ptr(orig);
34113         orig_conv.is_owned = ptr_is_owned(orig);
34114         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34115         orig_conv.is_owned = false;
34116         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
34117         uint64_t ret_ref = 0;
34118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34120         return ret_ref;
34121 }
34122
34123 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
34124         LDKUnsignedNodeAnnouncement a_conv;
34125         a_conv.inner = untag_ptr(a);
34126         a_conv.is_owned = ptr_is_owned(a);
34127         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34128         a_conv.is_owned = false;
34129         LDKUnsignedNodeAnnouncement b_conv;
34130         b_conv.inner = untag_ptr(b);
34131         b_conv.is_owned = ptr_is_owned(b);
34132         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34133         b_conv.is_owned = false;
34134         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
34135         return ret_conv;
34136 }
34137
34138 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
34139         LDKNodeAnnouncement this_obj_conv;
34140         this_obj_conv.inner = untag_ptr(this_obj);
34141         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34143         NodeAnnouncement_free(this_obj_conv);
34144 }
34145
34146 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
34147         LDKNodeAnnouncement this_ptr_conv;
34148         this_ptr_conv.inner = untag_ptr(this_ptr);
34149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34151         this_ptr_conv.is_owned = false;
34152         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34153         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
34154         return ret_arr;
34155 }
34156
34157 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
34158         LDKNodeAnnouncement this_ptr_conv;
34159         this_ptr_conv.inner = untag_ptr(this_ptr);
34160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34162         this_ptr_conv.is_owned = false;
34163         LDKSignature val_ref;
34164         CHECK(val->arr_len == 64);
34165         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34166         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
34167 }
34168
34169 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
34170         LDKNodeAnnouncement this_ptr_conv;
34171         this_ptr_conv.inner = untag_ptr(this_ptr);
34172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34174         this_ptr_conv.is_owned = false;
34175         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
34176         uint64_t ret_ref = 0;
34177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34179         return ret_ref;
34180 }
34181
34182 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
34183         LDKNodeAnnouncement this_ptr_conv;
34184         this_ptr_conv.inner = untag_ptr(this_ptr);
34185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34187         this_ptr_conv.is_owned = false;
34188         LDKUnsignedNodeAnnouncement val_conv;
34189         val_conv.inner = untag_ptr(val);
34190         val_conv.is_owned = ptr_is_owned(val);
34191         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34192         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
34193         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
34194 }
34195
34196 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
34197         LDKSignature signature_arg_ref;
34198         CHECK(signature_arg->arr_len == 64);
34199         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
34200         LDKUnsignedNodeAnnouncement contents_arg_conv;
34201         contents_arg_conv.inner = untag_ptr(contents_arg);
34202         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34203         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34204         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
34205         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
34206         uint64_t ret_ref = 0;
34207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34209         return ret_ref;
34210 }
34211
34212 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
34213         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
34214         uint64_t ret_ref = 0;
34215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34217         return ret_ref;
34218 }
34219 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
34220         LDKNodeAnnouncement arg_conv;
34221         arg_conv.inner = untag_ptr(arg);
34222         arg_conv.is_owned = ptr_is_owned(arg);
34223         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34224         arg_conv.is_owned = false;
34225         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
34226         return ret_conv;
34227 }
34228
34229 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
34230         LDKNodeAnnouncement orig_conv;
34231         orig_conv.inner = untag_ptr(orig);
34232         orig_conv.is_owned = ptr_is_owned(orig);
34233         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34234         orig_conv.is_owned = false;
34235         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
34236         uint64_t ret_ref = 0;
34237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34239         return ret_ref;
34240 }
34241
34242 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
34243         LDKNodeAnnouncement a_conv;
34244         a_conv.inner = untag_ptr(a);
34245         a_conv.is_owned = ptr_is_owned(a);
34246         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34247         a_conv.is_owned = false;
34248         LDKNodeAnnouncement b_conv;
34249         b_conv.inner = untag_ptr(b);
34250         b_conv.is_owned = ptr_is_owned(b);
34251         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34252         b_conv.is_owned = false;
34253         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
34254         return ret_conv;
34255 }
34256
34257 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
34258         LDKUnsignedChannelAnnouncement this_obj_conv;
34259         this_obj_conv.inner = untag_ptr(this_obj);
34260         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34262         UnsignedChannelAnnouncement_free(this_obj_conv);
34263 }
34264
34265 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
34266         LDKUnsignedChannelAnnouncement this_ptr_conv;
34267         this_ptr_conv.inner = untag_ptr(this_ptr);
34268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34270         this_ptr_conv.is_owned = false;
34271         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
34272         uint64_t ret_ref = 0;
34273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34275         return ret_ref;
34276 }
34277
34278 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
34279         LDKUnsignedChannelAnnouncement this_ptr_conv;
34280         this_ptr_conv.inner = untag_ptr(this_ptr);
34281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34283         this_ptr_conv.is_owned = false;
34284         LDKChannelFeatures val_conv;
34285         val_conv.inner = untag_ptr(val);
34286         val_conv.is_owned = ptr_is_owned(val);
34287         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34288         val_conv = ChannelFeatures_clone(&val_conv);
34289         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
34290 }
34291
34292 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
34293         LDKUnsignedChannelAnnouncement this_ptr_conv;
34294         this_ptr_conv.inner = untag_ptr(this_ptr);
34295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34297         this_ptr_conv.is_owned = false;
34298         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34299         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
34300         return ret_arr;
34301 }
34302
34303 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34304         LDKUnsignedChannelAnnouncement this_ptr_conv;
34305         this_ptr_conv.inner = untag_ptr(this_ptr);
34306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34308         this_ptr_conv.is_owned = false;
34309         LDKThirtyTwoBytes val_ref;
34310         CHECK(val->arr_len == 32);
34311         memcpy(val_ref.data, val->elems, 32); FREE(val);
34312         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
34313 }
34314
34315 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
34316         LDKUnsignedChannelAnnouncement this_ptr_conv;
34317         this_ptr_conv.inner = untag_ptr(this_ptr);
34318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34320         this_ptr_conv.is_owned = false;
34321         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
34322         return ret_conv;
34323 }
34324
34325 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
34326         LDKUnsignedChannelAnnouncement this_ptr_conv;
34327         this_ptr_conv.inner = untag_ptr(this_ptr);
34328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34330         this_ptr_conv.is_owned = false;
34331         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
34332 }
34333
34334 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
34335         LDKUnsignedChannelAnnouncement this_ptr_conv;
34336         this_ptr_conv.inner = untag_ptr(this_ptr);
34337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34339         this_ptr_conv.is_owned = false;
34340         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
34341         uint64_t ret_ref = 0;
34342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34344         return ret_ref;
34345 }
34346
34347 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, uint64_t val) {
34348         LDKUnsignedChannelAnnouncement this_ptr_conv;
34349         this_ptr_conv.inner = untag_ptr(this_ptr);
34350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34352         this_ptr_conv.is_owned = false;
34353         LDKNodeId val_conv;
34354         val_conv.inner = untag_ptr(val);
34355         val_conv.is_owned = ptr_is_owned(val);
34356         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34357         val_conv = NodeId_clone(&val_conv);
34358         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
34359 }
34360
34361 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
34362         LDKUnsignedChannelAnnouncement this_ptr_conv;
34363         this_ptr_conv.inner = untag_ptr(this_ptr);
34364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34366         this_ptr_conv.is_owned = false;
34367         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
34368         uint64_t ret_ref = 0;
34369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34371         return ret_ref;
34372 }
34373
34374 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, uint64_t val) {
34375         LDKUnsignedChannelAnnouncement this_ptr_conv;
34376         this_ptr_conv.inner = untag_ptr(this_ptr);
34377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34379         this_ptr_conv.is_owned = false;
34380         LDKNodeId val_conv;
34381         val_conv.inner = untag_ptr(val);
34382         val_conv.is_owned = ptr_is_owned(val);
34383         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34384         val_conv = NodeId_clone(&val_conv);
34385         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
34386 }
34387
34388 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
34389         LDKUnsignedChannelAnnouncement this_ptr_conv;
34390         this_ptr_conv.inner = untag_ptr(this_ptr);
34391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34393         this_ptr_conv.is_owned = false;
34394         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
34395         uint64_t ret_ref = 0;
34396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34398         return ret_ref;
34399 }
34400
34401 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, uint64_t val) {
34402         LDKUnsignedChannelAnnouncement this_ptr_conv;
34403         this_ptr_conv.inner = untag_ptr(this_ptr);
34404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34406         this_ptr_conv.is_owned = false;
34407         LDKNodeId val_conv;
34408         val_conv.inner = untag_ptr(val);
34409         val_conv.is_owned = ptr_is_owned(val);
34410         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34411         val_conv = NodeId_clone(&val_conv);
34412         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
34413 }
34414
34415 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
34416         LDKUnsignedChannelAnnouncement this_ptr_conv;
34417         this_ptr_conv.inner = untag_ptr(this_ptr);
34418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34420         this_ptr_conv.is_owned = false;
34421         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
34422         uint64_t ret_ref = 0;
34423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34425         return ret_ref;
34426 }
34427
34428 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, uint64_t val) {
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 val_conv;
34435         val_conv.inner = untag_ptr(val);
34436         val_conv.is_owned = ptr_is_owned(val);
34437         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34438         val_conv = NodeId_clone(&val_conv);
34439         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
34440 }
34441
34442 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
34443         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
34444         uint64_t ret_ref = 0;
34445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34447         return ret_ref;
34448 }
34449 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
34450         LDKUnsignedChannelAnnouncement arg_conv;
34451         arg_conv.inner = untag_ptr(arg);
34452         arg_conv.is_owned = ptr_is_owned(arg);
34453         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34454         arg_conv.is_owned = false;
34455         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
34456         return ret_conv;
34457 }
34458
34459 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
34460         LDKUnsignedChannelAnnouncement orig_conv;
34461         orig_conv.inner = untag_ptr(orig);
34462         orig_conv.is_owned = ptr_is_owned(orig);
34463         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34464         orig_conv.is_owned = false;
34465         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
34466         uint64_t ret_ref = 0;
34467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34469         return ret_ref;
34470 }
34471
34472 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
34473         LDKUnsignedChannelAnnouncement a_conv;
34474         a_conv.inner = untag_ptr(a);
34475         a_conv.is_owned = ptr_is_owned(a);
34476         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34477         a_conv.is_owned = false;
34478         LDKUnsignedChannelAnnouncement b_conv;
34479         b_conv.inner = untag_ptr(b);
34480         b_conv.is_owned = ptr_is_owned(b);
34481         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34482         b_conv.is_owned = false;
34483         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
34484         return ret_conv;
34485 }
34486
34487 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
34488         LDKChannelAnnouncement this_obj_conv;
34489         this_obj_conv.inner = untag_ptr(this_obj);
34490         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34492         ChannelAnnouncement_free(this_obj_conv);
34493 }
34494
34495 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
34496         LDKChannelAnnouncement 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         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34502         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
34503         return ret_arr;
34504 }
34505
34506 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
34507         LDKChannelAnnouncement this_ptr_conv;
34508         this_ptr_conv.inner = untag_ptr(this_ptr);
34509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34511         this_ptr_conv.is_owned = false;
34512         LDKSignature val_ref;
34513         CHECK(val->arr_len == 64);
34514         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34515         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
34516 }
34517
34518 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
34519         LDKChannelAnnouncement this_ptr_conv;
34520         this_ptr_conv.inner = untag_ptr(this_ptr);
34521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34523         this_ptr_conv.is_owned = false;
34524         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34525         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
34526         return ret_arr;
34527 }
34528
34529 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
34530         LDKChannelAnnouncement this_ptr_conv;
34531         this_ptr_conv.inner = untag_ptr(this_ptr);
34532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34534         this_ptr_conv.is_owned = false;
34535         LDKSignature val_ref;
34536         CHECK(val->arr_len == 64);
34537         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34538         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
34539 }
34540
34541 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
34542         LDKChannelAnnouncement this_ptr_conv;
34543         this_ptr_conv.inner = untag_ptr(this_ptr);
34544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34546         this_ptr_conv.is_owned = false;
34547         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34548         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
34549         return ret_arr;
34550 }
34551
34552 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
34553         LDKChannelAnnouncement this_ptr_conv;
34554         this_ptr_conv.inner = untag_ptr(this_ptr);
34555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34557         this_ptr_conv.is_owned = false;
34558         LDKSignature val_ref;
34559         CHECK(val->arr_len == 64);
34560         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34561         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
34562 }
34563
34564 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
34565         LDKChannelAnnouncement this_ptr_conv;
34566         this_ptr_conv.inner = untag_ptr(this_ptr);
34567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34569         this_ptr_conv.is_owned = false;
34570         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34571         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
34572         return ret_arr;
34573 }
34574
34575 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
34576         LDKChannelAnnouncement this_ptr_conv;
34577         this_ptr_conv.inner = untag_ptr(this_ptr);
34578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34580         this_ptr_conv.is_owned = false;
34581         LDKSignature val_ref;
34582         CHECK(val->arr_len == 64);
34583         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34584         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
34585 }
34586
34587 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
34588         LDKChannelAnnouncement this_ptr_conv;
34589         this_ptr_conv.inner = untag_ptr(this_ptr);
34590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34592         this_ptr_conv.is_owned = false;
34593         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
34594         uint64_t ret_ref = 0;
34595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34597         return ret_ref;
34598 }
34599
34600 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t 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         LDKUnsignedChannelAnnouncement val_conv;
34607         val_conv.inner = untag_ptr(val);
34608         val_conv.is_owned = ptr_is_owned(val);
34609         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34610         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
34611         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
34612 }
34613
34614 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) {
34615         LDKSignature node_signature_1_arg_ref;
34616         CHECK(node_signature_1_arg->arr_len == 64);
34617         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
34618         LDKSignature node_signature_2_arg_ref;
34619         CHECK(node_signature_2_arg->arr_len == 64);
34620         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
34621         LDKSignature bitcoin_signature_1_arg_ref;
34622         CHECK(bitcoin_signature_1_arg->arr_len == 64);
34623         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
34624         LDKSignature bitcoin_signature_2_arg_ref;
34625         CHECK(bitcoin_signature_2_arg->arr_len == 64);
34626         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
34627         LDKUnsignedChannelAnnouncement contents_arg_conv;
34628         contents_arg_conv.inner = untag_ptr(contents_arg);
34629         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34630         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34631         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
34632         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);
34633         uint64_t ret_ref = 0;
34634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34636         return ret_ref;
34637 }
34638
34639 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
34640         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
34641         uint64_t ret_ref = 0;
34642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34644         return ret_ref;
34645 }
34646 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
34647         LDKChannelAnnouncement arg_conv;
34648         arg_conv.inner = untag_ptr(arg);
34649         arg_conv.is_owned = ptr_is_owned(arg);
34650         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34651         arg_conv.is_owned = false;
34652         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
34653         return ret_conv;
34654 }
34655
34656 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
34657         LDKChannelAnnouncement orig_conv;
34658         orig_conv.inner = untag_ptr(orig);
34659         orig_conv.is_owned = ptr_is_owned(orig);
34660         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34661         orig_conv.is_owned = false;
34662         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
34663         uint64_t ret_ref = 0;
34664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34666         return ret_ref;
34667 }
34668
34669 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
34670         LDKChannelAnnouncement a_conv;
34671         a_conv.inner = untag_ptr(a);
34672         a_conv.is_owned = ptr_is_owned(a);
34673         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34674         a_conv.is_owned = false;
34675         LDKChannelAnnouncement b_conv;
34676         b_conv.inner = untag_ptr(b);
34677         b_conv.is_owned = ptr_is_owned(b);
34678         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34679         b_conv.is_owned = false;
34680         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
34681         return ret_conv;
34682 }
34683
34684 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
34685         LDKUnsignedChannelUpdate this_obj_conv;
34686         this_obj_conv.inner = untag_ptr(this_obj);
34687         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34689         UnsignedChannelUpdate_free(this_obj_conv);
34690 }
34691
34692 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
34693         LDKUnsignedChannelUpdate this_ptr_conv;
34694         this_ptr_conv.inner = untag_ptr(this_ptr);
34695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34697         this_ptr_conv.is_owned = false;
34698         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34699         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
34700         return ret_arr;
34701 }
34702
34703 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34704         LDKUnsignedChannelUpdate this_ptr_conv;
34705         this_ptr_conv.inner = untag_ptr(this_ptr);
34706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34708         this_ptr_conv.is_owned = false;
34709         LDKThirtyTwoBytes val_ref;
34710         CHECK(val->arr_len == 32);
34711         memcpy(val_ref.data, val->elems, 32); FREE(val);
34712         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
34713 }
34714
34715 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
34716         LDKUnsignedChannelUpdate this_ptr_conv;
34717         this_ptr_conv.inner = untag_ptr(this_ptr);
34718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34720         this_ptr_conv.is_owned = false;
34721         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
34722         return ret_conv;
34723 }
34724
34725 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
34726         LDKUnsignedChannelUpdate this_ptr_conv;
34727         this_ptr_conv.inner = untag_ptr(this_ptr);
34728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34730         this_ptr_conv.is_owned = false;
34731         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
34732 }
34733
34734 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
34735         LDKUnsignedChannelUpdate this_ptr_conv;
34736         this_ptr_conv.inner = untag_ptr(this_ptr);
34737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34739         this_ptr_conv.is_owned = false;
34740         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
34741         return ret_conv;
34742 }
34743
34744 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
34745         LDKUnsignedChannelUpdate this_ptr_conv;
34746         this_ptr_conv.inner = untag_ptr(this_ptr);
34747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34749         this_ptr_conv.is_owned = false;
34750         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
34751 }
34752
34753 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
34754         LDKUnsignedChannelUpdate this_ptr_conv;
34755         this_ptr_conv.inner = untag_ptr(this_ptr);
34756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34758         this_ptr_conv.is_owned = false;
34759         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
34760         return ret_conv;
34761 }
34762
34763 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
34764         LDKUnsignedChannelUpdate this_ptr_conv;
34765         this_ptr_conv.inner = untag_ptr(this_ptr);
34766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34768         this_ptr_conv.is_owned = false;
34769         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
34770 }
34771
34772 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
34773         LDKUnsignedChannelUpdate this_ptr_conv;
34774         this_ptr_conv.inner = untag_ptr(this_ptr);
34775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34777         this_ptr_conv.is_owned = false;
34778         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
34779         return ret_conv;
34780 }
34781
34782 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
34783         LDKUnsignedChannelUpdate this_ptr_conv;
34784         this_ptr_conv.inner = untag_ptr(this_ptr);
34785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34787         this_ptr_conv.is_owned = false;
34788         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
34789 }
34790
34791 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
34792         LDKUnsignedChannelUpdate this_ptr_conv;
34793         this_ptr_conv.inner = untag_ptr(this_ptr);
34794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34796         this_ptr_conv.is_owned = false;
34797         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
34798         return ret_conv;
34799 }
34800
34801 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
34802         LDKUnsignedChannelUpdate this_ptr_conv;
34803         this_ptr_conv.inner = untag_ptr(this_ptr);
34804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34806         this_ptr_conv.is_owned = false;
34807         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
34808 }
34809
34810 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
34811         LDKUnsignedChannelUpdate this_ptr_conv;
34812         this_ptr_conv.inner = untag_ptr(this_ptr);
34813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34815         this_ptr_conv.is_owned = false;
34816         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
34817         return ret_conv;
34818 }
34819
34820 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
34821         LDKUnsignedChannelUpdate this_ptr_conv;
34822         this_ptr_conv.inner = untag_ptr(this_ptr);
34823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34825         this_ptr_conv.is_owned = false;
34826         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
34827 }
34828
34829 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
34830         LDKUnsignedChannelUpdate this_ptr_conv;
34831         this_ptr_conv.inner = untag_ptr(this_ptr);
34832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34834         this_ptr_conv.is_owned = false;
34835         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
34836         return ret_conv;
34837 }
34838
34839 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
34840         LDKUnsignedChannelUpdate this_ptr_conv;
34841         this_ptr_conv.inner = untag_ptr(this_ptr);
34842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34844         this_ptr_conv.is_owned = false;
34845         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
34846 }
34847
34848 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
34849         LDKUnsignedChannelUpdate this_ptr_conv;
34850         this_ptr_conv.inner = untag_ptr(this_ptr);
34851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34853         this_ptr_conv.is_owned = false;
34854         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
34855         return ret_conv;
34856 }
34857
34858 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
34859         LDKUnsignedChannelUpdate this_ptr_conv;
34860         this_ptr_conv.inner = untag_ptr(this_ptr);
34861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34863         this_ptr_conv.is_owned = false;
34864         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
34865 }
34866
34867 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
34868         LDKUnsignedChannelUpdate this_ptr_conv;
34869         this_ptr_conv.inner = untag_ptr(this_ptr);
34870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34872         this_ptr_conv.is_owned = false;
34873         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
34874         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34875         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34876         CVec_u8Z_free(ret_var);
34877         return ret_arr;
34878 }
34879
34880 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
34881         LDKUnsignedChannelUpdate this_ptr_conv;
34882         this_ptr_conv.inner = untag_ptr(this_ptr);
34883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34885         this_ptr_conv.is_owned = false;
34886         LDKCVec_u8Z val_ref;
34887         val_ref.datalen = val->arr_len;
34888         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
34889         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
34890         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
34891 }
34892
34893 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) {
34894         LDKThirtyTwoBytes chain_hash_arg_ref;
34895         CHECK(chain_hash_arg->arr_len == 32);
34896         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
34897         LDKCVec_u8Z excess_data_arg_ref;
34898         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
34899         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
34900         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
34901         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);
34902         uint64_t ret_ref = 0;
34903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34905         return ret_ref;
34906 }
34907
34908 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
34909         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
34910         uint64_t ret_ref = 0;
34911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34913         return ret_ref;
34914 }
34915 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
34916         LDKUnsignedChannelUpdate arg_conv;
34917         arg_conv.inner = untag_ptr(arg);
34918         arg_conv.is_owned = ptr_is_owned(arg);
34919         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34920         arg_conv.is_owned = false;
34921         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
34922         return ret_conv;
34923 }
34924
34925 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
34926         LDKUnsignedChannelUpdate orig_conv;
34927         orig_conv.inner = untag_ptr(orig);
34928         orig_conv.is_owned = ptr_is_owned(orig);
34929         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34930         orig_conv.is_owned = false;
34931         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
34932         uint64_t ret_ref = 0;
34933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34935         return ret_ref;
34936 }
34937
34938 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
34939         LDKUnsignedChannelUpdate a_conv;
34940         a_conv.inner = untag_ptr(a);
34941         a_conv.is_owned = ptr_is_owned(a);
34942         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34943         a_conv.is_owned = false;
34944         LDKUnsignedChannelUpdate b_conv;
34945         b_conv.inner = untag_ptr(b);
34946         b_conv.is_owned = ptr_is_owned(b);
34947         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34948         b_conv.is_owned = false;
34949         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
34950         return ret_conv;
34951 }
34952
34953 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
34954         LDKChannelUpdate this_obj_conv;
34955         this_obj_conv.inner = untag_ptr(this_obj);
34956         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34958         ChannelUpdate_free(this_obj_conv);
34959 }
34960
34961 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
34962         LDKChannelUpdate 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         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34968         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
34969         return ret_arr;
34970 }
34971
34972 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
34973         LDKChannelUpdate this_ptr_conv;
34974         this_ptr_conv.inner = untag_ptr(this_ptr);
34975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34977         this_ptr_conv.is_owned = false;
34978         LDKSignature val_ref;
34979         CHECK(val->arr_len == 64);
34980         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34981         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
34982 }
34983
34984 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
34985         LDKChannelUpdate this_ptr_conv;
34986         this_ptr_conv.inner = untag_ptr(this_ptr);
34987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34989         this_ptr_conv.is_owned = false;
34990         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
34991         uint64_t ret_ref = 0;
34992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34994         return ret_ref;
34995 }
34996
34997 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
34998         LDKChannelUpdate this_ptr_conv;
34999         this_ptr_conv.inner = untag_ptr(this_ptr);
35000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35002         this_ptr_conv.is_owned = false;
35003         LDKUnsignedChannelUpdate val_conv;
35004         val_conv.inner = untag_ptr(val);
35005         val_conv.is_owned = ptr_is_owned(val);
35006         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35007         val_conv = UnsignedChannelUpdate_clone(&val_conv);
35008         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
35009 }
35010
35011 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
35012         LDKSignature signature_arg_ref;
35013         CHECK(signature_arg->arr_len == 64);
35014         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
35015         LDKUnsignedChannelUpdate contents_arg_conv;
35016         contents_arg_conv.inner = untag_ptr(contents_arg);
35017         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
35018         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
35019         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
35020         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
35021         uint64_t ret_ref = 0;
35022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35024         return ret_ref;
35025 }
35026
35027 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
35028         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
35029         uint64_t ret_ref = 0;
35030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35032         return ret_ref;
35033 }
35034 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
35035         LDKChannelUpdate arg_conv;
35036         arg_conv.inner = untag_ptr(arg);
35037         arg_conv.is_owned = ptr_is_owned(arg);
35038         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35039         arg_conv.is_owned = false;
35040         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
35041         return ret_conv;
35042 }
35043
35044 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
35045         LDKChannelUpdate orig_conv;
35046         orig_conv.inner = untag_ptr(orig);
35047         orig_conv.is_owned = ptr_is_owned(orig);
35048         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35049         orig_conv.is_owned = false;
35050         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
35051         uint64_t ret_ref = 0;
35052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35054         return ret_ref;
35055 }
35056
35057 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
35058         LDKChannelUpdate a_conv;
35059         a_conv.inner = untag_ptr(a);
35060         a_conv.is_owned = ptr_is_owned(a);
35061         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35062         a_conv.is_owned = false;
35063         LDKChannelUpdate b_conv;
35064         b_conv.inner = untag_ptr(b);
35065         b_conv.is_owned = ptr_is_owned(b);
35066         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35067         b_conv.is_owned = false;
35068         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
35069         return ret_conv;
35070 }
35071
35072 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
35073         LDKQueryChannelRange this_obj_conv;
35074         this_obj_conv.inner = untag_ptr(this_obj);
35075         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35077         QueryChannelRange_free(this_obj_conv);
35078 }
35079
35080 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
35081         LDKQueryChannelRange this_ptr_conv;
35082         this_ptr_conv.inner = untag_ptr(this_ptr);
35083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35085         this_ptr_conv.is_owned = false;
35086         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35087         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
35088         return ret_arr;
35089 }
35090
35091 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35092         LDKQueryChannelRange 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         LDKThirtyTwoBytes val_ref;
35098         CHECK(val->arr_len == 32);
35099         memcpy(val_ref.data, val->elems, 32); FREE(val);
35100         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
35101 }
35102
35103 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
35104         LDKQueryChannelRange this_ptr_conv;
35105         this_ptr_conv.inner = untag_ptr(this_ptr);
35106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35108         this_ptr_conv.is_owned = false;
35109         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
35110         return ret_conv;
35111 }
35112
35113 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
35114         LDKQueryChannelRange this_ptr_conv;
35115         this_ptr_conv.inner = untag_ptr(this_ptr);
35116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35118         this_ptr_conv.is_owned = false;
35119         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
35120 }
35121
35122 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
35123         LDKQueryChannelRange this_ptr_conv;
35124         this_ptr_conv.inner = untag_ptr(this_ptr);
35125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35127         this_ptr_conv.is_owned = false;
35128         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
35129         return ret_conv;
35130 }
35131
35132 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
35133         LDKQueryChannelRange this_ptr_conv;
35134         this_ptr_conv.inner = untag_ptr(this_ptr);
35135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35137         this_ptr_conv.is_owned = false;
35138         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
35139 }
35140
35141 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) {
35142         LDKThirtyTwoBytes chain_hash_arg_ref;
35143         CHECK(chain_hash_arg->arr_len == 32);
35144         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35145         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
35146         uint64_t ret_ref = 0;
35147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35149         return ret_ref;
35150 }
35151
35152 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
35153         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
35154         uint64_t ret_ref = 0;
35155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35157         return ret_ref;
35158 }
35159 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
35160         LDKQueryChannelRange arg_conv;
35161         arg_conv.inner = untag_ptr(arg);
35162         arg_conv.is_owned = ptr_is_owned(arg);
35163         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35164         arg_conv.is_owned = false;
35165         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
35166         return ret_conv;
35167 }
35168
35169 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
35170         LDKQueryChannelRange orig_conv;
35171         orig_conv.inner = untag_ptr(orig);
35172         orig_conv.is_owned = ptr_is_owned(orig);
35173         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35174         orig_conv.is_owned = false;
35175         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
35176         uint64_t ret_ref = 0;
35177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35179         return ret_ref;
35180 }
35181
35182 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
35183         LDKQueryChannelRange a_conv;
35184         a_conv.inner = untag_ptr(a);
35185         a_conv.is_owned = ptr_is_owned(a);
35186         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35187         a_conv.is_owned = false;
35188         LDKQueryChannelRange b_conv;
35189         b_conv.inner = untag_ptr(b);
35190         b_conv.is_owned = ptr_is_owned(b);
35191         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35192         b_conv.is_owned = false;
35193         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
35194         return ret_conv;
35195 }
35196
35197 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
35198         LDKReplyChannelRange this_obj_conv;
35199         this_obj_conv.inner = untag_ptr(this_obj);
35200         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35202         ReplyChannelRange_free(this_obj_conv);
35203 }
35204
35205 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
35206         LDKReplyChannelRange this_ptr_conv;
35207         this_ptr_conv.inner = untag_ptr(this_ptr);
35208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35210         this_ptr_conv.is_owned = false;
35211         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35212         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
35213         return ret_arr;
35214 }
35215
35216 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35217         LDKReplyChannelRange 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         LDKThirtyTwoBytes val_ref;
35223         CHECK(val->arr_len == 32);
35224         memcpy(val_ref.data, val->elems, 32); FREE(val);
35225         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
35226 }
35227
35228 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
35229         LDKReplyChannelRange this_ptr_conv;
35230         this_ptr_conv.inner = untag_ptr(this_ptr);
35231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35233         this_ptr_conv.is_owned = false;
35234         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
35235         return ret_conv;
35236 }
35237
35238 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
35239         LDKReplyChannelRange this_ptr_conv;
35240         this_ptr_conv.inner = untag_ptr(this_ptr);
35241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35243         this_ptr_conv.is_owned = false;
35244         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
35245 }
35246
35247 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
35248         LDKReplyChannelRange this_ptr_conv;
35249         this_ptr_conv.inner = untag_ptr(this_ptr);
35250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35252         this_ptr_conv.is_owned = false;
35253         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
35254         return ret_conv;
35255 }
35256
35257 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
35258         LDKReplyChannelRange this_ptr_conv;
35259         this_ptr_conv.inner = untag_ptr(this_ptr);
35260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35262         this_ptr_conv.is_owned = false;
35263         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
35264 }
35265
35266 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
35267         LDKReplyChannelRange this_ptr_conv;
35268         this_ptr_conv.inner = untag_ptr(this_ptr);
35269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35271         this_ptr_conv.is_owned = false;
35272         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
35273         return ret_conv;
35274 }
35275
35276 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
35277         LDKReplyChannelRange this_ptr_conv;
35278         this_ptr_conv.inner = untag_ptr(this_ptr);
35279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35281         this_ptr_conv.is_owned = false;
35282         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
35283 }
35284
35285 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
35286         LDKReplyChannelRange this_ptr_conv;
35287         this_ptr_conv.inner = untag_ptr(this_ptr);
35288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35290         this_ptr_conv.is_owned = false;
35291         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
35292         int64_tArray ret_arr = NULL;
35293         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35294         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35295         for (size_t i = 0; i < ret_var.datalen; i++) {
35296                 int64_t ret_conv_8_conv = ret_var.data[i];
35297                 ret_arr_ptr[i] = ret_conv_8_conv;
35298         }
35299         
35300         FREE(ret_var.data);
35301         return ret_arr;
35302 }
35303
35304 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
35305         LDKReplyChannelRange this_ptr_conv;
35306         this_ptr_conv.inner = untag_ptr(this_ptr);
35307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35309         this_ptr_conv.is_owned = false;
35310         LDKCVec_u64Z val_constr;
35311         val_constr.datalen = val->arr_len;
35312         if (val_constr.datalen > 0)
35313                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35314         else
35315                 val_constr.data = NULL;
35316         int64_t* val_vals = val->elems;
35317         for (size_t i = 0; i < val_constr.datalen; i++) {
35318                 int64_t val_conv_8 = val_vals[i];
35319                 val_constr.data[i] = val_conv_8;
35320         }
35321         FREE(val);
35322         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
35323 }
35324
35325 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) {
35326         LDKThirtyTwoBytes chain_hash_arg_ref;
35327         CHECK(chain_hash_arg->arr_len == 32);
35328         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35329         LDKCVec_u64Z short_channel_ids_arg_constr;
35330         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
35331         if (short_channel_ids_arg_constr.datalen > 0)
35332                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35333         else
35334                 short_channel_ids_arg_constr.data = NULL;
35335         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
35336         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
35337                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
35338                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
35339         }
35340         FREE(short_channel_ids_arg);
35341         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
35342         uint64_t ret_ref = 0;
35343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35345         return ret_ref;
35346 }
35347
35348 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
35349         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
35350         uint64_t ret_ref = 0;
35351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35353         return ret_ref;
35354 }
35355 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
35356         LDKReplyChannelRange arg_conv;
35357         arg_conv.inner = untag_ptr(arg);
35358         arg_conv.is_owned = ptr_is_owned(arg);
35359         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35360         arg_conv.is_owned = false;
35361         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
35362         return ret_conv;
35363 }
35364
35365 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
35366         LDKReplyChannelRange orig_conv;
35367         orig_conv.inner = untag_ptr(orig);
35368         orig_conv.is_owned = ptr_is_owned(orig);
35369         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35370         orig_conv.is_owned = false;
35371         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
35372         uint64_t ret_ref = 0;
35373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35375         return ret_ref;
35376 }
35377
35378 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
35379         LDKReplyChannelRange a_conv;
35380         a_conv.inner = untag_ptr(a);
35381         a_conv.is_owned = ptr_is_owned(a);
35382         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35383         a_conv.is_owned = false;
35384         LDKReplyChannelRange b_conv;
35385         b_conv.inner = untag_ptr(b);
35386         b_conv.is_owned = ptr_is_owned(b);
35387         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35388         b_conv.is_owned = false;
35389         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
35390         return ret_conv;
35391 }
35392
35393 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
35394         LDKQueryShortChannelIds this_obj_conv;
35395         this_obj_conv.inner = untag_ptr(this_obj);
35396         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35398         QueryShortChannelIds_free(this_obj_conv);
35399 }
35400
35401 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
35402         LDKQueryShortChannelIds this_ptr_conv;
35403         this_ptr_conv.inner = untag_ptr(this_ptr);
35404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35406         this_ptr_conv.is_owned = false;
35407         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35408         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
35409         return ret_arr;
35410 }
35411
35412 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35413         LDKQueryShortChannelIds this_ptr_conv;
35414         this_ptr_conv.inner = untag_ptr(this_ptr);
35415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35417         this_ptr_conv.is_owned = false;
35418         LDKThirtyTwoBytes val_ref;
35419         CHECK(val->arr_len == 32);
35420         memcpy(val_ref.data, val->elems, 32); FREE(val);
35421         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
35422 }
35423
35424 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
35425         LDKQueryShortChannelIds this_ptr_conv;
35426         this_ptr_conv.inner = untag_ptr(this_ptr);
35427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35429         this_ptr_conv.is_owned = false;
35430         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
35431         int64_tArray ret_arr = NULL;
35432         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35433         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35434         for (size_t i = 0; i < ret_var.datalen; i++) {
35435                 int64_t ret_conv_8_conv = ret_var.data[i];
35436                 ret_arr_ptr[i] = ret_conv_8_conv;
35437         }
35438         
35439         FREE(ret_var.data);
35440         return ret_arr;
35441 }
35442
35443 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
35444         LDKQueryShortChannelIds this_ptr_conv;
35445         this_ptr_conv.inner = untag_ptr(this_ptr);
35446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35448         this_ptr_conv.is_owned = false;
35449         LDKCVec_u64Z val_constr;
35450         val_constr.datalen = val->arr_len;
35451         if (val_constr.datalen > 0)
35452                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35453         else
35454                 val_constr.data = NULL;
35455         int64_t* val_vals = val->elems;
35456         for (size_t i = 0; i < val_constr.datalen; i++) {
35457                 int64_t val_conv_8 = val_vals[i];
35458                 val_constr.data[i] = val_conv_8;
35459         }
35460         FREE(val);
35461         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
35462 }
35463
35464 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
35465         LDKThirtyTwoBytes chain_hash_arg_ref;
35466         CHECK(chain_hash_arg->arr_len == 32);
35467         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35468         LDKCVec_u64Z short_channel_ids_arg_constr;
35469         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
35470         if (short_channel_ids_arg_constr.datalen > 0)
35471                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35472         else
35473                 short_channel_ids_arg_constr.data = NULL;
35474         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
35475         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
35476                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
35477                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
35478         }
35479         FREE(short_channel_ids_arg);
35480         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
35481         uint64_t ret_ref = 0;
35482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35484         return ret_ref;
35485 }
35486
35487 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
35488         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
35489         uint64_t ret_ref = 0;
35490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35492         return ret_ref;
35493 }
35494 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
35495         LDKQueryShortChannelIds arg_conv;
35496         arg_conv.inner = untag_ptr(arg);
35497         arg_conv.is_owned = ptr_is_owned(arg);
35498         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35499         arg_conv.is_owned = false;
35500         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
35501         return ret_conv;
35502 }
35503
35504 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
35505         LDKQueryShortChannelIds orig_conv;
35506         orig_conv.inner = untag_ptr(orig);
35507         orig_conv.is_owned = ptr_is_owned(orig);
35508         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35509         orig_conv.is_owned = false;
35510         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
35511         uint64_t ret_ref = 0;
35512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35514         return ret_ref;
35515 }
35516
35517 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
35518         LDKQueryShortChannelIds a_conv;
35519         a_conv.inner = untag_ptr(a);
35520         a_conv.is_owned = ptr_is_owned(a);
35521         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35522         a_conv.is_owned = false;
35523         LDKQueryShortChannelIds b_conv;
35524         b_conv.inner = untag_ptr(b);
35525         b_conv.is_owned = ptr_is_owned(b);
35526         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35527         b_conv.is_owned = false;
35528         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
35529         return ret_conv;
35530 }
35531
35532 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
35533         LDKReplyShortChannelIdsEnd this_obj_conv;
35534         this_obj_conv.inner = untag_ptr(this_obj);
35535         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35537         ReplyShortChannelIdsEnd_free(this_obj_conv);
35538 }
35539
35540 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
35541         LDKReplyShortChannelIdsEnd this_ptr_conv;
35542         this_ptr_conv.inner = untag_ptr(this_ptr);
35543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35545         this_ptr_conv.is_owned = false;
35546         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35547         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
35548         return ret_arr;
35549 }
35550
35551 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35552         LDKReplyShortChannelIdsEnd this_ptr_conv;
35553         this_ptr_conv.inner = untag_ptr(this_ptr);
35554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35556         this_ptr_conv.is_owned = false;
35557         LDKThirtyTwoBytes val_ref;
35558         CHECK(val->arr_len == 32);
35559         memcpy(val_ref.data, val->elems, 32); FREE(val);
35560         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
35561 }
35562
35563 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
35564         LDKReplyShortChannelIdsEnd this_ptr_conv;
35565         this_ptr_conv.inner = untag_ptr(this_ptr);
35566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35568         this_ptr_conv.is_owned = false;
35569         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
35570         return ret_conv;
35571 }
35572
35573 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
35574         LDKReplyShortChannelIdsEnd this_ptr_conv;
35575         this_ptr_conv.inner = untag_ptr(this_ptr);
35576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35578         this_ptr_conv.is_owned = false;
35579         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
35580 }
35581
35582 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
35583         LDKThirtyTwoBytes chain_hash_arg_ref;
35584         CHECK(chain_hash_arg->arr_len == 32);
35585         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35586         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
35587         uint64_t ret_ref = 0;
35588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35590         return ret_ref;
35591 }
35592
35593 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
35594         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
35595         uint64_t ret_ref = 0;
35596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35598         return ret_ref;
35599 }
35600 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
35601         LDKReplyShortChannelIdsEnd arg_conv;
35602         arg_conv.inner = untag_ptr(arg);
35603         arg_conv.is_owned = ptr_is_owned(arg);
35604         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35605         arg_conv.is_owned = false;
35606         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
35607         return ret_conv;
35608 }
35609
35610 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
35611         LDKReplyShortChannelIdsEnd orig_conv;
35612         orig_conv.inner = untag_ptr(orig);
35613         orig_conv.is_owned = ptr_is_owned(orig);
35614         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35615         orig_conv.is_owned = false;
35616         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
35617         uint64_t ret_ref = 0;
35618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35620         return ret_ref;
35621 }
35622
35623 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
35624         LDKReplyShortChannelIdsEnd a_conv;
35625         a_conv.inner = untag_ptr(a);
35626         a_conv.is_owned = ptr_is_owned(a);
35627         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35628         a_conv.is_owned = false;
35629         LDKReplyShortChannelIdsEnd b_conv;
35630         b_conv.inner = untag_ptr(b);
35631         b_conv.is_owned = ptr_is_owned(b);
35632         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35633         b_conv.is_owned = false;
35634         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
35635         return ret_conv;
35636 }
35637
35638 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
35639         LDKGossipTimestampFilter this_obj_conv;
35640         this_obj_conv.inner = untag_ptr(this_obj);
35641         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35643         GossipTimestampFilter_free(this_obj_conv);
35644 }
35645
35646 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
35647         LDKGossipTimestampFilter this_ptr_conv;
35648         this_ptr_conv.inner = untag_ptr(this_ptr);
35649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35651         this_ptr_conv.is_owned = false;
35652         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35653         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
35654         return ret_arr;
35655 }
35656
35657 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35658         LDKGossipTimestampFilter 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         LDKThirtyTwoBytes val_ref;
35664         CHECK(val->arr_len == 32);
35665         memcpy(val_ref.data, val->elems, 32); FREE(val);
35666         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
35667 }
35668
35669 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
35670         LDKGossipTimestampFilter this_ptr_conv;
35671         this_ptr_conv.inner = untag_ptr(this_ptr);
35672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35674         this_ptr_conv.is_owned = false;
35675         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
35676         return ret_conv;
35677 }
35678
35679 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
35680         LDKGossipTimestampFilter this_ptr_conv;
35681         this_ptr_conv.inner = untag_ptr(this_ptr);
35682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35684         this_ptr_conv.is_owned = false;
35685         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
35686 }
35687
35688 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
35689         LDKGossipTimestampFilter this_ptr_conv;
35690         this_ptr_conv.inner = untag_ptr(this_ptr);
35691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35693         this_ptr_conv.is_owned = false;
35694         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
35695         return ret_conv;
35696 }
35697
35698 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
35699         LDKGossipTimestampFilter this_ptr_conv;
35700         this_ptr_conv.inner = untag_ptr(this_ptr);
35701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35703         this_ptr_conv.is_owned = false;
35704         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
35705 }
35706
35707 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) {
35708         LDKThirtyTwoBytes chain_hash_arg_ref;
35709         CHECK(chain_hash_arg->arr_len == 32);
35710         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35711         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
35712         uint64_t ret_ref = 0;
35713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35715         return ret_ref;
35716 }
35717
35718 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
35719         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
35720         uint64_t ret_ref = 0;
35721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35723         return ret_ref;
35724 }
35725 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
35726         LDKGossipTimestampFilter arg_conv;
35727         arg_conv.inner = untag_ptr(arg);
35728         arg_conv.is_owned = ptr_is_owned(arg);
35729         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35730         arg_conv.is_owned = false;
35731         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
35732         return ret_conv;
35733 }
35734
35735 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
35736         LDKGossipTimestampFilter orig_conv;
35737         orig_conv.inner = untag_ptr(orig);
35738         orig_conv.is_owned = ptr_is_owned(orig);
35739         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35740         orig_conv.is_owned = false;
35741         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
35742         uint64_t ret_ref = 0;
35743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35745         return ret_ref;
35746 }
35747
35748 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
35749         LDKGossipTimestampFilter a_conv;
35750         a_conv.inner = untag_ptr(a);
35751         a_conv.is_owned = ptr_is_owned(a);
35752         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35753         a_conv.is_owned = false;
35754         LDKGossipTimestampFilter b_conv;
35755         b_conv.inner = untag_ptr(b);
35756         b_conv.is_owned = ptr_is_owned(b);
35757         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35758         b_conv.is_owned = false;
35759         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
35760         return ret_conv;
35761 }
35762
35763 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
35764         if (!ptr_is_owned(this_ptr)) return;
35765         void* this_ptr_ptr = untag_ptr(this_ptr);
35766         CHECK_ACCESS(this_ptr_ptr);
35767         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
35768         FREE(untag_ptr(this_ptr));
35769         ErrorAction_free(this_ptr_conv);
35770 }
35771
35772 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
35773         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35774         *ret_copy = ErrorAction_clone(arg);
35775         uint64_t ret_ref = tag_ptr(ret_copy, true);
35776         return ret_ref;
35777 }
35778 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
35779         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
35780         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
35781         return ret_conv;
35782 }
35783
35784 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
35785         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
35786         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35787         *ret_copy = ErrorAction_clone(orig_conv);
35788         uint64_t ret_ref = tag_ptr(ret_copy, true);
35789         return ret_ref;
35790 }
35791
35792 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
35793         LDKErrorMessage msg_conv;
35794         msg_conv.inner = untag_ptr(msg);
35795         msg_conv.is_owned = ptr_is_owned(msg);
35796         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35797         msg_conv = ErrorMessage_clone(&msg_conv);
35798         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35799         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
35800         uint64_t ret_ref = tag_ptr(ret_copy, true);
35801         return ret_ref;
35802 }
35803
35804 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
35805         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35806         *ret_copy = ErrorAction_ignore_error();
35807         uint64_t ret_ref = tag_ptr(ret_copy, true);
35808         return ret_ref;
35809 }
35810
35811 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
35812         LDKLevel a_conv = LDKLevel_from_js(a);
35813         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35814         *ret_copy = ErrorAction_ignore_and_log(a_conv);
35815         uint64_t ret_ref = tag_ptr(ret_copy, true);
35816         return ret_ref;
35817 }
35818
35819 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
35820         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35821         *ret_copy = ErrorAction_ignore_duplicate_gossip();
35822         uint64_t ret_ref = tag_ptr(ret_copy, true);
35823         return ret_ref;
35824 }
35825
35826 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
35827         LDKErrorMessage msg_conv;
35828         msg_conv.inner = untag_ptr(msg);
35829         msg_conv.is_owned = ptr_is_owned(msg);
35830         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35831         msg_conv = ErrorMessage_clone(&msg_conv);
35832         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35833         *ret_copy = ErrorAction_send_error_message(msg_conv);
35834         uint64_t ret_ref = tag_ptr(ret_copy, true);
35835         return ret_ref;
35836 }
35837
35838 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
35839         LDKWarningMessage msg_conv;
35840         msg_conv.inner = untag_ptr(msg);
35841         msg_conv.is_owned = ptr_is_owned(msg);
35842         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35843         msg_conv = WarningMessage_clone(&msg_conv);
35844         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
35845         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35846         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
35847         uint64_t ret_ref = tag_ptr(ret_copy, true);
35848         return ret_ref;
35849 }
35850
35851 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
35852         LDKLightningError this_obj_conv;
35853         this_obj_conv.inner = untag_ptr(this_obj);
35854         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35856         LightningError_free(this_obj_conv);
35857 }
35858
35859 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
35860         LDKLightningError this_ptr_conv;
35861         this_ptr_conv.inner = untag_ptr(this_ptr);
35862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35864         this_ptr_conv.is_owned = false;
35865         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
35866         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
35867         Str_free(ret_str);
35868         return ret_conv;
35869 }
35870
35871 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
35872         LDKLightningError this_ptr_conv;
35873         this_ptr_conv.inner = untag_ptr(this_ptr);
35874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35876         this_ptr_conv.is_owned = false;
35877         LDKStr val_conv = str_ref_to_owned_c(val);
35878         LightningError_set_err(&this_ptr_conv, val_conv);
35879 }
35880
35881 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
35882         LDKLightningError this_ptr_conv;
35883         this_ptr_conv.inner = untag_ptr(this_ptr);
35884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35886         this_ptr_conv.is_owned = false;
35887         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35888         *ret_copy = LightningError_get_action(&this_ptr_conv);
35889         uint64_t ret_ref = tag_ptr(ret_copy, true);
35890         return ret_ref;
35891 }
35892
35893 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
35894         LDKLightningError this_ptr_conv;
35895         this_ptr_conv.inner = untag_ptr(this_ptr);
35896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35898         this_ptr_conv.is_owned = false;
35899         void* val_ptr = untag_ptr(val);
35900         CHECK_ACCESS(val_ptr);
35901         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
35902         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
35903         LightningError_set_action(&this_ptr_conv, val_conv);
35904 }
35905
35906 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
35907         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
35908         void* action_arg_ptr = untag_ptr(action_arg);
35909         CHECK_ACCESS(action_arg_ptr);
35910         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
35911         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
35912         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
35913         uint64_t ret_ref = 0;
35914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35916         return ret_ref;
35917 }
35918
35919 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
35920         LDKLightningError ret_var = LightningError_clone(arg);
35921         uint64_t ret_ref = 0;
35922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35924         return ret_ref;
35925 }
35926 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
35927         LDKLightningError arg_conv;
35928         arg_conv.inner = untag_ptr(arg);
35929         arg_conv.is_owned = ptr_is_owned(arg);
35930         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35931         arg_conv.is_owned = false;
35932         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
35933         return ret_conv;
35934 }
35935
35936 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
35937         LDKLightningError orig_conv;
35938         orig_conv.inner = untag_ptr(orig);
35939         orig_conv.is_owned = ptr_is_owned(orig);
35940         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35941         orig_conv.is_owned = false;
35942         LDKLightningError ret_var = LightningError_clone(&orig_conv);
35943         uint64_t ret_ref = 0;
35944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35946         return ret_ref;
35947 }
35948
35949 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
35950         LDKCommitmentUpdate this_obj_conv;
35951         this_obj_conv.inner = untag_ptr(this_obj);
35952         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35954         CommitmentUpdate_free(this_obj_conv);
35955 }
35956
35957 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
35958         LDKCommitmentUpdate this_ptr_conv;
35959         this_ptr_conv.inner = untag_ptr(this_ptr);
35960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35962         this_ptr_conv.is_owned = false;
35963         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
35964         uint64_tArray ret_arr = NULL;
35965         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35966         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35967         for (size_t p = 0; p < ret_var.datalen; p++) {
35968                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
35969                 uint64_t ret_conv_15_ref = 0;
35970                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
35971                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
35972                 ret_arr_ptr[p] = ret_conv_15_ref;
35973         }
35974         
35975         FREE(ret_var.data);
35976         return ret_arr;
35977 }
35978
35979 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
35980         LDKCommitmentUpdate this_ptr_conv;
35981         this_ptr_conv.inner = untag_ptr(this_ptr);
35982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35984         this_ptr_conv.is_owned = false;
35985         LDKCVec_UpdateAddHTLCZ val_constr;
35986         val_constr.datalen = val->arr_len;
35987         if (val_constr.datalen > 0)
35988                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
35989         else
35990                 val_constr.data = NULL;
35991         uint64_t* val_vals = val->elems;
35992         for (size_t p = 0; p < val_constr.datalen; p++) {
35993                 uint64_t val_conv_15 = val_vals[p];
35994                 LDKUpdateAddHTLC val_conv_15_conv;
35995                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
35996                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
35997                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
35998                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
35999                 val_constr.data[p] = val_conv_15_conv;
36000         }
36001         FREE(val);
36002         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
36003 }
36004
36005 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
36006         LDKCommitmentUpdate this_ptr_conv;
36007         this_ptr_conv.inner = untag_ptr(this_ptr);
36008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36010         this_ptr_conv.is_owned = false;
36011         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
36012         uint64_tArray ret_arr = NULL;
36013         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36014         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36015         for (size_t t = 0; t < ret_var.datalen; t++) {
36016                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
36017                 uint64_t ret_conv_19_ref = 0;
36018                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
36019                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
36020                 ret_arr_ptr[t] = ret_conv_19_ref;
36021         }
36022         
36023         FREE(ret_var.data);
36024         return ret_arr;
36025 }
36026
36027 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
36028         LDKCommitmentUpdate this_ptr_conv;
36029         this_ptr_conv.inner = untag_ptr(this_ptr);
36030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36032         this_ptr_conv.is_owned = false;
36033         LDKCVec_UpdateFulfillHTLCZ val_constr;
36034         val_constr.datalen = val->arr_len;
36035         if (val_constr.datalen > 0)
36036                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
36037         else
36038                 val_constr.data = NULL;
36039         uint64_t* val_vals = val->elems;
36040         for (size_t t = 0; t < val_constr.datalen; t++) {
36041                 uint64_t val_conv_19 = val_vals[t];
36042                 LDKUpdateFulfillHTLC val_conv_19_conv;
36043                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
36044                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
36045                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
36046                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
36047                 val_constr.data[t] = val_conv_19_conv;
36048         }
36049         FREE(val);
36050         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
36051 }
36052
36053 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
36054         LDKCommitmentUpdate this_ptr_conv;
36055         this_ptr_conv.inner = untag_ptr(this_ptr);
36056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36058         this_ptr_conv.is_owned = false;
36059         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
36060         uint64_tArray ret_arr = NULL;
36061         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36062         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36063         for (size_t q = 0; q < ret_var.datalen; q++) {
36064                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
36065                 uint64_t ret_conv_16_ref = 0;
36066                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
36067                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
36068                 ret_arr_ptr[q] = ret_conv_16_ref;
36069         }
36070         
36071         FREE(ret_var.data);
36072         return ret_arr;
36073 }
36074
36075 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
36076         LDKCommitmentUpdate this_ptr_conv;
36077         this_ptr_conv.inner = untag_ptr(this_ptr);
36078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36080         this_ptr_conv.is_owned = false;
36081         LDKCVec_UpdateFailHTLCZ val_constr;
36082         val_constr.datalen = val->arr_len;
36083         if (val_constr.datalen > 0)
36084                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
36085         else
36086                 val_constr.data = NULL;
36087         uint64_t* val_vals = val->elems;
36088         for (size_t q = 0; q < val_constr.datalen; q++) {
36089                 uint64_t val_conv_16 = val_vals[q];
36090                 LDKUpdateFailHTLC val_conv_16_conv;
36091                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
36092                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
36093                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
36094                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
36095                 val_constr.data[q] = val_conv_16_conv;
36096         }
36097         FREE(val);
36098         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
36099 }
36100
36101 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
36102         LDKCommitmentUpdate this_ptr_conv;
36103         this_ptr_conv.inner = untag_ptr(this_ptr);
36104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36106         this_ptr_conv.is_owned = false;
36107         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
36108         uint64_tArray ret_arr = NULL;
36109         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36110         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36111         for (size_t z = 0; z < ret_var.datalen; z++) {
36112                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
36113                 uint64_t ret_conv_25_ref = 0;
36114                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
36115                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
36116                 ret_arr_ptr[z] = ret_conv_25_ref;
36117         }
36118         
36119         FREE(ret_var.data);
36120         return ret_arr;
36121 }
36122
36123 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) {
36124         LDKCommitmentUpdate this_ptr_conv;
36125         this_ptr_conv.inner = untag_ptr(this_ptr);
36126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36128         this_ptr_conv.is_owned = false;
36129         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
36130         val_constr.datalen = val->arr_len;
36131         if (val_constr.datalen > 0)
36132                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
36133         else
36134                 val_constr.data = NULL;
36135         uint64_t* val_vals = val->elems;
36136         for (size_t z = 0; z < val_constr.datalen; z++) {
36137                 uint64_t val_conv_25 = val_vals[z];
36138                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
36139                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
36140                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
36141                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
36142                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
36143                 val_constr.data[z] = val_conv_25_conv;
36144         }
36145         FREE(val);
36146         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
36147 }
36148
36149 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
36150         LDKCommitmentUpdate this_ptr_conv;
36151         this_ptr_conv.inner = untag_ptr(this_ptr);
36152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36154         this_ptr_conv.is_owned = false;
36155         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
36156         uint64_t ret_ref = 0;
36157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36159         return ret_ref;
36160 }
36161
36162 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
36163         LDKCommitmentUpdate this_ptr_conv;
36164         this_ptr_conv.inner = untag_ptr(this_ptr);
36165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36167         this_ptr_conv.is_owned = false;
36168         LDKUpdateFee val_conv;
36169         val_conv.inner = untag_ptr(val);
36170         val_conv.is_owned = ptr_is_owned(val);
36171         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36172         val_conv = UpdateFee_clone(&val_conv);
36173         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
36174 }
36175
36176 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
36177         LDKCommitmentUpdate this_ptr_conv;
36178         this_ptr_conv.inner = untag_ptr(this_ptr);
36179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36181         this_ptr_conv.is_owned = false;
36182         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
36183         uint64_t ret_ref = 0;
36184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36186         return ret_ref;
36187 }
36188
36189 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
36190         LDKCommitmentUpdate this_ptr_conv;
36191         this_ptr_conv.inner = untag_ptr(this_ptr);
36192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36194         this_ptr_conv.is_owned = false;
36195         LDKCommitmentSigned val_conv;
36196         val_conv.inner = untag_ptr(val);
36197         val_conv.is_owned = ptr_is_owned(val);
36198         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36199         val_conv = CommitmentSigned_clone(&val_conv);
36200         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
36201 }
36202
36203 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) {
36204         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
36205         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
36206         if (update_add_htlcs_arg_constr.datalen > 0)
36207                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
36208         else
36209                 update_add_htlcs_arg_constr.data = NULL;
36210         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
36211         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
36212                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
36213                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
36214                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
36215                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
36216                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
36217                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
36218                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
36219         }
36220         FREE(update_add_htlcs_arg);
36221         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
36222         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
36223         if (update_fulfill_htlcs_arg_constr.datalen > 0)
36224                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
36225         else
36226                 update_fulfill_htlcs_arg_constr.data = NULL;
36227         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
36228         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
36229                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
36230                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
36231                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
36232                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
36233                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
36234                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
36235                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
36236         }
36237         FREE(update_fulfill_htlcs_arg);
36238         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
36239         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
36240         if (update_fail_htlcs_arg_constr.datalen > 0)
36241                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
36242         else
36243                 update_fail_htlcs_arg_constr.data = NULL;
36244         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
36245         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
36246                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
36247                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
36248                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
36249                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
36250                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
36251                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
36252                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
36253         }
36254         FREE(update_fail_htlcs_arg);
36255         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
36256         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
36257         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
36258                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
36259         else
36260                 update_fail_malformed_htlcs_arg_constr.data = NULL;
36261         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
36262         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
36263                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
36264                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
36265                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
36266                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
36267                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
36268                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
36269                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
36270         }
36271         FREE(update_fail_malformed_htlcs_arg);
36272         LDKUpdateFee update_fee_arg_conv;
36273         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
36274         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
36275         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
36276         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
36277         LDKCommitmentSigned commitment_signed_arg_conv;
36278         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
36279         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
36280         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
36281         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
36282         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);
36283         uint64_t ret_ref = 0;
36284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36286         return ret_ref;
36287 }
36288
36289 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
36290         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
36291         uint64_t ret_ref = 0;
36292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36294         return ret_ref;
36295 }
36296 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
36297         LDKCommitmentUpdate arg_conv;
36298         arg_conv.inner = untag_ptr(arg);
36299         arg_conv.is_owned = ptr_is_owned(arg);
36300         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36301         arg_conv.is_owned = false;
36302         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
36303         return ret_conv;
36304 }
36305
36306 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
36307         LDKCommitmentUpdate orig_conv;
36308         orig_conv.inner = untag_ptr(orig);
36309         orig_conv.is_owned = ptr_is_owned(orig);
36310         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36311         orig_conv.is_owned = false;
36312         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
36313         uint64_t ret_ref = 0;
36314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36316         return ret_ref;
36317 }
36318
36319 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
36320         LDKCommitmentUpdate a_conv;
36321         a_conv.inner = untag_ptr(a);
36322         a_conv.is_owned = ptr_is_owned(a);
36323         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36324         a_conv.is_owned = false;
36325         LDKCommitmentUpdate b_conv;
36326         b_conv.inner = untag_ptr(b);
36327         b_conv.is_owned = ptr_is_owned(b);
36328         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36329         b_conv.is_owned = false;
36330         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
36331         return ret_conv;
36332 }
36333
36334 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
36335         if (!ptr_is_owned(this_ptr)) return;
36336         void* this_ptr_ptr = untag_ptr(this_ptr);
36337         CHECK_ACCESS(this_ptr_ptr);
36338         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
36339         FREE(untag_ptr(this_ptr));
36340         ChannelMessageHandler_free(this_ptr_conv);
36341 }
36342
36343 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
36344         if (!ptr_is_owned(this_ptr)) return;
36345         void* this_ptr_ptr = untag_ptr(this_ptr);
36346         CHECK_ACCESS(this_ptr_ptr);
36347         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
36348         FREE(untag_ptr(this_ptr));
36349         RoutingMessageHandler_free(this_ptr_conv);
36350 }
36351
36352 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
36353         if (!ptr_is_owned(this_ptr)) return;
36354         void* this_ptr_ptr = untag_ptr(this_ptr);
36355         CHECK_ACCESS(this_ptr_ptr);
36356         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
36357         FREE(untag_ptr(this_ptr));
36358         OnionMessageHandler_free(this_ptr_conv);
36359 }
36360
36361 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
36362         LDKAcceptChannel obj_conv;
36363         obj_conv.inner = untag_ptr(obj);
36364         obj_conv.is_owned = ptr_is_owned(obj);
36365         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36366         obj_conv.is_owned = false;
36367         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
36368         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36369         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36370         CVec_u8Z_free(ret_var);
36371         return ret_arr;
36372 }
36373
36374 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
36375         LDKu8slice ser_ref;
36376         ser_ref.datalen = ser->arr_len;
36377         ser_ref.data = ser->elems;
36378         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
36379         *ret_conv = AcceptChannel_read(ser_ref);
36380         FREE(ser);
36381         return tag_ptr(ret_conv, true);
36382 }
36383
36384 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
36385         LDKAnnouncementSignatures obj_conv;
36386         obj_conv.inner = untag_ptr(obj);
36387         obj_conv.is_owned = ptr_is_owned(obj);
36388         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36389         obj_conv.is_owned = false;
36390         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
36391         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36392         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36393         CVec_u8Z_free(ret_var);
36394         return ret_arr;
36395 }
36396
36397 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
36398         LDKu8slice ser_ref;
36399         ser_ref.datalen = ser->arr_len;
36400         ser_ref.data = ser->elems;
36401         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
36402         *ret_conv = AnnouncementSignatures_read(ser_ref);
36403         FREE(ser);
36404         return tag_ptr(ret_conv, true);
36405 }
36406
36407 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
36408         LDKChannelReestablish obj_conv;
36409         obj_conv.inner = untag_ptr(obj);
36410         obj_conv.is_owned = ptr_is_owned(obj);
36411         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36412         obj_conv.is_owned = false;
36413         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
36414         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36415         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36416         CVec_u8Z_free(ret_var);
36417         return ret_arr;
36418 }
36419
36420 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
36421         LDKu8slice ser_ref;
36422         ser_ref.datalen = ser->arr_len;
36423         ser_ref.data = ser->elems;
36424         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
36425         *ret_conv = ChannelReestablish_read(ser_ref);
36426         FREE(ser);
36427         return tag_ptr(ret_conv, true);
36428 }
36429
36430 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
36431         LDKClosingSigned obj_conv;
36432         obj_conv.inner = untag_ptr(obj);
36433         obj_conv.is_owned = ptr_is_owned(obj);
36434         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36435         obj_conv.is_owned = false;
36436         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
36437         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36438         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36439         CVec_u8Z_free(ret_var);
36440         return ret_arr;
36441 }
36442
36443 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
36444         LDKu8slice ser_ref;
36445         ser_ref.datalen = ser->arr_len;
36446         ser_ref.data = ser->elems;
36447         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
36448         *ret_conv = ClosingSigned_read(ser_ref);
36449         FREE(ser);
36450         return tag_ptr(ret_conv, true);
36451 }
36452
36453 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
36454         LDKClosingSignedFeeRange obj_conv;
36455         obj_conv.inner = untag_ptr(obj);
36456         obj_conv.is_owned = ptr_is_owned(obj);
36457         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36458         obj_conv.is_owned = false;
36459         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
36460         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36461         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36462         CVec_u8Z_free(ret_var);
36463         return ret_arr;
36464 }
36465
36466 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
36467         LDKu8slice ser_ref;
36468         ser_ref.datalen = ser->arr_len;
36469         ser_ref.data = ser->elems;
36470         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
36471         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
36472         FREE(ser);
36473         return tag_ptr(ret_conv, true);
36474 }
36475
36476 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
36477         LDKCommitmentSigned obj_conv;
36478         obj_conv.inner = untag_ptr(obj);
36479         obj_conv.is_owned = ptr_is_owned(obj);
36480         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36481         obj_conv.is_owned = false;
36482         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
36483         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36484         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36485         CVec_u8Z_free(ret_var);
36486         return ret_arr;
36487 }
36488
36489 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
36490         LDKu8slice ser_ref;
36491         ser_ref.datalen = ser->arr_len;
36492         ser_ref.data = ser->elems;
36493         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
36494         *ret_conv = CommitmentSigned_read(ser_ref);
36495         FREE(ser);
36496         return tag_ptr(ret_conv, true);
36497 }
36498
36499 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
36500         LDKFundingCreated obj_conv;
36501         obj_conv.inner = untag_ptr(obj);
36502         obj_conv.is_owned = ptr_is_owned(obj);
36503         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36504         obj_conv.is_owned = false;
36505         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
36506         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36507         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36508         CVec_u8Z_free(ret_var);
36509         return ret_arr;
36510 }
36511
36512 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
36513         LDKu8slice ser_ref;
36514         ser_ref.datalen = ser->arr_len;
36515         ser_ref.data = ser->elems;
36516         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
36517         *ret_conv = FundingCreated_read(ser_ref);
36518         FREE(ser);
36519         return tag_ptr(ret_conv, true);
36520 }
36521
36522 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
36523         LDKFundingSigned obj_conv;
36524         obj_conv.inner = untag_ptr(obj);
36525         obj_conv.is_owned = ptr_is_owned(obj);
36526         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36527         obj_conv.is_owned = false;
36528         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
36529         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36530         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36531         CVec_u8Z_free(ret_var);
36532         return ret_arr;
36533 }
36534
36535 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
36536         LDKu8slice ser_ref;
36537         ser_ref.datalen = ser->arr_len;
36538         ser_ref.data = ser->elems;
36539         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
36540         *ret_conv = FundingSigned_read(ser_ref);
36541         FREE(ser);
36542         return tag_ptr(ret_conv, true);
36543 }
36544
36545 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
36546         LDKChannelReady obj_conv;
36547         obj_conv.inner = untag_ptr(obj);
36548         obj_conv.is_owned = ptr_is_owned(obj);
36549         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36550         obj_conv.is_owned = false;
36551         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
36552         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36553         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36554         CVec_u8Z_free(ret_var);
36555         return ret_arr;
36556 }
36557
36558 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
36559         LDKu8slice ser_ref;
36560         ser_ref.datalen = ser->arr_len;
36561         ser_ref.data = ser->elems;
36562         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
36563         *ret_conv = ChannelReady_read(ser_ref);
36564         FREE(ser);
36565         return tag_ptr(ret_conv, true);
36566 }
36567
36568 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
36569         LDKInit obj_conv;
36570         obj_conv.inner = untag_ptr(obj);
36571         obj_conv.is_owned = ptr_is_owned(obj);
36572         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36573         obj_conv.is_owned = false;
36574         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
36575         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36576         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36577         CVec_u8Z_free(ret_var);
36578         return ret_arr;
36579 }
36580
36581 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
36582         LDKu8slice ser_ref;
36583         ser_ref.datalen = ser->arr_len;
36584         ser_ref.data = ser->elems;
36585         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
36586         *ret_conv = Init_read(ser_ref);
36587         FREE(ser);
36588         return tag_ptr(ret_conv, true);
36589 }
36590
36591 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
36592         LDKOpenChannel obj_conv;
36593         obj_conv.inner = untag_ptr(obj);
36594         obj_conv.is_owned = ptr_is_owned(obj);
36595         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36596         obj_conv.is_owned = false;
36597         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
36598         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36599         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36600         CVec_u8Z_free(ret_var);
36601         return ret_arr;
36602 }
36603
36604 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
36605         LDKu8slice ser_ref;
36606         ser_ref.datalen = ser->arr_len;
36607         ser_ref.data = ser->elems;
36608         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
36609         *ret_conv = OpenChannel_read(ser_ref);
36610         FREE(ser);
36611         return tag_ptr(ret_conv, true);
36612 }
36613
36614 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
36615         LDKRevokeAndACK obj_conv;
36616         obj_conv.inner = untag_ptr(obj);
36617         obj_conv.is_owned = ptr_is_owned(obj);
36618         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36619         obj_conv.is_owned = false;
36620         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
36621         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36622         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36623         CVec_u8Z_free(ret_var);
36624         return ret_arr;
36625 }
36626
36627 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
36628         LDKu8slice ser_ref;
36629         ser_ref.datalen = ser->arr_len;
36630         ser_ref.data = ser->elems;
36631         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
36632         *ret_conv = RevokeAndACK_read(ser_ref);
36633         FREE(ser);
36634         return tag_ptr(ret_conv, true);
36635 }
36636
36637 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
36638         LDKShutdown obj_conv;
36639         obj_conv.inner = untag_ptr(obj);
36640         obj_conv.is_owned = ptr_is_owned(obj);
36641         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36642         obj_conv.is_owned = false;
36643         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
36644         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36645         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36646         CVec_u8Z_free(ret_var);
36647         return ret_arr;
36648 }
36649
36650 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
36651         LDKu8slice ser_ref;
36652         ser_ref.datalen = ser->arr_len;
36653         ser_ref.data = ser->elems;
36654         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
36655         *ret_conv = Shutdown_read(ser_ref);
36656         FREE(ser);
36657         return tag_ptr(ret_conv, true);
36658 }
36659
36660 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
36661         LDKUpdateFailHTLC obj_conv;
36662         obj_conv.inner = untag_ptr(obj);
36663         obj_conv.is_owned = ptr_is_owned(obj);
36664         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36665         obj_conv.is_owned = false;
36666         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
36667         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36668         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36669         CVec_u8Z_free(ret_var);
36670         return ret_arr;
36671 }
36672
36673 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
36674         LDKu8slice ser_ref;
36675         ser_ref.datalen = ser->arr_len;
36676         ser_ref.data = ser->elems;
36677         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
36678         *ret_conv = UpdateFailHTLC_read(ser_ref);
36679         FREE(ser);
36680         return tag_ptr(ret_conv, true);
36681 }
36682
36683 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
36684         LDKUpdateFailMalformedHTLC obj_conv;
36685         obj_conv.inner = untag_ptr(obj);
36686         obj_conv.is_owned = ptr_is_owned(obj);
36687         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36688         obj_conv.is_owned = false;
36689         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
36690         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36691         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36692         CVec_u8Z_free(ret_var);
36693         return ret_arr;
36694 }
36695
36696 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
36697         LDKu8slice ser_ref;
36698         ser_ref.datalen = ser->arr_len;
36699         ser_ref.data = ser->elems;
36700         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
36701         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
36702         FREE(ser);
36703         return tag_ptr(ret_conv, true);
36704 }
36705
36706 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
36707         LDKUpdateFee obj_conv;
36708         obj_conv.inner = untag_ptr(obj);
36709         obj_conv.is_owned = ptr_is_owned(obj);
36710         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36711         obj_conv.is_owned = false;
36712         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
36713         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36714         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36715         CVec_u8Z_free(ret_var);
36716         return ret_arr;
36717 }
36718
36719 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
36720         LDKu8slice ser_ref;
36721         ser_ref.datalen = ser->arr_len;
36722         ser_ref.data = ser->elems;
36723         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
36724         *ret_conv = UpdateFee_read(ser_ref);
36725         FREE(ser);
36726         return tag_ptr(ret_conv, true);
36727 }
36728
36729 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
36730         LDKUpdateFulfillHTLC obj_conv;
36731         obj_conv.inner = untag_ptr(obj);
36732         obj_conv.is_owned = ptr_is_owned(obj);
36733         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36734         obj_conv.is_owned = false;
36735         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
36736         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36737         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36738         CVec_u8Z_free(ret_var);
36739         return ret_arr;
36740 }
36741
36742 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
36743         LDKu8slice ser_ref;
36744         ser_ref.datalen = ser->arr_len;
36745         ser_ref.data = ser->elems;
36746         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
36747         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
36748         FREE(ser);
36749         return tag_ptr(ret_conv, true);
36750 }
36751
36752 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
36753         LDKUpdateAddHTLC obj_conv;
36754         obj_conv.inner = untag_ptr(obj);
36755         obj_conv.is_owned = ptr_is_owned(obj);
36756         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36757         obj_conv.is_owned = false;
36758         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
36759         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36760         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36761         CVec_u8Z_free(ret_var);
36762         return ret_arr;
36763 }
36764
36765 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
36766         LDKu8slice ser_ref;
36767         ser_ref.datalen = ser->arr_len;
36768         ser_ref.data = ser->elems;
36769         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
36770         *ret_conv = UpdateAddHTLC_read(ser_ref);
36771         FREE(ser);
36772         return tag_ptr(ret_conv, true);
36773 }
36774
36775 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
36776         LDKu8slice ser_ref;
36777         ser_ref.datalen = ser->arr_len;
36778         ser_ref.data = ser->elems;
36779         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
36780         *ret_conv = OnionMessage_read(ser_ref);
36781         FREE(ser);
36782         return tag_ptr(ret_conv, true);
36783 }
36784
36785 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
36786         LDKOnionMessage obj_conv;
36787         obj_conv.inner = untag_ptr(obj);
36788         obj_conv.is_owned = ptr_is_owned(obj);
36789         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36790         obj_conv.is_owned = false;
36791         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
36792         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36793         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36794         CVec_u8Z_free(ret_var);
36795         return ret_arr;
36796 }
36797
36798 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
36799         LDKPing obj_conv;
36800         obj_conv.inner = untag_ptr(obj);
36801         obj_conv.is_owned = ptr_is_owned(obj);
36802         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36803         obj_conv.is_owned = false;
36804         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
36805         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36806         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36807         CVec_u8Z_free(ret_var);
36808         return ret_arr;
36809 }
36810
36811 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
36812         LDKu8slice ser_ref;
36813         ser_ref.datalen = ser->arr_len;
36814         ser_ref.data = ser->elems;
36815         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
36816         *ret_conv = Ping_read(ser_ref);
36817         FREE(ser);
36818         return tag_ptr(ret_conv, true);
36819 }
36820
36821 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
36822         LDKPong obj_conv;
36823         obj_conv.inner = untag_ptr(obj);
36824         obj_conv.is_owned = ptr_is_owned(obj);
36825         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36826         obj_conv.is_owned = false;
36827         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
36828         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36829         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36830         CVec_u8Z_free(ret_var);
36831         return ret_arr;
36832 }
36833
36834 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
36835         LDKu8slice ser_ref;
36836         ser_ref.datalen = ser->arr_len;
36837         ser_ref.data = ser->elems;
36838         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
36839         *ret_conv = Pong_read(ser_ref);
36840         FREE(ser);
36841         return tag_ptr(ret_conv, true);
36842 }
36843
36844 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
36845         LDKUnsignedChannelAnnouncement obj_conv;
36846         obj_conv.inner = untag_ptr(obj);
36847         obj_conv.is_owned = ptr_is_owned(obj);
36848         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36849         obj_conv.is_owned = false;
36850         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
36851         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36852         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36853         CVec_u8Z_free(ret_var);
36854         return ret_arr;
36855 }
36856
36857 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
36858         LDKu8slice ser_ref;
36859         ser_ref.datalen = ser->arr_len;
36860         ser_ref.data = ser->elems;
36861         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
36862         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
36863         FREE(ser);
36864         return tag_ptr(ret_conv, true);
36865 }
36866
36867 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
36868         LDKChannelAnnouncement obj_conv;
36869         obj_conv.inner = untag_ptr(obj);
36870         obj_conv.is_owned = ptr_is_owned(obj);
36871         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36872         obj_conv.is_owned = false;
36873         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
36874         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36875         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36876         CVec_u8Z_free(ret_var);
36877         return ret_arr;
36878 }
36879
36880 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
36881         LDKu8slice ser_ref;
36882         ser_ref.datalen = ser->arr_len;
36883         ser_ref.data = ser->elems;
36884         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
36885         *ret_conv = ChannelAnnouncement_read(ser_ref);
36886         FREE(ser);
36887         return tag_ptr(ret_conv, true);
36888 }
36889
36890 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
36891         LDKUnsignedChannelUpdate obj_conv;
36892         obj_conv.inner = untag_ptr(obj);
36893         obj_conv.is_owned = ptr_is_owned(obj);
36894         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36895         obj_conv.is_owned = false;
36896         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
36897         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36898         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36899         CVec_u8Z_free(ret_var);
36900         return ret_arr;
36901 }
36902
36903 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
36904         LDKu8slice ser_ref;
36905         ser_ref.datalen = ser->arr_len;
36906         ser_ref.data = ser->elems;
36907         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
36908         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
36909         FREE(ser);
36910         return tag_ptr(ret_conv, true);
36911 }
36912
36913 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
36914         LDKChannelUpdate obj_conv;
36915         obj_conv.inner = untag_ptr(obj);
36916         obj_conv.is_owned = ptr_is_owned(obj);
36917         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36918         obj_conv.is_owned = false;
36919         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
36920         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36921         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36922         CVec_u8Z_free(ret_var);
36923         return ret_arr;
36924 }
36925
36926 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
36927         LDKu8slice ser_ref;
36928         ser_ref.datalen = ser->arr_len;
36929         ser_ref.data = ser->elems;
36930         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
36931         *ret_conv = ChannelUpdate_read(ser_ref);
36932         FREE(ser);
36933         return tag_ptr(ret_conv, true);
36934 }
36935
36936 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
36937         LDKErrorMessage obj_conv;
36938         obj_conv.inner = untag_ptr(obj);
36939         obj_conv.is_owned = ptr_is_owned(obj);
36940         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36941         obj_conv.is_owned = false;
36942         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
36943         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36944         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36945         CVec_u8Z_free(ret_var);
36946         return ret_arr;
36947 }
36948
36949 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
36950         LDKu8slice ser_ref;
36951         ser_ref.datalen = ser->arr_len;
36952         ser_ref.data = ser->elems;
36953         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
36954         *ret_conv = ErrorMessage_read(ser_ref);
36955         FREE(ser);
36956         return tag_ptr(ret_conv, true);
36957 }
36958
36959 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
36960         LDKWarningMessage obj_conv;
36961         obj_conv.inner = untag_ptr(obj);
36962         obj_conv.is_owned = ptr_is_owned(obj);
36963         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36964         obj_conv.is_owned = false;
36965         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
36966         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36967         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36968         CVec_u8Z_free(ret_var);
36969         return ret_arr;
36970 }
36971
36972 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
36973         LDKu8slice ser_ref;
36974         ser_ref.datalen = ser->arr_len;
36975         ser_ref.data = ser->elems;
36976         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
36977         *ret_conv = WarningMessage_read(ser_ref);
36978         FREE(ser);
36979         return tag_ptr(ret_conv, true);
36980 }
36981
36982 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
36983         LDKUnsignedNodeAnnouncement obj_conv;
36984         obj_conv.inner = untag_ptr(obj);
36985         obj_conv.is_owned = ptr_is_owned(obj);
36986         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36987         obj_conv.is_owned = false;
36988         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
36989         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36990         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36991         CVec_u8Z_free(ret_var);
36992         return ret_arr;
36993 }
36994
36995 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
36996         LDKu8slice ser_ref;
36997         ser_ref.datalen = ser->arr_len;
36998         ser_ref.data = ser->elems;
36999         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
37000         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
37001         FREE(ser);
37002         return tag_ptr(ret_conv, true);
37003 }
37004
37005 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
37006         LDKNodeAnnouncement obj_conv;
37007         obj_conv.inner = untag_ptr(obj);
37008         obj_conv.is_owned = ptr_is_owned(obj);
37009         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37010         obj_conv.is_owned = false;
37011         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
37012         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37013         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37014         CVec_u8Z_free(ret_var);
37015         return ret_arr;
37016 }
37017
37018 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
37019         LDKu8slice ser_ref;
37020         ser_ref.datalen = ser->arr_len;
37021         ser_ref.data = ser->elems;
37022         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
37023         *ret_conv = NodeAnnouncement_read(ser_ref);
37024         FREE(ser);
37025         return tag_ptr(ret_conv, true);
37026 }
37027
37028 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
37029         LDKu8slice ser_ref;
37030         ser_ref.datalen = ser->arr_len;
37031         ser_ref.data = ser->elems;
37032         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
37033         *ret_conv = QueryShortChannelIds_read(ser_ref);
37034         FREE(ser);
37035         return tag_ptr(ret_conv, true);
37036 }
37037
37038 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
37039         LDKQueryShortChannelIds obj_conv;
37040         obj_conv.inner = untag_ptr(obj);
37041         obj_conv.is_owned = ptr_is_owned(obj);
37042         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37043         obj_conv.is_owned = false;
37044         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
37045         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37046         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37047         CVec_u8Z_free(ret_var);
37048         return ret_arr;
37049 }
37050
37051 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
37052         LDKReplyShortChannelIdsEnd obj_conv;
37053         obj_conv.inner = untag_ptr(obj);
37054         obj_conv.is_owned = ptr_is_owned(obj);
37055         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37056         obj_conv.is_owned = false;
37057         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
37058         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37059         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37060         CVec_u8Z_free(ret_var);
37061         return ret_arr;
37062 }
37063
37064 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
37065         LDKu8slice ser_ref;
37066         ser_ref.datalen = ser->arr_len;
37067         ser_ref.data = ser->elems;
37068         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
37069         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
37070         FREE(ser);
37071         return tag_ptr(ret_conv, true);
37072 }
37073
37074 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
37075         LDKQueryChannelRange this_arg_conv;
37076         this_arg_conv.inner = untag_ptr(this_arg);
37077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37079         this_arg_conv.is_owned = false;
37080         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
37081         return ret_conv;
37082 }
37083
37084 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
37085         LDKQueryChannelRange obj_conv;
37086         obj_conv.inner = untag_ptr(obj);
37087         obj_conv.is_owned = ptr_is_owned(obj);
37088         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37089         obj_conv.is_owned = false;
37090         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
37091         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37092         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37093         CVec_u8Z_free(ret_var);
37094         return ret_arr;
37095 }
37096
37097 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
37098         LDKu8slice ser_ref;
37099         ser_ref.datalen = ser->arr_len;
37100         ser_ref.data = ser->elems;
37101         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
37102         *ret_conv = QueryChannelRange_read(ser_ref);
37103         FREE(ser);
37104         return tag_ptr(ret_conv, true);
37105 }
37106
37107 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
37108         LDKu8slice ser_ref;
37109         ser_ref.datalen = ser->arr_len;
37110         ser_ref.data = ser->elems;
37111         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
37112         *ret_conv = ReplyChannelRange_read(ser_ref);
37113         FREE(ser);
37114         return tag_ptr(ret_conv, true);
37115 }
37116
37117 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
37118         LDKReplyChannelRange obj_conv;
37119         obj_conv.inner = untag_ptr(obj);
37120         obj_conv.is_owned = ptr_is_owned(obj);
37121         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37122         obj_conv.is_owned = false;
37123         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
37124         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37125         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37126         CVec_u8Z_free(ret_var);
37127         return ret_arr;
37128 }
37129
37130 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
37131         LDKGossipTimestampFilter obj_conv;
37132         obj_conv.inner = untag_ptr(obj);
37133         obj_conv.is_owned = ptr_is_owned(obj);
37134         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37135         obj_conv.is_owned = false;
37136         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
37137         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37138         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37139         CVec_u8Z_free(ret_var);
37140         return ret_arr;
37141 }
37142
37143 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
37144         LDKu8slice ser_ref;
37145         ser_ref.datalen = ser->arr_len;
37146         ser_ref.data = ser->elems;
37147         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
37148         *ret_conv = GossipTimestampFilter_read(ser_ref);
37149         FREE(ser);
37150         return tag_ptr(ret_conv, true);
37151 }
37152
37153 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
37154         if (!ptr_is_owned(this_ptr)) return;
37155         void* this_ptr_ptr = untag_ptr(this_ptr);
37156         CHECK_ACCESS(this_ptr_ptr);
37157         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
37158         FREE(untag_ptr(this_ptr));
37159         CustomMessageHandler_free(this_ptr_conv);
37160 }
37161
37162 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
37163         LDKIgnoringMessageHandler this_obj_conv;
37164         this_obj_conv.inner = untag_ptr(this_obj);
37165         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37167         IgnoringMessageHandler_free(this_obj_conv);
37168 }
37169
37170 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
37171         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
37172         uint64_t ret_ref = 0;
37173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37175         return ret_ref;
37176 }
37177
37178 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
37179         LDKIgnoringMessageHandler this_arg_conv;
37180         this_arg_conv.inner = untag_ptr(this_arg);
37181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37183         this_arg_conv.is_owned = false;
37184         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
37185         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
37186         return tag_ptr(ret_ret, true);
37187 }
37188
37189 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
37190         LDKIgnoringMessageHandler this_arg_conv;
37191         this_arg_conv.inner = untag_ptr(this_arg);
37192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37194         this_arg_conv.is_owned = false;
37195         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
37196         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
37197         return tag_ptr(ret_ret, true);
37198 }
37199
37200 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageProvider"))) TS_IgnoringMessageHandler_as_OnionMessageProvider(uint64_t this_arg) {
37201         LDKIgnoringMessageHandler this_arg_conv;
37202         this_arg_conv.inner = untag_ptr(this_arg);
37203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37205         this_arg_conv.is_owned = false;
37206         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
37207         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
37208         return tag_ptr(ret_ret, true);
37209 }
37210
37211 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
37212         LDKIgnoringMessageHandler this_arg_conv;
37213         this_arg_conv.inner = untag_ptr(this_arg);
37214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37216         this_arg_conv.is_owned = false;
37217         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
37218         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
37219         return tag_ptr(ret_ret, true);
37220 }
37221
37222 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
37223         LDKIgnoringMessageHandler this_arg_conv;
37224         this_arg_conv.inner = untag_ptr(this_arg);
37225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37227         this_arg_conv.is_owned = false;
37228         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
37229         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
37230         return tag_ptr(ret_ret, true);
37231 }
37232
37233 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
37234         LDKIgnoringMessageHandler this_arg_conv;
37235         this_arg_conv.inner = untag_ptr(this_arg);
37236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37238         this_arg_conv.is_owned = false;
37239         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
37240         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
37241         return tag_ptr(ret_ret, true);
37242 }
37243
37244 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
37245         LDKIgnoringMessageHandler this_arg_conv;
37246         this_arg_conv.inner = untag_ptr(this_arg);
37247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37249         this_arg_conv.is_owned = false;
37250         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
37251         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
37252         return tag_ptr(ret_ret, true);
37253 }
37254
37255 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
37256         LDKErroringMessageHandler this_obj_conv;
37257         this_obj_conv.inner = untag_ptr(this_obj);
37258         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37260         ErroringMessageHandler_free(this_obj_conv);
37261 }
37262
37263 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
37264         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
37265         uint64_t ret_ref = 0;
37266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37268         return ret_ref;
37269 }
37270
37271 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
37272         LDKErroringMessageHandler this_arg_conv;
37273         this_arg_conv.inner = untag_ptr(this_arg);
37274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37276         this_arg_conv.is_owned = false;
37277         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
37278         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
37279         return tag_ptr(ret_ret, true);
37280 }
37281
37282 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
37283         LDKErroringMessageHandler this_arg_conv;
37284         this_arg_conv.inner = untag_ptr(this_arg);
37285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37287         this_arg_conv.is_owned = false;
37288         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
37289         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
37290         return tag_ptr(ret_ret, true);
37291 }
37292
37293 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
37294         LDKMessageHandler this_obj_conv;
37295         this_obj_conv.inner = untag_ptr(this_obj);
37296         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37298         MessageHandler_free(this_obj_conv);
37299 }
37300
37301 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
37302         LDKMessageHandler this_ptr_conv;
37303         this_ptr_conv.inner = untag_ptr(this_ptr);
37304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37306         this_ptr_conv.is_owned = false;
37307         // WARNING: This object doesn't live past this scope, needs clone!
37308         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
37309         return ret_ret;
37310 }
37311
37312 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
37313         LDKMessageHandler this_ptr_conv;
37314         this_ptr_conv.inner = untag_ptr(this_ptr);
37315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37317         this_ptr_conv.is_owned = false;
37318         void* val_ptr = untag_ptr(val);
37319         CHECK_ACCESS(val_ptr);
37320         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
37321         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
37322                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37323                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
37324         }
37325         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
37326 }
37327
37328 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
37329         LDKMessageHandler this_ptr_conv;
37330         this_ptr_conv.inner = untag_ptr(this_ptr);
37331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37333         this_ptr_conv.is_owned = false;
37334         // WARNING: This object doesn't live past this scope, needs clone!
37335         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
37336         return ret_ret;
37337 }
37338
37339 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
37340         LDKMessageHandler this_ptr_conv;
37341         this_ptr_conv.inner = untag_ptr(this_ptr);
37342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37344         this_ptr_conv.is_owned = false;
37345         void* val_ptr = untag_ptr(val);
37346         CHECK_ACCESS(val_ptr);
37347         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
37348         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
37349                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37350                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
37351         }
37352         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
37353 }
37354
37355 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
37356         LDKMessageHandler this_ptr_conv;
37357         this_ptr_conv.inner = untag_ptr(this_ptr);
37358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37360         this_ptr_conv.is_owned = false;
37361         // WARNING: This object doesn't live past this scope, needs clone!
37362         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
37363         return ret_ret;
37364 }
37365
37366 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
37367         LDKMessageHandler this_ptr_conv;
37368         this_ptr_conv.inner = untag_ptr(this_ptr);
37369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37371         this_ptr_conv.is_owned = false;
37372         void* val_ptr = untag_ptr(val);
37373         CHECK_ACCESS(val_ptr);
37374         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
37375         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
37376                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37377                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
37378         }
37379         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
37380 }
37381
37382 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) {
37383         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
37384         CHECK_ACCESS(chan_handler_arg_ptr);
37385         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
37386         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
37387                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37388                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
37389         }
37390         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
37391         CHECK_ACCESS(route_handler_arg_ptr);
37392         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
37393         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
37394                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37395                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
37396         }
37397         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
37398         CHECK_ACCESS(onion_message_handler_arg_ptr);
37399         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
37400         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
37401                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37402                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
37403         }
37404         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv);
37405         uint64_t ret_ref = 0;
37406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37408         return ret_ref;
37409 }
37410
37411 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
37412         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37413         *ret_ret = SocketDescriptor_clone(arg);
37414         return tag_ptr(ret_ret, true);
37415 }
37416 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
37417         void* arg_ptr = untag_ptr(arg);
37418         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
37419         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
37420         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
37421         return ret_conv;
37422 }
37423
37424 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
37425         void* orig_ptr = untag_ptr(orig);
37426         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
37427         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
37428         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37429         *ret_ret = SocketDescriptor_clone(orig_conv);
37430         return tag_ptr(ret_ret, true);
37431 }
37432
37433 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
37434         if (!ptr_is_owned(this_ptr)) return;
37435         void* this_ptr_ptr = untag_ptr(this_ptr);
37436         CHECK_ACCESS(this_ptr_ptr);
37437         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
37438         FREE(untag_ptr(this_ptr));
37439         SocketDescriptor_free(this_ptr_conv);
37440 }
37441
37442 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
37443         LDKPeerHandleError this_obj_conv;
37444         this_obj_conv.inner = untag_ptr(this_obj);
37445         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37447         PeerHandleError_free(this_obj_conv);
37448 }
37449
37450 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new() {
37451         LDKPeerHandleError ret_var = PeerHandleError_new();
37452         uint64_t ret_ref = 0;
37453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37455         return ret_ref;
37456 }
37457
37458 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
37459         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
37460         uint64_t ret_ref = 0;
37461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37463         return ret_ref;
37464 }
37465 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
37466         LDKPeerHandleError arg_conv;
37467         arg_conv.inner = untag_ptr(arg);
37468         arg_conv.is_owned = ptr_is_owned(arg);
37469         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37470         arg_conv.is_owned = false;
37471         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
37472         return ret_conv;
37473 }
37474
37475 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
37476         LDKPeerHandleError orig_conv;
37477         orig_conv.inner = untag_ptr(orig);
37478         orig_conv.is_owned = ptr_is_owned(orig);
37479         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37480         orig_conv.is_owned = false;
37481         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
37482         uint64_t ret_ref = 0;
37483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37485         return ret_ref;
37486 }
37487
37488 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
37489         LDKPeerManager this_obj_conv;
37490         this_obj_conv.inner = untag_ptr(this_obj);
37491         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37493         PeerManager_free(this_obj_conv);
37494 }
37495
37496 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) {
37497         LDKMessageHandler message_handler_conv;
37498         message_handler_conv.inner = untag_ptr(message_handler);
37499         message_handler_conv.is_owned = ptr_is_owned(message_handler);
37500         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
37501         // WARNING: we need a move here but no clone is available for LDKMessageHandler
37502         
37503         uint8_t ephemeral_random_data_arr[32];
37504         CHECK(ephemeral_random_data->arr_len == 32);
37505         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
37506         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
37507         void* logger_ptr = untag_ptr(logger);
37508         CHECK_ACCESS(logger_ptr);
37509         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37510         if (logger_conv.free == LDKLogger_JCalls_free) {
37511                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37512                 LDKLogger_JCalls_cloned(&logger_conv);
37513         }
37514         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
37515         CHECK_ACCESS(custom_message_handler_ptr);
37516         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
37517         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
37518                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37519                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
37520         }
37521         void* node_signer_ptr = untag_ptr(node_signer);
37522         CHECK_ACCESS(node_signer_ptr);
37523         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
37524         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
37525                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37526                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
37527         }
37528         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv, node_signer_conv);
37529         uint64_t ret_ref = 0;
37530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37532         return ret_ref;
37533 }
37534
37535 uint64_tArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
37536         LDKPeerManager this_arg_conv;
37537         this_arg_conv.inner = untag_ptr(this_arg);
37538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37540         this_arg_conv.is_owned = false;
37541         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
37542         uint64_tArray ret_arr = NULL;
37543         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
37544         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
37545         for (size_t o = 0; o < ret_var.datalen; o++) {
37546                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
37547                 *ret_conv_40_conv = ret_var.data[o];
37548                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
37549         }
37550         
37551         FREE(ret_var.data);
37552         return ret_arr;
37553 }
37554
37555 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) {
37556         LDKPeerManager this_arg_conv;
37557         this_arg_conv.inner = untag_ptr(this_arg);
37558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37560         this_arg_conv.is_owned = false;
37561         LDKPublicKey their_node_id_ref;
37562         CHECK(their_node_id->arr_len == 33);
37563         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
37564         void* descriptor_ptr = untag_ptr(descriptor);
37565         CHECK_ACCESS(descriptor_ptr);
37566         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37567         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37568                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37569                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37570         }
37571         void* remote_network_address_ptr = untag_ptr(remote_network_address);
37572         CHECK_ACCESS(remote_network_address_ptr);
37573         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37574         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
37575         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
37576         return tag_ptr(ret_conv, true);
37577 }
37578
37579 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) {
37580         LDKPeerManager this_arg_conv;
37581         this_arg_conv.inner = untag_ptr(this_arg);
37582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37584         this_arg_conv.is_owned = false;
37585         void* descriptor_ptr = untag_ptr(descriptor);
37586         CHECK_ACCESS(descriptor_ptr);
37587         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37588         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37589                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37590                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37591         }
37592         void* remote_network_address_ptr = untag_ptr(remote_network_address);
37593         CHECK_ACCESS(remote_network_address_ptr);
37594         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37595         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37596         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
37597         return tag_ptr(ret_conv, true);
37598 }
37599
37600 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
37601         LDKPeerManager this_arg_conv;
37602         this_arg_conv.inner = untag_ptr(this_arg);
37603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37605         this_arg_conv.is_owned = false;
37606         void* descriptor_ptr = untag_ptr(descriptor);
37607         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
37608         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37609         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37610         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
37611         return tag_ptr(ret_conv, true);
37612 }
37613
37614 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
37615         LDKPeerManager this_arg_conv;
37616         this_arg_conv.inner = untag_ptr(this_arg);
37617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37619         this_arg_conv.is_owned = false;
37620         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
37621         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
37622         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
37623         LDKu8slice data_ref;
37624         data_ref.datalen = data->arr_len;
37625         data_ref.data = data->elems;
37626         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
37627         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
37628         FREE(data);
37629         return tag_ptr(ret_conv, true);
37630 }
37631
37632 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
37633         LDKPeerManager this_arg_conv;
37634         this_arg_conv.inner = untag_ptr(this_arg);
37635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37637         this_arg_conv.is_owned = false;
37638         PeerManager_process_events(&this_arg_conv);
37639 }
37640
37641 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
37642         LDKPeerManager this_arg_conv;
37643         this_arg_conv.inner = untag_ptr(this_arg);
37644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37646         this_arg_conv.is_owned = false;
37647         void* descriptor_ptr = untag_ptr(descriptor);
37648         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
37649         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37650         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
37651 }
37652
37653 void  __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id) {
37654         LDKPeerManager this_arg_conv;
37655         this_arg_conv.inner = untag_ptr(this_arg);
37656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37658         this_arg_conv.is_owned = false;
37659         LDKPublicKey node_id_ref;
37660         CHECK(node_id->arr_len == 33);
37661         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
37662         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
37663 }
37664
37665 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
37666         LDKPeerManager this_arg_conv;
37667         this_arg_conv.inner = untag_ptr(this_arg);
37668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37670         this_arg_conv.is_owned = false;
37671         PeerManager_disconnect_all_peers(&this_arg_conv);
37672 }
37673
37674 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
37675         LDKPeerManager this_arg_conv;
37676         this_arg_conv.inner = untag_ptr(this_arg);
37677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37679         this_arg_conv.is_owned = false;
37680         PeerManager_timer_tick_occurred(&this_arg_conv);
37681 }
37682
37683 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) {
37684         LDKPeerManager this_arg_conv;
37685         this_arg_conv.inner = untag_ptr(this_arg);
37686         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37688         this_arg_conv.is_owned = false;
37689         LDKThreeBytes rgb_ref;
37690         CHECK(rgb->arr_len == 3);
37691         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
37692         LDKThirtyTwoBytes alias_ref;
37693         CHECK(alias->arr_len == 32);
37694         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
37695         LDKCVec_NetAddressZ addresses_constr;
37696         addresses_constr.datalen = addresses->arr_len;
37697         if (addresses_constr.datalen > 0)
37698                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
37699         else
37700                 addresses_constr.data = NULL;
37701         uint64_t* addresses_vals = addresses->elems;
37702         for (size_t m = 0; m < addresses_constr.datalen; m++) {
37703                 uint64_t addresses_conv_12 = addresses_vals[m];
37704                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
37705                 CHECK_ACCESS(addresses_conv_12_ptr);
37706                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
37707                 addresses_constr.data[m] = addresses_conv_12_conv;
37708         }
37709         FREE(addresses);
37710         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
37711 }
37712
37713 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
37714         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
37715         return ret_conv;
37716 }
37717
37718 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
37719         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
37720         return ret_conv;
37721 }
37722
37723 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
37724         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
37725         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
37726         return ret_conv;
37727 }
37728
37729 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
37730         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
37731         return ret_conv;
37732 }
37733
37734 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
37735         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
37736         return ret_conv;
37737 }
37738
37739 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
37740         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
37741         return ret_conv;
37742 }
37743
37744 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
37745         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
37746         return ret_conv;
37747 }
37748
37749 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
37750         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
37751         return ret_conv;
37752 }
37753
37754 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
37755         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
37756         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
37757         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
37758         return ret_conv;
37759 }
37760
37761 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
37762         LDKWitness witness_ref;
37763         witness_ref.datalen = witness->arr_len;
37764         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
37765         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
37766         witness_ref.data_is_owned = true;
37767         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
37768         *ret_copy = HTLCClaim_from_witness(witness_ref);
37769         uint64_t ret_ref = tag_ptr(ret_copy, true);
37770         return ret_ref;
37771 }
37772
37773 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
37774         uint8_t commitment_seed_arr[32];
37775         CHECK(commitment_seed->arr_len == 32);
37776         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
37777         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
37778         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37779         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
37780         return ret_arr;
37781 }
37782
37783 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) {
37784         LDKCVec_u8Z to_holder_script_ref;
37785         to_holder_script_ref.datalen = to_holder_script->arr_len;
37786         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
37787         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
37788         LDKCVec_u8Z to_counterparty_script_ref;
37789         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
37790         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
37791         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
37792         LDKOutPoint funding_outpoint_conv;
37793         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
37794         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
37795         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37796         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37797         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);
37798         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37799         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37800         Transaction_free(ret_var);
37801         return ret_arr;
37802 }
37803
37804 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
37805         LDKCounterpartyCommitmentSecrets this_obj_conv;
37806         this_obj_conv.inner = untag_ptr(this_obj);
37807         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37809         CounterpartyCommitmentSecrets_free(this_obj_conv);
37810 }
37811
37812 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
37813         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
37814         uint64_t ret_ref = 0;
37815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37817         return ret_ref;
37818 }
37819 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
37820         LDKCounterpartyCommitmentSecrets arg_conv;
37821         arg_conv.inner = untag_ptr(arg);
37822         arg_conv.is_owned = ptr_is_owned(arg);
37823         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37824         arg_conv.is_owned = false;
37825         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
37826         return ret_conv;
37827 }
37828
37829 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
37830         LDKCounterpartyCommitmentSecrets orig_conv;
37831         orig_conv.inner = untag_ptr(orig);
37832         orig_conv.is_owned = ptr_is_owned(orig);
37833         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37834         orig_conv.is_owned = false;
37835         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
37836         uint64_t ret_ref = 0;
37837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37839         return ret_ref;
37840 }
37841
37842 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
37843         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
37844         uint64_t ret_ref = 0;
37845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37847         return ret_ref;
37848 }
37849
37850 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
37851         LDKCounterpartyCommitmentSecrets this_arg_conv;
37852         this_arg_conv.inner = untag_ptr(this_arg);
37853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37855         this_arg_conv.is_owned = false;
37856         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
37857         return ret_conv;
37858 }
37859
37860 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
37861         LDKCounterpartyCommitmentSecrets this_arg_conv;
37862         this_arg_conv.inner = untag_ptr(this_arg);
37863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37865         this_arg_conv.is_owned = false;
37866         LDKThirtyTwoBytes secret_ref;
37867         CHECK(secret->arr_len == 32);
37868         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
37869         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
37870         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
37871         return tag_ptr(ret_conv, true);
37872 }
37873
37874 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
37875         LDKCounterpartyCommitmentSecrets this_arg_conv;
37876         this_arg_conv.inner = untag_ptr(this_arg);
37877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37879         this_arg_conv.is_owned = false;
37880         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37881         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
37882         return ret_arr;
37883 }
37884
37885 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
37886         LDKCounterpartyCommitmentSecrets obj_conv;
37887         obj_conv.inner = untag_ptr(obj);
37888         obj_conv.is_owned = ptr_is_owned(obj);
37889         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37890         obj_conv.is_owned = false;
37891         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_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         CVec_u8Z_free(ret_var);
37895         return ret_arr;
37896 }
37897
37898 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
37899         LDKu8slice ser_ref;
37900         ser_ref.datalen = ser->arr_len;
37901         ser_ref.data = ser->elems;
37902         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
37903         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
37904         FREE(ser);
37905         return tag_ptr(ret_conv, true);
37906 }
37907
37908 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
37909         LDKPublicKey per_commitment_point_ref;
37910         CHECK(per_commitment_point->arr_len == 33);
37911         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37912         uint8_t base_secret_arr[32];
37913         CHECK(base_secret->arr_len == 32);
37914         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
37915         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
37916         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37917         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
37918         return ret_arr;
37919 }
37920
37921 int8_tArray  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
37922         LDKPublicKey per_commitment_point_ref;
37923         CHECK(per_commitment_point->arr_len == 33);
37924         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37925         LDKPublicKey base_point_ref;
37926         CHECK(base_point->arr_len == 33);
37927         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
37928         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37929         memcpy(ret_arr->elems, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form, 33);
37930         return ret_arr;
37931 }
37932
37933 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) {
37934         uint8_t per_commitment_secret_arr[32];
37935         CHECK(per_commitment_secret->arr_len == 32);
37936         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
37937         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
37938         uint8_t countersignatory_revocation_base_secret_arr[32];
37939         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
37940         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
37941         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
37942         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37943         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
37944         return ret_arr;
37945 }
37946
37947 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) {
37948         LDKPublicKey per_commitment_point_ref;
37949         CHECK(per_commitment_point->arr_len == 33);
37950         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37951         LDKPublicKey countersignatory_revocation_base_point_ref;
37952         CHECK(countersignatory_revocation_base_point->arr_len == 33);
37953         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
37954         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37955         memcpy(ret_arr->elems, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form, 33);
37956         return ret_arr;
37957 }
37958
37959 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
37960         LDKTxCreationKeys this_obj_conv;
37961         this_obj_conv.inner = untag_ptr(this_obj);
37962         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37964         TxCreationKeys_free(this_obj_conv);
37965 }
37966
37967 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
37968         LDKTxCreationKeys this_ptr_conv;
37969         this_ptr_conv.inner = untag_ptr(this_ptr);
37970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37972         this_ptr_conv.is_owned = false;
37973         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37974         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
37975         return ret_arr;
37976 }
37977
37978 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
37979         LDKTxCreationKeys this_ptr_conv;
37980         this_ptr_conv.inner = untag_ptr(this_ptr);
37981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37983         this_ptr_conv.is_owned = false;
37984         LDKPublicKey val_ref;
37985         CHECK(val->arr_len == 33);
37986         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37987         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
37988 }
37989
37990 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
37991         LDKTxCreationKeys this_ptr_conv;
37992         this_ptr_conv.inner = untag_ptr(this_ptr);
37993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37995         this_ptr_conv.is_owned = false;
37996         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37997         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
37998         return ret_arr;
37999 }
38000
38001 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
38002         LDKTxCreationKeys this_ptr_conv;
38003         this_ptr_conv.inner = untag_ptr(this_ptr);
38004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38006         this_ptr_conv.is_owned = false;
38007         LDKPublicKey val_ref;
38008         CHECK(val->arr_len == 33);
38009         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38010         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
38011 }
38012
38013 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
38014         LDKTxCreationKeys this_ptr_conv;
38015         this_ptr_conv.inner = untag_ptr(this_ptr);
38016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38018         this_ptr_conv.is_owned = false;
38019         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38020         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
38021         return ret_arr;
38022 }
38023
38024 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
38025         LDKTxCreationKeys this_ptr_conv;
38026         this_ptr_conv.inner = untag_ptr(this_ptr);
38027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38029         this_ptr_conv.is_owned = false;
38030         LDKPublicKey val_ref;
38031         CHECK(val->arr_len == 33);
38032         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38033         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
38034 }
38035
38036 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
38037         LDKTxCreationKeys this_ptr_conv;
38038         this_ptr_conv.inner = untag_ptr(this_ptr);
38039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38041         this_ptr_conv.is_owned = false;
38042         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38043         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
38044         return ret_arr;
38045 }
38046
38047 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
38048         LDKTxCreationKeys this_ptr_conv;
38049         this_ptr_conv.inner = untag_ptr(this_ptr);
38050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38052         this_ptr_conv.is_owned = false;
38053         LDKPublicKey val_ref;
38054         CHECK(val->arr_len == 33);
38055         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38056         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
38057 }
38058
38059 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
38060         LDKTxCreationKeys this_ptr_conv;
38061         this_ptr_conv.inner = untag_ptr(this_ptr);
38062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38064         this_ptr_conv.is_owned = false;
38065         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38066         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
38067         return ret_arr;
38068 }
38069
38070 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) {
38071         LDKTxCreationKeys this_ptr_conv;
38072         this_ptr_conv.inner = untag_ptr(this_ptr);
38073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38075         this_ptr_conv.is_owned = false;
38076         LDKPublicKey val_ref;
38077         CHECK(val->arr_len == 33);
38078         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38079         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
38080 }
38081
38082 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) {
38083         LDKPublicKey per_commitment_point_arg_ref;
38084         CHECK(per_commitment_point_arg->arr_len == 33);
38085         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
38086         LDKPublicKey revocation_key_arg_ref;
38087         CHECK(revocation_key_arg->arr_len == 33);
38088         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
38089         LDKPublicKey broadcaster_htlc_key_arg_ref;
38090         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
38091         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
38092         LDKPublicKey countersignatory_htlc_key_arg_ref;
38093         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
38094         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
38095         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
38096         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
38097         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
38098         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);
38099         uint64_t ret_ref = 0;
38100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38102         return ret_ref;
38103 }
38104
38105 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
38106         LDKTxCreationKeys a_conv;
38107         a_conv.inner = untag_ptr(a);
38108         a_conv.is_owned = ptr_is_owned(a);
38109         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38110         a_conv.is_owned = false;
38111         LDKTxCreationKeys b_conv;
38112         b_conv.inner = untag_ptr(b);
38113         b_conv.is_owned = ptr_is_owned(b);
38114         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38115         b_conv.is_owned = false;
38116         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
38117         return ret_conv;
38118 }
38119
38120 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
38121         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
38122         uint64_t ret_ref = 0;
38123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38125         return ret_ref;
38126 }
38127 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
38128         LDKTxCreationKeys arg_conv;
38129         arg_conv.inner = untag_ptr(arg);
38130         arg_conv.is_owned = ptr_is_owned(arg);
38131         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38132         arg_conv.is_owned = false;
38133         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
38134         return ret_conv;
38135 }
38136
38137 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
38138         LDKTxCreationKeys orig_conv;
38139         orig_conv.inner = untag_ptr(orig);
38140         orig_conv.is_owned = ptr_is_owned(orig);
38141         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38142         orig_conv.is_owned = false;
38143         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
38144         uint64_t ret_ref = 0;
38145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38147         return ret_ref;
38148 }
38149
38150 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
38151         LDKTxCreationKeys obj_conv;
38152         obj_conv.inner = untag_ptr(obj);
38153         obj_conv.is_owned = ptr_is_owned(obj);
38154         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38155         obj_conv.is_owned = false;
38156         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
38157         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38158         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38159         CVec_u8Z_free(ret_var);
38160         return ret_arr;
38161 }
38162
38163 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
38164         LDKu8slice ser_ref;
38165         ser_ref.datalen = ser->arr_len;
38166         ser_ref.data = ser->elems;
38167         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
38168         *ret_conv = TxCreationKeys_read(ser_ref);
38169         FREE(ser);
38170         return tag_ptr(ret_conv, true);
38171 }
38172
38173 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
38174         LDKChannelPublicKeys this_obj_conv;
38175         this_obj_conv.inner = untag_ptr(this_obj);
38176         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38178         ChannelPublicKeys_free(this_obj_conv);
38179 }
38180
38181 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
38182         LDKChannelPublicKeys this_ptr_conv;
38183         this_ptr_conv.inner = untag_ptr(this_ptr);
38184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38186         this_ptr_conv.is_owned = false;
38187         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38188         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
38189         return ret_arr;
38190 }
38191
38192 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
38193         LDKChannelPublicKeys this_ptr_conv;
38194         this_ptr_conv.inner = untag_ptr(this_ptr);
38195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38197         this_ptr_conv.is_owned = false;
38198         LDKPublicKey val_ref;
38199         CHECK(val->arr_len == 33);
38200         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38201         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
38202 }
38203
38204 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
38205         LDKChannelPublicKeys this_ptr_conv;
38206         this_ptr_conv.inner = untag_ptr(this_ptr);
38207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38209         this_ptr_conv.is_owned = false;
38210         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38211         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
38212         return ret_arr;
38213 }
38214
38215 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
38216         LDKChannelPublicKeys this_ptr_conv;
38217         this_ptr_conv.inner = untag_ptr(this_ptr);
38218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38220         this_ptr_conv.is_owned = false;
38221         LDKPublicKey val_ref;
38222         CHECK(val->arr_len == 33);
38223         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38224         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
38225 }
38226
38227 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
38228         LDKChannelPublicKeys this_ptr_conv;
38229         this_ptr_conv.inner = untag_ptr(this_ptr);
38230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38232         this_ptr_conv.is_owned = false;
38233         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38234         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
38235         return ret_arr;
38236 }
38237
38238 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
38239         LDKChannelPublicKeys this_ptr_conv;
38240         this_ptr_conv.inner = untag_ptr(this_ptr);
38241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38243         this_ptr_conv.is_owned = false;
38244         LDKPublicKey val_ref;
38245         CHECK(val->arr_len == 33);
38246         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38247         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
38248 }
38249
38250 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
38251         LDKChannelPublicKeys this_ptr_conv;
38252         this_ptr_conv.inner = untag_ptr(this_ptr);
38253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38255         this_ptr_conv.is_owned = false;
38256         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38257         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
38258         return ret_arr;
38259 }
38260
38261 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
38262         LDKChannelPublicKeys this_ptr_conv;
38263         this_ptr_conv.inner = untag_ptr(this_ptr);
38264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38266         this_ptr_conv.is_owned = false;
38267         LDKPublicKey val_ref;
38268         CHECK(val->arr_len == 33);
38269         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38270         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
38271 }
38272
38273 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
38274         LDKChannelPublicKeys this_ptr_conv;
38275         this_ptr_conv.inner = untag_ptr(this_ptr);
38276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38278         this_ptr_conv.is_owned = false;
38279         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38280         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
38281         return ret_arr;
38282 }
38283
38284 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
38285         LDKChannelPublicKeys this_ptr_conv;
38286         this_ptr_conv.inner = untag_ptr(this_ptr);
38287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38289         this_ptr_conv.is_owned = false;
38290         LDKPublicKey val_ref;
38291         CHECK(val->arr_len == 33);
38292         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38293         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
38294 }
38295
38296 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) {
38297         LDKPublicKey funding_pubkey_arg_ref;
38298         CHECK(funding_pubkey_arg->arr_len == 33);
38299         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
38300         LDKPublicKey revocation_basepoint_arg_ref;
38301         CHECK(revocation_basepoint_arg->arr_len == 33);
38302         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
38303         LDKPublicKey payment_point_arg_ref;
38304         CHECK(payment_point_arg->arr_len == 33);
38305         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
38306         LDKPublicKey delayed_payment_basepoint_arg_ref;
38307         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
38308         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
38309         LDKPublicKey htlc_basepoint_arg_ref;
38310         CHECK(htlc_basepoint_arg->arr_len == 33);
38311         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
38312         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);
38313         uint64_t ret_ref = 0;
38314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38316         return ret_ref;
38317 }
38318
38319 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
38320         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
38321         uint64_t ret_ref = 0;
38322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38324         return ret_ref;
38325 }
38326 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
38327         LDKChannelPublicKeys arg_conv;
38328         arg_conv.inner = untag_ptr(arg);
38329         arg_conv.is_owned = ptr_is_owned(arg);
38330         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38331         arg_conv.is_owned = false;
38332         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
38333         return ret_conv;
38334 }
38335
38336 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
38337         LDKChannelPublicKeys orig_conv;
38338         orig_conv.inner = untag_ptr(orig);
38339         orig_conv.is_owned = ptr_is_owned(orig);
38340         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38341         orig_conv.is_owned = false;
38342         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
38343         uint64_t ret_ref = 0;
38344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38346         return ret_ref;
38347 }
38348
38349 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
38350         LDKChannelPublicKeys a_conv;
38351         a_conv.inner = untag_ptr(a);
38352         a_conv.is_owned = ptr_is_owned(a);
38353         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38354         a_conv.is_owned = false;
38355         LDKChannelPublicKeys b_conv;
38356         b_conv.inner = untag_ptr(b);
38357         b_conv.is_owned = ptr_is_owned(b);
38358         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38359         b_conv.is_owned = false;
38360         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
38361         return ret_conv;
38362 }
38363
38364 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
38365         LDKChannelPublicKeys obj_conv;
38366         obj_conv.inner = untag_ptr(obj);
38367         obj_conv.is_owned = ptr_is_owned(obj);
38368         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38369         obj_conv.is_owned = false;
38370         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
38371         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38372         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38373         CVec_u8Z_free(ret_var);
38374         return ret_arr;
38375 }
38376
38377 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
38378         LDKu8slice ser_ref;
38379         ser_ref.datalen = ser->arr_len;
38380         ser_ref.data = ser->elems;
38381         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
38382         *ret_conv = ChannelPublicKeys_read(ser_ref);
38383         FREE(ser);
38384         return tag_ptr(ret_conv, true);
38385 }
38386
38387 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) {
38388         LDKPublicKey per_commitment_point_ref;
38389         CHECK(per_commitment_point->arr_len == 33);
38390         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
38391         LDKPublicKey broadcaster_delayed_payment_base_ref;
38392         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
38393         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
38394         LDKPublicKey broadcaster_htlc_base_ref;
38395         CHECK(broadcaster_htlc_base->arr_len == 33);
38396         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
38397         LDKPublicKey countersignatory_revocation_base_ref;
38398         CHECK(countersignatory_revocation_base->arr_len == 33);
38399         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
38400         LDKPublicKey countersignatory_htlc_base_ref;
38401         CHECK(countersignatory_htlc_base->arr_len == 33);
38402         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
38403         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);
38404         uint64_t ret_ref = 0;
38405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38407         return ret_ref;
38408 }
38409
38410 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) {
38411         LDKPublicKey per_commitment_point_ref;
38412         CHECK(per_commitment_point->arr_len == 33);
38413         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
38414         LDKChannelPublicKeys broadcaster_keys_conv;
38415         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
38416         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
38417         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
38418         broadcaster_keys_conv.is_owned = false;
38419         LDKChannelPublicKeys countersignatory_keys_conv;
38420         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
38421         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
38422         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
38423         countersignatory_keys_conv.is_owned = false;
38424         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
38425         uint64_t ret_ref = 0;
38426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38428         return ret_ref;
38429 }
38430
38431 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) {
38432         LDKPublicKey revocation_key_ref;
38433         CHECK(revocation_key->arr_len == 33);
38434         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
38435         LDKPublicKey broadcaster_delayed_payment_key_ref;
38436         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
38437         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
38438         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
38439         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38440         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38441         CVec_u8Z_free(ret_var);
38442         return ret_arr;
38443 }
38444
38445 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
38446         LDKHTLCOutputInCommitment this_obj_conv;
38447         this_obj_conv.inner = untag_ptr(this_obj);
38448         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38450         HTLCOutputInCommitment_free(this_obj_conv);
38451 }
38452
38453 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
38454         LDKHTLCOutputInCommitment this_ptr_conv;
38455         this_ptr_conv.inner = untag_ptr(this_ptr);
38456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38458         this_ptr_conv.is_owned = false;
38459         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
38460         return ret_conv;
38461 }
38462
38463 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
38464         LDKHTLCOutputInCommitment this_ptr_conv;
38465         this_ptr_conv.inner = untag_ptr(this_ptr);
38466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38468         this_ptr_conv.is_owned = false;
38469         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
38470 }
38471
38472 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
38473         LDKHTLCOutputInCommitment this_ptr_conv;
38474         this_ptr_conv.inner = untag_ptr(this_ptr);
38475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38477         this_ptr_conv.is_owned = false;
38478         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
38479         return ret_conv;
38480 }
38481
38482 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
38483         LDKHTLCOutputInCommitment this_ptr_conv;
38484         this_ptr_conv.inner = untag_ptr(this_ptr);
38485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38487         this_ptr_conv.is_owned = false;
38488         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
38489 }
38490
38491 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
38492         LDKHTLCOutputInCommitment this_ptr_conv;
38493         this_ptr_conv.inner = untag_ptr(this_ptr);
38494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38496         this_ptr_conv.is_owned = false;
38497         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
38498         return ret_conv;
38499 }
38500
38501 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
38502         LDKHTLCOutputInCommitment this_ptr_conv;
38503         this_ptr_conv.inner = untag_ptr(this_ptr);
38504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38506         this_ptr_conv.is_owned = false;
38507         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
38508 }
38509
38510 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
38511         LDKHTLCOutputInCommitment this_ptr_conv;
38512         this_ptr_conv.inner = untag_ptr(this_ptr);
38513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38515         this_ptr_conv.is_owned = false;
38516         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38517         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
38518         return ret_arr;
38519 }
38520
38521 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
38522         LDKHTLCOutputInCommitment this_ptr_conv;
38523         this_ptr_conv.inner = untag_ptr(this_ptr);
38524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38526         this_ptr_conv.is_owned = false;
38527         LDKThirtyTwoBytes val_ref;
38528         CHECK(val->arr_len == 32);
38529         memcpy(val_ref.data, val->elems, 32); FREE(val);
38530         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
38531 }
38532
38533 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
38534         LDKHTLCOutputInCommitment this_ptr_conv;
38535         this_ptr_conv.inner = untag_ptr(this_ptr);
38536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38538         this_ptr_conv.is_owned = false;
38539         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
38540         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
38541         uint64_t ret_ref = tag_ptr(ret_copy, true);
38542         return ret_ref;
38543 }
38544
38545 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
38546         LDKHTLCOutputInCommitment this_ptr_conv;
38547         this_ptr_conv.inner = untag_ptr(this_ptr);
38548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38550         this_ptr_conv.is_owned = false;
38551         void* val_ptr = untag_ptr(val);
38552         CHECK_ACCESS(val_ptr);
38553         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
38554         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
38555         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
38556 }
38557
38558 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) {
38559         LDKThirtyTwoBytes payment_hash_arg_ref;
38560         CHECK(payment_hash_arg->arr_len == 32);
38561         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
38562         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
38563         CHECK_ACCESS(transaction_output_index_arg_ptr);
38564         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
38565         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
38566         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
38567         uint64_t ret_ref = 0;
38568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38570         return ret_ref;
38571 }
38572
38573 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
38574         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
38575         uint64_t ret_ref = 0;
38576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38578         return ret_ref;
38579 }
38580 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
38581         LDKHTLCOutputInCommitment arg_conv;
38582         arg_conv.inner = untag_ptr(arg);
38583         arg_conv.is_owned = ptr_is_owned(arg);
38584         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38585         arg_conv.is_owned = false;
38586         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
38587         return ret_conv;
38588 }
38589
38590 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
38591         LDKHTLCOutputInCommitment orig_conv;
38592         orig_conv.inner = untag_ptr(orig);
38593         orig_conv.is_owned = ptr_is_owned(orig);
38594         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38595         orig_conv.is_owned = false;
38596         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
38597         uint64_t ret_ref = 0;
38598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38600         return ret_ref;
38601 }
38602
38603 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
38604         LDKHTLCOutputInCommitment a_conv;
38605         a_conv.inner = untag_ptr(a);
38606         a_conv.is_owned = ptr_is_owned(a);
38607         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38608         a_conv.is_owned = false;
38609         LDKHTLCOutputInCommitment b_conv;
38610         b_conv.inner = untag_ptr(b);
38611         b_conv.is_owned = ptr_is_owned(b);
38612         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38613         b_conv.is_owned = false;
38614         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
38615         return ret_conv;
38616 }
38617
38618 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
38619         LDKHTLCOutputInCommitment obj_conv;
38620         obj_conv.inner = untag_ptr(obj);
38621         obj_conv.is_owned = ptr_is_owned(obj);
38622         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38623         obj_conv.is_owned = false;
38624         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
38625         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38626         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38627         CVec_u8Z_free(ret_var);
38628         return ret_arr;
38629 }
38630
38631 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
38632         LDKu8slice ser_ref;
38633         ser_ref.datalen = ser->arr_len;
38634         ser_ref.data = ser->elems;
38635         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
38636         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
38637         FREE(ser);
38638         return tag_ptr(ret_conv, true);
38639 }
38640
38641 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, jboolean opt_anchors, uint64_t keys) {
38642         LDKHTLCOutputInCommitment htlc_conv;
38643         htlc_conv.inner = untag_ptr(htlc);
38644         htlc_conv.is_owned = ptr_is_owned(htlc);
38645         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38646         htlc_conv.is_owned = false;
38647         LDKTxCreationKeys keys_conv;
38648         keys_conv.inner = untag_ptr(keys);
38649         keys_conv.is_owned = ptr_is_owned(keys);
38650         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
38651         keys_conv.is_owned = false;
38652         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
38653         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38654         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38655         CVec_u8Z_free(ret_var);
38656         return ret_arr;
38657 }
38658
38659 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
38660         LDKPublicKey broadcaster_ref;
38661         CHECK(broadcaster->arr_len == 33);
38662         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
38663         LDKPublicKey countersignatory_ref;
38664         CHECK(countersignatory->arr_len == 33);
38665         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
38666         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
38667         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38668         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38669         CVec_u8Z_free(ret_var);
38670         return ret_arr;
38671 }
38672
38673 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) {
38674         uint8_t commitment_txid_arr[32];
38675         CHECK(commitment_txid->arr_len == 32);
38676         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
38677         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
38678         LDKHTLCOutputInCommitment htlc_conv;
38679         htlc_conv.inner = untag_ptr(htlc);
38680         htlc_conv.is_owned = ptr_is_owned(htlc);
38681         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38682         htlc_conv.is_owned = false;
38683         LDKPublicKey broadcaster_delayed_payment_key_ref;
38684         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
38685         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
38686         LDKPublicKey revocation_key_ref;
38687         CHECK(revocation_key->arr_len == 33);
38688         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
38689         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);
38690         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38691         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38692         Transaction_free(ret_var);
38693         return ret_arr;
38694 }
38695
38696 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) {
38697         LDKSignature local_sig_ref;
38698         CHECK(local_sig->arr_len == 64);
38699         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
38700         LDKSignature remote_sig_ref;
38701         CHECK(remote_sig->arr_len == 64);
38702         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
38703         LDKThirtyTwoBytes preimage_ref;
38704         CHECK(preimage->arr_len == 32);
38705         memcpy(preimage_ref.data, preimage->elems, 32); FREE(preimage);
38706         LDKu8slice redeem_script_ref;
38707         redeem_script_ref.datalen = redeem_script->arr_len;
38708         redeem_script_ref.data = redeem_script->elems;
38709         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_ref, redeem_script_ref, opt_anchors);
38710         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38711         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38712         Witness_free(ret_var);
38713         FREE(redeem_script);
38714         return ret_arr;
38715 }
38716
38717 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
38718         LDKPublicKey payment_point_ref;
38719         CHECK(payment_point->arr_len == 33);
38720         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
38721         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
38722         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38723         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38724         CVec_u8Z_free(ret_var);
38725         return ret_arr;
38726 }
38727
38728 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
38729         LDKPublicKey funding_pubkey_ref;
38730         CHECK(funding_pubkey->arr_len == 33);
38731         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
38732         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
38733         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38734         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38735         CVec_u8Z_free(ret_var);
38736         return ret_arr;
38737 }
38738
38739 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
38740         LDKPublicKey funding_key_ref;
38741         CHECK(funding_key->arr_len == 33);
38742         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
38743         LDKSignature funding_sig_ref;
38744         CHECK(funding_sig->arr_len == 64);
38745         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
38746         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
38747         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38748         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38749         Witness_free(ret_var);
38750         return ret_arr;
38751 }
38752
38753 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
38754         LDKChannelTransactionParameters this_obj_conv;
38755         this_obj_conv.inner = untag_ptr(this_obj);
38756         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38758         ChannelTransactionParameters_free(this_obj_conv);
38759 }
38760
38761 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
38762         LDKChannelTransactionParameters this_ptr_conv;
38763         this_ptr_conv.inner = untag_ptr(this_ptr);
38764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38766         this_ptr_conv.is_owned = false;
38767         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
38768         uint64_t ret_ref = 0;
38769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38771         return ret_ref;
38772 }
38773
38774 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
38775         LDKChannelTransactionParameters this_ptr_conv;
38776         this_ptr_conv.inner = untag_ptr(this_ptr);
38777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38779         this_ptr_conv.is_owned = false;
38780         LDKChannelPublicKeys val_conv;
38781         val_conv.inner = untag_ptr(val);
38782         val_conv.is_owned = ptr_is_owned(val);
38783         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38784         val_conv = ChannelPublicKeys_clone(&val_conv);
38785         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
38786 }
38787
38788 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
38789         LDKChannelTransactionParameters this_ptr_conv;
38790         this_ptr_conv.inner = untag_ptr(this_ptr);
38791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38793         this_ptr_conv.is_owned = false;
38794         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
38795         return ret_conv;
38796 }
38797
38798 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) {
38799         LDKChannelTransactionParameters this_ptr_conv;
38800         this_ptr_conv.inner = untag_ptr(this_ptr);
38801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38803         this_ptr_conv.is_owned = false;
38804         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
38805 }
38806
38807 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
38808         LDKChannelTransactionParameters this_ptr_conv;
38809         this_ptr_conv.inner = untag_ptr(this_ptr);
38810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38812         this_ptr_conv.is_owned = false;
38813         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
38814         return ret_conv;
38815 }
38816
38817 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
38818         LDKChannelTransactionParameters this_ptr_conv;
38819         this_ptr_conv.inner = untag_ptr(this_ptr);
38820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38822         this_ptr_conv.is_owned = false;
38823         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
38824 }
38825
38826 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
38827         LDKChannelTransactionParameters this_ptr_conv;
38828         this_ptr_conv.inner = untag_ptr(this_ptr);
38829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38831         this_ptr_conv.is_owned = false;
38832         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
38833         uint64_t ret_ref = 0;
38834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38836         return ret_ref;
38837 }
38838
38839 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
38840         LDKChannelTransactionParameters this_ptr_conv;
38841         this_ptr_conv.inner = untag_ptr(this_ptr);
38842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38844         this_ptr_conv.is_owned = false;
38845         LDKCounterpartyChannelTransactionParameters val_conv;
38846         val_conv.inner = untag_ptr(val);
38847         val_conv.is_owned = ptr_is_owned(val);
38848         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38849         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
38850         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
38851 }
38852
38853 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
38854         LDKChannelTransactionParameters this_ptr_conv;
38855         this_ptr_conv.inner = untag_ptr(this_ptr);
38856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38858         this_ptr_conv.is_owned = false;
38859         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
38860         uint64_t ret_ref = 0;
38861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38863         return ret_ref;
38864 }
38865
38866 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
38867         LDKChannelTransactionParameters this_ptr_conv;
38868         this_ptr_conv.inner = untag_ptr(this_ptr);
38869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38871         this_ptr_conv.is_owned = false;
38872         LDKOutPoint val_conv;
38873         val_conv.inner = untag_ptr(val);
38874         val_conv.is_owned = ptr_is_owned(val);
38875         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38876         val_conv = OutPoint_clone(&val_conv);
38877         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
38878 }
38879
38880 uint32_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint64_t this_ptr) {
38881         LDKChannelTransactionParameters this_ptr_conv;
38882         this_ptr_conv.inner = untag_ptr(this_ptr);
38883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38885         this_ptr_conv.is_owned = false;
38886         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
38887         return ret_conv;
38888 }
38889
38890 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint64_t this_ptr, uint32_t val) {
38891         LDKChannelTransactionParameters this_ptr_conv;
38892         this_ptr_conv.inner = untag_ptr(this_ptr);
38893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38895         this_ptr_conv.is_owned = false;
38896         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
38897         ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
38898 }
38899
38900 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) {
38901         LDKChannelTransactionParameters this_ptr_conv;
38902         this_ptr_conv.inner = untag_ptr(this_ptr);
38903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38905         this_ptr_conv.is_owned = false;
38906         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_non_zero_fee_anchors(&this_ptr_conv));
38907         return ret_conv;
38908 }
38909
38910 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) {
38911         LDKChannelTransactionParameters this_ptr_conv;
38912         this_ptr_conv.inner = untag_ptr(this_ptr);
38913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38915         this_ptr_conv.is_owned = false;
38916         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
38917         ChannelTransactionParameters_set_opt_non_zero_fee_anchors(&this_ptr_conv, val_conv);
38918 }
38919
38920 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) {
38921         LDKChannelPublicKeys holder_pubkeys_arg_conv;
38922         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
38923         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
38924         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
38925         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
38926         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
38927         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
38928         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
38929         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
38930         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
38931         LDKOutPoint funding_outpoint_arg_conv;
38932         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
38933         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
38934         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
38935         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
38936         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
38937         LDKCOption_NoneZ opt_non_zero_fee_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_non_zero_fee_anchors_arg);
38938         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);
38939         uint64_t ret_ref = 0;
38940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38942         return ret_ref;
38943 }
38944
38945 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
38946         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
38947         uint64_t ret_ref = 0;
38948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38950         return ret_ref;
38951 }
38952 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
38953         LDKChannelTransactionParameters arg_conv;
38954         arg_conv.inner = untag_ptr(arg);
38955         arg_conv.is_owned = ptr_is_owned(arg);
38956         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38957         arg_conv.is_owned = false;
38958         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
38959         return ret_conv;
38960 }
38961
38962 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
38963         LDKChannelTransactionParameters orig_conv;
38964         orig_conv.inner = untag_ptr(orig);
38965         orig_conv.is_owned = ptr_is_owned(orig);
38966         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38967         orig_conv.is_owned = false;
38968         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
38969         uint64_t ret_ref = 0;
38970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38972         return ret_ref;
38973 }
38974
38975 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_eq"))) TS_ChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
38976         LDKChannelTransactionParameters a_conv;
38977         a_conv.inner = untag_ptr(a);
38978         a_conv.is_owned = ptr_is_owned(a);
38979         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38980         a_conv.is_owned = false;
38981         LDKChannelTransactionParameters b_conv;
38982         b_conv.inner = untag_ptr(b);
38983         b_conv.is_owned = ptr_is_owned(b);
38984         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38985         b_conv.is_owned = false;
38986         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
38987         return ret_conv;
38988 }
38989
38990 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
38991         LDKCounterpartyChannelTransactionParameters this_obj_conv;
38992         this_obj_conv.inner = untag_ptr(this_obj);
38993         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38995         CounterpartyChannelTransactionParameters_free(this_obj_conv);
38996 }
38997
38998 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
38999         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39000         this_ptr_conv.inner = untag_ptr(this_ptr);
39001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39003         this_ptr_conv.is_owned = false;
39004         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
39005         uint64_t ret_ref = 0;
39006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39008         return ret_ref;
39009 }
39010
39011 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
39012         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39013         this_ptr_conv.inner = untag_ptr(this_ptr);
39014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39016         this_ptr_conv.is_owned = false;
39017         LDKChannelPublicKeys val_conv;
39018         val_conv.inner = untag_ptr(val);
39019         val_conv.is_owned = ptr_is_owned(val);
39020         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39021         val_conv = ChannelPublicKeys_clone(&val_conv);
39022         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
39023 }
39024
39025 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
39026         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39027         this_ptr_conv.inner = untag_ptr(this_ptr);
39028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39030         this_ptr_conv.is_owned = false;
39031         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
39032         return ret_conv;
39033 }
39034
39035 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
39036         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39037         this_ptr_conv.inner = untag_ptr(this_ptr);
39038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39040         this_ptr_conv.is_owned = false;
39041         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
39042 }
39043
39044 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
39045         LDKChannelPublicKeys pubkeys_arg_conv;
39046         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
39047         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
39048         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
39049         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
39050         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
39051         uint64_t ret_ref = 0;
39052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39054         return ret_ref;
39055 }
39056
39057 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
39058         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
39059         uint64_t ret_ref = 0;
39060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39062         return ret_ref;
39063 }
39064 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
39065         LDKCounterpartyChannelTransactionParameters arg_conv;
39066         arg_conv.inner = untag_ptr(arg);
39067         arg_conv.is_owned = ptr_is_owned(arg);
39068         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39069         arg_conv.is_owned = false;
39070         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
39071         return ret_conv;
39072 }
39073
39074 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
39075         LDKCounterpartyChannelTransactionParameters orig_conv;
39076         orig_conv.inner = untag_ptr(orig);
39077         orig_conv.is_owned = ptr_is_owned(orig);
39078         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39079         orig_conv.is_owned = false;
39080         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
39081         uint64_t ret_ref = 0;
39082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39084         return ret_ref;
39085 }
39086
39087 jboolean  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_eq"))) TS_CounterpartyChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
39088         LDKCounterpartyChannelTransactionParameters a_conv;
39089         a_conv.inner = untag_ptr(a);
39090         a_conv.is_owned = ptr_is_owned(a);
39091         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39092         a_conv.is_owned = false;
39093         LDKCounterpartyChannelTransactionParameters b_conv;
39094         b_conv.inner = untag_ptr(b);
39095         b_conv.is_owned = ptr_is_owned(b);
39096         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39097         b_conv.is_owned = false;
39098         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
39099         return ret_conv;
39100 }
39101
39102 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
39103         LDKChannelTransactionParameters this_arg_conv;
39104         this_arg_conv.inner = untag_ptr(this_arg);
39105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39107         this_arg_conv.is_owned = false;
39108         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
39109         return ret_conv;
39110 }
39111
39112 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
39113         LDKChannelTransactionParameters this_arg_conv;
39114         this_arg_conv.inner = untag_ptr(this_arg);
39115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39117         this_arg_conv.is_owned = false;
39118         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
39119         uint64_t ret_ref = 0;
39120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39122         return ret_ref;
39123 }
39124
39125 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
39126         LDKChannelTransactionParameters this_arg_conv;
39127         this_arg_conv.inner = untag_ptr(this_arg);
39128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39130         this_arg_conv.is_owned = false;
39131         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
39132         uint64_t ret_ref = 0;
39133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39135         return ret_ref;
39136 }
39137
39138 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
39139         LDKCounterpartyChannelTransactionParameters obj_conv;
39140         obj_conv.inner = untag_ptr(obj);
39141         obj_conv.is_owned = ptr_is_owned(obj);
39142         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39143         obj_conv.is_owned = false;
39144         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
39145         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39146         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39147         CVec_u8Z_free(ret_var);
39148         return ret_arr;
39149 }
39150
39151 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
39152         LDKu8slice ser_ref;
39153         ser_ref.datalen = ser->arr_len;
39154         ser_ref.data = ser->elems;
39155         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
39156         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
39157         FREE(ser);
39158         return tag_ptr(ret_conv, true);
39159 }
39160
39161 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
39162         LDKChannelTransactionParameters obj_conv;
39163         obj_conv.inner = untag_ptr(obj);
39164         obj_conv.is_owned = ptr_is_owned(obj);
39165         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39166         obj_conv.is_owned = false;
39167         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
39168         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39169         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39170         CVec_u8Z_free(ret_var);
39171         return ret_arr;
39172 }
39173
39174 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
39175         LDKu8slice ser_ref;
39176         ser_ref.datalen = ser->arr_len;
39177         ser_ref.data = ser->elems;
39178         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
39179         *ret_conv = ChannelTransactionParameters_read(ser_ref);
39180         FREE(ser);
39181         return tag_ptr(ret_conv, true);
39182 }
39183
39184 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
39185         LDKDirectedChannelTransactionParameters this_obj_conv;
39186         this_obj_conv.inner = untag_ptr(this_obj);
39187         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39189         DirectedChannelTransactionParameters_free(this_obj_conv);
39190 }
39191
39192 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
39193         LDKDirectedChannelTransactionParameters this_arg_conv;
39194         this_arg_conv.inner = untag_ptr(this_arg);
39195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39197         this_arg_conv.is_owned = false;
39198         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
39199         uint64_t ret_ref = 0;
39200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39202         return ret_ref;
39203 }
39204
39205 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
39206         LDKDirectedChannelTransactionParameters this_arg_conv;
39207         this_arg_conv.inner = untag_ptr(this_arg);
39208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39210         this_arg_conv.is_owned = false;
39211         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
39212         uint64_t ret_ref = 0;
39213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39215         return ret_ref;
39216 }
39217
39218 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
39219         LDKDirectedChannelTransactionParameters this_arg_conv;
39220         this_arg_conv.inner = untag_ptr(this_arg);
39221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39223         this_arg_conv.is_owned = false;
39224         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
39225         return ret_conv;
39226 }
39227
39228 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
39229         LDKDirectedChannelTransactionParameters this_arg_conv;
39230         this_arg_conv.inner = untag_ptr(this_arg);
39231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39233         this_arg_conv.is_owned = false;
39234         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
39235         return ret_conv;
39236 }
39237
39238 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
39239         LDKDirectedChannelTransactionParameters this_arg_conv;
39240         this_arg_conv.inner = untag_ptr(this_arg);
39241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39243         this_arg_conv.is_owned = false;
39244         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
39245         uint64_t ret_ref = 0;
39246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39248         return ret_ref;
39249 }
39250
39251 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint64_t this_arg) {
39252         LDKDirectedChannelTransactionParameters this_arg_conv;
39253         this_arg_conv.inner = untag_ptr(this_arg);
39254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39256         this_arg_conv.is_owned = false;
39257         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
39258         return ret_conv;
39259 }
39260
39261 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
39262         LDKHolderCommitmentTransaction this_obj_conv;
39263         this_obj_conv.inner = untag_ptr(this_obj);
39264         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39266         HolderCommitmentTransaction_free(this_obj_conv);
39267 }
39268
39269 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
39270         LDKHolderCommitmentTransaction this_ptr_conv;
39271         this_ptr_conv.inner = untag_ptr(this_ptr);
39272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39274         this_ptr_conv.is_owned = false;
39275         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39276         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
39277         return ret_arr;
39278 }
39279
39280 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
39281         LDKHolderCommitmentTransaction this_ptr_conv;
39282         this_ptr_conv.inner = untag_ptr(this_ptr);
39283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39285         this_ptr_conv.is_owned = false;
39286         LDKSignature val_ref;
39287         CHECK(val->arr_len == 64);
39288         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
39289         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
39290 }
39291
39292 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
39293         LDKHolderCommitmentTransaction this_ptr_conv;
39294         this_ptr_conv.inner = untag_ptr(this_ptr);
39295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39297         this_ptr_conv.is_owned = false;
39298         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
39299         ptrArray ret_arr = NULL;
39300         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
39301         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
39302         for (size_t m = 0; m < ret_var.datalen; m++) {
39303                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
39304                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
39305                 ret_arr_ptr[m] = ret_conv_12_arr;
39306         }
39307         
39308         FREE(ret_var.data);
39309         return ret_arr;
39310 }
39311
39312 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
39313         LDKHolderCommitmentTransaction this_ptr_conv;
39314         this_ptr_conv.inner = untag_ptr(this_ptr);
39315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39317         this_ptr_conv.is_owned = false;
39318         LDKCVec_SignatureZ val_constr;
39319         val_constr.datalen = val->arr_len;
39320         if (val_constr.datalen > 0)
39321                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39322         else
39323                 val_constr.data = NULL;
39324         int8_tArray* val_vals = (void*) val->elems;
39325         for (size_t m = 0; m < val_constr.datalen; m++) {
39326                 int8_tArray val_conv_12 = val_vals[m];
39327                 LDKSignature val_conv_12_ref;
39328                 CHECK(val_conv_12->arr_len == 64);
39329                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
39330                 val_constr.data[m] = val_conv_12_ref;
39331         }
39332         FREE(val);
39333         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
39334 }
39335
39336 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
39337         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
39338         uint64_t ret_ref = 0;
39339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39341         return ret_ref;
39342 }
39343 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
39344         LDKHolderCommitmentTransaction arg_conv;
39345         arg_conv.inner = untag_ptr(arg);
39346         arg_conv.is_owned = ptr_is_owned(arg);
39347         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39348         arg_conv.is_owned = false;
39349         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
39350         return ret_conv;
39351 }
39352
39353 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
39354         LDKHolderCommitmentTransaction orig_conv;
39355         orig_conv.inner = untag_ptr(orig);
39356         orig_conv.is_owned = ptr_is_owned(orig);
39357         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39358         orig_conv.is_owned = false;
39359         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
39360         uint64_t ret_ref = 0;
39361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39363         return ret_ref;
39364 }
39365
39366 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
39367         LDKHolderCommitmentTransaction obj_conv;
39368         obj_conv.inner = untag_ptr(obj);
39369         obj_conv.is_owned = ptr_is_owned(obj);
39370         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39371         obj_conv.is_owned = false;
39372         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
39373         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39374         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39375         CVec_u8Z_free(ret_var);
39376         return ret_arr;
39377 }
39378
39379 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
39380         LDKu8slice ser_ref;
39381         ser_ref.datalen = ser->arr_len;
39382         ser_ref.data = ser->elems;
39383         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
39384         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
39385         FREE(ser);
39386         return tag_ptr(ret_conv, true);
39387 }
39388
39389 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) {
39390         LDKCommitmentTransaction commitment_tx_conv;
39391         commitment_tx_conv.inner = untag_ptr(commitment_tx);
39392         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
39393         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
39394         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
39395         LDKSignature counterparty_sig_ref;
39396         CHECK(counterparty_sig->arr_len == 64);
39397         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
39398         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
39399         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
39400         if (counterparty_htlc_sigs_constr.datalen > 0)
39401                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39402         else
39403                 counterparty_htlc_sigs_constr.data = NULL;
39404         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
39405         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
39406                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
39407                 LDKSignature counterparty_htlc_sigs_conv_12_ref;
39408                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
39409                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
39410                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
39411         }
39412         FREE(counterparty_htlc_sigs);
39413         LDKPublicKey holder_funding_key_ref;
39414         CHECK(holder_funding_key->arr_len == 33);
39415         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
39416         LDKPublicKey counterparty_funding_key_ref;
39417         CHECK(counterparty_funding_key->arr_len == 33);
39418         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
39419         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
39420         uint64_t ret_ref = 0;
39421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39423         return ret_ref;
39424 }
39425
39426 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
39427         LDKBuiltCommitmentTransaction this_obj_conv;
39428         this_obj_conv.inner = untag_ptr(this_obj);
39429         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39431         BuiltCommitmentTransaction_free(this_obj_conv);
39432 }
39433
39434 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
39435         LDKBuiltCommitmentTransaction this_ptr_conv;
39436         this_ptr_conv.inner = untag_ptr(this_ptr);
39437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39439         this_ptr_conv.is_owned = false;
39440         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
39441         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39442         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39443         Transaction_free(ret_var);
39444         return ret_arr;
39445 }
39446
39447 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
39448         LDKBuiltCommitmentTransaction this_ptr_conv;
39449         this_ptr_conv.inner = untag_ptr(this_ptr);
39450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39452         this_ptr_conv.is_owned = false;
39453         LDKTransaction val_ref;
39454         val_ref.datalen = val->arr_len;
39455         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
39456         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
39457         val_ref.data_is_owned = true;
39458         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
39459 }
39460
39461 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
39462         LDKBuiltCommitmentTransaction this_ptr_conv;
39463         this_ptr_conv.inner = untag_ptr(this_ptr);
39464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39466         this_ptr_conv.is_owned = false;
39467         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39468         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
39469         return ret_arr;
39470 }
39471
39472 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
39473         LDKBuiltCommitmentTransaction this_ptr_conv;
39474         this_ptr_conv.inner = untag_ptr(this_ptr);
39475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39477         this_ptr_conv.is_owned = false;
39478         LDKThirtyTwoBytes val_ref;
39479         CHECK(val->arr_len == 32);
39480         memcpy(val_ref.data, val->elems, 32); FREE(val);
39481         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
39482 }
39483
39484 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
39485         LDKTransaction transaction_arg_ref;
39486         transaction_arg_ref.datalen = transaction_arg->arr_len;
39487         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
39488         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
39489         transaction_arg_ref.data_is_owned = true;
39490         LDKThirtyTwoBytes txid_arg_ref;
39491         CHECK(txid_arg->arr_len == 32);
39492         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
39493         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
39494         uint64_t ret_ref = 0;
39495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39497         return ret_ref;
39498 }
39499
39500 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
39501         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
39502         uint64_t ret_ref = 0;
39503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39505         return ret_ref;
39506 }
39507 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
39508         LDKBuiltCommitmentTransaction arg_conv;
39509         arg_conv.inner = untag_ptr(arg);
39510         arg_conv.is_owned = ptr_is_owned(arg);
39511         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39512         arg_conv.is_owned = false;
39513         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
39514         return ret_conv;
39515 }
39516
39517 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
39518         LDKBuiltCommitmentTransaction orig_conv;
39519         orig_conv.inner = untag_ptr(orig);
39520         orig_conv.is_owned = ptr_is_owned(orig);
39521         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39522         orig_conv.is_owned = false;
39523         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
39524         uint64_t ret_ref = 0;
39525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39527         return ret_ref;
39528 }
39529
39530 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
39531         LDKBuiltCommitmentTransaction obj_conv;
39532         obj_conv.inner = untag_ptr(obj);
39533         obj_conv.is_owned = ptr_is_owned(obj);
39534         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39535         obj_conv.is_owned = false;
39536         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
39537         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39538         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39539         CVec_u8Z_free(ret_var);
39540         return ret_arr;
39541 }
39542
39543 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
39544         LDKu8slice ser_ref;
39545         ser_ref.datalen = ser->arr_len;
39546         ser_ref.data = ser->elems;
39547         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
39548         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
39549         FREE(ser);
39550         return tag_ptr(ret_conv, true);
39551 }
39552
39553 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) {
39554         LDKBuiltCommitmentTransaction this_arg_conv;
39555         this_arg_conv.inner = untag_ptr(this_arg);
39556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39558         this_arg_conv.is_owned = false;
39559         LDKu8slice funding_redeemscript_ref;
39560         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39561         funding_redeemscript_ref.data = funding_redeemscript->elems;
39562         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39563         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
39564         FREE(funding_redeemscript);
39565         return ret_arr;
39566 }
39567
39568 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_sign_counterparty_commitment"))) TS_BuiltCommitmentTransaction_sign_counterparty_commitment(uint64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
39569         LDKBuiltCommitmentTransaction this_arg_conv;
39570         this_arg_conv.inner = untag_ptr(this_arg);
39571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39573         this_arg_conv.is_owned = false;
39574         uint8_t funding_key_arr[32];
39575         CHECK(funding_key->arr_len == 32);
39576         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
39577         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
39578         LDKu8slice funding_redeemscript_ref;
39579         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39580         funding_redeemscript_ref.data = funding_redeemscript->elems;
39581         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39582         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
39583         FREE(funding_redeemscript);
39584         return ret_arr;
39585 }
39586
39587 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_sign_holder_commitment"))) TS_BuiltCommitmentTransaction_sign_holder_commitment(uint64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis, uint64_t entropy_source) {
39588         LDKBuiltCommitmentTransaction this_arg_conv;
39589         this_arg_conv.inner = untag_ptr(this_arg);
39590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39592         this_arg_conv.is_owned = false;
39593         uint8_t funding_key_arr[32];
39594         CHECK(funding_key->arr_len == 32);
39595         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
39596         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
39597         LDKu8slice funding_redeemscript_ref;
39598         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39599         funding_redeemscript_ref.data = funding_redeemscript->elems;
39600         void* entropy_source_ptr = untag_ptr(entropy_source);
39601         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
39602         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
39603         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39604         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_holder_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis, entropy_source_conv).compact_form, 64);
39605         FREE(funding_redeemscript);
39606         return ret_arr;
39607 }
39608
39609 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
39610         LDKClosingTransaction this_obj_conv;
39611         this_obj_conv.inner = untag_ptr(this_obj);
39612         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39614         ClosingTransaction_free(this_obj_conv);
39615 }
39616
39617 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
39618         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
39619         uint64_t ret_ref = 0;
39620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39622         return ret_ref;
39623 }
39624 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
39625         LDKClosingTransaction arg_conv;
39626         arg_conv.inner = untag_ptr(arg);
39627         arg_conv.is_owned = ptr_is_owned(arg);
39628         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39629         arg_conv.is_owned = false;
39630         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
39631         return ret_conv;
39632 }
39633
39634 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
39635         LDKClosingTransaction orig_conv;
39636         orig_conv.inner = untag_ptr(orig);
39637         orig_conv.is_owned = ptr_is_owned(orig);
39638         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39639         orig_conv.is_owned = false;
39640         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
39641         uint64_t ret_ref = 0;
39642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39644         return ret_ref;
39645 }
39646
39647 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
39648         LDKClosingTransaction o_conv;
39649         o_conv.inner = untag_ptr(o);
39650         o_conv.is_owned = ptr_is_owned(o);
39651         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39652         o_conv.is_owned = false;
39653         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
39654         return ret_conv;
39655 }
39656
39657 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
39658         LDKClosingTransaction a_conv;
39659         a_conv.inner = untag_ptr(a);
39660         a_conv.is_owned = ptr_is_owned(a);
39661         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39662         a_conv.is_owned = false;
39663         LDKClosingTransaction b_conv;
39664         b_conv.inner = untag_ptr(b);
39665         b_conv.is_owned = ptr_is_owned(b);
39666         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39667         b_conv.is_owned = false;
39668         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
39669         return ret_conv;
39670 }
39671
39672 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) {
39673         LDKCVec_u8Z to_holder_script_ref;
39674         to_holder_script_ref.datalen = to_holder_script->arr_len;
39675         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
39676         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
39677         LDKCVec_u8Z to_counterparty_script_ref;
39678         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
39679         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
39680         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
39681         LDKOutPoint funding_outpoint_conv;
39682         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
39683         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
39684         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39685         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39686         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
39687         uint64_t ret_ref = 0;
39688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39690         return ret_ref;
39691 }
39692
39693 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
39694         LDKClosingTransaction this_arg_conv;
39695         this_arg_conv.inner = untag_ptr(this_arg);
39696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39698         this_arg_conv.is_owned = false;
39699         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
39700         uint64_t ret_ref = 0;
39701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39703         return ret_ref;
39704 }
39705
39706 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
39707         LDKClosingTransaction this_arg_conv;
39708         this_arg_conv.inner = untag_ptr(this_arg);
39709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39711         this_arg_conv.is_owned = false;
39712         LDKOutPoint funding_outpoint_conv;
39713         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
39714         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
39715         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39716         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39717         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
39718         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
39719         return tag_ptr(ret_conv, true);
39720 }
39721
39722 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
39723         LDKClosingTransaction this_arg_conv;
39724         this_arg_conv.inner = untag_ptr(this_arg);
39725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39727         this_arg_conv.is_owned = false;
39728         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
39729         return ret_conv;
39730 }
39731
39732 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
39733         LDKClosingTransaction this_arg_conv;
39734         this_arg_conv.inner = untag_ptr(this_arg);
39735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39737         this_arg_conv.is_owned = false;
39738         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
39739         return ret_conv;
39740 }
39741
39742 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
39743         LDKClosingTransaction this_arg_conv;
39744         this_arg_conv.inner = untag_ptr(this_arg);
39745         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39747         this_arg_conv.is_owned = false;
39748         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
39749         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39750         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39751         return ret_arr;
39752 }
39753
39754 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
39755         LDKClosingTransaction this_arg_conv;
39756         this_arg_conv.inner = untag_ptr(this_arg);
39757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39759         this_arg_conv.is_owned = false;
39760         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
39761         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39762         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39763         return ret_arr;
39764 }
39765
39766 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
39767         LDKTrustedClosingTransaction this_obj_conv;
39768         this_obj_conv.inner = untag_ptr(this_obj);
39769         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39771         TrustedClosingTransaction_free(this_obj_conv);
39772 }
39773
39774 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
39775         LDKTrustedClosingTransaction 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         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
39781         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39782         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39783         Transaction_free(ret_var);
39784         return ret_arr;
39785 }
39786
39787 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) {
39788         LDKTrustedClosingTransaction this_arg_conv;
39789         this_arg_conv.inner = untag_ptr(this_arg);
39790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39792         this_arg_conv.is_owned = false;
39793         LDKu8slice funding_redeemscript_ref;
39794         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39795         funding_redeemscript_ref.data = funding_redeemscript->elems;
39796         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39797         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
39798         FREE(funding_redeemscript);
39799         return ret_arr;
39800 }
39801
39802 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) {
39803         LDKTrustedClosingTransaction this_arg_conv;
39804         this_arg_conv.inner = untag_ptr(this_arg);
39805         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39807         this_arg_conv.is_owned = false;
39808         uint8_t funding_key_arr[32];
39809         CHECK(funding_key->arr_len == 32);
39810         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
39811         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
39812         LDKu8slice funding_redeemscript_ref;
39813         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39814         funding_redeemscript_ref.data = funding_redeemscript->elems;
39815         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39816         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
39817         FREE(funding_redeemscript);
39818         return ret_arr;
39819 }
39820
39821 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
39822         LDKCommitmentTransaction this_obj_conv;
39823         this_obj_conv.inner = untag_ptr(this_obj);
39824         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39826         CommitmentTransaction_free(this_obj_conv);
39827 }
39828
39829 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
39830         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
39831         uint64_t ret_ref = 0;
39832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39834         return ret_ref;
39835 }
39836 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
39837         LDKCommitmentTransaction arg_conv;
39838         arg_conv.inner = untag_ptr(arg);
39839         arg_conv.is_owned = ptr_is_owned(arg);
39840         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39841         arg_conv.is_owned = false;
39842         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
39843         return ret_conv;
39844 }
39845
39846 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
39847         LDKCommitmentTransaction orig_conv;
39848         orig_conv.inner = untag_ptr(orig);
39849         orig_conv.is_owned = ptr_is_owned(orig);
39850         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39851         orig_conv.is_owned = false;
39852         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
39853         uint64_t ret_ref = 0;
39854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39856         return ret_ref;
39857 }
39858
39859 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
39860         LDKCommitmentTransaction obj_conv;
39861         obj_conv.inner = untag_ptr(obj);
39862         obj_conv.is_owned = ptr_is_owned(obj);
39863         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39864         obj_conv.is_owned = false;
39865         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
39866         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39867         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39868         CVec_u8Z_free(ret_var);
39869         return ret_arr;
39870 }
39871
39872 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
39873         LDKu8slice ser_ref;
39874         ser_ref.datalen = ser->arr_len;
39875         ser_ref.data = ser->elems;
39876         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
39877         *ret_conv = CommitmentTransaction_read(ser_ref);
39878         FREE(ser);
39879         return tag_ptr(ret_conv, true);
39880 }
39881
39882 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
39883         LDKCommitmentTransaction this_arg_conv;
39884         this_arg_conv.inner = untag_ptr(this_arg);
39885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39887         this_arg_conv.is_owned = false;
39888         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
39889         return ret_conv;
39890 }
39891
39892 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
39893         LDKCommitmentTransaction this_arg_conv;
39894         this_arg_conv.inner = untag_ptr(this_arg);
39895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39897         this_arg_conv.is_owned = false;
39898         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
39899         return ret_conv;
39900 }
39901
39902 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
39903         LDKCommitmentTransaction this_arg_conv;
39904         this_arg_conv.inner = untag_ptr(this_arg);
39905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39907         this_arg_conv.is_owned = false;
39908         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
39909         return ret_conv;
39910 }
39911
39912 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
39913         LDKCommitmentTransaction this_arg_conv;
39914         this_arg_conv.inner = untag_ptr(this_arg);
39915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39917         this_arg_conv.is_owned = false;
39918         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
39919         return ret_conv;
39920 }
39921
39922 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
39923         LDKCommitmentTransaction this_arg_conv;
39924         this_arg_conv.inner = untag_ptr(this_arg);
39925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39927         this_arg_conv.is_owned = false;
39928         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
39929         uint64_t ret_ref = 0;
39930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39932         return ret_ref;
39933 }
39934
39935 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) {
39936         LDKCommitmentTransaction this_arg_conv;
39937         this_arg_conv.inner = untag_ptr(this_arg);
39938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39940         this_arg_conv.is_owned = false;
39941         LDKDirectedChannelTransactionParameters channel_parameters_conv;
39942         channel_parameters_conv.inner = untag_ptr(channel_parameters);
39943         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
39944         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39945         channel_parameters_conv.is_owned = false;
39946         LDKChannelPublicKeys broadcaster_keys_conv;
39947         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
39948         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
39949         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
39950         broadcaster_keys_conv.is_owned = false;
39951         LDKChannelPublicKeys countersignatory_keys_conv;
39952         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
39953         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
39954         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
39955         countersignatory_keys_conv.is_owned = false;
39956         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
39957         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
39958         return tag_ptr(ret_conv, true);
39959 }
39960
39961 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
39962         LDKTrustedCommitmentTransaction this_obj_conv;
39963         this_obj_conv.inner = untag_ptr(this_obj);
39964         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39966         TrustedCommitmentTransaction_free(this_obj_conv);
39967 }
39968
39969 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
39970         LDKTrustedCommitmentTransaction this_arg_conv;
39971         this_arg_conv.inner = untag_ptr(this_arg);
39972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39974         this_arg_conv.is_owned = false;
39975         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39976         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
39977         return ret_arr;
39978 }
39979
39980 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
39981         LDKTrustedCommitmentTransaction this_arg_conv;
39982         this_arg_conv.inner = untag_ptr(this_arg);
39983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39985         this_arg_conv.is_owned = false;
39986         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
39987         uint64_t ret_ref = 0;
39988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39990         return ret_ref;
39991 }
39992
39993 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
39994         LDKTrustedCommitmentTransaction this_arg_conv;
39995         this_arg_conv.inner = untag_ptr(this_arg);
39996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39998         this_arg_conv.is_owned = false;
39999         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
40000         uint64_t ret_ref = 0;
40001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40003         return ret_ref;
40004 }
40005
40006 jboolean  __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint64_t this_arg) {
40007         LDKTrustedCommitmentTransaction this_arg_conv;
40008         this_arg_conv.inner = untag_ptr(this_arg);
40009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40011         this_arg_conv.is_owned = false;
40012         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
40013         return ret_conv;
40014 }
40015
40016 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, uint64_t entropy_source) {
40017         LDKTrustedCommitmentTransaction this_arg_conv;
40018         this_arg_conv.inner = untag_ptr(this_arg);
40019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40021         this_arg_conv.is_owned = false;
40022         uint8_t htlc_base_key_arr[32];
40023         CHECK(htlc_base_key->arr_len == 32);
40024         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
40025         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
40026         LDKDirectedChannelTransactionParameters channel_parameters_conv;
40027         channel_parameters_conv.inner = untag_ptr(channel_parameters);
40028         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
40029         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
40030         channel_parameters_conv.is_owned = false;
40031         void* entropy_source_ptr = untag_ptr(entropy_source);
40032         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
40033         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
40034         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
40035         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
40036         return tag_ptr(ret_conv, true);
40037 }
40038
40039 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) {
40040         LDKPublicKey broadcaster_payment_basepoint_ref;
40041         CHECK(broadcaster_payment_basepoint->arr_len == 33);
40042         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
40043         LDKPublicKey countersignatory_payment_basepoint_ref;
40044         CHECK(countersignatory_payment_basepoint->arr_len == 33);
40045         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
40046         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
40047         return ret_conv;
40048 }
40049
40050 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
40051         LDKInitFeatures a_conv;
40052         a_conv.inner = untag_ptr(a);
40053         a_conv.is_owned = ptr_is_owned(a);
40054         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40055         a_conv.is_owned = false;
40056         LDKInitFeatures b_conv;
40057         b_conv.inner = untag_ptr(b);
40058         b_conv.is_owned = ptr_is_owned(b);
40059         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40060         b_conv.is_owned = false;
40061         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
40062         return ret_conv;
40063 }
40064
40065 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
40066         LDKNodeFeatures a_conv;
40067         a_conv.inner = untag_ptr(a);
40068         a_conv.is_owned = ptr_is_owned(a);
40069         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40070         a_conv.is_owned = false;
40071         LDKNodeFeatures b_conv;
40072         b_conv.inner = untag_ptr(b);
40073         b_conv.is_owned = ptr_is_owned(b);
40074         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40075         b_conv.is_owned = false;
40076         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
40077         return ret_conv;
40078 }
40079
40080 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
40081         LDKChannelFeatures a_conv;
40082         a_conv.inner = untag_ptr(a);
40083         a_conv.is_owned = ptr_is_owned(a);
40084         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40085         a_conv.is_owned = false;
40086         LDKChannelFeatures b_conv;
40087         b_conv.inner = untag_ptr(b);
40088         b_conv.is_owned = ptr_is_owned(b);
40089         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40090         b_conv.is_owned = false;
40091         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
40092         return ret_conv;
40093 }
40094
40095 jboolean  __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint64_t a, uint64_t b) {
40096         LDKInvoiceFeatures a_conv;
40097         a_conv.inner = untag_ptr(a);
40098         a_conv.is_owned = ptr_is_owned(a);
40099         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40100         a_conv.is_owned = false;
40101         LDKInvoiceFeatures b_conv;
40102         b_conv.inner = untag_ptr(b);
40103         b_conv.is_owned = ptr_is_owned(b);
40104         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40105         b_conv.is_owned = false;
40106         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
40107         return ret_conv;
40108 }
40109
40110 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
40111         LDKOfferFeatures a_conv;
40112         a_conv.inner = untag_ptr(a);
40113         a_conv.is_owned = ptr_is_owned(a);
40114         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40115         a_conv.is_owned = false;
40116         LDKOfferFeatures b_conv;
40117         b_conv.inner = untag_ptr(b);
40118         b_conv.is_owned = ptr_is_owned(b);
40119         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40120         b_conv.is_owned = false;
40121         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
40122         return ret_conv;
40123 }
40124
40125 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
40126         LDKInvoiceRequestFeatures a_conv;
40127         a_conv.inner = untag_ptr(a);
40128         a_conv.is_owned = ptr_is_owned(a);
40129         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40130         a_conv.is_owned = false;
40131         LDKInvoiceRequestFeatures b_conv;
40132         b_conv.inner = untag_ptr(b);
40133         b_conv.is_owned = ptr_is_owned(b);
40134         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40135         b_conv.is_owned = false;
40136         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
40137         return ret_conv;
40138 }
40139
40140 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_eq"))) TS_Bolt12InvoiceFeatures_eq(uint64_t a, uint64_t b) {
40141         LDKBolt12InvoiceFeatures a_conv;
40142         a_conv.inner = untag_ptr(a);
40143         a_conv.is_owned = ptr_is_owned(a);
40144         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40145         a_conv.is_owned = false;
40146         LDKBolt12InvoiceFeatures b_conv;
40147         b_conv.inner = untag_ptr(b);
40148         b_conv.is_owned = ptr_is_owned(b);
40149         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40150         b_conv.is_owned = false;
40151         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
40152         return ret_conv;
40153 }
40154
40155 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_eq"))) TS_BlindedHopFeatures_eq(uint64_t a, uint64_t b) {
40156         LDKBlindedHopFeatures a_conv;
40157         a_conv.inner = untag_ptr(a);
40158         a_conv.is_owned = ptr_is_owned(a);
40159         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40160         a_conv.is_owned = false;
40161         LDKBlindedHopFeatures b_conv;
40162         b_conv.inner = untag_ptr(b);
40163         b_conv.is_owned = ptr_is_owned(b);
40164         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40165         b_conv.is_owned = false;
40166         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
40167         return ret_conv;
40168 }
40169
40170 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
40171         LDKChannelTypeFeatures a_conv;
40172         a_conv.inner = untag_ptr(a);
40173         a_conv.is_owned = ptr_is_owned(a);
40174         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40175         a_conv.is_owned = false;
40176         LDKChannelTypeFeatures b_conv;
40177         b_conv.inner = untag_ptr(b);
40178         b_conv.is_owned = ptr_is_owned(b);
40179         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40180         b_conv.is_owned = false;
40181         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
40182         return ret_conv;
40183 }
40184
40185 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
40186         LDKInitFeatures ret_var = InitFeatures_clone(arg);
40187         uint64_t ret_ref = 0;
40188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40190         return ret_ref;
40191 }
40192 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
40193         LDKInitFeatures arg_conv;
40194         arg_conv.inner = untag_ptr(arg);
40195         arg_conv.is_owned = ptr_is_owned(arg);
40196         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40197         arg_conv.is_owned = false;
40198         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
40199         return ret_conv;
40200 }
40201
40202 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
40203         LDKInitFeatures orig_conv;
40204         orig_conv.inner = untag_ptr(orig);
40205         orig_conv.is_owned = ptr_is_owned(orig);
40206         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40207         orig_conv.is_owned = false;
40208         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
40209         uint64_t ret_ref = 0;
40210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40212         return ret_ref;
40213 }
40214
40215 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
40216         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
40217         uint64_t ret_ref = 0;
40218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40220         return ret_ref;
40221 }
40222 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
40223         LDKNodeFeatures arg_conv;
40224         arg_conv.inner = untag_ptr(arg);
40225         arg_conv.is_owned = ptr_is_owned(arg);
40226         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40227         arg_conv.is_owned = false;
40228         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
40229         return ret_conv;
40230 }
40231
40232 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
40233         LDKNodeFeatures orig_conv;
40234         orig_conv.inner = untag_ptr(orig);
40235         orig_conv.is_owned = ptr_is_owned(orig);
40236         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40237         orig_conv.is_owned = false;
40238         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
40239         uint64_t ret_ref = 0;
40240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40242         return ret_ref;
40243 }
40244
40245 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
40246         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
40247         uint64_t ret_ref = 0;
40248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40250         return ret_ref;
40251 }
40252 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
40253         LDKChannelFeatures arg_conv;
40254         arg_conv.inner = untag_ptr(arg);
40255         arg_conv.is_owned = ptr_is_owned(arg);
40256         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40257         arg_conv.is_owned = false;
40258         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
40259         return ret_conv;
40260 }
40261
40262 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
40263         LDKChannelFeatures orig_conv;
40264         orig_conv.inner = untag_ptr(orig);
40265         orig_conv.is_owned = ptr_is_owned(orig);
40266         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40267         orig_conv.is_owned = false;
40268         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
40269         uint64_t ret_ref = 0;
40270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40272         return ret_ref;
40273 }
40274
40275 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
40276         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
40277         uint64_t ret_ref = 0;
40278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40280         return ret_ref;
40281 }
40282 int64_t  __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint64_t arg) {
40283         LDKInvoiceFeatures arg_conv;
40284         arg_conv.inner = untag_ptr(arg);
40285         arg_conv.is_owned = ptr_is_owned(arg);
40286         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40287         arg_conv.is_owned = false;
40288         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
40289         return ret_conv;
40290 }
40291
40292 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint64_t orig) {
40293         LDKInvoiceFeatures orig_conv;
40294         orig_conv.inner = untag_ptr(orig);
40295         orig_conv.is_owned = ptr_is_owned(orig);
40296         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40297         orig_conv.is_owned = false;
40298         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
40299         uint64_t ret_ref = 0;
40300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40302         return ret_ref;
40303 }
40304
40305 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
40306         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
40307         uint64_t ret_ref = 0;
40308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40310         return ret_ref;
40311 }
40312 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
40313         LDKOfferFeatures arg_conv;
40314         arg_conv.inner = untag_ptr(arg);
40315         arg_conv.is_owned = ptr_is_owned(arg);
40316         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40317         arg_conv.is_owned = false;
40318         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
40319         return ret_conv;
40320 }
40321
40322 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
40323         LDKOfferFeatures orig_conv;
40324         orig_conv.inner = untag_ptr(orig);
40325         orig_conv.is_owned = ptr_is_owned(orig);
40326         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40327         orig_conv.is_owned = false;
40328         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
40329         uint64_t ret_ref = 0;
40330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40332         return ret_ref;
40333 }
40334
40335 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
40336         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
40337         uint64_t ret_ref = 0;
40338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40340         return ret_ref;
40341 }
40342 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
40343         LDKInvoiceRequestFeatures arg_conv;
40344         arg_conv.inner = untag_ptr(arg);
40345         arg_conv.is_owned = ptr_is_owned(arg);
40346         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40347         arg_conv.is_owned = false;
40348         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
40349         return ret_conv;
40350 }
40351
40352 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
40353         LDKInvoiceRequestFeatures orig_conv;
40354         orig_conv.inner = untag_ptr(orig);
40355         orig_conv.is_owned = ptr_is_owned(orig);
40356         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40357         orig_conv.is_owned = false;
40358         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
40359         uint64_t ret_ref = 0;
40360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40362         return ret_ref;
40363 }
40364
40365 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
40366         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
40367         uint64_t ret_ref = 0;
40368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40370         return ret_ref;
40371 }
40372 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone_ptr"))) TS_Bolt12InvoiceFeatures_clone_ptr(uint64_t arg) {
40373         LDKBolt12InvoiceFeatures arg_conv;
40374         arg_conv.inner = untag_ptr(arg);
40375         arg_conv.is_owned = ptr_is_owned(arg);
40376         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40377         arg_conv.is_owned = false;
40378         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
40379         return ret_conv;
40380 }
40381
40382 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone"))) TS_Bolt12InvoiceFeatures_clone(uint64_t orig) {
40383         LDKBolt12InvoiceFeatures orig_conv;
40384         orig_conv.inner = untag_ptr(orig);
40385         orig_conv.is_owned = ptr_is_owned(orig);
40386         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40387         orig_conv.is_owned = false;
40388         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
40389         uint64_t ret_ref = 0;
40390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40392         return ret_ref;
40393 }
40394
40395 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
40396         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
40397         uint64_t ret_ref = 0;
40398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40400         return ret_ref;
40401 }
40402 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone_ptr"))) TS_BlindedHopFeatures_clone_ptr(uint64_t arg) {
40403         LDKBlindedHopFeatures arg_conv;
40404         arg_conv.inner = untag_ptr(arg);
40405         arg_conv.is_owned = ptr_is_owned(arg);
40406         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40407         arg_conv.is_owned = false;
40408         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
40409         return ret_conv;
40410 }
40411
40412 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone"))) TS_BlindedHopFeatures_clone(uint64_t orig) {
40413         LDKBlindedHopFeatures orig_conv;
40414         orig_conv.inner = untag_ptr(orig);
40415         orig_conv.is_owned = ptr_is_owned(orig);
40416         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40417         orig_conv.is_owned = false;
40418         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
40419         uint64_t ret_ref = 0;
40420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40422         return ret_ref;
40423 }
40424
40425 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
40426         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
40427         uint64_t ret_ref = 0;
40428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40430         return ret_ref;
40431 }
40432 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
40433         LDKChannelTypeFeatures arg_conv;
40434         arg_conv.inner = untag_ptr(arg);
40435         arg_conv.is_owned = ptr_is_owned(arg);
40436         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40437         arg_conv.is_owned = false;
40438         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
40439         return ret_conv;
40440 }
40441
40442 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
40443         LDKChannelTypeFeatures orig_conv;
40444         orig_conv.inner = untag_ptr(orig);
40445         orig_conv.is_owned = ptr_is_owned(orig);
40446         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40447         orig_conv.is_owned = false;
40448         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
40449         uint64_t ret_ref = 0;
40450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40452         return ret_ref;
40453 }
40454
40455 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
40456         LDKInitFeatures this_obj_conv;
40457         this_obj_conv.inner = untag_ptr(this_obj);
40458         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40460         InitFeatures_free(this_obj_conv);
40461 }
40462
40463 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
40464         LDKNodeFeatures this_obj_conv;
40465         this_obj_conv.inner = untag_ptr(this_obj);
40466         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40468         NodeFeatures_free(this_obj_conv);
40469 }
40470
40471 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
40472         LDKChannelFeatures this_obj_conv;
40473         this_obj_conv.inner = untag_ptr(this_obj);
40474         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40476         ChannelFeatures_free(this_obj_conv);
40477 }
40478
40479 void  __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint64_t this_obj) {
40480         LDKInvoiceFeatures this_obj_conv;
40481         this_obj_conv.inner = untag_ptr(this_obj);
40482         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40484         InvoiceFeatures_free(this_obj_conv);
40485 }
40486
40487 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
40488         LDKOfferFeatures this_obj_conv;
40489         this_obj_conv.inner = untag_ptr(this_obj);
40490         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40492         OfferFeatures_free(this_obj_conv);
40493 }
40494
40495 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
40496         LDKInvoiceRequestFeatures this_obj_conv;
40497         this_obj_conv.inner = untag_ptr(this_obj);
40498         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40500         InvoiceRequestFeatures_free(this_obj_conv);
40501 }
40502
40503 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_free"))) TS_Bolt12InvoiceFeatures_free(uint64_t this_obj) {
40504         LDKBolt12InvoiceFeatures this_obj_conv;
40505         this_obj_conv.inner = untag_ptr(this_obj);
40506         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40508         Bolt12InvoiceFeatures_free(this_obj_conv);
40509 }
40510
40511 void  __attribute__((export_name("TS_BlindedHopFeatures_free"))) TS_BlindedHopFeatures_free(uint64_t this_obj) {
40512         LDKBlindedHopFeatures this_obj_conv;
40513         this_obj_conv.inner = untag_ptr(this_obj);
40514         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40516         BlindedHopFeatures_free(this_obj_conv);
40517 }
40518
40519 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
40520         LDKChannelTypeFeatures this_obj_conv;
40521         this_obj_conv.inner = untag_ptr(this_obj);
40522         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40524         ChannelTypeFeatures_free(this_obj_conv);
40525 }
40526
40527 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
40528         LDKInitFeatures ret_var = InitFeatures_empty();
40529         uint64_t ret_ref = 0;
40530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40532         return ret_ref;
40533 }
40534
40535 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
40536         LDKInitFeatures this_arg_conv;
40537         this_arg_conv.inner = untag_ptr(this_arg);
40538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40540         this_arg_conv.is_owned = false;
40541         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
40542         return ret_conv;
40543 }
40544
40545 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
40546         LDKNodeFeatures ret_var = NodeFeatures_empty();
40547         uint64_t ret_ref = 0;
40548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40550         return ret_ref;
40551 }
40552
40553 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
40554         LDKNodeFeatures this_arg_conv;
40555         this_arg_conv.inner = untag_ptr(this_arg);
40556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40558         this_arg_conv.is_owned = false;
40559         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
40560         return ret_conv;
40561 }
40562
40563 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
40564         LDKChannelFeatures ret_var = ChannelFeatures_empty();
40565         uint64_t ret_ref = 0;
40566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40568         return ret_ref;
40569 }
40570
40571 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
40572         LDKChannelFeatures this_arg_conv;
40573         this_arg_conv.inner = untag_ptr(this_arg);
40574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40576         this_arg_conv.is_owned = false;
40577         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
40578         return ret_conv;
40579 }
40580
40581 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
40582         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
40583         uint64_t ret_ref = 0;
40584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40586         return ret_ref;
40587 }
40588
40589 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
40590         LDKInvoiceFeatures this_arg_conv;
40591         this_arg_conv.inner = untag_ptr(this_arg);
40592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40594         this_arg_conv.is_owned = false;
40595         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
40596         return ret_conv;
40597 }
40598
40599 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
40600         LDKOfferFeatures ret_var = OfferFeatures_empty();
40601         uint64_t ret_ref = 0;
40602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40604         return ret_ref;
40605 }
40606
40607 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
40608         LDKOfferFeatures this_arg_conv;
40609         this_arg_conv.inner = untag_ptr(this_arg);
40610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40612         this_arg_conv.is_owned = false;
40613         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
40614         return ret_conv;
40615 }
40616
40617 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
40618         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
40619         uint64_t ret_ref = 0;
40620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40622         return ret_ref;
40623 }
40624
40625 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
40626         LDKInvoiceRequestFeatures this_arg_conv;
40627         this_arg_conv.inner = untag_ptr(this_arg);
40628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40630         this_arg_conv.is_owned = false;
40631         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
40632         return ret_conv;
40633 }
40634
40635 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_empty"))) TS_Bolt12InvoiceFeatures_empty() {
40636         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
40637         uint64_t ret_ref = 0;
40638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40640         return ret_ref;
40641 }
40642
40643 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
40644         LDKBolt12InvoiceFeatures this_arg_conv;
40645         this_arg_conv.inner = untag_ptr(this_arg);
40646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40648         this_arg_conv.is_owned = false;
40649         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
40650         return ret_conv;
40651 }
40652
40653 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_empty"))) TS_BlindedHopFeatures_empty() {
40654         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
40655         uint64_t ret_ref = 0;
40656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40658         return ret_ref;
40659 }
40660
40661 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits"))) TS_BlindedHopFeatures_requires_unknown_bits(uint64_t this_arg) {
40662         LDKBlindedHopFeatures this_arg_conv;
40663         this_arg_conv.inner = untag_ptr(this_arg);
40664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40666         this_arg_conv.is_owned = false;
40667         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
40668         return ret_conv;
40669 }
40670
40671 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
40672         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
40673         uint64_t ret_ref = 0;
40674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40676         return ret_ref;
40677 }
40678
40679 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
40680         LDKChannelTypeFeatures this_arg_conv;
40681         this_arg_conv.inner = untag_ptr(this_arg);
40682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40684         this_arg_conv.is_owned = false;
40685         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
40686         return ret_conv;
40687 }
40688
40689 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
40690         LDKInitFeatures obj_conv;
40691         obj_conv.inner = untag_ptr(obj);
40692         obj_conv.is_owned = ptr_is_owned(obj);
40693         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40694         obj_conv.is_owned = false;
40695         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
40696         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40697         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40698         CVec_u8Z_free(ret_var);
40699         return ret_arr;
40700 }
40701
40702 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
40703         LDKu8slice ser_ref;
40704         ser_ref.datalen = ser->arr_len;
40705         ser_ref.data = ser->elems;
40706         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
40707         *ret_conv = InitFeatures_read(ser_ref);
40708         FREE(ser);
40709         return tag_ptr(ret_conv, true);
40710 }
40711
40712 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
40713         LDKChannelFeatures obj_conv;
40714         obj_conv.inner = untag_ptr(obj);
40715         obj_conv.is_owned = ptr_is_owned(obj);
40716         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40717         obj_conv.is_owned = false;
40718         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
40719         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40720         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40721         CVec_u8Z_free(ret_var);
40722         return ret_arr;
40723 }
40724
40725 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
40726         LDKu8slice ser_ref;
40727         ser_ref.datalen = ser->arr_len;
40728         ser_ref.data = ser->elems;
40729         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
40730         *ret_conv = ChannelFeatures_read(ser_ref);
40731         FREE(ser);
40732         return tag_ptr(ret_conv, true);
40733 }
40734
40735 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
40736         LDKNodeFeatures obj_conv;
40737         obj_conv.inner = untag_ptr(obj);
40738         obj_conv.is_owned = ptr_is_owned(obj);
40739         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40740         obj_conv.is_owned = false;
40741         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
40742         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40743         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40744         CVec_u8Z_free(ret_var);
40745         return ret_arr;
40746 }
40747
40748 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
40749         LDKu8slice ser_ref;
40750         ser_ref.datalen = ser->arr_len;
40751         ser_ref.data = ser->elems;
40752         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
40753         *ret_conv = NodeFeatures_read(ser_ref);
40754         FREE(ser);
40755         return tag_ptr(ret_conv, true);
40756 }
40757
40758 int8_tArray  __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint64_t obj) {
40759         LDKInvoiceFeatures obj_conv;
40760         obj_conv.inner = untag_ptr(obj);
40761         obj_conv.is_owned = ptr_is_owned(obj);
40762         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40763         obj_conv.is_owned = false;
40764         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
40765         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40766         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40767         CVec_u8Z_free(ret_var);
40768         return ret_arr;
40769 }
40770
40771 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
40772         LDKu8slice ser_ref;
40773         ser_ref.datalen = ser->arr_len;
40774         ser_ref.data = ser->elems;
40775         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
40776         *ret_conv = InvoiceFeatures_read(ser_ref);
40777         FREE(ser);
40778         return tag_ptr(ret_conv, true);
40779 }
40780
40781 int8_tArray  __attribute__((export_name("TS_BlindedHopFeatures_write"))) TS_BlindedHopFeatures_write(uint64_t obj) {
40782         LDKBlindedHopFeatures obj_conv;
40783         obj_conv.inner = untag_ptr(obj);
40784         obj_conv.is_owned = ptr_is_owned(obj);
40785         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40786         obj_conv.is_owned = false;
40787         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
40788         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40789         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40790         CVec_u8Z_free(ret_var);
40791         return ret_arr;
40792 }
40793
40794 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_read"))) TS_BlindedHopFeatures_read(int8_tArray ser) {
40795         LDKu8slice ser_ref;
40796         ser_ref.datalen = ser->arr_len;
40797         ser_ref.data = ser->elems;
40798         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
40799         *ret_conv = BlindedHopFeatures_read(ser_ref);
40800         FREE(ser);
40801         return tag_ptr(ret_conv, true);
40802 }
40803
40804 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
40805         LDKChannelTypeFeatures obj_conv;
40806         obj_conv.inner = untag_ptr(obj);
40807         obj_conv.is_owned = ptr_is_owned(obj);
40808         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40809         obj_conv.is_owned = false;
40810         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
40811         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40812         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40813         CVec_u8Z_free(ret_var);
40814         return ret_arr;
40815 }
40816
40817 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
40818         LDKu8slice ser_ref;
40819         ser_ref.datalen = ser->arr_len;
40820         ser_ref.data = ser->elems;
40821         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
40822         *ret_conv = ChannelTypeFeatures_read(ser_ref);
40823         FREE(ser);
40824         return tag_ptr(ret_conv, true);
40825 }
40826
40827 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
40828         LDKInitFeatures this_arg_conv;
40829         this_arg_conv.inner = untag_ptr(this_arg);
40830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40832         this_arg_conv.is_owned = false;
40833         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
40834 }
40835
40836 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
40837         LDKInitFeatures this_arg_conv;
40838         this_arg_conv.inner = untag_ptr(this_arg);
40839         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40841         this_arg_conv.is_owned = false;
40842         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
40843 }
40844
40845 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
40846         LDKInitFeatures this_arg_conv;
40847         this_arg_conv.inner = untag_ptr(this_arg);
40848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40850         this_arg_conv.is_owned = false;
40851         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
40852         return ret_conv;
40853 }
40854
40855 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
40856         LDKNodeFeatures this_arg_conv;
40857         this_arg_conv.inner = untag_ptr(this_arg);
40858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40860         this_arg_conv.is_owned = false;
40861         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
40862 }
40863
40864 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
40865         LDKNodeFeatures this_arg_conv;
40866         this_arg_conv.inner = untag_ptr(this_arg);
40867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40869         this_arg_conv.is_owned = false;
40870         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
40871 }
40872
40873 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
40874         LDKNodeFeatures this_arg_conv;
40875         this_arg_conv.inner = untag_ptr(this_arg);
40876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40878         this_arg_conv.is_owned = false;
40879         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
40880         return ret_conv;
40881 }
40882
40883 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
40884         LDKInitFeatures this_arg_conv;
40885         this_arg_conv.inner = untag_ptr(this_arg);
40886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40888         this_arg_conv.is_owned = false;
40889         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
40890         return ret_conv;
40891 }
40892
40893 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
40894         LDKNodeFeatures this_arg_conv;
40895         this_arg_conv.inner = untag_ptr(this_arg);
40896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40898         this_arg_conv.is_owned = false;
40899         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
40900         return ret_conv;
40901 }
40902
40903 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
40904         LDKInitFeatures 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         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
40910 }
40911
40912 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
40913         LDKInitFeatures 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         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
40919 }
40920
40921 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
40922         LDKInitFeatures this_arg_conv;
40923         this_arg_conv.inner = untag_ptr(this_arg);
40924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40926         this_arg_conv.is_owned = false;
40927         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
40928         return ret_conv;
40929 }
40930
40931 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
40932         LDKInitFeatures this_arg_conv;
40933         this_arg_conv.inner = untag_ptr(this_arg);
40934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40936         this_arg_conv.is_owned = false;
40937         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40938 }
40939
40940 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
40941         LDKInitFeatures this_arg_conv;
40942         this_arg_conv.inner = untag_ptr(this_arg);
40943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40945         this_arg_conv.is_owned = false;
40946         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40947 }
40948
40949 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
40950         LDKInitFeatures this_arg_conv;
40951         this_arg_conv.inner = untag_ptr(this_arg);
40952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40954         this_arg_conv.is_owned = false;
40955         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40956         return ret_conv;
40957 }
40958
40959 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
40960         LDKNodeFeatures this_arg_conv;
40961         this_arg_conv.inner = untag_ptr(this_arg);
40962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40964         this_arg_conv.is_owned = false;
40965         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40966 }
40967
40968 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
40969         LDKNodeFeatures this_arg_conv;
40970         this_arg_conv.inner = untag_ptr(this_arg);
40971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40973         this_arg_conv.is_owned = false;
40974         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40975 }
40976
40977 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
40978         LDKNodeFeatures this_arg_conv;
40979         this_arg_conv.inner = untag_ptr(this_arg);
40980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40982         this_arg_conv.is_owned = false;
40983         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40984         return ret_conv;
40985 }
40986
40987 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
40988         LDKInitFeatures this_arg_conv;
40989         this_arg_conv.inner = untag_ptr(this_arg);
40990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40992         this_arg_conv.is_owned = false;
40993         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
40994         return ret_conv;
40995 }
40996
40997 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
40998         LDKNodeFeatures this_arg_conv;
40999         this_arg_conv.inner = untag_ptr(this_arg);
41000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41002         this_arg_conv.is_owned = false;
41003         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
41004         return ret_conv;
41005 }
41006
41007 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
41008         LDKInitFeatures 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         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
41014 }
41015
41016 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
41017         LDKInitFeatures 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         InitFeatures_set_gossip_queries_required(&this_arg_conv);
41023 }
41024
41025 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
41026         LDKInitFeatures this_arg_conv;
41027         this_arg_conv.inner = untag_ptr(this_arg);
41028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41030         this_arg_conv.is_owned = false;
41031         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
41032         return ret_conv;
41033 }
41034
41035 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
41036         LDKNodeFeatures this_arg_conv;
41037         this_arg_conv.inner = untag_ptr(this_arg);
41038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41040         this_arg_conv.is_owned = false;
41041         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
41042 }
41043
41044 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
41045         LDKNodeFeatures this_arg_conv;
41046         this_arg_conv.inner = untag_ptr(this_arg);
41047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41049         this_arg_conv.is_owned = false;
41050         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
41051 }
41052
41053 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
41054         LDKNodeFeatures this_arg_conv;
41055         this_arg_conv.inner = untag_ptr(this_arg);
41056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41058         this_arg_conv.is_owned = false;
41059         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
41060         return ret_conv;
41061 }
41062
41063 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
41064         LDKInitFeatures this_arg_conv;
41065         this_arg_conv.inner = untag_ptr(this_arg);
41066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41068         this_arg_conv.is_owned = false;
41069         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
41070         return ret_conv;
41071 }
41072
41073 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
41074         LDKNodeFeatures this_arg_conv;
41075         this_arg_conv.inner = untag_ptr(this_arg);
41076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41078         this_arg_conv.is_owned = false;
41079         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
41080         return ret_conv;
41081 }
41082
41083 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
41084         LDKInitFeatures 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         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
41090 }
41091
41092 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
41093         LDKInitFeatures 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         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
41099 }
41100
41101 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
41102         LDKInitFeatures this_arg_conv;
41103         this_arg_conv.inner = untag_ptr(this_arg);
41104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41106         this_arg_conv.is_owned = false;
41107         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
41108         return ret_conv;
41109 }
41110
41111 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
41112         LDKNodeFeatures this_arg_conv;
41113         this_arg_conv.inner = untag_ptr(this_arg);
41114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41116         this_arg_conv.is_owned = false;
41117         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
41118 }
41119
41120 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
41121         LDKNodeFeatures this_arg_conv;
41122         this_arg_conv.inner = untag_ptr(this_arg);
41123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41125         this_arg_conv.is_owned = false;
41126         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
41127 }
41128
41129 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
41130         LDKNodeFeatures this_arg_conv;
41131         this_arg_conv.inner = untag_ptr(this_arg);
41132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41134         this_arg_conv.is_owned = false;
41135         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
41136         return ret_conv;
41137 }
41138
41139 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_optional"))) TS_InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
41140         LDKInvoiceFeatures this_arg_conv;
41141         this_arg_conv.inner = untag_ptr(this_arg);
41142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41144         this_arg_conv.is_owned = false;
41145         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
41146 }
41147
41148 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_required"))) TS_InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
41149         LDKInvoiceFeatures this_arg_conv;
41150         this_arg_conv.inner = untag_ptr(this_arg);
41151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41153         this_arg_conv.is_owned = false;
41154         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
41155 }
41156
41157 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_variable_length_onion"))) TS_InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
41158         LDKInvoiceFeatures this_arg_conv;
41159         this_arg_conv.inner = untag_ptr(this_arg);
41160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41162         this_arg_conv.is_owned = false;
41163         jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
41164         return ret_conv;
41165 }
41166
41167 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
41168         LDKInitFeatures this_arg_conv;
41169         this_arg_conv.inner = untag_ptr(this_arg);
41170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41172         this_arg_conv.is_owned = false;
41173         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
41174         return ret_conv;
41175 }
41176
41177 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
41178         LDKNodeFeatures this_arg_conv;
41179         this_arg_conv.inner = untag_ptr(this_arg);
41180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41182         this_arg_conv.is_owned = false;
41183         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
41184         return ret_conv;
41185 }
41186
41187 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_variable_length_onion"))) TS_InvoiceFeatures_requires_variable_length_onion(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         jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
41194         return ret_conv;
41195 }
41196
41197 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
41198         LDKInitFeatures this_arg_conv;
41199         this_arg_conv.inner = untag_ptr(this_arg);
41200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41202         this_arg_conv.is_owned = false;
41203         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
41204 }
41205
41206 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(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         InitFeatures_set_static_remote_key_required(&this_arg_conv);
41213 }
41214
41215 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
41216         LDKInitFeatures this_arg_conv;
41217         this_arg_conv.inner = untag_ptr(this_arg);
41218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41220         this_arg_conv.is_owned = false;
41221         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
41222         return ret_conv;
41223 }
41224
41225 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
41226         LDKNodeFeatures this_arg_conv;
41227         this_arg_conv.inner = untag_ptr(this_arg);
41228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41230         this_arg_conv.is_owned = false;
41231         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
41232 }
41233
41234 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
41235         LDKNodeFeatures this_arg_conv;
41236         this_arg_conv.inner = untag_ptr(this_arg);
41237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41239         this_arg_conv.is_owned = false;
41240         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
41241 }
41242
41243 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
41244         LDKNodeFeatures this_arg_conv;
41245         this_arg_conv.inner = untag_ptr(this_arg);
41246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41248         this_arg_conv.is_owned = false;
41249         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
41250         return ret_conv;
41251 }
41252
41253 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
41254         LDKChannelTypeFeatures this_arg_conv;
41255         this_arg_conv.inner = untag_ptr(this_arg);
41256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41258         this_arg_conv.is_owned = false;
41259         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
41260 }
41261
41262 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
41263         LDKChannelTypeFeatures this_arg_conv;
41264         this_arg_conv.inner = untag_ptr(this_arg);
41265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41267         this_arg_conv.is_owned = false;
41268         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
41269 }
41270
41271 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
41272         LDKChannelTypeFeatures this_arg_conv;
41273         this_arg_conv.inner = untag_ptr(this_arg);
41274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41276         this_arg_conv.is_owned = false;
41277         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
41278         return ret_conv;
41279 }
41280
41281 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
41282         LDKInitFeatures this_arg_conv;
41283         this_arg_conv.inner = untag_ptr(this_arg);
41284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41286         this_arg_conv.is_owned = false;
41287         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
41288         return ret_conv;
41289 }
41290
41291 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
41292         LDKNodeFeatures this_arg_conv;
41293         this_arg_conv.inner = untag_ptr(this_arg);
41294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41296         this_arg_conv.is_owned = false;
41297         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
41298         return ret_conv;
41299 }
41300
41301 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(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         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
41308         return ret_conv;
41309 }
41310
41311 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
41312         LDKInitFeatures this_arg_conv;
41313         this_arg_conv.inner = untag_ptr(this_arg);
41314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41316         this_arg_conv.is_owned = false;
41317         InitFeatures_set_payment_secret_optional(&this_arg_conv);
41318 }
41319
41320 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(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         InitFeatures_set_payment_secret_required(&this_arg_conv);
41327 }
41328
41329 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
41330         LDKInitFeatures this_arg_conv;
41331         this_arg_conv.inner = untag_ptr(this_arg);
41332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41334         this_arg_conv.is_owned = false;
41335         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
41336         return ret_conv;
41337 }
41338
41339 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
41340         LDKNodeFeatures this_arg_conv;
41341         this_arg_conv.inner = untag_ptr(this_arg);
41342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41344         this_arg_conv.is_owned = false;
41345         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
41346 }
41347
41348 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
41349         LDKNodeFeatures this_arg_conv;
41350         this_arg_conv.inner = untag_ptr(this_arg);
41351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41353         this_arg_conv.is_owned = false;
41354         NodeFeatures_set_payment_secret_required(&this_arg_conv);
41355 }
41356
41357 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
41358         LDKNodeFeatures this_arg_conv;
41359         this_arg_conv.inner = untag_ptr(this_arg);
41360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41362         this_arg_conv.is_owned = false;
41363         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
41364         return ret_conv;
41365 }
41366
41367 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_optional"))) TS_InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
41368         LDKInvoiceFeatures this_arg_conv;
41369         this_arg_conv.inner = untag_ptr(this_arg);
41370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41372         this_arg_conv.is_owned = false;
41373         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
41374 }
41375
41376 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_required"))) TS_InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
41377         LDKInvoiceFeatures this_arg_conv;
41378         this_arg_conv.inner = untag_ptr(this_arg);
41379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41381         this_arg_conv.is_owned = false;
41382         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
41383 }
41384
41385 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_payment_secret"))) TS_InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
41386         LDKInvoiceFeatures this_arg_conv;
41387         this_arg_conv.inner = untag_ptr(this_arg);
41388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41390         this_arg_conv.is_owned = false;
41391         jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
41392         return ret_conv;
41393 }
41394
41395 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
41396         LDKInitFeatures this_arg_conv;
41397         this_arg_conv.inner = untag_ptr(this_arg);
41398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41400         this_arg_conv.is_owned = false;
41401         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
41402         return ret_conv;
41403 }
41404
41405 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
41406         LDKNodeFeatures this_arg_conv;
41407         this_arg_conv.inner = untag_ptr(this_arg);
41408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41410         this_arg_conv.is_owned = false;
41411         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
41412         return ret_conv;
41413 }
41414
41415 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_payment_secret"))) TS_InvoiceFeatures_requires_payment_secret(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         jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
41422         return ret_conv;
41423 }
41424
41425 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41426         LDKInitFeatures this_arg_conv;
41427         this_arg_conv.inner = untag_ptr(this_arg);
41428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41430         this_arg_conv.is_owned = false;
41431         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
41432 }
41433
41434 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(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         InitFeatures_set_basic_mpp_required(&this_arg_conv);
41441 }
41442
41443 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
41444         LDKInitFeatures this_arg_conv;
41445         this_arg_conv.inner = untag_ptr(this_arg);
41446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41448         this_arg_conv.is_owned = false;
41449         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
41450         return ret_conv;
41451 }
41452
41453 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41454         LDKNodeFeatures this_arg_conv;
41455         this_arg_conv.inner = untag_ptr(this_arg);
41456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41458         this_arg_conv.is_owned = false;
41459         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
41460 }
41461
41462 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
41463         LDKNodeFeatures this_arg_conv;
41464         this_arg_conv.inner = untag_ptr(this_arg);
41465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41467         this_arg_conv.is_owned = false;
41468         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
41469 }
41470
41471 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
41472         LDKNodeFeatures this_arg_conv;
41473         this_arg_conv.inner = untag_ptr(this_arg);
41474         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41476         this_arg_conv.is_owned = false;
41477         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
41478         return ret_conv;
41479 }
41480
41481 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_optional"))) TS_InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41482         LDKInvoiceFeatures this_arg_conv;
41483         this_arg_conv.inner = untag_ptr(this_arg);
41484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41486         this_arg_conv.is_owned = false;
41487         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
41488 }
41489
41490 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_required"))) TS_InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
41491         LDKInvoiceFeatures this_arg_conv;
41492         this_arg_conv.inner = untag_ptr(this_arg);
41493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41495         this_arg_conv.is_owned = false;
41496         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
41497 }
41498
41499 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) TS_InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
41500         LDKInvoiceFeatures this_arg_conv;
41501         this_arg_conv.inner = untag_ptr(this_arg);
41502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41504         this_arg_conv.is_owned = false;
41505         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
41506         return ret_conv;
41507 }
41508
41509 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41510         LDKBolt12InvoiceFeatures this_arg_conv;
41511         this_arg_conv.inner = untag_ptr(this_arg);
41512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41514         this_arg_conv.is_owned = false;
41515         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
41516 }
41517
41518 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
41519         LDKBolt12InvoiceFeatures this_arg_conv;
41520         this_arg_conv.inner = untag_ptr(this_arg);
41521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41523         this_arg_conv.is_owned = false;
41524         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
41525 }
41526
41527 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_supports_basic_mpp"))) TS_Bolt12InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
41528         LDKBolt12InvoiceFeatures this_arg_conv;
41529         this_arg_conv.inner = untag_ptr(this_arg);
41530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41532         this_arg_conv.is_owned = false;
41533         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
41534         return ret_conv;
41535 }
41536
41537 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
41538         LDKInitFeatures this_arg_conv;
41539         this_arg_conv.inner = untag_ptr(this_arg);
41540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41542         this_arg_conv.is_owned = false;
41543         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
41544         return ret_conv;
41545 }
41546
41547 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
41548         LDKNodeFeatures this_arg_conv;
41549         this_arg_conv.inner = untag_ptr(this_arg);
41550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41552         this_arg_conv.is_owned = false;
41553         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
41554         return ret_conv;
41555 }
41556
41557 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) TS_InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
41558         LDKInvoiceFeatures 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         jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
41564         return ret_conv;
41565 }
41566
41567 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_basic_mpp"))) TS_Bolt12InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
41568         LDKBolt12InvoiceFeatures this_arg_conv;
41569         this_arg_conv.inner = untag_ptr(this_arg);
41570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41572         this_arg_conv.is_owned = false;
41573         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
41574         return ret_conv;
41575 }
41576
41577 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
41578         LDKInitFeatures this_arg_conv;
41579         this_arg_conv.inner = untag_ptr(this_arg);
41580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41582         this_arg_conv.is_owned = false;
41583         InitFeatures_set_wumbo_optional(&this_arg_conv);
41584 }
41585
41586 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
41587         LDKInitFeatures 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         InitFeatures_set_wumbo_required(&this_arg_conv);
41593 }
41594
41595 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
41596         LDKInitFeatures this_arg_conv;
41597         this_arg_conv.inner = untag_ptr(this_arg);
41598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41600         this_arg_conv.is_owned = false;
41601         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
41602         return ret_conv;
41603 }
41604
41605 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
41606         LDKNodeFeatures this_arg_conv;
41607         this_arg_conv.inner = untag_ptr(this_arg);
41608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41610         this_arg_conv.is_owned = false;
41611         NodeFeatures_set_wumbo_optional(&this_arg_conv);
41612 }
41613
41614 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
41615         LDKNodeFeatures this_arg_conv;
41616         this_arg_conv.inner = untag_ptr(this_arg);
41617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41619         this_arg_conv.is_owned = false;
41620         NodeFeatures_set_wumbo_required(&this_arg_conv);
41621 }
41622
41623 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
41624         LDKNodeFeatures this_arg_conv;
41625         this_arg_conv.inner = untag_ptr(this_arg);
41626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41628         this_arg_conv.is_owned = false;
41629         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
41630         return ret_conv;
41631 }
41632
41633 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
41634         LDKInitFeatures this_arg_conv;
41635         this_arg_conv.inner = untag_ptr(this_arg);
41636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41638         this_arg_conv.is_owned = false;
41639         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
41640         return ret_conv;
41641 }
41642
41643 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
41644         LDKNodeFeatures this_arg_conv;
41645         this_arg_conv.inner = untag_ptr(this_arg);
41646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41648         this_arg_conv.is_owned = false;
41649         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
41650         return ret_conv;
41651 }
41652
41653 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) {
41654         LDKInitFeatures 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         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
41660 }
41661
41662 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) {
41663         LDKInitFeatures 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         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
41669 }
41670
41671 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41672         LDKInitFeatures this_arg_conv;
41673         this_arg_conv.inner = untag_ptr(this_arg);
41674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41676         this_arg_conv.is_owned = false;
41677         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
41678         return ret_conv;
41679 }
41680
41681 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) {
41682         LDKNodeFeatures this_arg_conv;
41683         this_arg_conv.inner = untag_ptr(this_arg);
41684         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41686         this_arg_conv.is_owned = false;
41687         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
41688 }
41689
41690 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) {
41691         LDKNodeFeatures this_arg_conv;
41692         this_arg_conv.inner = untag_ptr(this_arg);
41693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41695         this_arg_conv.is_owned = false;
41696         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
41697 }
41698
41699 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41700         LDKNodeFeatures this_arg_conv;
41701         this_arg_conv.inner = untag_ptr(this_arg);
41702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41704         this_arg_conv.is_owned = false;
41705         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
41706         return ret_conv;
41707 }
41708
41709 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) {
41710         LDKChannelTypeFeatures this_arg_conv;
41711         this_arg_conv.inner = untag_ptr(this_arg);
41712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41714         this_arg_conv.is_owned = false;
41715         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
41716 }
41717
41718 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) {
41719         LDKChannelTypeFeatures this_arg_conv;
41720         this_arg_conv.inner = untag_ptr(this_arg);
41721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41723         this_arg_conv.is_owned = false;
41724         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
41725 }
41726
41727 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41728         LDKChannelTypeFeatures this_arg_conv;
41729         this_arg_conv.inner = untag_ptr(this_arg);
41730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41732         this_arg_conv.is_owned = false;
41733         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
41734         return ret_conv;
41735 }
41736
41737 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41738         LDKInitFeatures this_arg_conv;
41739         this_arg_conv.inner = untag_ptr(this_arg);
41740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41742         this_arg_conv.is_owned = false;
41743         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
41744         return ret_conv;
41745 }
41746
41747 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41748         LDKNodeFeatures this_arg_conv;
41749         this_arg_conv.inner = untag_ptr(this_arg);
41750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41752         this_arg_conv.is_owned = false;
41753         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
41754         return ret_conv;
41755 }
41756
41757 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(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         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
41764         return ret_conv;
41765 }
41766
41767 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
41768         LDKInitFeatures this_arg_conv;
41769         this_arg_conv.inner = untag_ptr(this_arg);
41770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41772         this_arg_conv.is_owned = false;
41773         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
41774 }
41775
41776 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(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         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
41783 }
41784
41785 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
41786         LDKInitFeatures this_arg_conv;
41787         this_arg_conv.inner = untag_ptr(this_arg);
41788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41790         this_arg_conv.is_owned = false;
41791         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
41792         return ret_conv;
41793 }
41794
41795 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
41796         LDKNodeFeatures this_arg_conv;
41797         this_arg_conv.inner = untag_ptr(this_arg);
41798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41800         this_arg_conv.is_owned = false;
41801         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
41802 }
41803
41804 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
41805         LDKNodeFeatures this_arg_conv;
41806         this_arg_conv.inner = untag_ptr(this_arg);
41807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41809         this_arg_conv.is_owned = false;
41810         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
41811 }
41812
41813 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
41814         LDKNodeFeatures this_arg_conv;
41815         this_arg_conv.inner = untag_ptr(this_arg);
41816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41818         this_arg_conv.is_owned = false;
41819         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
41820         return ret_conv;
41821 }
41822
41823 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
41824         LDKInitFeatures this_arg_conv;
41825         this_arg_conv.inner = untag_ptr(this_arg);
41826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41828         this_arg_conv.is_owned = false;
41829         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
41830         return ret_conv;
41831 }
41832
41833 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
41834         LDKNodeFeatures this_arg_conv;
41835         this_arg_conv.inner = untag_ptr(this_arg);
41836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41838         this_arg_conv.is_owned = false;
41839         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
41840         return ret_conv;
41841 }
41842
41843 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
41844         LDKInitFeatures 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         InitFeatures_set_onion_messages_optional(&this_arg_conv);
41850 }
41851
41852 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
41853         LDKInitFeatures 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         InitFeatures_set_onion_messages_required(&this_arg_conv);
41859 }
41860
41861 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
41862         LDKInitFeatures this_arg_conv;
41863         this_arg_conv.inner = untag_ptr(this_arg);
41864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41866         this_arg_conv.is_owned = false;
41867         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
41868         return ret_conv;
41869 }
41870
41871 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
41872         LDKNodeFeatures this_arg_conv;
41873         this_arg_conv.inner = untag_ptr(this_arg);
41874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41876         this_arg_conv.is_owned = false;
41877         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
41878 }
41879
41880 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
41881         LDKNodeFeatures this_arg_conv;
41882         this_arg_conv.inner = untag_ptr(this_arg);
41883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41885         this_arg_conv.is_owned = false;
41886         NodeFeatures_set_onion_messages_required(&this_arg_conv);
41887 }
41888
41889 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
41890         LDKNodeFeatures this_arg_conv;
41891         this_arg_conv.inner = untag_ptr(this_arg);
41892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41894         this_arg_conv.is_owned = false;
41895         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
41896         return ret_conv;
41897 }
41898
41899 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
41900         LDKInitFeatures this_arg_conv;
41901         this_arg_conv.inner = untag_ptr(this_arg);
41902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41904         this_arg_conv.is_owned = false;
41905         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
41906         return ret_conv;
41907 }
41908
41909 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
41910         LDKNodeFeatures this_arg_conv;
41911         this_arg_conv.inner = untag_ptr(this_arg);
41912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41914         this_arg_conv.is_owned = false;
41915         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
41916         return ret_conv;
41917 }
41918
41919 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
41920         LDKInitFeatures 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         InitFeatures_set_channel_type_optional(&this_arg_conv);
41926 }
41927
41928 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
41929         LDKInitFeatures 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         InitFeatures_set_channel_type_required(&this_arg_conv);
41935 }
41936
41937 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
41938         LDKInitFeatures this_arg_conv;
41939         this_arg_conv.inner = untag_ptr(this_arg);
41940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41942         this_arg_conv.is_owned = false;
41943         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
41944         return ret_conv;
41945 }
41946
41947 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
41948         LDKNodeFeatures this_arg_conv;
41949         this_arg_conv.inner = untag_ptr(this_arg);
41950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41952         this_arg_conv.is_owned = false;
41953         NodeFeatures_set_channel_type_optional(&this_arg_conv);
41954 }
41955
41956 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
41957         LDKNodeFeatures this_arg_conv;
41958         this_arg_conv.inner = untag_ptr(this_arg);
41959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41961         this_arg_conv.is_owned = false;
41962         NodeFeatures_set_channel_type_required(&this_arg_conv);
41963 }
41964
41965 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
41966         LDKNodeFeatures this_arg_conv;
41967         this_arg_conv.inner = untag_ptr(this_arg);
41968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41970         this_arg_conv.is_owned = false;
41971         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
41972         return ret_conv;
41973 }
41974
41975 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
41976         LDKInitFeatures this_arg_conv;
41977         this_arg_conv.inner = untag_ptr(this_arg);
41978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41980         this_arg_conv.is_owned = false;
41981         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
41982         return ret_conv;
41983 }
41984
41985 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
41986         LDKNodeFeatures this_arg_conv;
41987         this_arg_conv.inner = untag_ptr(this_arg);
41988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41990         this_arg_conv.is_owned = false;
41991         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
41992         return ret_conv;
41993 }
41994
41995 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
41996         LDKInitFeatures 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         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
42002 }
42003
42004 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
42005         LDKInitFeatures 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         InitFeatures_set_scid_privacy_required(&this_arg_conv);
42011 }
42012
42013 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
42014         LDKInitFeatures this_arg_conv;
42015         this_arg_conv.inner = untag_ptr(this_arg);
42016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42018         this_arg_conv.is_owned = false;
42019         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
42020         return ret_conv;
42021 }
42022
42023 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
42024         LDKNodeFeatures this_arg_conv;
42025         this_arg_conv.inner = untag_ptr(this_arg);
42026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42028         this_arg_conv.is_owned = false;
42029         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
42030 }
42031
42032 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
42033         LDKNodeFeatures this_arg_conv;
42034         this_arg_conv.inner = untag_ptr(this_arg);
42035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42037         this_arg_conv.is_owned = false;
42038         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
42039 }
42040
42041 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
42042         LDKNodeFeatures this_arg_conv;
42043         this_arg_conv.inner = untag_ptr(this_arg);
42044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42046         this_arg_conv.is_owned = false;
42047         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
42048         return ret_conv;
42049 }
42050
42051 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
42052         LDKChannelTypeFeatures this_arg_conv;
42053         this_arg_conv.inner = untag_ptr(this_arg);
42054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42056         this_arg_conv.is_owned = false;
42057         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
42058 }
42059
42060 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
42061         LDKChannelTypeFeatures this_arg_conv;
42062         this_arg_conv.inner = untag_ptr(this_arg);
42063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42065         this_arg_conv.is_owned = false;
42066         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
42067 }
42068
42069 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
42070         LDKChannelTypeFeatures this_arg_conv;
42071         this_arg_conv.inner = untag_ptr(this_arg);
42072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42074         this_arg_conv.is_owned = false;
42075         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
42076         return ret_conv;
42077 }
42078
42079 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
42080         LDKInitFeatures this_arg_conv;
42081         this_arg_conv.inner = untag_ptr(this_arg);
42082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42084         this_arg_conv.is_owned = false;
42085         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
42086         return ret_conv;
42087 }
42088
42089 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
42090         LDKNodeFeatures this_arg_conv;
42091         this_arg_conv.inner = untag_ptr(this_arg);
42092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42094         this_arg_conv.is_owned = false;
42095         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
42096         return ret_conv;
42097 }
42098
42099 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(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         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
42106         return ret_conv;
42107 }
42108
42109 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_metadata_optional"))) TS_InvoiceFeatures_set_payment_metadata_optional(uint64_t this_arg) {
42110         LDKInvoiceFeatures this_arg_conv;
42111         this_arg_conv.inner = untag_ptr(this_arg);
42112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42114         this_arg_conv.is_owned = false;
42115         InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
42116 }
42117
42118 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_metadata_required"))) TS_InvoiceFeatures_set_payment_metadata_required(uint64_t this_arg) {
42119         LDKInvoiceFeatures 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         InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
42125 }
42126
42127 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_payment_metadata"))) TS_InvoiceFeatures_supports_payment_metadata(uint64_t this_arg) {
42128         LDKInvoiceFeatures this_arg_conv;
42129         this_arg_conv.inner = untag_ptr(this_arg);
42130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42132         this_arg_conv.is_owned = false;
42133         jboolean ret_conv = InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
42134         return ret_conv;
42135 }
42136
42137 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_payment_metadata"))) TS_InvoiceFeatures_requires_payment_metadata(uint64_t this_arg) {
42138         LDKInvoiceFeatures this_arg_conv;
42139         this_arg_conv.inner = untag_ptr(this_arg);
42140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42142         this_arg_conv.is_owned = false;
42143         jboolean ret_conv = InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
42144         return ret_conv;
42145 }
42146
42147 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
42148         LDKInitFeatures this_arg_conv;
42149         this_arg_conv.inner = untag_ptr(this_arg);
42150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42152         this_arg_conv.is_owned = false;
42153         InitFeatures_set_zero_conf_optional(&this_arg_conv);
42154 }
42155
42156 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
42157         LDKInitFeatures this_arg_conv;
42158         this_arg_conv.inner = untag_ptr(this_arg);
42159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42161         this_arg_conv.is_owned = false;
42162         InitFeatures_set_zero_conf_required(&this_arg_conv);
42163 }
42164
42165 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
42166         LDKInitFeatures this_arg_conv;
42167         this_arg_conv.inner = untag_ptr(this_arg);
42168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42170         this_arg_conv.is_owned = false;
42171         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
42172         return ret_conv;
42173 }
42174
42175 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
42176         LDKNodeFeatures this_arg_conv;
42177         this_arg_conv.inner = untag_ptr(this_arg);
42178         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42180         this_arg_conv.is_owned = false;
42181         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
42182 }
42183
42184 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
42185         LDKNodeFeatures this_arg_conv;
42186         this_arg_conv.inner = untag_ptr(this_arg);
42187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42189         this_arg_conv.is_owned = false;
42190         NodeFeatures_set_zero_conf_required(&this_arg_conv);
42191 }
42192
42193 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
42194         LDKNodeFeatures this_arg_conv;
42195         this_arg_conv.inner = untag_ptr(this_arg);
42196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42198         this_arg_conv.is_owned = false;
42199         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
42200         return ret_conv;
42201 }
42202
42203 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
42204         LDKChannelTypeFeatures this_arg_conv;
42205         this_arg_conv.inner = untag_ptr(this_arg);
42206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42208         this_arg_conv.is_owned = false;
42209         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
42210 }
42211
42212 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
42213         LDKChannelTypeFeatures this_arg_conv;
42214         this_arg_conv.inner = untag_ptr(this_arg);
42215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42217         this_arg_conv.is_owned = false;
42218         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
42219 }
42220
42221 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
42222         LDKChannelTypeFeatures this_arg_conv;
42223         this_arg_conv.inner = untag_ptr(this_arg);
42224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42226         this_arg_conv.is_owned = false;
42227         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
42228         return ret_conv;
42229 }
42230
42231 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
42232         LDKInitFeatures this_arg_conv;
42233         this_arg_conv.inner = untag_ptr(this_arg);
42234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42236         this_arg_conv.is_owned = false;
42237         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
42238         return ret_conv;
42239 }
42240
42241 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
42242         LDKNodeFeatures this_arg_conv;
42243         this_arg_conv.inner = untag_ptr(this_arg);
42244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42246         this_arg_conv.is_owned = false;
42247         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
42248         return ret_conv;
42249 }
42250
42251 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
42252         LDKChannelTypeFeatures this_arg_conv;
42253         this_arg_conv.inner = untag_ptr(this_arg);
42254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42256         this_arg_conv.is_owned = false;
42257         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
42258         return ret_conv;
42259 }
42260
42261 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
42262         LDKNodeFeatures this_arg_conv;
42263         this_arg_conv.inner = untag_ptr(this_arg);
42264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42266         this_arg_conv.is_owned = false;
42267         NodeFeatures_set_keysend_optional(&this_arg_conv);
42268 }
42269
42270 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
42271         LDKNodeFeatures this_arg_conv;
42272         this_arg_conv.inner = untag_ptr(this_arg);
42273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42275         this_arg_conv.is_owned = false;
42276         NodeFeatures_set_keysend_required(&this_arg_conv);
42277 }
42278
42279 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
42280         LDKNodeFeatures this_arg_conv;
42281         this_arg_conv.inner = untag_ptr(this_arg);
42282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42284         this_arg_conv.is_owned = false;
42285         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
42286         return ret_conv;
42287 }
42288
42289 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
42290         LDKNodeFeatures this_arg_conv;
42291         this_arg_conv.inner = untag_ptr(this_arg);
42292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42294         this_arg_conv.is_owned = false;
42295         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
42296         return ret_conv;
42297 }
42298
42299 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
42300         LDKShutdownScript this_obj_conv;
42301         this_obj_conv.inner = untag_ptr(this_obj);
42302         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42304         ShutdownScript_free(this_obj_conv);
42305 }
42306
42307 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
42308         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
42309         uint64_t ret_ref = 0;
42310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42312         return ret_ref;
42313 }
42314 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
42315         LDKShutdownScript arg_conv;
42316         arg_conv.inner = untag_ptr(arg);
42317         arg_conv.is_owned = ptr_is_owned(arg);
42318         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42319         arg_conv.is_owned = false;
42320         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
42321         return ret_conv;
42322 }
42323
42324 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
42325         LDKShutdownScript orig_conv;
42326         orig_conv.inner = untag_ptr(orig);
42327         orig_conv.is_owned = ptr_is_owned(orig);
42328         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42329         orig_conv.is_owned = false;
42330         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
42331         uint64_t ret_ref = 0;
42332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42334         return ret_ref;
42335 }
42336
42337 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
42338         LDKShutdownScript a_conv;
42339         a_conv.inner = untag_ptr(a);
42340         a_conv.is_owned = ptr_is_owned(a);
42341         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42342         a_conv.is_owned = false;
42343         LDKShutdownScript b_conv;
42344         b_conv.inner = untag_ptr(b);
42345         b_conv.is_owned = ptr_is_owned(b);
42346         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42347         b_conv.is_owned = false;
42348         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
42349         return ret_conv;
42350 }
42351
42352 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
42353         LDKInvalidShutdownScript this_obj_conv;
42354         this_obj_conv.inner = untag_ptr(this_obj);
42355         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42357         InvalidShutdownScript_free(this_obj_conv);
42358 }
42359
42360 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
42361         LDKInvalidShutdownScript this_ptr_conv;
42362         this_ptr_conv.inner = untag_ptr(this_ptr);
42363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42365         this_ptr_conv.is_owned = false;
42366         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
42367         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42368         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42369         return ret_arr;
42370 }
42371
42372 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
42373         LDKInvalidShutdownScript this_ptr_conv;
42374         this_ptr_conv.inner = untag_ptr(this_ptr);
42375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42377         this_ptr_conv.is_owned = false;
42378         LDKCVec_u8Z val_ref;
42379         val_ref.datalen = val->arr_len;
42380         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
42381         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
42382         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
42383 }
42384
42385 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
42386         LDKCVec_u8Z script_arg_ref;
42387         script_arg_ref.datalen = script_arg->arr_len;
42388         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
42389         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
42390         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
42391         uint64_t ret_ref = 0;
42392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42394         return ret_ref;
42395 }
42396
42397 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
42398         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
42399         uint64_t ret_ref = 0;
42400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42402         return ret_ref;
42403 }
42404 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
42405         LDKInvalidShutdownScript arg_conv;
42406         arg_conv.inner = untag_ptr(arg);
42407         arg_conv.is_owned = ptr_is_owned(arg);
42408         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42409         arg_conv.is_owned = false;
42410         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
42411         return ret_conv;
42412 }
42413
42414 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
42415         LDKInvalidShutdownScript orig_conv;
42416         orig_conv.inner = untag_ptr(orig);
42417         orig_conv.is_owned = ptr_is_owned(orig);
42418         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42419         orig_conv.is_owned = false;
42420         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
42421         uint64_t ret_ref = 0;
42422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42424         return ret_ref;
42425 }
42426
42427 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
42428         LDKShutdownScript obj_conv;
42429         obj_conv.inner = untag_ptr(obj);
42430         obj_conv.is_owned = ptr_is_owned(obj);
42431         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42432         obj_conv.is_owned = false;
42433         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
42434         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42435         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42436         CVec_u8Z_free(ret_var);
42437         return ret_arr;
42438 }
42439
42440 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
42441         LDKu8slice ser_ref;
42442         ser_ref.datalen = ser->arr_len;
42443         ser_ref.data = ser->elems;
42444         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
42445         *ret_conv = ShutdownScript_read(ser_ref);
42446         FREE(ser);
42447         return tag_ptr(ret_conv, true);
42448 }
42449
42450 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
42451         uint8_t pubkey_hash_arr[20];
42452         CHECK(pubkey_hash->arr_len == 20);
42453         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
42454         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
42455         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
42456         uint64_t ret_ref = 0;
42457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42459         return ret_ref;
42460 }
42461
42462 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
42463         uint8_t script_hash_arr[32];
42464         CHECK(script_hash->arr_len == 32);
42465         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
42466         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
42467         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
42468         uint64_t ret_ref = 0;
42469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42471         return ret_ref;
42472 }
42473
42474 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
42475         
42476         LDKu8slice program_ref;
42477         program_ref.datalen = program->arr_len;
42478         program_ref.data = program->elems;
42479         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
42480         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
42481         FREE(program);
42482         return tag_ptr(ret_conv, true);
42483 }
42484
42485 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
42486         LDKShutdownScript this_arg_conv;
42487         this_arg_conv.inner = untag_ptr(this_arg);
42488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42490         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
42491         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
42492         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42493         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42494         CVec_u8Z_free(ret_var);
42495         return ret_arr;
42496 }
42497
42498 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
42499         LDKShutdownScript this_arg_conv;
42500         this_arg_conv.inner = untag_ptr(this_arg);
42501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42503         this_arg_conv.is_owned = false;
42504         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42505         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
42506         return ret_arr;
42507 }
42508
42509 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
42510         LDKShutdownScript this_arg_conv;
42511         this_arg_conv.inner = untag_ptr(this_arg);
42512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42514         this_arg_conv.is_owned = false;
42515         LDKInitFeatures features_conv;
42516         features_conv.inner = untag_ptr(features);
42517         features_conv.is_owned = ptr_is_owned(features);
42518         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
42519         features_conv.is_owned = false;
42520         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
42521         return ret_conv;
42522 }
42523
42524 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
42525         if (!ptr_is_owned(this_ptr)) return;
42526         void* this_ptr_ptr = untag_ptr(this_ptr);
42527         CHECK_ACCESS(this_ptr_ptr);
42528         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
42529         FREE(untag_ptr(this_ptr));
42530         Retry_free(this_ptr_conv);
42531 }
42532
42533 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
42534         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
42535         *ret_copy = Retry_clone(arg);
42536         uint64_t ret_ref = tag_ptr(ret_copy, true);
42537         return ret_ref;
42538 }
42539 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
42540         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
42541         int64_t ret_conv = Retry_clone_ptr(arg_conv);
42542         return ret_conv;
42543 }
42544
42545 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
42546         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
42547         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
42548         *ret_copy = Retry_clone(orig_conv);
42549         uint64_t ret_ref = tag_ptr(ret_copy, true);
42550         return ret_ref;
42551 }
42552
42553 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
42554         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
42555         *ret_copy = Retry_attempts(a);
42556         uint64_t ret_ref = tag_ptr(ret_copy, true);
42557         return ret_ref;
42558 }
42559
42560 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
42561         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
42562         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
42563         jboolean ret_conv = Retry_eq(a_conv, b_conv);
42564         return ret_conv;
42565 }
42566
42567 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
42568         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
42569         int64_t ret_conv = Retry_hash(o_conv);
42570         return ret_conv;
42571 }
42572
42573 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_clone"))) TS_RetryableSendFailure_clone(uint64_t orig) {
42574         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
42575         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_clone(orig_conv));
42576         return ret_conv;
42577 }
42578
42579 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_payment_expired"))) TS_RetryableSendFailure_payment_expired() {
42580         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_payment_expired());
42581         return ret_conv;
42582 }
42583
42584 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_route_not_found"))) TS_RetryableSendFailure_route_not_found() {
42585         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_route_not_found());
42586         return ret_conv;
42587 }
42588
42589 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_duplicate_payment"))) TS_RetryableSendFailure_duplicate_payment() {
42590         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_duplicate_payment());
42591         return ret_conv;
42592 }
42593
42594 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
42595         if (!ptr_is_owned(this_ptr)) return;
42596         void* this_ptr_ptr = untag_ptr(this_ptr);
42597         CHECK_ACCESS(this_ptr_ptr);
42598         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
42599         FREE(untag_ptr(this_ptr));
42600         PaymentSendFailure_free(this_ptr_conv);
42601 }
42602
42603 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
42604         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42605         *ret_copy = PaymentSendFailure_clone(arg);
42606         uint64_t ret_ref = tag_ptr(ret_copy, true);
42607         return ret_ref;
42608 }
42609 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
42610         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
42611         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
42612         return ret_conv;
42613 }
42614
42615 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
42616         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
42617         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42618         *ret_copy = PaymentSendFailure_clone(orig_conv);
42619         uint64_t ret_ref = tag_ptr(ret_copy, true);
42620         return ret_ref;
42621 }
42622
42623 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
42624         void* a_ptr = untag_ptr(a);
42625         CHECK_ACCESS(a_ptr);
42626         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
42627         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
42628         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42629         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
42630         uint64_t ret_ref = tag_ptr(ret_copy, true);
42631         return ret_ref;
42632 }
42633
42634 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
42635         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
42636         a_constr.datalen = a->arr_len;
42637         if (a_constr.datalen > 0)
42638                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
42639         else
42640                 a_constr.data = NULL;
42641         uint64_t* a_vals = a->elems;
42642         for (size_t w = 0; w < a_constr.datalen; w++) {
42643                 uint64_t a_conv_22 = a_vals[w];
42644                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
42645                 CHECK_ACCESS(a_conv_22_ptr);
42646                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
42647                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
42648                 a_constr.data[w] = a_conv_22_conv;
42649         }
42650         FREE(a);
42651         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42652         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
42653         uint64_t ret_ref = tag_ptr(ret_copy, true);
42654         return ret_ref;
42655 }
42656
42657 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
42658         LDKCVec_APIErrorZ a_constr;
42659         a_constr.datalen = a->arr_len;
42660         if (a_constr.datalen > 0)
42661                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
42662         else
42663                 a_constr.data = NULL;
42664         uint64_t* a_vals = a->elems;
42665         for (size_t k = 0; k < a_constr.datalen; k++) {
42666                 uint64_t a_conv_10 = a_vals[k];
42667                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
42668                 CHECK_ACCESS(a_conv_10_ptr);
42669                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
42670                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
42671                 a_constr.data[k] = a_conv_10_conv;
42672         }
42673         FREE(a);
42674         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42675         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
42676         uint64_t ret_ref = tag_ptr(ret_copy, true);
42677         return ret_ref;
42678 }
42679
42680 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
42681         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42682         *ret_copy = PaymentSendFailure_duplicate_payment();
42683         uint64_t ret_ref = tag_ptr(ret_copy, true);
42684         return ret_ref;
42685 }
42686
42687 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) {
42688         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
42689         results_constr.datalen = results->arr_len;
42690         if (results_constr.datalen > 0)
42691                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
42692         else
42693                 results_constr.data = NULL;
42694         uint64_t* results_vals = results->elems;
42695         for (size_t w = 0; w < results_constr.datalen; w++) {
42696                 uint64_t results_conv_22 = results_vals[w];
42697                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
42698                 CHECK_ACCESS(results_conv_22_ptr);
42699                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
42700                 results_constr.data[w] = results_conv_22_conv;
42701         }
42702         FREE(results);
42703         LDKRouteParameters failed_paths_retry_conv;
42704         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
42705         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
42706         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
42707         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
42708         LDKThirtyTwoBytes payment_id_ref;
42709         CHECK(payment_id->arr_len == 32);
42710         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42711         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42712         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
42713         uint64_t ret_ref = tag_ptr(ret_copy, true);
42714         return ret_ref;
42715 }
42716
42717 void  __attribute__((export_name("TS_RecipientOnionFields_free"))) TS_RecipientOnionFields_free(uint64_t this_obj) {
42718         LDKRecipientOnionFields this_obj_conv;
42719         this_obj_conv.inner = untag_ptr(this_obj);
42720         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42722         RecipientOnionFields_free(this_obj_conv);
42723 }
42724
42725 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_get_payment_secret"))) TS_RecipientOnionFields_get_payment_secret(uint64_t this_ptr) {
42726         LDKRecipientOnionFields this_ptr_conv;
42727         this_ptr_conv.inner = untag_ptr(this_ptr);
42728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42730         this_ptr_conv.is_owned = false;
42731         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42732         memcpy(ret_arr->elems, RecipientOnionFields_get_payment_secret(&this_ptr_conv).data, 32);
42733         return ret_arr;
42734 }
42735
42736 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_secret"))) TS_RecipientOnionFields_set_payment_secret(uint64_t this_ptr, int8_tArray val) {
42737         LDKRecipientOnionFields this_ptr_conv;
42738         this_ptr_conv.inner = untag_ptr(this_ptr);
42739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42741         this_ptr_conv.is_owned = false;
42742         LDKThirtyTwoBytes val_ref;
42743         CHECK(val->arr_len == 32);
42744         memcpy(val_ref.data, val->elems, 32); FREE(val);
42745         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_ref);
42746 }
42747
42748 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_metadata"))) TS_RecipientOnionFields_get_payment_metadata(uint64_t this_ptr) {
42749         LDKRecipientOnionFields this_ptr_conv;
42750         this_ptr_conv.inner = untag_ptr(this_ptr);
42751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42753         this_ptr_conv.is_owned = false;
42754         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
42755         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
42756         uint64_t ret_ref = tag_ptr(ret_copy, true);
42757         return ret_ref;
42758 }
42759
42760 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_metadata"))) TS_RecipientOnionFields_set_payment_metadata(uint64_t this_ptr, uint64_t val) {
42761         LDKRecipientOnionFields this_ptr_conv;
42762         this_ptr_conv.inner = untag_ptr(this_ptr);
42763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42765         this_ptr_conv.is_owned = false;
42766         void* val_ptr = untag_ptr(val);
42767         CHECK_ACCESS(val_ptr);
42768         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
42769         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
42770         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
42771 }
42772
42773 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_new"))) TS_RecipientOnionFields_new(int8_tArray payment_secret_arg, uint64_t payment_metadata_arg) {
42774         LDKThirtyTwoBytes payment_secret_arg_ref;
42775         CHECK(payment_secret_arg->arr_len == 32);
42776         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
42777         void* payment_metadata_arg_ptr = untag_ptr(payment_metadata_arg);
42778         CHECK_ACCESS(payment_metadata_arg_ptr);
42779         LDKCOption_CVec_u8ZZ payment_metadata_arg_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_arg_ptr);
42780         payment_metadata_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata_arg));
42781         LDKRecipientOnionFields ret_var = RecipientOnionFields_new(payment_secret_arg_ref, payment_metadata_arg_conv);
42782         uint64_t ret_ref = 0;
42783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42785         return ret_ref;
42786 }
42787
42788 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
42789         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
42790         uint64_t ret_ref = 0;
42791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42793         return ret_ref;
42794 }
42795 int64_t  __attribute__((export_name("TS_RecipientOnionFields_clone_ptr"))) TS_RecipientOnionFields_clone_ptr(uint64_t arg) {
42796         LDKRecipientOnionFields arg_conv;
42797         arg_conv.inner = untag_ptr(arg);
42798         arg_conv.is_owned = ptr_is_owned(arg);
42799         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42800         arg_conv.is_owned = false;
42801         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
42802         return ret_conv;
42803 }
42804
42805 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_clone"))) TS_RecipientOnionFields_clone(uint64_t orig) {
42806         LDKRecipientOnionFields orig_conv;
42807         orig_conv.inner = untag_ptr(orig);
42808         orig_conv.is_owned = ptr_is_owned(orig);
42809         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42810         orig_conv.is_owned = false;
42811         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
42812         uint64_t ret_ref = 0;
42813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42815         return ret_ref;
42816 }
42817
42818 jboolean  __attribute__((export_name("TS_RecipientOnionFields_eq"))) TS_RecipientOnionFields_eq(uint64_t a, uint64_t b) {
42819         LDKRecipientOnionFields a_conv;
42820         a_conv.inner = untag_ptr(a);
42821         a_conv.is_owned = ptr_is_owned(a);
42822         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42823         a_conv.is_owned = false;
42824         LDKRecipientOnionFields b_conv;
42825         b_conv.inner = untag_ptr(b);
42826         b_conv.is_owned = ptr_is_owned(b);
42827         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42828         b_conv.is_owned = false;
42829         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
42830         return ret_conv;
42831 }
42832
42833 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_write"))) TS_RecipientOnionFields_write(uint64_t obj) {
42834         LDKRecipientOnionFields obj_conv;
42835         obj_conv.inner = untag_ptr(obj);
42836         obj_conv.is_owned = ptr_is_owned(obj);
42837         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42838         obj_conv.is_owned = false;
42839         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
42840         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42841         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42842         CVec_u8Z_free(ret_var);
42843         return ret_arr;
42844 }
42845
42846 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_read"))) TS_RecipientOnionFields_read(int8_tArray ser) {
42847         LDKu8slice ser_ref;
42848         ser_ref.datalen = ser->arr_len;
42849         ser_ref.data = ser->elems;
42850         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
42851         *ret_conv = RecipientOnionFields_read(ser_ref);
42852         FREE(ser);
42853         return tag_ptr(ret_conv, true);
42854 }
42855
42856 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_secret_only"))) TS_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
42857         LDKThirtyTwoBytes payment_secret_ref;
42858         CHECK(payment_secret->arr_len == 32);
42859         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
42860         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
42861         uint64_t ret_ref = 0;
42862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42864         return ret_ref;
42865 }
42866
42867 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_spontaneous_empty"))) TS_RecipientOnionFields_spontaneous_empty() {
42868         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
42869         uint64_t ret_ref = 0;
42870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42872         return ret_ref;
42873 }
42874
42875 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
42876         if (!ptr_is_owned(this_ptr)) return;
42877         void* this_ptr_ptr = untag_ptr(this_ptr);
42878         CHECK_ACCESS(this_ptr_ptr);
42879         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
42880         FREE(untag_ptr(this_ptr));
42881         CustomMessageReader_free(this_ptr_conv);
42882 }
42883
42884 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
42885         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
42886         *ret_ret = Type_clone(arg);
42887         return tag_ptr(ret_ret, true);
42888 }
42889 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
42890         void* arg_ptr = untag_ptr(arg);
42891         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
42892         LDKType* arg_conv = (LDKType*)arg_ptr;
42893         int64_t ret_conv = Type_clone_ptr(arg_conv);
42894         return ret_conv;
42895 }
42896
42897 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
42898         void* orig_ptr = untag_ptr(orig);
42899         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
42900         LDKType* orig_conv = (LDKType*)orig_ptr;
42901         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
42902         *ret_ret = Type_clone(orig_conv);
42903         return tag_ptr(ret_ret, true);
42904 }
42905
42906 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
42907         if (!ptr_is_owned(this_ptr)) return;
42908         void* this_ptr_ptr = untag_ptr(this_ptr);
42909         CHECK_ACCESS(this_ptr_ptr);
42910         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
42911         FREE(untag_ptr(this_ptr));
42912         Type_free(this_ptr_conv);
42913 }
42914
42915 void  __attribute__((export_name("TS_UnsignedInvoice_free"))) TS_UnsignedInvoice_free(uint64_t this_obj) {
42916         LDKUnsignedInvoice this_obj_conv;
42917         this_obj_conv.inner = untag_ptr(this_obj);
42918         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42920         UnsignedInvoice_free(this_obj_conv);
42921 }
42922
42923 int8_tArray  __attribute__((export_name("TS_UnsignedInvoice_signing_pubkey"))) TS_UnsignedInvoice_signing_pubkey(uint64_t this_arg) {
42924         LDKUnsignedInvoice this_arg_conv;
42925         this_arg_conv.inner = untag_ptr(this_arg);
42926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42928         this_arg_conv.is_owned = false;
42929         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42930         memcpy(ret_arr->elems, UnsignedInvoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
42931         return ret_arr;
42932 }
42933
42934 void  __attribute__((export_name("TS_BlindedPayInfo_free"))) TS_BlindedPayInfo_free(uint64_t this_obj) {
42935         LDKBlindedPayInfo this_obj_conv;
42936         this_obj_conv.inner = untag_ptr(this_obj);
42937         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42939         BlindedPayInfo_free(this_obj_conv);
42940 }
42941
42942 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_base_msat"))) TS_BlindedPayInfo_get_fee_base_msat(uint64_t this_ptr) {
42943         LDKBlindedPayInfo this_ptr_conv;
42944         this_ptr_conv.inner = untag_ptr(this_ptr);
42945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42947         this_ptr_conv.is_owned = false;
42948         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
42949         return ret_conv;
42950 }
42951
42952 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_base_msat"))) TS_BlindedPayInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
42953         LDKBlindedPayInfo this_ptr_conv;
42954         this_ptr_conv.inner = untag_ptr(this_ptr);
42955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42957         this_ptr_conv.is_owned = false;
42958         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
42959 }
42960
42961 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_proportional_millionths"))) TS_BlindedPayInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
42962         LDKBlindedPayInfo this_ptr_conv;
42963         this_ptr_conv.inner = untag_ptr(this_ptr);
42964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42966         this_ptr_conv.is_owned = false;
42967         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
42968         return ret_conv;
42969 }
42970
42971 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_proportional_millionths"))) TS_BlindedPayInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
42972         LDKBlindedPayInfo this_ptr_conv;
42973         this_ptr_conv.inner = untag_ptr(this_ptr);
42974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42976         this_ptr_conv.is_owned = false;
42977         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
42978 }
42979
42980 int16_t  __attribute__((export_name("TS_BlindedPayInfo_get_cltv_expiry_delta"))) TS_BlindedPayInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
42981         LDKBlindedPayInfo this_ptr_conv;
42982         this_ptr_conv.inner = untag_ptr(this_ptr);
42983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42985         this_ptr_conv.is_owned = false;
42986         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
42987         return ret_conv;
42988 }
42989
42990 void  __attribute__((export_name("TS_BlindedPayInfo_set_cltv_expiry_delta"))) TS_BlindedPayInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
42991         LDKBlindedPayInfo this_ptr_conv;
42992         this_ptr_conv.inner = untag_ptr(this_ptr);
42993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42995         this_ptr_conv.is_owned = false;
42996         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
42997 }
42998
42999 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_minimum_msat"))) TS_BlindedPayInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
43000         LDKBlindedPayInfo this_ptr_conv;
43001         this_ptr_conv.inner = untag_ptr(this_ptr);
43002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43004         this_ptr_conv.is_owned = false;
43005         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
43006         return ret_conv;
43007 }
43008
43009 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_minimum_msat"))) TS_BlindedPayInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
43010         LDKBlindedPayInfo this_ptr_conv;
43011         this_ptr_conv.inner = untag_ptr(this_ptr);
43012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43014         this_ptr_conv.is_owned = false;
43015         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
43016 }
43017
43018 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_maximum_msat"))) TS_BlindedPayInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
43019         LDKBlindedPayInfo this_ptr_conv;
43020         this_ptr_conv.inner = untag_ptr(this_ptr);
43021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43023         this_ptr_conv.is_owned = false;
43024         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
43025         return ret_conv;
43026 }
43027
43028 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_maximum_msat"))) TS_BlindedPayInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
43029         LDKBlindedPayInfo this_ptr_conv;
43030         this_ptr_conv.inner = untag_ptr(this_ptr);
43031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43033         this_ptr_conv.is_owned = false;
43034         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
43035 }
43036
43037 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_get_features"))) TS_BlindedPayInfo_get_features(uint64_t this_ptr) {
43038         LDKBlindedPayInfo this_ptr_conv;
43039         this_ptr_conv.inner = untag_ptr(this_ptr);
43040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43042         this_ptr_conv.is_owned = false;
43043         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
43044         uint64_t ret_ref = 0;
43045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43047         return ret_ref;
43048 }
43049
43050 void  __attribute__((export_name("TS_BlindedPayInfo_set_features"))) TS_BlindedPayInfo_set_features(uint64_t this_ptr, uint64_t val) {
43051         LDKBlindedPayInfo this_ptr_conv;
43052         this_ptr_conv.inner = untag_ptr(this_ptr);
43053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43055         this_ptr_conv.is_owned = false;
43056         LDKBlindedHopFeatures val_conv;
43057         val_conv.inner = untag_ptr(val);
43058         val_conv.is_owned = ptr_is_owned(val);
43059         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43060         val_conv = BlindedHopFeatures_clone(&val_conv);
43061         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
43062 }
43063
43064 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_new"))) TS_BlindedPayInfo_new(int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, uint64_t features_arg) {
43065         LDKBlindedHopFeatures features_arg_conv;
43066         features_arg_conv.inner = untag_ptr(features_arg);
43067         features_arg_conv.is_owned = ptr_is_owned(features_arg);
43068         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
43069         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
43070         LDKBlindedPayInfo ret_var = BlindedPayInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, features_arg_conv);
43071         uint64_t ret_ref = 0;
43072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43074         return ret_ref;
43075 }
43076
43077 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
43078         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
43079         uint64_t ret_ref = 0;
43080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43082         return ret_ref;
43083 }
43084 int64_t  __attribute__((export_name("TS_BlindedPayInfo_clone_ptr"))) TS_BlindedPayInfo_clone_ptr(uint64_t arg) {
43085         LDKBlindedPayInfo arg_conv;
43086         arg_conv.inner = untag_ptr(arg);
43087         arg_conv.is_owned = ptr_is_owned(arg);
43088         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43089         arg_conv.is_owned = false;
43090         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
43091         return ret_conv;
43092 }
43093
43094 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_clone"))) TS_BlindedPayInfo_clone(uint64_t orig) {
43095         LDKBlindedPayInfo orig_conv;
43096         orig_conv.inner = untag_ptr(orig);
43097         orig_conv.is_owned = ptr_is_owned(orig);
43098         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43099         orig_conv.is_owned = false;
43100         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
43101         uint64_t ret_ref = 0;
43102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43104         return ret_ref;
43105 }
43106
43107 int64_t  __attribute__((export_name("TS_BlindedPayInfo_hash"))) TS_BlindedPayInfo_hash(uint64_t o) {
43108         LDKBlindedPayInfo o_conv;
43109         o_conv.inner = untag_ptr(o);
43110         o_conv.is_owned = ptr_is_owned(o);
43111         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43112         o_conv.is_owned = false;
43113         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
43114         return ret_conv;
43115 }
43116
43117 jboolean  __attribute__((export_name("TS_BlindedPayInfo_eq"))) TS_BlindedPayInfo_eq(uint64_t a, uint64_t b) {
43118         LDKBlindedPayInfo a_conv;
43119         a_conv.inner = untag_ptr(a);
43120         a_conv.is_owned = ptr_is_owned(a);
43121         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43122         a_conv.is_owned = false;
43123         LDKBlindedPayInfo b_conv;
43124         b_conv.inner = untag_ptr(b);
43125         b_conv.is_owned = ptr_is_owned(b);
43126         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43127         b_conv.is_owned = false;
43128         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
43129         return ret_conv;
43130 }
43131
43132 int8_tArray  __attribute__((export_name("TS_BlindedPayInfo_write"))) TS_BlindedPayInfo_write(uint64_t obj) {
43133         LDKBlindedPayInfo obj_conv;
43134         obj_conv.inner = untag_ptr(obj);
43135         obj_conv.is_owned = ptr_is_owned(obj);
43136         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43137         obj_conv.is_owned = false;
43138         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
43139         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43140         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43141         CVec_u8Z_free(ret_var);
43142         return ret_arr;
43143 }
43144
43145 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_read"))) TS_BlindedPayInfo_read(int8_tArray ser) {
43146         LDKu8slice ser_ref;
43147         ser_ref.datalen = ser->arr_len;
43148         ser_ref.data = ser->elems;
43149         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
43150         *ret_conv = BlindedPayInfo_read(ser_ref);
43151         FREE(ser);
43152         return tag_ptr(ret_conv, true);
43153 }
43154
43155 void  __attribute__((export_name("TS_UnsignedInvoiceRequest_free"))) TS_UnsignedInvoiceRequest_free(uint64_t this_obj) {
43156         LDKUnsignedInvoiceRequest this_obj_conv;
43157         this_obj_conv.inner = untag_ptr(this_obj);
43158         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43160         UnsignedInvoiceRequest_free(this_obj_conv);
43161 }
43162
43163 void  __attribute__((export_name("TS_InvoiceRequest_free"))) TS_InvoiceRequest_free(uint64_t this_obj) {
43164         LDKInvoiceRequest this_obj_conv;
43165         this_obj_conv.inner = untag_ptr(this_obj);
43166         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43168         InvoiceRequest_free(this_obj_conv);
43169 }
43170
43171 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
43172         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
43173         uint64_t ret_ref = 0;
43174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43176         return ret_ref;
43177 }
43178 int64_t  __attribute__((export_name("TS_InvoiceRequest_clone_ptr"))) TS_InvoiceRequest_clone_ptr(uint64_t arg) {
43179         LDKInvoiceRequest arg_conv;
43180         arg_conv.inner = untag_ptr(arg);
43181         arg_conv.is_owned = ptr_is_owned(arg);
43182         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43183         arg_conv.is_owned = false;
43184         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
43185         return ret_conv;
43186 }
43187
43188 uint64_t  __attribute__((export_name("TS_InvoiceRequest_clone"))) TS_InvoiceRequest_clone(uint64_t orig) {
43189         LDKInvoiceRequest orig_conv;
43190         orig_conv.inner = untag_ptr(orig);
43191         orig_conv.is_owned = ptr_is_owned(orig);
43192         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43193         orig_conv.is_owned = false;
43194         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
43195         uint64_t ret_ref = 0;
43196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43198         return ret_ref;
43199 }
43200
43201 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_metadata"))) TS_InvoiceRequest_metadata(uint64_t this_arg) {
43202         LDKInvoiceRequest this_arg_conv;
43203         this_arg_conv.inner = untag_ptr(this_arg);
43204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43206         this_arg_conv.is_owned = false;
43207         LDKu8slice ret_var = InvoiceRequest_metadata(&this_arg_conv);
43208         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43209         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43210         return ret_arr;
43211 }
43212
43213 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_chain"))) TS_InvoiceRequest_chain(uint64_t this_arg) {
43214         LDKInvoiceRequest this_arg_conv;
43215         this_arg_conv.inner = untag_ptr(this_arg);
43216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43218         this_arg_conv.is_owned = false;
43219         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43220         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
43221         return ret_arr;
43222 }
43223
43224 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount_msats"))) TS_InvoiceRequest_amount_msats(uint64_t this_arg) {
43225         LDKInvoiceRequest this_arg_conv;
43226         this_arg_conv.inner = untag_ptr(this_arg);
43227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43229         this_arg_conv.is_owned = false;
43230         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43231         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
43232         uint64_t ret_ref = tag_ptr(ret_copy, true);
43233         return ret_ref;
43234 }
43235
43236 uint64_t  __attribute__((export_name("TS_InvoiceRequest_features"))) TS_InvoiceRequest_features(uint64_t this_arg) {
43237         LDKInvoiceRequest this_arg_conv;
43238         this_arg_conv.inner = untag_ptr(this_arg);
43239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43241         this_arg_conv.is_owned = false;
43242         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_features(&this_arg_conv);
43243         uint64_t ret_ref = 0;
43244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43246         return ret_ref;
43247 }
43248
43249 uint64_t  __attribute__((export_name("TS_InvoiceRequest_quantity"))) TS_InvoiceRequest_quantity(uint64_t this_arg) {
43250         LDKInvoiceRequest this_arg_conv;
43251         this_arg_conv.inner = untag_ptr(this_arg);
43252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43254         this_arg_conv.is_owned = false;
43255         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43256         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
43257         uint64_t ret_ref = tag_ptr(ret_copy, true);
43258         return ret_ref;
43259 }
43260
43261 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_id"))) TS_InvoiceRequest_payer_id(uint64_t this_arg) {
43262         LDKInvoiceRequest this_arg_conv;
43263         this_arg_conv.inner = untag_ptr(this_arg);
43264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43266         this_arg_conv.is_owned = false;
43267         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43268         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
43269         return ret_arr;
43270 }
43271
43272 uint64_t  __attribute__((export_name("TS_InvoiceRequest_payer_note"))) TS_InvoiceRequest_payer_note(uint64_t this_arg) {
43273         LDKInvoiceRequest this_arg_conv;
43274         this_arg_conv.inner = untag_ptr(this_arg);
43275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43277         this_arg_conv.is_owned = false;
43278         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
43279         uint64_t ret_ref = 0;
43280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43282         return ret_ref;
43283 }
43284
43285 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_write"))) TS_InvoiceRequest_write(uint64_t obj) {
43286         LDKInvoiceRequest obj_conv;
43287         obj_conv.inner = untag_ptr(obj);
43288         obj_conv.is_owned = ptr_is_owned(obj);
43289         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43290         obj_conv.is_owned = false;
43291         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
43292         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43293         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43294         CVec_u8Z_free(ret_var);
43295         return ret_arr;
43296 }
43297
43298 void  __attribute__((export_name("TS_Offer_free"))) TS_Offer_free(uint64_t this_obj) {
43299         LDKOffer this_obj_conv;
43300         this_obj_conv.inner = untag_ptr(this_obj);
43301         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43303         Offer_free(this_obj_conv);
43304 }
43305
43306 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
43307         LDKOffer ret_var = Offer_clone(arg);
43308         uint64_t ret_ref = 0;
43309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43311         return ret_ref;
43312 }
43313 int64_t  __attribute__((export_name("TS_Offer_clone_ptr"))) TS_Offer_clone_ptr(uint64_t arg) {
43314         LDKOffer arg_conv;
43315         arg_conv.inner = untag_ptr(arg);
43316         arg_conv.is_owned = ptr_is_owned(arg);
43317         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43318         arg_conv.is_owned = false;
43319         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
43320         return ret_conv;
43321 }
43322
43323 uint64_t  __attribute__((export_name("TS_Offer_clone"))) TS_Offer_clone(uint64_t orig) {
43324         LDKOffer orig_conv;
43325         orig_conv.inner = untag_ptr(orig);
43326         orig_conv.is_owned = ptr_is_owned(orig);
43327         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43328         orig_conv.is_owned = false;
43329         LDKOffer ret_var = Offer_clone(&orig_conv);
43330         uint64_t ret_ref = 0;
43331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43333         return ret_ref;
43334 }
43335
43336 ptrArray  __attribute__((export_name("TS_Offer_chains"))) TS_Offer_chains(uint64_t this_arg) {
43337         LDKOffer this_arg_conv;
43338         this_arg_conv.inner = untag_ptr(this_arg);
43339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43341         this_arg_conv.is_owned = false;
43342         LDKCVec_ChainHashZ ret_var = Offer_chains(&this_arg_conv);
43343         ptrArray ret_arr = NULL;
43344         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
43345         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
43346         for (size_t m = 0; m < ret_var.datalen; m++) {
43347                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
43348                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
43349                 ret_arr_ptr[m] = ret_conv_12_arr;
43350         }
43351         
43352         FREE(ret_var.data);
43353         return ret_arr;
43354 }
43355
43356 jboolean  __attribute__((export_name("TS_Offer_supports_chain"))) TS_Offer_supports_chain(uint64_t this_arg, int8_tArray chain) {
43357         LDKOffer this_arg_conv;
43358         this_arg_conv.inner = untag_ptr(this_arg);
43359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43361         this_arg_conv.is_owned = false;
43362         LDKThirtyTwoBytes chain_ref;
43363         CHECK(chain->arr_len == 32);
43364         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
43365         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
43366         return ret_conv;
43367 }
43368
43369 uint64_t  __attribute__((export_name("TS_Offer_metadata"))) TS_Offer_metadata(uint64_t this_arg) {
43370         LDKOffer this_arg_conv;
43371         this_arg_conv.inner = untag_ptr(this_arg);
43372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43374         this_arg_conv.is_owned = false;
43375         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
43376         *ret_copy = Offer_metadata(&this_arg_conv);
43377         uint64_t ret_ref = tag_ptr(ret_copy, true);
43378         return ret_ref;
43379 }
43380
43381 uint64_t  __attribute__((export_name("TS_Offer_amount"))) TS_Offer_amount(uint64_t this_arg) {
43382         LDKOffer this_arg_conv;
43383         this_arg_conv.inner = untag_ptr(this_arg);
43384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43386         this_arg_conv.is_owned = false;
43387         LDKAmount ret_var = Offer_amount(&this_arg_conv);
43388         uint64_t ret_ref = 0;
43389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43391         return ret_ref;
43392 }
43393
43394 uint64_t  __attribute__((export_name("TS_Offer_description"))) TS_Offer_description(uint64_t this_arg) {
43395         LDKOffer this_arg_conv;
43396         this_arg_conv.inner = untag_ptr(this_arg);
43397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43399         this_arg_conv.is_owned = false;
43400         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
43401         uint64_t ret_ref = 0;
43402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43404         return ret_ref;
43405 }
43406
43407 uint64_t  __attribute__((export_name("TS_Offer_features"))) TS_Offer_features(uint64_t this_arg) {
43408         LDKOffer this_arg_conv;
43409         this_arg_conv.inner = untag_ptr(this_arg);
43410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43412         this_arg_conv.is_owned = false;
43413         LDKOfferFeatures ret_var = Offer_features(&this_arg_conv);
43414         uint64_t ret_ref = 0;
43415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43417         return ret_ref;
43418 }
43419
43420 uint64_t  __attribute__((export_name("TS_Offer_absolute_expiry"))) TS_Offer_absolute_expiry(uint64_t this_arg) {
43421         LDKOffer this_arg_conv;
43422         this_arg_conv.inner = untag_ptr(this_arg);
43423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43425         this_arg_conv.is_owned = false;
43426         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
43427         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
43428         uint64_t ret_ref = tag_ptr(ret_copy, true);
43429         return ret_ref;
43430 }
43431
43432 uint64_t  __attribute__((export_name("TS_Offer_issuer"))) TS_Offer_issuer(uint64_t this_arg) {
43433         LDKOffer this_arg_conv;
43434         this_arg_conv.inner = untag_ptr(this_arg);
43435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43437         this_arg_conv.is_owned = false;
43438         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
43439         uint64_t ret_ref = 0;
43440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43442         return ret_ref;
43443 }
43444
43445 uint64_tArray  __attribute__((export_name("TS_Offer_paths"))) TS_Offer_paths(uint64_t this_arg) {
43446         LDKOffer this_arg_conv;
43447         this_arg_conv.inner = untag_ptr(this_arg);
43448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43450         this_arg_conv.is_owned = false;
43451         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
43452         uint64_tArray ret_arr = NULL;
43453         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43454         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43455         for (size_t n = 0; n < ret_var.datalen; n++) {
43456                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
43457                 uint64_t ret_conv_13_ref = 0;
43458                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
43459                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
43460                 ret_arr_ptr[n] = ret_conv_13_ref;
43461         }
43462         
43463         FREE(ret_var.data);
43464         return ret_arr;
43465 }
43466
43467 uint64_t  __attribute__((export_name("TS_Offer_supported_quantity"))) TS_Offer_supported_quantity(uint64_t this_arg) {
43468         LDKOffer this_arg_conv;
43469         this_arg_conv.inner = untag_ptr(this_arg);
43470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43472         this_arg_conv.is_owned = false;
43473         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
43474         uint64_t ret_ref = 0;
43475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43477         return ret_ref;
43478 }
43479
43480 jboolean  __attribute__((export_name("TS_Offer_is_valid_quantity"))) TS_Offer_is_valid_quantity(uint64_t this_arg, int64_t quantity) {
43481         LDKOffer this_arg_conv;
43482         this_arg_conv.inner = untag_ptr(this_arg);
43483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43485         this_arg_conv.is_owned = false;
43486         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
43487         return ret_conv;
43488 }
43489
43490 jboolean  __attribute__((export_name("TS_Offer_expects_quantity"))) TS_Offer_expects_quantity(uint64_t this_arg) {
43491         LDKOffer this_arg_conv;
43492         this_arg_conv.inner = untag_ptr(this_arg);
43493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43495         this_arg_conv.is_owned = false;
43496         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
43497         return ret_conv;
43498 }
43499
43500 int8_tArray  __attribute__((export_name("TS_Offer_signing_pubkey"))) TS_Offer_signing_pubkey(uint64_t this_arg) {
43501         LDKOffer this_arg_conv;
43502         this_arg_conv.inner = untag_ptr(this_arg);
43503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43505         this_arg_conv.is_owned = false;
43506         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43507         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
43508         return ret_arr;
43509 }
43510
43511 int8_tArray  __attribute__((export_name("TS_Offer_write"))) TS_Offer_write(uint64_t obj) {
43512         LDKOffer obj_conv;
43513         obj_conv.inner = untag_ptr(obj);
43514         obj_conv.is_owned = ptr_is_owned(obj);
43515         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43516         obj_conv.is_owned = false;
43517         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
43518         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43519         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43520         CVec_u8Z_free(ret_var);
43521         return ret_arr;
43522 }
43523
43524 void  __attribute__((export_name("TS_Amount_free"))) TS_Amount_free(uint64_t this_obj) {
43525         LDKAmount this_obj_conv;
43526         this_obj_conv.inner = untag_ptr(this_obj);
43527         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43529         Amount_free(this_obj_conv);
43530 }
43531
43532 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
43533         LDKAmount ret_var = Amount_clone(arg);
43534         uint64_t ret_ref = 0;
43535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43537         return ret_ref;
43538 }
43539 int64_t  __attribute__((export_name("TS_Amount_clone_ptr"))) TS_Amount_clone_ptr(uint64_t arg) {
43540         LDKAmount arg_conv;
43541         arg_conv.inner = untag_ptr(arg);
43542         arg_conv.is_owned = ptr_is_owned(arg);
43543         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43544         arg_conv.is_owned = false;
43545         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
43546         return ret_conv;
43547 }
43548
43549 uint64_t  __attribute__((export_name("TS_Amount_clone"))) TS_Amount_clone(uint64_t orig) {
43550         LDKAmount orig_conv;
43551         orig_conv.inner = untag_ptr(orig);
43552         orig_conv.is_owned = ptr_is_owned(orig);
43553         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43554         orig_conv.is_owned = false;
43555         LDKAmount ret_var = Amount_clone(&orig_conv);
43556         uint64_t ret_ref = 0;
43557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43559         return ret_ref;
43560 }
43561
43562 void  __attribute__((export_name("TS_Quantity_free"))) TS_Quantity_free(uint64_t this_obj) {
43563         LDKQuantity this_obj_conv;
43564         this_obj_conv.inner = untag_ptr(this_obj);
43565         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43567         Quantity_free(this_obj_conv);
43568 }
43569
43570 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
43571         LDKQuantity ret_var = Quantity_clone(arg);
43572         uint64_t ret_ref = 0;
43573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43575         return ret_ref;
43576 }
43577 int64_t  __attribute__((export_name("TS_Quantity_clone_ptr"))) TS_Quantity_clone_ptr(uint64_t arg) {
43578         LDKQuantity arg_conv;
43579         arg_conv.inner = untag_ptr(arg);
43580         arg_conv.is_owned = ptr_is_owned(arg);
43581         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43582         arg_conv.is_owned = false;
43583         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
43584         return ret_conv;
43585 }
43586
43587 uint64_t  __attribute__((export_name("TS_Quantity_clone"))) TS_Quantity_clone(uint64_t orig) {
43588         LDKQuantity orig_conv;
43589         orig_conv.inner = untag_ptr(orig);
43590         orig_conv.is_owned = ptr_is_owned(orig);
43591         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43592         orig_conv.is_owned = false;
43593         LDKQuantity ret_var = Quantity_clone(&orig_conv);
43594         uint64_t ret_ref = 0;
43595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43597         return ret_ref;
43598 }
43599
43600 void  __attribute__((export_name("TS_Refund_free"))) TS_Refund_free(uint64_t this_obj) {
43601         LDKRefund this_obj_conv;
43602         this_obj_conv.inner = untag_ptr(this_obj);
43603         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43605         Refund_free(this_obj_conv);
43606 }
43607
43608 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
43609         LDKRefund ret_var = Refund_clone(arg);
43610         uint64_t ret_ref = 0;
43611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43613         return ret_ref;
43614 }
43615 int64_t  __attribute__((export_name("TS_Refund_clone_ptr"))) TS_Refund_clone_ptr(uint64_t arg) {
43616         LDKRefund arg_conv;
43617         arg_conv.inner = untag_ptr(arg);
43618         arg_conv.is_owned = ptr_is_owned(arg);
43619         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43620         arg_conv.is_owned = false;
43621         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
43622         return ret_conv;
43623 }
43624
43625 uint64_t  __attribute__((export_name("TS_Refund_clone"))) TS_Refund_clone(uint64_t orig) {
43626         LDKRefund orig_conv;
43627         orig_conv.inner = untag_ptr(orig);
43628         orig_conv.is_owned = ptr_is_owned(orig);
43629         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43630         orig_conv.is_owned = false;
43631         LDKRefund ret_var = Refund_clone(&orig_conv);
43632         uint64_t ret_ref = 0;
43633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43635         return ret_ref;
43636 }
43637
43638 uint64_t  __attribute__((export_name("TS_Refund_description"))) TS_Refund_description(uint64_t this_arg) {
43639         LDKRefund this_arg_conv;
43640         this_arg_conv.inner = untag_ptr(this_arg);
43641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43643         this_arg_conv.is_owned = false;
43644         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
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
43651 uint64_t  __attribute__((export_name("TS_Refund_absolute_expiry"))) TS_Refund_absolute_expiry(uint64_t this_arg) {
43652         LDKRefund this_arg_conv;
43653         this_arg_conv.inner = untag_ptr(this_arg);
43654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43656         this_arg_conv.is_owned = false;
43657         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
43658         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
43659         uint64_t ret_ref = tag_ptr(ret_copy, true);
43660         return ret_ref;
43661 }
43662
43663 uint64_t  __attribute__((export_name("TS_Refund_issuer"))) TS_Refund_issuer(uint64_t this_arg) {
43664         LDKRefund this_arg_conv;
43665         this_arg_conv.inner = untag_ptr(this_arg);
43666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43668         this_arg_conv.is_owned = false;
43669         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
43670         uint64_t ret_ref = 0;
43671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43673         return ret_ref;
43674 }
43675
43676 uint64_tArray  __attribute__((export_name("TS_Refund_paths"))) TS_Refund_paths(uint64_t this_arg) {
43677         LDKRefund this_arg_conv;
43678         this_arg_conv.inner = untag_ptr(this_arg);
43679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43681         this_arg_conv.is_owned = false;
43682         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
43683         uint64_tArray ret_arr = NULL;
43684         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43685         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43686         for (size_t n = 0; n < ret_var.datalen; n++) {
43687                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
43688                 uint64_t ret_conv_13_ref = 0;
43689                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
43690                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
43691                 ret_arr_ptr[n] = ret_conv_13_ref;
43692         }
43693         
43694         FREE(ret_var.data);
43695         return ret_arr;
43696 }
43697
43698 int8_tArray  __attribute__((export_name("TS_Refund_metadata"))) TS_Refund_metadata(uint64_t this_arg) {
43699         LDKRefund this_arg_conv;
43700         this_arg_conv.inner = untag_ptr(this_arg);
43701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43703         this_arg_conv.is_owned = false;
43704         LDKu8slice ret_var = Refund_metadata(&this_arg_conv);
43705         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43706         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43707         return ret_arr;
43708 }
43709
43710 int8_tArray  __attribute__((export_name("TS_Refund_chain"))) TS_Refund_chain(uint64_t this_arg) {
43711         LDKRefund this_arg_conv;
43712         this_arg_conv.inner = untag_ptr(this_arg);
43713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43715         this_arg_conv.is_owned = false;
43716         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43717         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
43718         return ret_arr;
43719 }
43720
43721 int64_t  __attribute__((export_name("TS_Refund_amount_msats"))) TS_Refund_amount_msats(uint64_t this_arg) {
43722         LDKRefund this_arg_conv;
43723         this_arg_conv.inner = untag_ptr(this_arg);
43724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43726         this_arg_conv.is_owned = false;
43727         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
43728         return ret_conv;
43729 }
43730
43731 uint64_t  __attribute__((export_name("TS_Refund_features"))) TS_Refund_features(uint64_t this_arg) {
43732         LDKRefund this_arg_conv;
43733         this_arg_conv.inner = untag_ptr(this_arg);
43734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43736         this_arg_conv.is_owned = false;
43737         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
43738         uint64_t ret_ref = 0;
43739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43741         return ret_ref;
43742 }
43743
43744 uint64_t  __attribute__((export_name("TS_Refund_quantity"))) TS_Refund_quantity(uint64_t this_arg) {
43745         LDKRefund this_arg_conv;
43746         this_arg_conv.inner = untag_ptr(this_arg);
43747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43749         this_arg_conv.is_owned = false;
43750         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43751         *ret_copy = Refund_quantity(&this_arg_conv);
43752         uint64_t ret_ref = tag_ptr(ret_copy, true);
43753         return ret_ref;
43754 }
43755
43756 int8_tArray  __attribute__((export_name("TS_Refund_payer_id"))) TS_Refund_payer_id(uint64_t this_arg) {
43757         LDKRefund this_arg_conv;
43758         this_arg_conv.inner = untag_ptr(this_arg);
43759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43761         this_arg_conv.is_owned = false;
43762         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43763         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
43764         return ret_arr;
43765 }
43766
43767 uint64_t  __attribute__((export_name("TS_Refund_payer_note"))) TS_Refund_payer_note(uint64_t this_arg) {
43768         LDKRefund this_arg_conv;
43769         this_arg_conv.inner = untag_ptr(this_arg);
43770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43772         this_arg_conv.is_owned = false;
43773         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
43774         uint64_t ret_ref = 0;
43775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43777         return ret_ref;
43778 }
43779
43780 int8_tArray  __attribute__((export_name("TS_Refund_write"))) TS_Refund_write(uint64_t obj) {
43781         LDKRefund obj_conv;
43782         obj_conv.inner = untag_ptr(obj);
43783         obj_conv.is_owned = ptr_is_owned(obj);
43784         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43785         obj_conv.is_owned = false;
43786         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
43787         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43788         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43789         CVec_u8Z_free(ret_var);
43790         return ret_arr;
43791 }
43792
43793 uint32_t  __attribute__((export_name("TS_UtxoLookupError_clone"))) TS_UtxoLookupError_clone(uint64_t orig) {
43794         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
43795         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_clone(orig_conv));
43796         return ret_conv;
43797 }
43798
43799 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_chain"))) TS_UtxoLookupError_unknown_chain() {
43800         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_chain());
43801         return ret_conv;
43802 }
43803
43804 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_tx"))) TS_UtxoLookupError_unknown_tx() {
43805         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_tx());
43806         return ret_conv;
43807 }
43808
43809 void  __attribute__((export_name("TS_UtxoResult_free"))) TS_UtxoResult_free(uint64_t this_ptr) {
43810         if (!ptr_is_owned(this_ptr)) return;
43811         void* this_ptr_ptr = untag_ptr(this_ptr);
43812         CHECK_ACCESS(this_ptr_ptr);
43813         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
43814         FREE(untag_ptr(this_ptr));
43815         UtxoResult_free(this_ptr_conv);
43816 }
43817
43818 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
43819         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
43820         *ret_copy = UtxoResult_clone(arg);
43821         uint64_t ret_ref = tag_ptr(ret_copy, true);
43822         return ret_ref;
43823 }
43824 int64_t  __attribute__((export_name("TS_UtxoResult_clone_ptr"))) TS_UtxoResult_clone_ptr(uint64_t arg) {
43825         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
43826         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
43827         return ret_conv;
43828 }
43829
43830 uint64_t  __attribute__((export_name("TS_UtxoResult_clone"))) TS_UtxoResult_clone(uint64_t orig) {
43831         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
43832         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
43833         *ret_copy = UtxoResult_clone(orig_conv);
43834         uint64_t ret_ref = tag_ptr(ret_copy, true);
43835         return ret_ref;
43836 }
43837
43838 uint64_t  __attribute__((export_name("TS_UtxoResult_sync"))) TS_UtxoResult_sync(uint64_t a) {
43839         void* a_ptr = untag_ptr(a);
43840         CHECK_ACCESS(a_ptr);
43841         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
43842         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
43843         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
43844         *ret_copy = UtxoResult_sync(a_conv);
43845         uint64_t ret_ref = tag_ptr(ret_copy, true);
43846         return ret_ref;
43847 }
43848
43849 uint64_t  __attribute__((export_name("TS_UtxoResult_async"))) TS_UtxoResult_async(uint64_t a) {
43850         LDKUtxoFuture a_conv;
43851         a_conv.inner = untag_ptr(a);
43852         a_conv.is_owned = ptr_is_owned(a);
43853         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43854         a_conv = UtxoFuture_clone(&a_conv);
43855         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
43856         *ret_copy = UtxoResult_async(a_conv);
43857         uint64_t ret_ref = tag_ptr(ret_copy, true);
43858         return ret_ref;
43859 }
43860
43861 void  __attribute__((export_name("TS_UtxoLookup_free"))) TS_UtxoLookup_free(uint64_t this_ptr) {
43862         if (!ptr_is_owned(this_ptr)) return;
43863         void* this_ptr_ptr = untag_ptr(this_ptr);
43864         CHECK_ACCESS(this_ptr_ptr);
43865         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
43866         FREE(untag_ptr(this_ptr));
43867         UtxoLookup_free(this_ptr_conv);
43868 }
43869
43870 void  __attribute__((export_name("TS_UtxoFuture_free"))) TS_UtxoFuture_free(uint64_t this_obj) {
43871         LDKUtxoFuture this_obj_conv;
43872         this_obj_conv.inner = untag_ptr(this_obj);
43873         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43875         UtxoFuture_free(this_obj_conv);
43876 }
43877
43878 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
43879         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
43880         uint64_t ret_ref = 0;
43881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43883         return ret_ref;
43884 }
43885 int64_t  __attribute__((export_name("TS_UtxoFuture_clone_ptr"))) TS_UtxoFuture_clone_ptr(uint64_t arg) {
43886         LDKUtxoFuture arg_conv;
43887         arg_conv.inner = untag_ptr(arg);
43888         arg_conv.is_owned = ptr_is_owned(arg);
43889         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43890         arg_conv.is_owned = false;
43891         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
43892         return ret_conv;
43893 }
43894
43895 uint64_t  __attribute__((export_name("TS_UtxoFuture_clone"))) TS_UtxoFuture_clone(uint64_t orig) {
43896         LDKUtxoFuture orig_conv;
43897         orig_conv.inner = untag_ptr(orig);
43898         orig_conv.is_owned = ptr_is_owned(orig);
43899         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43900         orig_conv.is_owned = false;
43901         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
43902         uint64_t ret_ref = 0;
43903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43905         return ret_ref;
43906 }
43907
43908 uint64_t  __attribute__((export_name("TS_UtxoFuture_new"))) TS_UtxoFuture_new() {
43909         LDKUtxoFuture ret_var = UtxoFuture_new();
43910         uint64_t ret_ref = 0;
43911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43913         return ret_ref;
43914 }
43915
43916 void  __attribute__((export_name("TS_UtxoFuture_resolve_without_forwarding"))) TS_UtxoFuture_resolve_without_forwarding(uint64_t this_arg, uint64_t graph, uint64_t result) {
43917         LDKUtxoFuture this_arg_conv;
43918         this_arg_conv.inner = untag_ptr(this_arg);
43919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43921         this_arg_conv.is_owned = false;
43922         LDKNetworkGraph graph_conv;
43923         graph_conv.inner = untag_ptr(graph);
43924         graph_conv.is_owned = ptr_is_owned(graph);
43925         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
43926         graph_conv.is_owned = false;
43927         void* result_ptr = untag_ptr(result);
43928         CHECK_ACCESS(result_ptr);
43929         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
43930         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
43931 }
43932
43933 void  __attribute__((export_name("TS_UtxoFuture_resolve"))) TS_UtxoFuture_resolve(uint64_t this_arg, uint64_t graph, uint64_t gossip, uint64_t result) {
43934         LDKUtxoFuture this_arg_conv;
43935         this_arg_conv.inner = untag_ptr(this_arg);
43936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43938         this_arg_conv.is_owned = false;
43939         LDKNetworkGraph graph_conv;
43940         graph_conv.inner = untag_ptr(graph);
43941         graph_conv.is_owned = ptr_is_owned(graph);
43942         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
43943         graph_conv.is_owned = false;
43944         LDKP2PGossipSync gossip_conv;
43945         gossip_conv.inner = untag_ptr(gossip);
43946         gossip_conv.is_owned = ptr_is_owned(gossip);
43947         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
43948         gossip_conv.is_owned = false;
43949         void* result_ptr = untag_ptr(result);
43950         CHECK_ACCESS(result_ptr);
43951         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
43952         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
43953 }
43954
43955 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
43956         LDKNodeId this_obj_conv;
43957         this_obj_conv.inner = untag_ptr(this_obj);
43958         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43960         NodeId_free(this_obj_conv);
43961 }
43962
43963 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
43964         LDKNodeId ret_var = NodeId_clone(arg);
43965         uint64_t ret_ref = 0;
43966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43968         return ret_ref;
43969 }
43970 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
43971         LDKNodeId arg_conv;
43972         arg_conv.inner = untag_ptr(arg);
43973         arg_conv.is_owned = ptr_is_owned(arg);
43974         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43975         arg_conv.is_owned = false;
43976         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
43977         return ret_conv;
43978 }
43979
43980 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
43981         LDKNodeId orig_conv;
43982         orig_conv.inner = untag_ptr(orig);
43983         orig_conv.is_owned = ptr_is_owned(orig);
43984         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43985         orig_conv.is_owned = false;
43986         LDKNodeId ret_var = NodeId_clone(&orig_conv);
43987         uint64_t ret_ref = 0;
43988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43990         return ret_ref;
43991 }
43992
43993 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
43994         LDKPublicKey pubkey_ref;
43995         CHECK(pubkey->arr_len == 33);
43996         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
43997         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
43998         uint64_t ret_ref = 0;
43999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44001         return ret_ref;
44002 }
44003
44004 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
44005         LDKNodeId this_arg_conv;
44006         this_arg_conv.inner = untag_ptr(this_arg);
44007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44009         this_arg_conv.is_owned = false;
44010         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
44011         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44012         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44013         return ret_arr;
44014 }
44015
44016 uint64_t  __attribute__((export_name("TS_NodeId_as_pubkey"))) TS_NodeId_as_pubkey(uint64_t this_arg) {
44017         LDKNodeId this_arg_conv;
44018         this_arg_conv.inner = untag_ptr(this_arg);
44019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44021         this_arg_conv.is_owned = false;
44022         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
44023         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
44024         return tag_ptr(ret_conv, true);
44025 }
44026
44027 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
44028         LDKNodeId o_conv;
44029         o_conv.inner = untag_ptr(o);
44030         o_conv.is_owned = ptr_is_owned(o);
44031         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44032         o_conv.is_owned = false;
44033         int64_t ret_conv = NodeId_hash(&o_conv);
44034         return ret_conv;
44035 }
44036
44037 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
44038         LDKNodeId obj_conv;
44039         obj_conv.inner = untag_ptr(obj);
44040         obj_conv.is_owned = ptr_is_owned(obj);
44041         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44042         obj_conv.is_owned = false;
44043         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
44044         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44045         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44046         CVec_u8Z_free(ret_var);
44047         return ret_arr;
44048 }
44049
44050 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
44051         LDKu8slice ser_ref;
44052         ser_ref.datalen = ser->arr_len;
44053         ser_ref.data = ser->elems;
44054         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
44055         *ret_conv = NodeId_read(ser_ref);
44056         FREE(ser);
44057         return tag_ptr(ret_conv, true);
44058 }
44059
44060 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
44061         LDKNetworkGraph this_obj_conv;
44062         this_obj_conv.inner = untag_ptr(this_obj);
44063         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44065         NetworkGraph_free(this_obj_conv);
44066 }
44067
44068 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
44069         LDKReadOnlyNetworkGraph this_obj_conv;
44070         this_obj_conv.inner = untag_ptr(this_obj);
44071         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44073         ReadOnlyNetworkGraph_free(this_obj_conv);
44074 }
44075
44076 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
44077         if (!ptr_is_owned(this_ptr)) return;
44078         void* this_ptr_ptr = untag_ptr(this_ptr);
44079         CHECK_ACCESS(this_ptr_ptr);
44080         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
44081         FREE(untag_ptr(this_ptr));
44082         NetworkUpdate_free(this_ptr_conv);
44083 }
44084
44085 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
44086         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44087         *ret_copy = NetworkUpdate_clone(arg);
44088         uint64_t ret_ref = tag_ptr(ret_copy, true);
44089         return ret_ref;
44090 }
44091 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
44092         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
44093         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
44094         return ret_conv;
44095 }
44096
44097 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
44098         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
44099         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44100         *ret_copy = NetworkUpdate_clone(orig_conv);
44101         uint64_t ret_ref = tag_ptr(ret_copy, true);
44102         return ret_ref;
44103 }
44104
44105 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
44106         LDKChannelUpdate msg_conv;
44107         msg_conv.inner = untag_ptr(msg);
44108         msg_conv.is_owned = ptr_is_owned(msg);
44109         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44110         msg_conv = ChannelUpdate_clone(&msg_conv);
44111         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44112         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
44113         uint64_t ret_ref = tag_ptr(ret_copy, true);
44114         return ret_ref;
44115 }
44116
44117 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
44118         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44119         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
44120         uint64_t ret_ref = tag_ptr(ret_copy, true);
44121         return ret_ref;
44122 }
44123
44124 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
44125         LDKPublicKey node_id_ref;
44126         CHECK(node_id->arr_len == 33);
44127         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
44128         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44129         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
44130         uint64_t ret_ref = tag_ptr(ret_copy, true);
44131         return ret_ref;
44132 }
44133
44134 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
44135         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
44136         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
44137         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
44138         return ret_conv;
44139 }
44140
44141 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
44142         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
44143         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
44144         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44145         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44146         CVec_u8Z_free(ret_var);
44147         return ret_arr;
44148 }
44149
44150 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
44151         LDKu8slice ser_ref;
44152         ser_ref.datalen = ser->arr_len;
44153         ser_ref.data = ser->elems;
44154         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
44155         *ret_conv = NetworkUpdate_read(ser_ref);
44156         FREE(ser);
44157         return tag_ptr(ret_conv, true);
44158 }
44159
44160 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
44161         LDKP2PGossipSync this_obj_conv;
44162         this_obj_conv.inner = untag_ptr(this_obj);
44163         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44165         P2PGossipSync_free(this_obj_conv);
44166 }
44167
44168 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t utxo_lookup, uint64_t logger) {
44169         LDKNetworkGraph network_graph_conv;
44170         network_graph_conv.inner = untag_ptr(network_graph);
44171         network_graph_conv.is_owned = ptr_is_owned(network_graph);
44172         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44173         network_graph_conv.is_owned = false;
44174         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
44175         CHECK_ACCESS(utxo_lookup_ptr);
44176         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
44177         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
44178         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
44179                 // Manually implement clone for Java trait instances
44180                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
44181                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44182                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
44183                 }
44184         }
44185         void* logger_ptr = untag_ptr(logger);
44186         CHECK_ACCESS(logger_ptr);
44187         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44188         if (logger_conv.free == LDKLogger_JCalls_free) {
44189                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44190                 LDKLogger_JCalls_cloned(&logger_conv);
44191         }
44192         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
44193         uint64_t ret_ref = 0;
44194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44196         return ret_ref;
44197 }
44198
44199 void  __attribute__((export_name("TS_P2PGossipSync_add_utxo_lookup"))) TS_P2PGossipSync_add_utxo_lookup(uint64_t this_arg, uint64_t utxo_lookup) {
44200         LDKP2PGossipSync this_arg_conv;
44201         this_arg_conv.inner = untag_ptr(this_arg);
44202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44204         this_arg_conv.is_owned = false;
44205         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
44206         CHECK_ACCESS(utxo_lookup_ptr);
44207         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
44208         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
44209         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
44210                 // Manually implement clone for Java trait instances
44211                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
44212                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44213                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
44214                 }
44215         }
44216         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
44217 }
44218
44219 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
44220         LDKNetworkGraph this_arg_conv;
44221         this_arg_conv.inner = untag_ptr(this_arg);
44222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44224         this_arg_conv.is_owned = false;
44225         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
44226         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
44227 }
44228
44229 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
44230         LDKP2PGossipSync this_arg_conv;
44231         this_arg_conv.inner = untag_ptr(this_arg);
44232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44234         this_arg_conv.is_owned = false;
44235         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
44236         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
44237         return tag_ptr(ret_ret, true);
44238 }
44239
44240 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
44241         LDKP2PGossipSync this_arg_conv;
44242         this_arg_conv.inner = untag_ptr(this_arg);
44243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44245         this_arg_conv.is_owned = false;
44246         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
44247         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
44248         return tag_ptr(ret_ret, true);
44249 }
44250
44251 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
44252         LDKChannelUpdateInfo this_obj_conv;
44253         this_obj_conv.inner = untag_ptr(this_obj);
44254         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44256         ChannelUpdateInfo_free(this_obj_conv);
44257 }
44258
44259 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
44260         LDKChannelUpdateInfo this_ptr_conv;
44261         this_ptr_conv.inner = untag_ptr(this_ptr);
44262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44264         this_ptr_conv.is_owned = false;
44265         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
44266         return ret_conv;
44267 }
44268
44269 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
44270         LDKChannelUpdateInfo this_ptr_conv;
44271         this_ptr_conv.inner = untag_ptr(this_ptr);
44272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44274         this_ptr_conv.is_owned = false;
44275         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
44276 }
44277
44278 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
44279         LDKChannelUpdateInfo this_ptr_conv;
44280         this_ptr_conv.inner = untag_ptr(this_ptr);
44281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44283         this_ptr_conv.is_owned = false;
44284         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
44285         return ret_conv;
44286 }
44287
44288 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
44289         LDKChannelUpdateInfo this_ptr_conv;
44290         this_ptr_conv.inner = untag_ptr(this_ptr);
44291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44293         this_ptr_conv.is_owned = false;
44294         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
44295 }
44296
44297 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
44298         LDKChannelUpdateInfo this_ptr_conv;
44299         this_ptr_conv.inner = untag_ptr(this_ptr);
44300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44302         this_ptr_conv.is_owned = false;
44303         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
44304         return ret_conv;
44305 }
44306
44307 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
44308         LDKChannelUpdateInfo this_ptr_conv;
44309         this_ptr_conv.inner = untag_ptr(this_ptr);
44310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44312         this_ptr_conv.is_owned = false;
44313         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
44314 }
44315
44316 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
44317         LDKChannelUpdateInfo this_ptr_conv;
44318         this_ptr_conv.inner = untag_ptr(this_ptr);
44319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44321         this_ptr_conv.is_owned = false;
44322         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
44323         return ret_conv;
44324 }
44325
44326 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
44327         LDKChannelUpdateInfo this_ptr_conv;
44328         this_ptr_conv.inner = untag_ptr(this_ptr);
44329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44331         this_ptr_conv.is_owned = false;
44332         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
44333 }
44334
44335 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
44336         LDKChannelUpdateInfo this_ptr_conv;
44337         this_ptr_conv.inner = untag_ptr(this_ptr);
44338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44340         this_ptr_conv.is_owned = false;
44341         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
44342         return ret_conv;
44343 }
44344
44345 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
44346         LDKChannelUpdateInfo this_ptr_conv;
44347         this_ptr_conv.inner = untag_ptr(this_ptr);
44348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44350         this_ptr_conv.is_owned = false;
44351         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
44352 }
44353
44354 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
44355         LDKChannelUpdateInfo this_ptr_conv;
44356         this_ptr_conv.inner = untag_ptr(this_ptr);
44357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44359         this_ptr_conv.is_owned = false;
44360         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
44361         uint64_t ret_ref = 0;
44362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44364         return ret_ref;
44365 }
44366
44367 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
44368         LDKChannelUpdateInfo this_ptr_conv;
44369         this_ptr_conv.inner = untag_ptr(this_ptr);
44370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44372         this_ptr_conv.is_owned = false;
44373         LDKRoutingFees val_conv;
44374         val_conv.inner = untag_ptr(val);
44375         val_conv.is_owned = ptr_is_owned(val);
44376         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44377         val_conv = RoutingFees_clone(&val_conv);
44378         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
44379 }
44380
44381 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
44382         LDKChannelUpdateInfo this_ptr_conv;
44383         this_ptr_conv.inner = untag_ptr(this_ptr);
44384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44386         this_ptr_conv.is_owned = false;
44387         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
44388         uint64_t ret_ref = 0;
44389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44391         return ret_ref;
44392 }
44393
44394 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
44395         LDKChannelUpdateInfo this_ptr_conv;
44396         this_ptr_conv.inner = untag_ptr(this_ptr);
44397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44399         this_ptr_conv.is_owned = false;
44400         LDKChannelUpdate val_conv;
44401         val_conv.inner = untag_ptr(val);
44402         val_conv.is_owned = ptr_is_owned(val);
44403         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44404         val_conv = ChannelUpdate_clone(&val_conv);
44405         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
44406 }
44407
44408 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) {
44409         LDKRoutingFees fees_arg_conv;
44410         fees_arg_conv.inner = untag_ptr(fees_arg);
44411         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
44412         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
44413         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
44414         LDKChannelUpdate last_update_message_arg_conv;
44415         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
44416         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
44417         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
44418         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
44419         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);
44420         uint64_t ret_ref = 0;
44421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44423         return ret_ref;
44424 }
44425
44426 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
44427         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
44428         uint64_t ret_ref = 0;
44429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44431         return ret_ref;
44432 }
44433 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
44434         LDKChannelUpdateInfo arg_conv;
44435         arg_conv.inner = untag_ptr(arg);
44436         arg_conv.is_owned = ptr_is_owned(arg);
44437         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44438         arg_conv.is_owned = false;
44439         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
44440         return ret_conv;
44441 }
44442
44443 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
44444         LDKChannelUpdateInfo orig_conv;
44445         orig_conv.inner = untag_ptr(orig);
44446         orig_conv.is_owned = ptr_is_owned(orig);
44447         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44448         orig_conv.is_owned = false;
44449         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_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 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
44457         LDKChannelUpdateInfo a_conv;
44458         a_conv.inner = untag_ptr(a);
44459         a_conv.is_owned = ptr_is_owned(a);
44460         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44461         a_conv.is_owned = false;
44462         LDKChannelUpdateInfo b_conv;
44463         b_conv.inner = untag_ptr(b);
44464         b_conv.is_owned = ptr_is_owned(b);
44465         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44466         b_conv.is_owned = false;
44467         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
44468         return ret_conv;
44469 }
44470
44471 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
44472         LDKChannelUpdateInfo obj_conv;
44473         obj_conv.inner = untag_ptr(obj);
44474         obj_conv.is_owned = ptr_is_owned(obj);
44475         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44476         obj_conv.is_owned = false;
44477         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
44478         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44479         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44480         CVec_u8Z_free(ret_var);
44481         return ret_arr;
44482 }
44483
44484 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
44485         LDKu8slice ser_ref;
44486         ser_ref.datalen = ser->arr_len;
44487         ser_ref.data = ser->elems;
44488         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
44489         *ret_conv = ChannelUpdateInfo_read(ser_ref);
44490         FREE(ser);
44491         return tag_ptr(ret_conv, true);
44492 }
44493
44494 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
44495         LDKChannelInfo this_obj_conv;
44496         this_obj_conv.inner = untag_ptr(this_obj);
44497         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44499         ChannelInfo_free(this_obj_conv);
44500 }
44501
44502 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
44503         LDKChannelInfo this_ptr_conv;
44504         this_ptr_conv.inner = untag_ptr(this_ptr);
44505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44507         this_ptr_conv.is_owned = false;
44508         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
44509         uint64_t ret_ref = 0;
44510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44512         return ret_ref;
44513 }
44514
44515 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
44516         LDKChannelInfo this_ptr_conv;
44517         this_ptr_conv.inner = untag_ptr(this_ptr);
44518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44520         this_ptr_conv.is_owned = false;
44521         LDKChannelFeatures val_conv;
44522         val_conv.inner = untag_ptr(val);
44523         val_conv.is_owned = ptr_is_owned(val);
44524         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44525         val_conv = ChannelFeatures_clone(&val_conv);
44526         ChannelInfo_set_features(&this_ptr_conv, val_conv);
44527 }
44528
44529 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
44530         LDKChannelInfo this_ptr_conv;
44531         this_ptr_conv.inner = untag_ptr(this_ptr);
44532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44534         this_ptr_conv.is_owned = false;
44535         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
44536         uint64_t ret_ref = 0;
44537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44539         return ret_ref;
44540 }
44541
44542 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
44543         LDKChannelInfo this_ptr_conv;
44544         this_ptr_conv.inner = untag_ptr(this_ptr);
44545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44547         this_ptr_conv.is_owned = false;
44548         LDKNodeId val_conv;
44549         val_conv.inner = untag_ptr(val);
44550         val_conv.is_owned = ptr_is_owned(val);
44551         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44552         val_conv = NodeId_clone(&val_conv);
44553         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
44554 }
44555
44556 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
44557         LDKChannelInfo this_ptr_conv;
44558         this_ptr_conv.inner = untag_ptr(this_ptr);
44559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44561         this_ptr_conv.is_owned = false;
44562         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
44563         uint64_t ret_ref = 0;
44564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44566         return ret_ref;
44567 }
44568
44569 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
44570         LDKChannelInfo this_ptr_conv;
44571         this_ptr_conv.inner = untag_ptr(this_ptr);
44572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44574         this_ptr_conv.is_owned = false;
44575         LDKChannelUpdateInfo val_conv;
44576         val_conv.inner = untag_ptr(val);
44577         val_conv.is_owned = ptr_is_owned(val);
44578         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44579         val_conv = ChannelUpdateInfo_clone(&val_conv);
44580         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
44581 }
44582
44583 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
44584         LDKChannelInfo this_ptr_conv;
44585         this_ptr_conv.inner = untag_ptr(this_ptr);
44586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44588         this_ptr_conv.is_owned = false;
44589         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
44590         uint64_t ret_ref = 0;
44591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44593         return ret_ref;
44594 }
44595
44596 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
44597         LDKChannelInfo this_ptr_conv;
44598         this_ptr_conv.inner = untag_ptr(this_ptr);
44599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44601         this_ptr_conv.is_owned = false;
44602         LDKNodeId val_conv;
44603         val_conv.inner = untag_ptr(val);
44604         val_conv.is_owned = ptr_is_owned(val);
44605         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44606         val_conv = NodeId_clone(&val_conv);
44607         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
44608 }
44609
44610 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
44611         LDKChannelInfo this_ptr_conv;
44612         this_ptr_conv.inner = untag_ptr(this_ptr);
44613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44615         this_ptr_conv.is_owned = false;
44616         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
44617         uint64_t ret_ref = 0;
44618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44620         return ret_ref;
44621 }
44622
44623 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
44624         LDKChannelInfo this_ptr_conv;
44625         this_ptr_conv.inner = untag_ptr(this_ptr);
44626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44628         this_ptr_conv.is_owned = false;
44629         LDKChannelUpdateInfo val_conv;
44630         val_conv.inner = untag_ptr(val);
44631         val_conv.is_owned = ptr_is_owned(val);
44632         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44633         val_conv = ChannelUpdateInfo_clone(&val_conv);
44634         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
44635 }
44636
44637 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
44638         LDKChannelInfo this_ptr_conv;
44639         this_ptr_conv.inner = untag_ptr(this_ptr);
44640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44642         this_ptr_conv.is_owned = false;
44643         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44644         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
44645         uint64_t ret_ref = tag_ptr(ret_copy, true);
44646         return ret_ref;
44647 }
44648
44649 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
44650         LDKChannelInfo this_ptr_conv;
44651         this_ptr_conv.inner = untag_ptr(this_ptr);
44652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44654         this_ptr_conv.is_owned = false;
44655         void* val_ptr = untag_ptr(val);
44656         CHECK_ACCESS(val_ptr);
44657         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44658         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44659         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
44660 }
44661
44662 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
44663         LDKChannelInfo this_ptr_conv;
44664         this_ptr_conv.inner = untag_ptr(this_ptr);
44665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44667         this_ptr_conv.is_owned = false;
44668         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
44669         uint64_t ret_ref = 0;
44670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44672         return ret_ref;
44673 }
44674
44675 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
44676         LDKChannelInfo this_ptr_conv;
44677         this_ptr_conv.inner = untag_ptr(this_ptr);
44678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44680         this_ptr_conv.is_owned = false;
44681         LDKChannelAnnouncement val_conv;
44682         val_conv.inner = untag_ptr(val);
44683         val_conv.is_owned = ptr_is_owned(val);
44684         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44685         val_conv = ChannelAnnouncement_clone(&val_conv);
44686         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
44687 }
44688
44689 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
44690         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
44691         uint64_t ret_ref = 0;
44692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44694         return ret_ref;
44695 }
44696 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
44697         LDKChannelInfo arg_conv;
44698         arg_conv.inner = untag_ptr(arg);
44699         arg_conv.is_owned = ptr_is_owned(arg);
44700         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44701         arg_conv.is_owned = false;
44702         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
44703         return ret_conv;
44704 }
44705
44706 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
44707         LDKChannelInfo orig_conv;
44708         orig_conv.inner = untag_ptr(orig);
44709         orig_conv.is_owned = ptr_is_owned(orig);
44710         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44711         orig_conv.is_owned = false;
44712         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
44713         uint64_t ret_ref = 0;
44714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44716         return ret_ref;
44717 }
44718
44719 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
44720         LDKChannelInfo a_conv;
44721         a_conv.inner = untag_ptr(a);
44722         a_conv.is_owned = ptr_is_owned(a);
44723         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44724         a_conv.is_owned = false;
44725         LDKChannelInfo b_conv;
44726         b_conv.inner = untag_ptr(b);
44727         b_conv.is_owned = ptr_is_owned(b);
44728         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44729         b_conv.is_owned = false;
44730         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
44731         return ret_conv;
44732 }
44733
44734 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
44735         LDKChannelInfo this_arg_conv;
44736         this_arg_conv.inner = untag_ptr(this_arg);
44737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44739         this_arg_conv.is_owned = false;
44740         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
44741         uint64_t ret_ref = 0;
44742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44744         return ret_ref;
44745 }
44746
44747 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
44748         LDKChannelInfo obj_conv;
44749         obj_conv.inner = untag_ptr(obj);
44750         obj_conv.is_owned = ptr_is_owned(obj);
44751         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44752         obj_conv.is_owned = false;
44753         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
44754         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44755         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44756         CVec_u8Z_free(ret_var);
44757         return ret_arr;
44758 }
44759
44760 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
44761         LDKu8slice ser_ref;
44762         ser_ref.datalen = ser->arr_len;
44763         ser_ref.data = ser->elems;
44764         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
44765         *ret_conv = ChannelInfo_read(ser_ref);
44766         FREE(ser);
44767         return tag_ptr(ret_conv, true);
44768 }
44769
44770 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
44771         LDKDirectedChannelInfo this_obj_conv;
44772         this_obj_conv.inner = untag_ptr(this_obj);
44773         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44775         DirectedChannelInfo_free(this_obj_conv);
44776 }
44777
44778 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
44779         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
44780         uint64_t ret_ref = 0;
44781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44783         return ret_ref;
44784 }
44785 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
44786         LDKDirectedChannelInfo arg_conv;
44787         arg_conv.inner = untag_ptr(arg);
44788         arg_conv.is_owned = ptr_is_owned(arg);
44789         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44790         arg_conv.is_owned = false;
44791         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
44792         return ret_conv;
44793 }
44794
44795 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
44796         LDKDirectedChannelInfo orig_conv;
44797         orig_conv.inner = untag_ptr(orig);
44798         orig_conv.is_owned = ptr_is_owned(orig);
44799         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44800         orig_conv.is_owned = false;
44801         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
44802         uint64_t ret_ref = 0;
44803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44805         return ret_ref;
44806 }
44807
44808 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
44809         LDKDirectedChannelInfo this_arg_conv;
44810         this_arg_conv.inner = untag_ptr(this_arg);
44811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44813         this_arg_conv.is_owned = false;
44814         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
44815         uint64_t ret_ref = 0;
44816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44818         return ret_ref;
44819 }
44820
44821 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
44822         LDKDirectedChannelInfo this_arg_conv;
44823         this_arg_conv.inner = untag_ptr(this_arg);
44824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44826         this_arg_conv.is_owned = false;
44827         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
44828         return ret_conv;
44829 }
44830
44831 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
44832         LDKDirectedChannelInfo this_arg_conv;
44833         this_arg_conv.inner = untag_ptr(this_arg);
44834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44836         this_arg_conv.is_owned = false;
44837         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44838         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
44839         uint64_t ret_ref = tag_ptr(ret_copy, true);
44840         return ret_ref;
44841 }
44842
44843 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
44844         if (!ptr_is_owned(this_ptr)) return;
44845         void* this_ptr_ptr = untag_ptr(this_ptr);
44846         CHECK_ACCESS(this_ptr_ptr);
44847         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
44848         FREE(untag_ptr(this_ptr));
44849         EffectiveCapacity_free(this_ptr_conv);
44850 }
44851
44852 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
44853         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44854         *ret_copy = EffectiveCapacity_clone(arg);
44855         uint64_t ret_ref = tag_ptr(ret_copy, true);
44856         return ret_ref;
44857 }
44858 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
44859         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
44860         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
44861         return ret_conv;
44862 }
44863
44864 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
44865         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
44866         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44867         *ret_copy = EffectiveCapacity_clone(orig_conv);
44868         uint64_t ret_ref = tag_ptr(ret_copy, true);
44869         return ret_ref;
44870 }
44871
44872 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
44873         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44874         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
44875         uint64_t ret_ref = tag_ptr(ret_copy, true);
44876         return ret_ref;
44877 }
44878
44879 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
44880         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44881         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
44882         uint64_t ret_ref = tag_ptr(ret_copy, true);
44883         return ret_ref;
44884 }
44885
44886 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
44887         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44888         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
44889         uint64_t ret_ref = tag_ptr(ret_copy, true);
44890         return ret_ref;
44891 }
44892
44893 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
44894         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44895         *ret_copy = EffectiveCapacity_infinite();
44896         uint64_t ret_ref = tag_ptr(ret_copy, true);
44897         return ret_ref;
44898 }
44899
44900 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
44901         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44902         *ret_copy = EffectiveCapacity_unknown();
44903         uint64_t ret_ref = tag_ptr(ret_copy, true);
44904         return ret_ref;
44905 }
44906
44907 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
44908         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
44909         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
44910         return ret_conv;
44911 }
44912
44913 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
44914         LDKRoutingFees this_obj_conv;
44915         this_obj_conv.inner = untag_ptr(this_obj);
44916         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44918         RoutingFees_free(this_obj_conv);
44919 }
44920
44921 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
44922         LDKRoutingFees this_ptr_conv;
44923         this_ptr_conv.inner = untag_ptr(this_ptr);
44924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44926         this_ptr_conv.is_owned = false;
44927         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
44928         return ret_conv;
44929 }
44930
44931 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
44932         LDKRoutingFees this_ptr_conv;
44933         this_ptr_conv.inner = untag_ptr(this_ptr);
44934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44936         this_ptr_conv.is_owned = false;
44937         RoutingFees_set_base_msat(&this_ptr_conv, val);
44938 }
44939
44940 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
44941         LDKRoutingFees this_ptr_conv;
44942         this_ptr_conv.inner = untag_ptr(this_ptr);
44943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44945         this_ptr_conv.is_owned = false;
44946         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
44947         return ret_conv;
44948 }
44949
44950 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
44951         LDKRoutingFees this_ptr_conv;
44952         this_ptr_conv.inner = untag_ptr(this_ptr);
44953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44955         this_ptr_conv.is_owned = false;
44956         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
44957 }
44958
44959 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
44960         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
44961         uint64_t ret_ref = 0;
44962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44964         return ret_ref;
44965 }
44966
44967 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
44968         LDKRoutingFees a_conv;
44969         a_conv.inner = untag_ptr(a);
44970         a_conv.is_owned = ptr_is_owned(a);
44971         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44972         a_conv.is_owned = false;
44973         LDKRoutingFees b_conv;
44974         b_conv.inner = untag_ptr(b);
44975         b_conv.is_owned = ptr_is_owned(b);
44976         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44977         b_conv.is_owned = false;
44978         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
44979         return ret_conv;
44980 }
44981
44982 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
44983         LDKRoutingFees ret_var = RoutingFees_clone(arg);
44984         uint64_t ret_ref = 0;
44985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44987         return ret_ref;
44988 }
44989 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
44990         LDKRoutingFees arg_conv;
44991         arg_conv.inner = untag_ptr(arg);
44992         arg_conv.is_owned = ptr_is_owned(arg);
44993         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44994         arg_conv.is_owned = false;
44995         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
44996         return ret_conv;
44997 }
44998
44999 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
45000         LDKRoutingFees orig_conv;
45001         orig_conv.inner = untag_ptr(orig);
45002         orig_conv.is_owned = ptr_is_owned(orig);
45003         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45004         orig_conv.is_owned = false;
45005         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
45006         uint64_t ret_ref = 0;
45007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45009         return ret_ref;
45010 }
45011
45012 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
45013         LDKRoutingFees o_conv;
45014         o_conv.inner = untag_ptr(o);
45015         o_conv.is_owned = ptr_is_owned(o);
45016         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45017         o_conv.is_owned = false;
45018         int64_t ret_conv = RoutingFees_hash(&o_conv);
45019         return ret_conv;
45020 }
45021
45022 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
45023         LDKRoutingFees obj_conv;
45024         obj_conv.inner = untag_ptr(obj);
45025         obj_conv.is_owned = ptr_is_owned(obj);
45026         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45027         obj_conv.is_owned = false;
45028         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
45029         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45030         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45031         CVec_u8Z_free(ret_var);
45032         return ret_arr;
45033 }
45034
45035 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
45036         LDKu8slice ser_ref;
45037         ser_ref.datalen = ser->arr_len;
45038         ser_ref.data = ser->elems;
45039         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
45040         *ret_conv = RoutingFees_read(ser_ref);
45041         FREE(ser);
45042         return tag_ptr(ret_conv, true);
45043 }
45044
45045 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
45046         LDKNodeAnnouncementInfo this_obj_conv;
45047         this_obj_conv.inner = untag_ptr(this_obj);
45048         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45050         NodeAnnouncementInfo_free(this_obj_conv);
45051 }
45052
45053 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
45054         LDKNodeAnnouncementInfo this_ptr_conv;
45055         this_ptr_conv.inner = untag_ptr(this_ptr);
45056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45058         this_ptr_conv.is_owned = false;
45059         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
45060         uint64_t ret_ref = 0;
45061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45063         return ret_ref;
45064 }
45065
45066 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
45067         LDKNodeAnnouncementInfo this_ptr_conv;
45068         this_ptr_conv.inner = untag_ptr(this_ptr);
45069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45071         this_ptr_conv.is_owned = false;
45072         LDKNodeFeatures val_conv;
45073         val_conv.inner = untag_ptr(val);
45074         val_conv.is_owned = ptr_is_owned(val);
45075         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45076         val_conv = NodeFeatures_clone(&val_conv);
45077         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
45078 }
45079
45080 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
45081         LDKNodeAnnouncementInfo this_ptr_conv;
45082         this_ptr_conv.inner = untag_ptr(this_ptr);
45083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45085         this_ptr_conv.is_owned = false;
45086         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
45087         return ret_conv;
45088 }
45089
45090 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
45091         LDKNodeAnnouncementInfo this_ptr_conv;
45092         this_ptr_conv.inner = untag_ptr(this_ptr);
45093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45095         this_ptr_conv.is_owned = false;
45096         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
45097 }
45098
45099 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
45100         LDKNodeAnnouncementInfo this_ptr_conv;
45101         this_ptr_conv.inner = untag_ptr(this_ptr);
45102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45104         this_ptr_conv.is_owned = false;
45105         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
45106         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
45107         return ret_arr;
45108 }
45109
45110 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
45111         LDKNodeAnnouncementInfo this_ptr_conv;
45112         this_ptr_conv.inner = untag_ptr(this_ptr);
45113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45115         this_ptr_conv.is_owned = false;
45116         LDKThreeBytes val_ref;
45117         CHECK(val->arr_len == 3);
45118         memcpy(val_ref.data, val->elems, 3); FREE(val);
45119         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
45120 }
45121
45122 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
45123         LDKNodeAnnouncementInfo this_ptr_conv;
45124         this_ptr_conv.inner = untag_ptr(this_ptr);
45125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45127         this_ptr_conv.is_owned = false;
45128         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
45129         uint64_t ret_ref = 0;
45130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45132         return ret_ref;
45133 }
45134
45135 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
45136         LDKNodeAnnouncementInfo this_ptr_conv;
45137         this_ptr_conv.inner = untag_ptr(this_ptr);
45138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45140         this_ptr_conv.is_owned = false;
45141         LDKNodeAlias val_conv;
45142         val_conv.inner = untag_ptr(val);
45143         val_conv.is_owned = ptr_is_owned(val);
45144         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45145         val_conv = NodeAlias_clone(&val_conv);
45146         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
45147 }
45148
45149 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
45150         LDKNodeAnnouncementInfo this_ptr_conv;
45151         this_ptr_conv.inner = untag_ptr(this_ptr);
45152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45154         this_ptr_conv.is_owned = false;
45155         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
45156         uint64_t ret_ref = 0;
45157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45159         return ret_ref;
45160 }
45161
45162 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
45163         LDKNodeAnnouncementInfo this_ptr_conv;
45164         this_ptr_conv.inner = untag_ptr(this_ptr);
45165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45167         this_ptr_conv.is_owned = false;
45168         LDKNodeAnnouncement val_conv;
45169         val_conv.inner = untag_ptr(val);
45170         val_conv.is_owned = ptr_is_owned(val);
45171         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45172         val_conv = NodeAnnouncement_clone(&val_conv);
45173         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
45174 }
45175
45176 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_t announcement_message_arg) {
45177         LDKNodeFeatures features_arg_conv;
45178         features_arg_conv.inner = untag_ptr(features_arg);
45179         features_arg_conv.is_owned = ptr_is_owned(features_arg);
45180         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
45181         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
45182         LDKThreeBytes rgb_arg_ref;
45183         CHECK(rgb_arg->arr_len == 3);
45184         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
45185         LDKNodeAlias alias_arg_conv;
45186         alias_arg_conv.inner = untag_ptr(alias_arg);
45187         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
45188         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
45189         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
45190         LDKNodeAnnouncement announcement_message_arg_conv;
45191         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
45192         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
45193         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
45194         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
45195         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
45196         uint64_t ret_ref = 0;
45197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45199         return ret_ref;
45200 }
45201
45202 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
45203         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
45204         uint64_t ret_ref = 0;
45205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45207         return ret_ref;
45208 }
45209 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
45210         LDKNodeAnnouncementInfo arg_conv;
45211         arg_conv.inner = untag_ptr(arg);
45212         arg_conv.is_owned = ptr_is_owned(arg);
45213         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45214         arg_conv.is_owned = false;
45215         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
45216         return ret_conv;
45217 }
45218
45219 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
45220         LDKNodeAnnouncementInfo orig_conv;
45221         orig_conv.inner = untag_ptr(orig);
45222         orig_conv.is_owned = ptr_is_owned(orig);
45223         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45224         orig_conv.is_owned = false;
45225         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
45226         uint64_t ret_ref = 0;
45227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45229         return ret_ref;
45230 }
45231
45232 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
45233         LDKNodeAnnouncementInfo a_conv;
45234         a_conv.inner = untag_ptr(a);
45235         a_conv.is_owned = ptr_is_owned(a);
45236         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45237         a_conv.is_owned = false;
45238         LDKNodeAnnouncementInfo b_conv;
45239         b_conv.inner = untag_ptr(b);
45240         b_conv.is_owned = ptr_is_owned(b);
45241         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45242         b_conv.is_owned = false;
45243         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
45244         return ret_conv;
45245 }
45246
45247 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_addresses"))) TS_NodeAnnouncementInfo_addresses(uint64_t this_arg) {
45248         LDKNodeAnnouncementInfo this_arg_conv;
45249         this_arg_conv.inner = untag_ptr(this_arg);
45250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45252         this_arg_conv.is_owned = false;
45253         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
45254         uint64_tArray ret_arr = NULL;
45255         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45256         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45257         for (size_t m = 0; m < ret_var.datalen; m++) {
45258                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45259                 *ret_conv_12_copy = ret_var.data[m];
45260                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
45261                 ret_arr_ptr[m] = ret_conv_12_ref;
45262         }
45263         
45264         FREE(ret_var.data);
45265         return ret_arr;
45266 }
45267
45268 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
45269         LDKNodeAnnouncementInfo obj_conv;
45270         obj_conv.inner = untag_ptr(obj);
45271         obj_conv.is_owned = ptr_is_owned(obj);
45272         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45273         obj_conv.is_owned = false;
45274         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
45275         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45276         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45277         CVec_u8Z_free(ret_var);
45278         return ret_arr;
45279 }
45280
45281 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
45282         LDKu8slice ser_ref;
45283         ser_ref.datalen = ser->arr_len;
45284         ser_ref.data = ser->elems;
45285         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
45286         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
45287         FREE(ser);
45288         return tag_ptr(ret_conv, true);
45289 }
45290
45291 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
45292         LDKNodeAlias this_obj_conv;
45293         this_obj_conv.inner = untag_ptr(this_obj);
45294         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45296         NodeAlias_free(this_obj_conv);
45297 }
45298
45299 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
45300         LDKNodeAlias this_ptr_conv;
45301         this_ptr_conv.inner = untag_ptr(this_ptr);
45302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45304         this_ptr_conv.is_owned = false;
45305         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45306         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
45307         return ret_arr;
45308 }
45309
45310 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
45311         LDKNodeAlias this_ptr_conv;
45312         this_ptr_conv.inner = untag_ptr(this_ptr);
45313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45315         this_ptr_conv.is_owned = false;
45316         LDKThirtyTwoBytes val_ref;
45317         CHECK(val->arr_len == 32);
45318         memcpy(val_ref.data, val->elems, 32); FREE(val);
45319         NodeAlias_set_a(&this_ptr_conv, val_ref);
45320 }
45321
45322 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
45323         LDKThirtyTwoBytes a_arg_ref;
45324         CHECK(a_arg->arr_len == 32);
45325         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
45326         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
45327         uint64_t ret_ref = 0;
45328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45330         return ret_ref;
45331 }
45332
45333 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
45334         LDKNodeAlias ret_var = NodeAlias_clone(arg);
45335         uint64_t ret_ref = 0;
45336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45338         return ret_ref;
45339 }
45340 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
45341         LDKNodeAlias arg_conv;
45342         arg_conv.inner = untag_ptr(arg);
45343         arg_conv.is_owned = ptr_is_owned(arg);
45344         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45345         arg_conv.is_owned = false;
45346         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
45347         return ret_conv;
45348 }
45349
45350 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
45351         LDKNodeAlias orig_conv;
45352         orig_conv.inner = untag_ptr(orig);
45353         orig_conv.is_owned = ptr_is_owned(orig);
45354         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45355         orig_conv.is_owned = false;
45356         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
45357         uint64_t ret_ref = 0;
45358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45360         return ret_ref;
45361 }
45362
45363 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
45364         LDKNodeAlias a_conv;
45365         a_conv.inner = untag_ptr(a);
45366         a_conv.is_owned = ptr_is_owned(a);
45367         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45368         a_conv.is_owned = false;
45369         LDKNodeAlias b_conv;
45370         b_conv.inner = untag_ptr(b);
45371         b_conv.is_owned = ptr_is_owned(b);
45372         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45373         b_conv.is_owned = false;
45374         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
45375         return ret_conv;
45376 }
45377
45378 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
45379         LDKNodeAlias obj_conv;
45380         obj_conv.inner = untag_ptr(obj);
45381         obj_conv.is_owned = ptr_is_owned(obj);
45382         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45383         obj_conv.is_owned = false;
45384         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
45385         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45386         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45387         CVec_u8Z_free(ret_var);
45388         return ret_arr;
45389 }
45390
45391 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
45392         LDKu8slice ser_ref;
45393         ser_ref.datalen = ser->arr_len;
45394         ser_ref.data = ser->elems;
45395         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
45396         *ret_conv = NodeAlias_read(ser_ref);
45397         FREE(ser);
45398         return tag_ptr(ret_conv, true);
45399 }
45400
45401 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
45402         LDKNodeInfo this_obj_conv;
45403         this_obj_conv.inner = untag_ptr(this_obj);
45404         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45406         NodeInfo_free(this_obj_conv);
45407 }
45408
45409 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
45410         LDKNodeInfo this_ptr_conv;
45411         this_ptr_conv.inner = untag_ptr(this_ptr);
45412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45414         this_ptr_conv.is_owned = false;
45415         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
45416         int64_tArray ret_arr = NULL;
45417         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
45418         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
45419         for (size_t i = 0; i < ret_var.datalen; i++) {
45420                 int64_t ret_conv_8_conv = ret_var.data[i];
45421                 ret_arr_ptr[i] = ret_conv_8_conv;
45422         }
45423         
45424         FREE(ret_var.data);
45425         return ret_arr;
45426 }
45427
45428 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
45429         LDKNodeInfo this_ptr_conv;
45430         this_ptr_conv.inner = untag_ptr(this_ptr);
45431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45433         this_ptr_conv.is_owned = false;
45434         LDKCVec_u64Z val_constr;
45435         val_constr.datalen = val->arr_len;
45436         if (val_constr.datalen > 0)
45437                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
45438         else
45439                 val_constr.data = NULL;
45440         int64_t* val_vals = val->elems;
45441         for (size_t i = 0; i < val_constr.datalen; i++) {
45442                 int64_t val_conv_8 = val_vals[i];
45443                 val_constr.data[i] = val_conv_8;
45444         }
45445         FREE(val);
45446         NodeInfo_set_channels(&this_ptr_conv, val_constr);
45447 }
45448
45449 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
45450         LDKNodeInfo this_ptr_conv;
45451         this_ptr_conv.inner = untag_ptr(this_ptr);
45452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45454         this_ptr_conv.is_owned = false;
45455         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
45456         uint64_t ret_ref = 0;
45457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45459         return ret_ref;
45460 }
45461
45462 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
45463         LDKNodeInfo this_ptr_conv;
45464         this_ptr_conv.inner = untag_ptr(this_ptr);
45465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45467         this_ptr_conv.is_owned = false;
45468         LDKNodeAnnouncementInfo val_conv;
45469         val_conv.inner = untag_ptr(val);
45470         val_conv.is_owned = ptr_is_owned(val);
45471         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45472         val_conv = NodeAnnouncementInfo_clone(&val_conv);
45473         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
45474 }
45475
45476 uint64_t  __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t announcement_info_arg) {
45477         LDKCVec_u64Z channels_arg_constr;
45478         channels_arg_constr.datalen = channels_arg->arr_len;
45479         if (channels_arg_constr.datalen > 0)
45480                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
45481         else
45482                 channels_arg_constr.data = NULL;
45483         int64_t* channels_arg_vals = channels_arg->elems;
45484         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
45485                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
45486                 channels_arg_constr.data[i] = channels_arg_conv_8;
45487         }
45488         FREE(channels_arg);
45489         LDKNodeAnnouncementInfo announcement_info_arg_conv;
45490         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
45491         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
45492         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
45493         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
45494         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
45495         uint64_t ret_ref = 0;
45496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45498         return ret_ref;
45499 }
45500
45501 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
45502         LDKNodeInfo ret_var = NodeInfo_clone(arg);
45503         uint64_t ret_ref = 0;
45504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45506         return ret_ref;
45507 }
45508 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
45509         LDKNodeInfo arg_conv;
45510         arg_conv.inner = untag_ptr(arg);
45511         arg_conv.is_owned = ptr_is_owned(arg);
45512         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45513         arg_conv.is_owned = false;
45514         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
45515         return ret_conv;
45516 }
45517
45518 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
45519         LDKNodeInfo orig_conv;
45520         orig_conv.inner = untag_ptr(orig);
45521         orig_conv.is_owned = ptr_is_owned(orig);
45522         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45523         orig_conv.is_owned = false;
45524         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
45525         uint64_t ret_ref = 0;
45526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45528         return ret_ref;
45529 }
45530
45531 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
45532         LDKNodeInfo a_conv;
45533         a_conv.inner = untag_ptr(a);
45534         a_conv.is_owned = ptr_is_owned(a);
45535         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45536         a_conv.is_owned = false;
45537         LDKNodeInfo b_conv;
45538         b_conv.inner = untag_ptr(b);
45539         b_conv.is_owned = ptr_is_owned(b);
45540         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45541         b_conv.is_owned = false;
45542         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
45543         return ret_conv;
45544 }
45545
45546 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
45547         LDKNodeInfo obj_conv;
45548         obj_conv.inner = untag_ptr(obj);
45549         obj_conv.is_owned = ptr_is_owned(obj);
45550         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45551         obj_conv.is_owned = false;
45552         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
45553         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45554         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45555         CVec_u8Z_free(ret_var);
45556         return ret_arr;
45557 }
45558
45559 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
45560         LDKu8slice ser_ref;
45561         ser_ref.datalen = ser->arr_len;
45562         ser_ref.data = ser->elems;
45563         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
45564         *ret_conv = NodeInfo_read(ser_ref);
45565         FREE(ser);
45566         return tag_ptr(ret_conv, true);
45567 }
45568
45569 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
45570         LDKNetworkGraph obj_conv;
45571         obj_conv.inner = untag_ptr(obj);
45572         obj_conv.is_owned = ptr_is_owned(obj);
45573         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45574         obj_conv.is_owned = false;
45575         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
45576         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45577         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45578         CVec_u8Z_free(ret_var);
45579         return ret_arr;
45580 }
45581
45582 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
45583         LDKu8slice ser_ref;
45584         ser_ref.datalen = ser->arr_len;
45585         ser_ref.data = ser->elems;
45586         void* arg_ptr = untag_ptr(arg);
45587         CHECK_ACCESS(arg_ptr);
45588         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
45589         if (arg_conv.free == LDKLogger_JCalls_free) {
45590                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45591                 LDKLogger_JCalls_cloned(&arg_conv);
45592         }
45593         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
45594         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
45595         FREE(ser);
45596         return tag_ptr(ret_conv, true);
45597 }
45598
45599 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(uint32_t network, uint64_t logger) {
45600         LDKNetwork network_conv = LDKNetwork_from_js(network);
45601         void* logger_ptr = untag_ptr(logger);
45602         CHECK_ACCESS(logger_ptr);
45603         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45604         if (logger_conv.free == LDKLogger_JCalls_free) {
45605                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45606                 LDKLogger_JCalls_cloned(&logger_conv);
45607         }
45608         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
45609         uint64_t ret_ref = 0;
45610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45612         return ret_ref;
45613 }
45614
45615 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
45616         LDKNetworkGraph this_arg_conv;
45617         this_arg_conv.inner = untag_ptr(this_arg);
45618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45620         this_arg_conv.is_owned = false;
45621         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
45622         uint64_t ret_ref = 0;
45623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45625         return ret_ref;
45626 }
45627
45628 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) {
45629         LDKNetworkGraph this_arg_conv;
45630         this_arg_conv.inner = untag_ptr(this_arg);
45631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45633         this_arg_conv.is_owned = false;
45634         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
45635         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
45636         uint64_t ret_ref = tag_ptr(ret_copy, true);
45637         return ret_ref;
45638 }
45639
45640 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) {
45641         LDKNetworkGraph this_arg_conv;
45642         this_arg_conv.inner = untag_ptr(this_arg);
45643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45645         this_arg_conv.is_owned = false;
45646         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
45647 }
45648
45649 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
45650         LDKNetworkGraph this_arg_conv;
45651         this_arg_conv.inner = untag_ptr(this_arg);
45652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45654         this_arg_conv.is_owned = false;
45655         LDKNodeAnnouncement msg_conv;
45656         msg_conv.inner = untag_ptr(msg);
45657         msg_conv.is_owned = ptr_is_owned(msg);
45658         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45659         msg_conv.is_owned = false;
45660         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45661         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
45662         return tag_ptr(ret_conv, true);
45663 }
45664
45665 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) {
45666         LDKNetworkGraph this_arg_conv;
45667         this_arg_conv.inner = untag_ptr(this_arg);
45668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45670         this_arg_conv.is_owned = false;
45671         LDKUnsignedNodeAnnouncement msg_conv;
45672         msg_conv.inner = untag_ptr(msg);
45673         msg_conv.is_owned = ptr_is_owned(msg);
45674         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45675         msg_conv.is_owned = false;
45676         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45677         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
45678         return tag_ptr(ret_conv, true);
45679 }
45680
45681 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) {
45682         LDKNetworkGraph this_arg_conv;
45683         this_arg_conv.inner = untag_ptr(this_arg);
45684         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45686         this_arg_conv.is_owned = false;
45687         LDKChannelAnnouncement msg_conv;
45688         msg_conv.inner = untag_ptr(msg);
45689         msg_conv.is_owned = ptr_is_owned(msg);
45690         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45691         msg_conv.is_owned = false;
45692         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
45693         CHECK_ACCESS(utxo_lookup_ptr);
45694         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
45695         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
45696         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
45697                 // Manually implement clone for Java trait instances
45698                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
45699                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45700                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
45701                 }
45702         }
45703         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45704         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
45705         return tag_ptr(ret_conv, true);
45706 }
45707
45708 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) {
45709         LDKNetworkGraph this_arg_conv;
45710         this_arg_conv.inner = untag_ptr(this_arg);
45711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45713         this_arg_conv.is_owned = false;
45714         LDKUnsignedChannelAnnouncement msg_conv;
45715         msg_conv.inner = untag_ptr(msg);
45716         msg_conv.is_owned = ptr_is_owned(msg);
45717         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45718         msg_conv.is_owned = false;
45719         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
45720         CHECK_ACCESS(utxo_lookup_ptr);
45721         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
45722         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
45723         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
45724                 // Manually implement clone for Java trait instances
45725                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
45726                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45727                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
45728                 }
45729         }
45730         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45731         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
45732         return tag_ptr(ret_conv, true);
45733 }
45734
45735 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) {
45736         LDKNetworkGraph this_arg_conv;
45737         this_arg_conv.inner = untag_ptr(this_arg);
45738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45740         this_arg_conv.is_owned = false;
45741         LDKChannelFeatures features_conv;
45742         features_conv.inner = untag_ptr(features);
45743         features_conv.is_owned = ptr_is_owned(features);
45744         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
45745         features_conv = ChannelFeatures_clone(&features_conv);
45746         LDKPublicKey node_id_1_ref;
45747         CHECK(node_id_1->arr_len == 33);
45748         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
45749         LDKPublicKey node_id_2_ref;
45750         CHECK(node_id_2->arr_len == 33);
45751         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
45752         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45753         *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);
45754         return tag_ptr(ret_conv, true);
45755 }
45756
45757 void  __attribute__((export_name("TS_NetworkGraph_channel_failed_permanent"))) TS_NetworkGraph_channel_failed_permanent(uint64_t this_arg, int64_t short_channel_id) {
45758         LDKNetworkGraph this_arg_conv;
45759         this_arg_conv.inner = untag_ptr(this_arg);
45760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45762         this_arg_conv.is_owned = false;
45763         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
45764 }
45765
45766 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
45767         LDKNetworkGraph this_arg_conv;
45768         this_arg_conv.inner = untag_ptr(this_arg);
45769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45771         this_arg_conv.is_owned = false;
45772         LDKPublicKey node_id_ref;
45773         CHECK(node_id->arr_len == 33);
45774         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
45775         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
45776 }
45777
45778 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) {
45779         LDKNetworkGraph this_arg_conv;
45780         this_arg_conv.inner = untag_ptr(this_arg);
45781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45783         this_arg_conv.is_owned = false;
45784         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
45785 }
45786
45787 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
45788         LDKNetworkGraph this_arg_conv;
45789         this_arg_conv.inner = untag_ptr(this_arg);
45790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45792         this_arg_conv.is_owned = false;
45793         LDKChannelUpdate msg_conv;
45794         msg_conv.inner = untag_ptr(msg);
45795         msg_conv.is_owned = ptr_is_owned(msg);
45796         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45797         msg_conv.is_owned = false;
45798         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45799         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
45800         return tag_ptr(ret_conv, true);
45801 }
45802
45803 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
45804         LDKNetworkGraph this_arg_conv;
45805         this_arg_conv.inner = untag_ptr(this_arg);
45806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45808         this_arg_conv.is_owned = false;
45809         LDKUnsignedChannelUpdate msg_conv;
45810         msg_conv.inner = untag_ptr(msg);
45811         msg_conv.is_owned = ptr_is_owned(msg);
45812         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45813         msg_conv.is_owned = false;
45814         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45815         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
45816         return tag_ptr(ret_conv, true);
45817 }
45818
45819 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
45820         LDKReadOnlyNetworkGraph this_arg_conv;
45821         this_arg_conv.inner = untag_ptr(this_arg);
45822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45824         this_arg_conv.is_owned = false;
45825         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
45826         uint64_t ret_ref = 0;
45827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45829         return ret_ref;
45830 }
45831
45832 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
45833         LDKReadOnlyNetworkGraph this_arg_conv;
45834         this_arg_conv.inner = untag_ptr(this_arg);
45835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45837         this_arg_conv.is_owned = false;
45838         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
45839         int64_tArray ret_arr = NULL;
45840         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
45841         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
45842         for (size_t i = 0; i < ret_var.datalen; i++) {
45843                 int64_t ret_conv_8_conv = ret_var.data[i];
45844                 ret_arr_ptr[i] = ret_conv_8_conv;
45845         }
45846         
45847         FREE(ret_var.data);
45848         return ret_arr;
45849 }
45850
45851 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
45852         LDKReadOnlyNetworkGraph this_arg_conv;
45853         this_arg_conv.inner = untag_ptr(this_arg);
45854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45856         this_arg_conv.is_owned = false;
45857         LDKNodeId node_id_conv;
45858         node_id_conv.inner = untag_ptr(node_id);
45859         node_id_conv.is_owned = ptr_is_owned(node_id);
45860         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45861         node_id_conv.is_owned = false;
45862         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
45863         uint64_t ret_ref = 0;
45864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45866         return ret_ref;
45867 }
45868
45869 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
45870         LDKReadOnlyNetworkGraph this_arg_conv;
45871         this_arg_conv.inner = untag_ptr(this_arg);
45872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45874         this_arg_conv.is_owned = false;
45875         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
45876         uint64_tArray ret_arr = NULL;
45877         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45878         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45879         for (size_t i = 0; i < ret_var.datalen; i++) {
45880                 LDKNodeId ret_conv_8_var = ret_var.data[i];
45881                 uint64_t ret_conv_8_ref = 0;
45882                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
45883                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
45884                 ret_arr_ptr[i] = ret_conv_8_ref;
45885         }
45886         
45887         FREE(ret_var.data);
45888         return ret_arr;
45889 }
45890
45891 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
45892         LDKReadOnlyNetworkGraph this_arg_conv;
45893         this_arg_conv.inner = untag_ptr(this_arg);
45894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45896         this_arg_conv.is_owned = false;
45897         LDKPublicKey pubkey_ref;
45898         CHECK(pubkey->arr_len == 33);
45899         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
45900         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
45901         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
45902         uint64_t ret_ref = tag_ptr(ret_copy, true);
45903         return ret_ref;
45904 }
45905
45906 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
45907         LDKDefaultRouter this_obj_conv;
45908         this_obj_conv.inner = untag_ptr(this_obj);
45909         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45911         DefaultRouter_free(this_obj_conv);
45912 }
45913
45914 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) {
45915         LDKNetworkGraph network_graph_conv;
45916         network_graph_conv.inner = untag_ptr(network_graph);
45917         network_graph_conv.is_owned = ptr_is_owned(network_graph);
45918         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45919         network_graph_conv.is_owned = false;
45920         void* logger_ptr = untag_ptr(logger);
45921         CHECK_ACCESS(logger_ptr);
45922         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45923         if (logger_conv.free == LDKLogger_JCalls_free) {
45924                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45925                 LDKLogger_JCalls_cloned(&logger_conv);
45926         }
45927         LDKThirtyTwoBytes random_seed_bytes_ref;
45928         CHECK(random_seed_bytes->arr_len == 32);
45929         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
45930         void* scorer_ptr = untag_ptr(scorer);
45931         CHECK_ACCESS(scorer_ptr);
45932         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
45933         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
45934                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45935                 LDKLockableScore_JCalls_cloned(&scorer_conv);
45936         }
45937         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv);
45938         uint64_t ret_ref = 0;
45939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45941         return ret_ref;
45942 }
45943
45944 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
45945         LDKDefaultRouter this_arg_conv;
45946         this_arg_conv.inner = untag_ptr(this_arg);
45947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45949         this_arg_conv.is_owned = false;
45950         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
45951         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
45952         return tag_ptr(ret_ret, true);
45953 }
45954
45955 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
45956         if (!ptr_is_owned(this_ptr)) return;
45957         void* this_ptr_ptr = untag_ptr(this_ptr);
45958         CHECK_ACCESS(this_ptr_ptr);
45959         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
45960         FREE(untag_ptr(this_ptr));
45961         Router_free(this_ptr_conv);
45962 }
45963
45964 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
45965         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
45966         this_obj_conv.inner = untag_ptr(this_obj);
45967         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45969         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
45970 }
45971
45972 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
45973         void* scorer_ptr = untag_ptr(scorer);
45974         CHECK_ACCESS(scorer_ptr);
45975         LDKScore scorer_conv = *(LDKScore*)(scorer_ptr);
45976         if (scorer_conv.free == LDKScore_JCalls_free) {
45977                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45978                 LDKScore_JCalls_cloned(&scorer_conv);
45979         }
45980         LDKInFlightHtlcs inflight_htlcs_conv;
45981         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
45982         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
45983         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
45984         inflight_htlcs_conv.is_owned = false;
45985         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
45986         uint64_t ret_ref = 0;
45987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45989         return ret_ref;
45990 }
45991
45992 int8_tArray  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_write"))) TS_ScorerAccountingForInFlightHtlcs_write(uint64_t obj) {
45993         LDKScorerAccountingForInFlightHtlcs obj_conv;
45994         obj_conv.inner = untag_ptr(obj);
45995         obj_conv.is_owned = ptr_is_owned(obj);
45996         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45997         obj_conv.is_owned = false;
45998         LDKCVec_u8Z ret_var = ScorerAccountingForInFlightHtlcs_write(&obj_conv);
45999         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46000         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46001         CVec_u8Z_free(ret_var);
46002         return ret_arr;
46003 }
46004
46005 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_Score"))) TS_ScorerAccountingForInFlightHtlcs_as_Score(uint64_t this_arg) {
46006         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
46007         this_arg_conv.inner = untag_ptr(this_arg);
46008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46010         this_arg_conv.is_owned = false;
46011         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
46012         *ret_ret = ScorerAccountingForInFlightHtlcs_as_Score(&this_arg_conv);
46013         return tag_ptr(ret_ret, true);
46014 }
46015
46016 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
46017         LDKInFlightHtlcs this_obj_conv;
46018         this_obj_conv.inner = untag_ptr(this_obj);
46019         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46021         InFlightHtlcs_free(this_obj_conv);
46022 }
46023
46024 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
46025         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
46026         uint64_t ret_ref = 0;
46027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46029         return ret_ref;
46030 }
46031 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
46032         LDKInFlightHtlcs arg_conv;
46033         arg_conv.inner = untag_ptr(arg);
46034         arg_conv.is_owned = ptr_is_owned(arg);
46035         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46036         arg_conv.is_owned = false;
46037         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
46038         return ret_conv;
46039 }
46040
46041 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
46042         LDKInFlightHtlcs orig_conv;
46043         orig_conv.inner = untag_ptr(orig);
46044         orig_conv.is_owned = ptr_is_owned(orig);
46045         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46046         orig_conv.is_owned = false;
46047         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
46048         uint64_t ret_ref = 0;
46049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46051         return ret_ref;
46052 }
46053
46054 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
46055         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
46056         uint64_t ret_ref = 0;
46057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46059         return ret_ref;
46060 }
46061
46062 void  __attribute__((export_name("TS_InFlightHtlcs_process_path"))) TS_InFlightHtlcs_process_path(uint64_t this_arg, uint64_t path, int8_tArray payer_node_id) {
46063         LDKInFlightHtlcs this_arg_conv;
46064         this_arg_conv.inner = untag_ptr(this_arg);
46065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46067         this_arg_conv.is_owned = false;
46068         LDKPath path_conv;
46069         path_conv.inner = untag_ptr(path);
46070         path_conv.is_owned = ptr_is_owned(path);
46071         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
46072         path_conv.is_owned = false;
46073         LDKPublicKey payer_node_id_ref;
46074         CHECK(payer_node_id->arr_len == 33);
46075         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
46076         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
46077 }
46078
46079 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) {
46080         LDKInFlightHtlcs this_arg_conv;
46081         this_arg_conv.inner = untag_ptr(this_arg);
46082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46084         this_arg_conv.is_owned = false;
46085         LDKNodeId source_conv;
46086         source_conv.inner = untag_ptr(source);
46087         source_conv.is_owned = ptr_is_owned(source);
46088         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
46089         source_conv.is_owned = false;
46090         LDKNodeId target_conv;
46091         target_conv.inner = untag_ptr(target);
46092         target_conv.is_owned = ptr_is_owned(target);
46093         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
46094         target_conv.is_owned = false;
46095         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46096         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
46097         uint64_t ret_ref = tag_ptr(ret_copy, true);
46098         return ret_ref;
46099 }
46100
46101 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
46102         LDKInFlightHtlcs obj_conv;
46103         obj_conv.inner = untag_ptr(obj);
46104         obj_conv.is_owned = ptr_is_owned(obj);
46105         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46106         obj_conv.is_owned = false;
46107         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
46108         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46109         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46110         CVec_u8Z_free(ret_var);
46111         return ret_arr;
46112 }
46113
46114 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
46115         LDKu8slice ser_ref;
46116         ser_ref.datalen = ser->arr_len;
46117         ser_ref.data = ser->elems;
46118         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
46119         *ret_conv = InFlightHtlcs_read(ser_ref);
46120         FREE(ser);
46121         return tag_ptr(ret_conv, true);
46122 }
46123
46124 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
46125         LDKRouteHop this_obj_conv;
46126         this_obj_conv.inner = untag_ptr(this_obj);
46127         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46129         RouteHop_free(this_obj_conv);
46130 }
46131
46132 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
46133         LDKRouteHop this_ptr_conv;
46134         this_ptr_conv.inner = untag_ptr(this_ptr);
46135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46137         this_ptr_conv.is_owned = false;
46138         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46139         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
46140         return ret_arr;
46141 }
46142
46143 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
46144         LDKRouteHop this_ptr_conv;
46145         this_ptr_conv.inner = untag_ptr(this_ptr);
46146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46148         this_ptr_conv.is_owned = false;
46149         LDKPublicKey val_ref;
46150         CHECK(val->arr_len == 33);
46151         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46152         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
46153 }
46154
46155 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
46156         LDKRouteHop this_ptr_conv;
46157         this_ptr_conv.inner = untag_ptr(this_ptr);
46158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46160         this_ptr_conv.is_owned = false;
46161         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
46162         uint64_t ret_ref = 0;
46163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46165         return ret_ref;
46166 }
46167
46168 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
46169         LDKRouteHop this_ptr_conv;
46170         this_ptr_conv.inner = untag_ptr(this_ptr);
46171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46173         this_ptr_conv.is_owned = false;
46174         LDKNodeFeatures val_conv;
46175         val_conv.inner = untag_ptr(val);
46176         val_conv.is_owned = ptr_is_owned(val);
46177         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46178         val_conv = NodeFeatures_clone(&val_conv);
46179         RouteHop_set_node_features(&this_ptr_conv, val_conv);
46180 }
46181
46182 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
46183         LDKRouteHop this_ptr_conv;
46184         this_ptr_conv.inner = untag_ptr(this_ptr);
46185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46187         this_ptr_conv.is_owned = false;
46188         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
46189         return ret_conv;
46190 }
46191
46192 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
46193         LDKRouteHop this_ptr_conv;
46194         this_ptr_conv.inner = untag_ptr(this_ptr);
46195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46197         this_ptr_conv.is_owned = false;
46198         RouteHop_set_short_channel_id(&this_ptr_conv, val);
46199 }
46200
46201 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
46202         LDKRouteHop this_ptr_conv;
46203         this_ptr_conv.inner = untag_ptr(this_ptr);
46204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46206         this_ptr_conv.is_owned = false;
46207         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
46208         uint64_t ret_ref = 0;
46209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46211         return ret_ref;
46212 }
46213
46214 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
46215         LDKRouteHop this_ptr_conv;
46216         this_ptr_conv.inner = untag_ptr(this_ptr);
46217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46219         this_ptr_conv.is_owned = false;
46220         LDKChannelFeatures val_conv;
46221         val_conv.inner = untag_ptr(val);
46222         val_conv.is_owned = ptr_is_owned(val);
46223         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46224         val_conv = ChannelFeatures_clone(&val_conv);
46225         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
46226 }
46227
46228 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
46229         LDKRouteHop this_ptr_conv;
46230         this_ptr_conv.inner = untag_ptr(this_ptr);
46231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46233         this_ptr_conv.is_owned = false;
46234         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
46235         return ret_conv;
46236 }
46237
46238 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
46239         LDKRouteHop this_ptr_conv;
46240         this_ptr_conv.inner = untag_ptr(this_ptr);
46241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46243         this_ptr_conv.is_owned = false;
46244         RouteHop_set_fee_msat(&this_ptr_conv, val);
46245 }
46246
46247 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
46248         LDKRouteHop this_ptr_conv;
46249         this_ptr_conv.inner = untag_ptr(this_ptr);
46250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46252         this_ptr_conv.is_owned = false;
46253         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
46254         return ret_conv;
46255 }
46256
46257 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
46258         LDKRouteHop this_ptr_conv;
46259         this_ptr_conv.inner = untag_ptr(this_ptr);
46260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46262         this_ptr_conv.is_owned = false;
46263         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
46264 }
46265
46266 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) {
46267         LDKPublicKey pubkey_arg_ref;
46268         CHECK(pubkey_arg->arr_len == 33);
46269         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
46270         LDKNodeFeatures node_features_arg_conv;
46271         node_features_arg_conv.inner = untag_ptr(node_features_arg);
46272         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
46273         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
46274         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
46275         LDKChannelFeatures channel_features_arg_conv;
46276         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
46277         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
46278         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
46279         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
46280         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);
46281         uint64_t ret_ref = 0;
46282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46284         return ret_ref;
46285 }
46286
46287 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
46288         LDKRouteHop ret_var = RouteHop_clone(arg);
46289         uint64_t ret_ref = 0;
46290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46292         return ret_ref;
46293 }
46294 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
46295         LDKRouteHop arg_conv;
46296         arg_conv.inner = untag_ptr(arg);
46297         arg_conv.is_owned = ptr_is_owned(arg);
46298         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46299         arg_conv.is_owned = false;
46300         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
46301         return ret_conv;
46302 }
46303
46304 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
46305         LDKRouteHop orig_conv;
46306         orig_conv.inner = untag_ptr(orig);
46307         orig_conv.is_owned = ptr_is_owned(orig);
46308         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46309         orig_conv.is_owned = false;
46310         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
46311         uint64_t ret_ref = 0;
46312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46314         return ret_ref;
46315 }
46316
46317 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
46318         LDKRouteHop o_conv;
46319         o_conv.inner = untag_ptr(o);
46320         o_conv.is_owned = ptr_is_owned(o);
46321         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46322         o_conv.is_owned = false;
46323         int64_t ret_conv = RouteHop_hash(&o_conv);
46324         return ret_conv;
46325 }
46326
46327 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
46328         LDKRouteHop a_conv;
46329         a_conv.inner = untag_ptr(a);
46330         a_conv.is_owned = ptr_is_owned(a);
46331         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46332         a_conv.is_owned = false;
46333         LDKRouteHop b_conv;
46334         b_conv.inner = untag_ptr(b);
46335         b_conv.is_owned = ptr_is_owned(b);
46336         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46337         b_conv.is_owned = false;
46338         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
46339         return ret_conv;
46340 }
46341
46342 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
46343         LDKRouteHop obj_conv;
46344         obj_conv.inner = untag_ptr(obj);
46345         obj_conv.is_owned = ptr_is_owned(obj);
46346         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46347         obj_conv.is_owned = false;
46348         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
46349         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46350         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46351         CVec_u8Z_free(ret_var);
46352         return ret_arr;
46353 }
46354
46355 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
46356         LDKu8slice ser_ref;
46357         ser_ref.datalen = ser->arr_len;
46358         ser_ref.data = ser->elems;
46359         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
46360         *ret_conv = RouteHop_read(ser_ref);
46361         FREE(ser);
46362         return tag_ptr(ret_conv, true);
46363 }
46364
46365 void  __attribute__((export_name("TS_BlindedTail_free"))) TS_BlindedTail_free(uint64_t this_obj) {
46366         LDKBlindedTail this_obj_conv;
46367         this_obj_conv.inner = untag_ptr(this_obj);
46368         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46370         BlindedTail_free(this_obj_conv);
46371 }
46372
46373 uint64_tArray  __attribute__((export_name("TS_BlindedTail_get_hops"))) TS_BlindedTail_get_hops(uint64_t this_ptr) {
46374         LDKBlindedTail this_ptr_conv;
46375         this_ptr_conv.inner = untag_ptr(this_ptr);
46376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46378         this_ptr_conv.is_owned = false;
46379         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
46380         uint64_tArray ret_arr = NULL;
46381         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46382         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46383         for (size_t m = 0; m < ret_var.datalen; m++) {
46384                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
46385                 uint64_t ret_conv_12_ref = 0;
46386                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
46387                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
46388                 ret_arr_ptr[m] = ret_conv_12_ref;
46389         }
46390         
46391         FREE(ret_var.data);
46392         return ret_arr;
46393 }
46394
46395 void  __attribute__((export_name("TS_BlindedTail_set_hops"))) TS_BlindedTail_set_hops(uint64_t this_ptr, uint64_tArray val) {
46396         LDKBlindedTail this_ptr_conv;
46397         this_ptr_conv.inner = untag_ptr(this_ptr);
46398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46400         this_ptr_conv.is_owned = false;
46401         LDKCVec_BlindedHopZ val_constr;
46402         val_constr.datalen = val->arr_len;
46403         if (val_constr.datalen > 0)
46404                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
46405         else
46406                 val_constr.data = NULL;
46407         uint64_t* val_vals = val->elems;
46408         for (size_t m = 0; m < val_constr.datalen; m++) {
46409                 uint64_t val_conv_12 = val_vals[m];
46410                 LDKBlindedHop val_conv_12_conv;
46411                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
46412                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
46413                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
46414                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
46415                 val_constr.data[m] = val_conv_12_conv;
46416         }
46417         FREE(val);
46418         BlindedTail_set_hops(&this_ptr_conv, val_constr);
46419 }
46420
46421 int8_tArray  __attribute__((export_name("TS_BlindedTail_get_blinding_point"))) TS_BlindedTail_get_blinding_point(uint64_t this_ptr) {
46422         LDKBlindedTail this_ptr_conv;
46423         this_ptr_conv.inner = untag_ptr(this_ptr);
46424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46426         this_ptr_conv.is_owned = false;
46427         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46428         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
46429         return ret_arr;
46430 }
46431
46432 void  __attribute__((export_name("TS_BlindedTail_set_blinding_point"))) TS_BlindedTail_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
46433         LDKBlindedTail this_ptr_conv;
46434         this_ptr_conv.inner = untag_ptr(this_ptr);
46435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46437         this_ptr_conv.is_owned = false;
46438         LDKPublicKey val_ref;
46439         CHECK(val->arr_len == 33);
46440         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46441         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
46442 }
46443
46444 int32_t  __attribute__((export_name("TS_BlindedTail_get_excess_final_cltv_expiry_delta"))) TS_BlindedTail_get_excess_final_cltv_expiry_delta(uint64_t this_ptr) {
46445         LDKBlindedTail this_ptr_conv;
46446         this_ptr_conv.inner = untag_ptr(this_ptr);
46447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46449         this_ptr_conv.is_owned = false;
46450         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
46451         return ret_conv;
46452 }
46453
46454 void  __attribute__((export_name("TS_BlindedTail_set_excess_final_cltv_expiry_delta"))) TS_BlindedTail_set_excess_final_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
46455         LDKBlindedTail this_ptr_conv;
46456         this_ptr_conv.inner = untag_ptr(this_ptr);
46457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46459         this_ptr_conv.is_owned = false;
46460         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
46461 }
46462
46463 int64_t  __attribute__((export_name("TS_BlindedTail_get_final_value_msat"))) TS_BlindedTail_get_final_value_msat(uint64_t this_ptr) {
46464         LDKBlindedTail this_ptr_conv;
46465         this_ptr_conv.inner = untag_ptr(this_ptr);
46466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46468         this_ptr_conv.is_owned = false;
46469         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
46470         return ret_conv;
46471 }
46472
46473 void  __attribute__((export_name("TS_BlindedTail_set_final_value_msat"))) TS_BlindedTail_set_final_value_msat(uint64_t this_ptr, int64_t val) {
46474         LDKBlindedTail this_ptr_conv;
46475         this_ptr_conv.inner = untag_ptr(this_ptr);
46476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46478         this_ptr_conv.is_owned = false;
46479         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
46480 }
46481
46482 uint64_t  __attribute__((export_name("TS_BlindedTail_new"))) TS_BlindedTail_new(uint64_tArray hops_arg, int8_tArray blinding_point_arg, int32_t excess_final_cltv_expiry_delta_arg, int64_t final_value_msat_arg) {
46483         LDKCVec_BlindedHopZ hops_arg_constr;
46484         hops_arg_constr.datalen = hops_arg->arr_len;
46485         if (hops_arg_constr.datalen > 0)
46486                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
46487         else
46488                 hops_arg_constr.data = NULL;
46489         uint64_t* hops_arg_vals = hops_arg->elems;
46490         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
46491                 uint64_t hops_arg_conv_12 = hops_arg_vals[m];
46492                 LDKBlindedHop hops_arg_conv_12_conv;
46493                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
46494                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
46495                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
46496                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
46497                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
46498         }
46499         FREE(hops_arg);
46500         LDKPublicKey blinding_point_arg_ref;
46501         CHECK(blinding_point_arg->arr_len == 33);
46502         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
46503         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
46504         uint64_t ret_ref = 0;
46505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46507         return ret_ref;
46508 }
46509
46510 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
46511         LDKBlindedTail ret_var = BlindedTail_clone(arg);
46512         uint64_t ret_ref = 0;
46513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46515         return ret_ref;
46516 }
46517 int64_t  __attribute__((export_name("TS_BlindedTail_clone_ptr"))) TS_BlindedTail_clone_ptr(uint64_t arg) {
46518         LDKBlindedTail arg_conv;
46519         arg_conv.inner = untag_ptr(arg);
46520         arg_conv.is_owned = ptr_is_owned(arg);
46521         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46522         arg_conv.is_owned = false;
46523         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
46524         return ret_conv;
46525 }
46526
46527 uint64_t  __attribute__((export_name("TS_BlindedTail_clone"))) TS_BlindedTail_clone(uint64_t orig) {
46528         LDKBlindedTail orig_conv;
46529         orig_conv.inner = untag_ptr(orig);
46530         orig_conv.is_owned = ptr_is_owned(orig);
46531         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46532         orig_conv.is_owned = false;
46533         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
46534         uint64_t ret_ref = 0;
46535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46537         return ret_ref;
46538 }
46539
46540 int64_t  __attribute__((export_name("TS_BlindedTail_hash"))) TS_BlindedTail_hash(uint64_t o) {
46541         LDKBlindedTail o_conv;
46542         o_conv.inner = untag_ptr(o);
46543         o_conv.is_owned = ptr_is_owned(o);
46544         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46545         o_conv.is_owned = false;
46546         int64_t ret_conv = BlindedTail_hash(&o_conv);
46547         return ret_conv;
46548 }
46549
46550 jboolean  __attribute__((export_name("TS_BlindedTail_eq"))) TS_BlindedTail_eq(uint64_t a, uint64_t b) {
46551         LDKBlindedTail a_conv;
46552         a_conv.inner = untag_ptr(a);
46553         a_conv.is_owned = ptr_is_owned(a);
46554         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46555         a_conv.is_owned = false;
46556         LDKBlindedTail b_conv;
46557         b_conv.inner = untag_ptr(b);
46558         b_conv.is_owned = ptr_is_owned(b);
46559         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46560         b_conv.is_owned = false;
46561         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
46562         return ret_conv;
46563 }
46564
46565 int8_tArray  __attribute__((export_name("TS_BlindedTail_write"))) TS_BlindedTail_write(uint64_t obj) {
46566         LDKBlindedTail obj_conv;
46567         obj_conv.inner = untag_ptr(obj);
46568         obj_conv.is_owned = ptr_is_owned(obj);
46569         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46570         obj_conv.is_owned = false;
46571         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
46572         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46573         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46574         CVec_u8Z_free(ret_var);
46575         return ret_arr;
46576 }
46577
46578 uint64_t  __attribute__((export_name("TS_BlindedTail_read"))) TS_BlindedTail_read(int8_tArray ser) {
46579         LDKu8slice ser_ref;
46580         ser_ref.datalen = ser->arr_len;
46581         ser_ref.data = ser->elems;
46582         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
46583         *ret_conv = BlindedTail_read(ser_ref);
46584         FREE(ser);
46585         return tag_ptr(ret_conv, true);
46586 }
46587
46588 void  __attribute__((export_name("TS_Path_free"))) TS_Path_free(uint64_t this_obj) {
46589         LDKPath this_obj_conv;
46590         this_obj_conv.inner = untag_ptr(this_obj);
46591         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46593         Path_free(this_obj_conv);
46594 }
46595
46596 uint64_tArray  __attribute__((export_name("TS_Path_get_hops"))) TS_Path_get_hops(uint64_t this_ptr) {
46597         LDKPath this_ptr_conv;
46598         this_ptr_conv.inner = untag_ptr(this_ptr);
46599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46601         this_ptr_conv.is_owned = false;
46602         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
46603         uint64_tArray ret_arr = NULL;
46604         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46605         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46606         for (size_t k = 0; k < ret_var.datalen; k++) {
46607                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
46608                 uint64_t ret_conv_10_ref = 0;
46609                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
46610                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
46611                 ret_arr_ptr[k] = ret_conv_10_ref;
46612         }
46613         
46614         FREE(ret_var.data);
46615         return ret_arr;
46616 }
46617
46618 void  __attribute__((export_name("TS_Path_set_hops"))) TS_Path_set_hops(uint64_t this_ptr, uint64_tArray val) {
46619         LDKPath this_ptr_conv;
46620         this_ptr_conv.inner = untag_ptr(this_ptr);
46621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46623         this_ptr_conv.is_owned = false;
46624         LDKCVec_RouteHopZ val_constr;
46625         val_constr.datalen = val->arr_len;
46626         if (val_constr.datalen > 0)
46627                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
46628         else
46629                 val_constr.data = NULL;
46630         uint64_t* val_vals = val->elems;
46631         for (size_t k = 0; k < val_constr.datalen; k++) {
46632                 uint64_t val_conv_10 = val_vals[k];
46633                 LDKRouteHop val_conv_10_conv;
46634                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
46635                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
46636                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
46637                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
46638                 val_constr.data[k] = val_conv_10_conv;
46639         }
46640         FREE(val);
46641         Path_set_hops(&this_ptr_conv, val_constr);
46642 }
46643
46644 uint64_t  __attribute__((export_name("TS_Path_get_blinded_tail"))) TS_Path_get_blinded_tail(uint64_t this_ptr) {
46645         LDKPath this_ptr_conv;
46646         this_ptr_conv.inner = untag_ptr(this_ptr);
46647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46649         this_ptr_conv.is_owned = false;
46650         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
46651         uint64_t ret_ref = 0;
46652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46654         return ret_ref;
46655 }
46656
46657 void  __attribute__((export_name("TS_Path_set_blinded_tail"))) TS_Path_set_blinded_tail(uint64_t this_ptr, uint64_t val) {
46658         LDKPath this_ptr_conv;
46659         this_ptr_conv.inner = untag_ptr(this_ptr);
46660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46662         this_ptr_conv.is_owned = false;
46663         LDKBlindedTail val_conv;
46664         val_conv.inner = untag_ptr(val);
46665         val_conv.is_owned = ptr_is_owned(val);
46666         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46667         val_conv = BlindedTail_clone(&val_conv);
46668         Path_set_blinded_tail(&this_ptr_conv, val_conv);
46669 }
46670
46671 uint64_t  __attribute__((export_name("TS_Path_new"))) TS_Path_new(uint64_tArray hops_arg, uint64_t blinded_tail_arg) {
46672         LDKCVec_RouteHopZ hops_arg_constr;
46673         hops_arg_constr.datalen = hops_arg->arr_len;
46674         if (hops_arg_constr.datalen > 0)
46675                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
46676         else
46677                 hops_arg_constr.data = NULL;
46678         uint64_t* hops_arg_vals = hops_arg->elems;
46679         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
46680                 uint64_t hops_arg_conv_10 = hops_arg_vals[k];
46681                 LDKRouteHop hops_arg_conv_10_conv;
46682                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
46683                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
46684                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
46685                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
46686                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
46687         }
46688         FREE(hops_arg);
46689         LDKBlindedTail blinded_tail_arg_conv;
46690         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
46691         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
46692         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
46693         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
46694         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
46695         uint64_t ret_ref = 0;
46696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46698         return ret_ref;
46699 }
46700
46701 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
46702         LDKPath ret_var = Path_clone(arg);
46703         uint64_t ret_ref = 0;
46704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46706         return ret_ref;
46707 }
46708 int64_t  __attribute__((export_name("TS_Path_clone_ptr"))) TS_Path_clone_ptr(uint64_t arg) {
46709         LDKPath arg_conv;
46710         arg_conv.inner = untag_ptr(arg);
46711         arg_conv.is_owned = ptr_is_owned(arg);
46712         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46713         arg_conv.is_owned = false;
46714         int64_t ret_conv = Path_clone_ptr(&arg_conv);
46715         return ret_conv;
46716 }
46717
46718 uint64_t  __attribute__((export_name("TS_Path_clone"))) TS_Path_clone(uint64_t orig) {
46719         LDKPath orig_conv;
46720         orig_conv.inner = untag_ptr(orig);
46721         orig_conv.is_owned = ptr_is_owned(orig);
46722         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46723         orig_conv.is_owned = false;
46724         LDKPath ret_var = Path_clone(&orig_conv);
46725         uint64_t ret_ref = 0;
46726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46728         return ret_ref;
46729 }
46730
46731 int64_t  __attribute__((export_name("TS_Path_hash"))) TS_Path_hash(uint64_t o) {
46732         LDKPath o_conv;
46733         o_conv.inner = untag_ptr(o);
46734         o_conv.is_owned = ptr_is_owned(o);
46735         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46736         o_conv.is_owned = false;
46737         int64_t ret_conv = Path_hash(&o_conv);
46738         return ret_conv;
46739 }
46740
46741 jboolean  __attribute__((export_name("TS_Path_eq"))) TS_Path_eq(uint64_t a, uint64_t b) {
46742         LDKPath a_conv;
46743         a_conv.inner = untag_ptr(a);
46744         a_conv.is_owned = ptr_is_owned(a);
46745         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46746         a_conv.is_owned = false;
46747         LDKPath b_conv;
46748         b_conv.inner = untag_ptr(b);
46749         b_conv.is_owned = ptr_is_owned(b);
46750         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46751         b_conv.is_owned = false;
46752         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
46753         return ret_conv;
46754 }
46755
46756 int64_t  __attribute__((export_name("TS_Path_fee_msat"))) TS_Path_fee_msat(uint64_t this_arg) {
46757         LDKPath this_arg_conv;
46758         this_arg_conv.inner = untag_ptr(this_arg);
46759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46761         this_arg_conv.is_owned = false;
46762         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
46763         return ret_conv;
46764 }
46765
46766 int64_t  __attribute__((export_name("TS_Path_final_value_msat"))) TS_Path_final_value_msat(uint64_t this_arg) {
46767         LDKPath this_arg_conv;
46768         this_arg_conv.inner = untag_ptr(this_arg);
46769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46771         this_arg_conv.is_owned = false;
46772         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
46773         return ret_conv;
46774 }
46775
46776 uint64_t  __attribute__((export_name("TS_Path_final_cltv_expiry_delta"))) TS_Path_final_cltv_expiry_delta(uint64_t this_arg) {
46777         LDKPath this_arg_conv;
46778         this_arg_conv.inner = untag_ptr(this_arg);
46779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46781         this_arg_conv.is_owned = false;
46782         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
46783         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
46784         uint64_t ret_ref = tag_ptr(ret_copy, true);
46785         return ret_ref;
46786 }
46787
46788 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
46789         LDKRoute this_obj_conv;
46790         this_obj_conv.inner = untag_ptr(this_obj);
46791         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46793         Route_free(this_obj_conv);
46794 }
46795
46796 uint64_tArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
46797         LDKRoute this_ptr_conv;
46798         this_ptr_conv.inner = untag_ptr(this_ptr);
46799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46801         this_ptr_conv.is_owned = false;
46802         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
46803         uint64_tArray ret_arr = NULL;
46804         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46805         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46806         for (size_t g = 0; g < ret_var.datalen; g++) {
46807                 LDKPath ret_conv_6_var = ret_var.data[g];
46808                 uint64_t ret_conv_6_ref = 0;
46809                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
46810                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
46811                 ret_arr_ptr[g] = ret_conv_6_ref;
46812         }
46813         
46814         FREE(ret_var.data);
46815         return ret_arr;
46816 }
46817
46818 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, uint64_tArray val) {
46819         LDKRoute this_ptr_conv;
46820         this_ptr_conv.inner = untag_ptr(this_ptr);
46821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46823         this_ptr_conv.is_owned = false;
46824         LDKCVec_PathZ val_constr;
46825         val_constr.datalen = val->arr_len;
46826         if (val_constr.datalen > 0)
46827                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
46828         else
46829                 val_constr.data = NULL;
46830         uint64_t* val_vals = val->elems;
46831         for (size_t g = 0; g < val_constr.datalen; g++) {
46832                 uint64_t val_conv_6 = val_vals[g];
46833                 LDKPath val_conv_6_conv;
46834                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
46835                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
46836                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
46837                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
46838                 val_constr.data[g] = val_conv_6_conv;
46839         }
46840         FREE(val);
46841         Route_set_paths(&this_ptr_conv, val_constr);
46842 }
46843
46844 uint64_t  __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint64_t this_ptr) {
46845         LDKRoute this_ptr_conv;
46846         this_ptr_conv.inner = untag_ptr(this_ptr);
46847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46849         this_ptr_conv.is_owned = false;
46850         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
46851         uint64_t ret_ref = 0;
46852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46854         return ret_ref;
46855 }
46856
46857 void  __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint64_t this_ptr, uint64_t val) {
46858         LDKRoute this_ptr_conv;
46859         this_ptr_conv.inner = untag_ptr(this_ptr);
46860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46862         this_ptr_conv.is_owned = false;
46863         LDKPaymentParameters val_conv;
46864         val_conv.inner = untag_ptr(val);
46865         val_conv.is_owned = ptr_is_owned(val);
46866         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46867         val_conv = PaymentParameters_clone(&val_conv);
46868         Route_set_payment_params(&this_ptr_conv, val_conv);
46869 }
46870
46871 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(uint64_tArray paths_arg, uint64_t payment_params_arg) {
46872         LDKCVec_PathZ paths_arg_constr;
46873         paths_arg_constr.datalen = paths_arg->arr_len;
46874         if (paths_arg_constr.datalen > 0)
46875                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
46876         else
46877                 paths_arg_constr.data = NULL;
46878         uint64_t* paths_arg_vals = paths_arg->elems;
46879         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
46880                 uint64_t paths_arg_conv_6 = paths_arg_vals[g];
46881                 LDKPath paths_arg_conv_6_conv;
46882                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
46883                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
46884                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
46885                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
46886                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
46887         }
46888         FREE(paths_arg);
46889         LDKPaymentParameters payment_params_arg_conv;
46890         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
46891         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
46892         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
46893         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
46894         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
46895         uint64_t ret_ref = 0;
46896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46898         return ret_ref;
46899 }
46900
46901 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
46902         LDKRoute ret_var = Route_clone(arg);
46903         uint64_t ret_ref = 0;
46904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46906         return ret_ref;
46907 }
46908 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
46909         LDKRoute arg_conv;
46910         arg_conv.inner = untag_ptr(arg);
46911         arg_conv.is_owned = ptr_is_owned(arg);
46912         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46913         arg_conv.is_owned = false;
46914         int64_t ret_conv = Route_clone_ptr(&arg_conv);
46915         return ret_conv;
46916 }
46917
46918 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
46919         LDKRoute orig_conv;
46920         orig_conv.inner = untag_ptr(orig);
46921         orig_conv.is_owned = ptr_is_owned(orig);
46922         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46923         orig_conv.is_owned = false;
46924         LDKRoute ret_var = Route_clone(&orig_conv);
46925         uint64_t ret_ref = 0;
46926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46928         return ret_ref;
46929 }
46930
46931 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
46932         LDKRoute o_conv;
46933         o_conv.inner = untag_ptr(o);
46934         o_conv.is_owned = ptr_is_owned(o);
46935         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46936         o_conv.is_owned = false;
46937         int64_t ret_conv = Route_hash(&o_conv);
46938         return ret_conv;
46939 }
46940
46941 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
46942         LDKRoute a_conv;
46943         a_conv.inner = untag_ptr(a);
46944         a_conv.is_owned = ptr_is_owned(a);
46945         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46946         a_conv.is_owned = false;
46947         LDKRoute b_conv;
46948         b_conv.inner = untag_ptr(b);
46949         b_conv.is_owned = ptr_is_owned(b);
46950         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46951         b_conv.is_owned = false;
46952         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
46953         return ret_conv;
46954 }
46955
46956 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
46957         LDKRoute this_arg_conv;
46958         this_arg_conv.inner = untag_ptr(this_arg);
46959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46961         this_arg_conv.is_owned = false;
46962         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
46963         return ret_conv;
46964 }
46965
46966 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
46967         LDKRoute this_arg_conv;
46968         this_arg_conv.inner = untag_ptr(this_arg);
46969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46971         this_arg_conv.is_owned = false;
46972         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
46973         return ret_conv;
46974 }
46975
46976 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
46977         LDKRoute obj_conv;
46978         obj_conv.inner = untag_ptr(obj);
46979         obj_conv.is_owned = ptr_is_owned(obj);
46980         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46981         obj_conv.is_owned = false;
46982         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
46983         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46984         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46985         CVec_u8Z_free(ret_var);
46986         return ret_arr;
46987 }
46988
46989 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
46990         LDKu8slice ser_ref;
46991         ser_ref.datalen = ser->arr_len;
46992         ser_ref.data = ser->elems;
46993         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
46994         *ret_conv = Route_read(ser_ref);
46995         FREE(ser);
46996         return tag_ptr(ret_conv, true);
46997 }
46998
46999 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
47000         LDKRouteParameters this_obj_conv;
47001         this_obj_conv.inner = untag_ptr(this_obj);
47002         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47004         RouteParameters_free(this_obj_conv);
47005 }
47006
47007 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
47008         LDKRouteParameters 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         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
47014         uint64_t ret_ref = 0;
47015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47017         return ret_ref;
47018 }
47019
47020 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
47021         LDKRouteParameters this_ptr_conv;
47022         this_ptr_conv.inner = untag_ptr(this_ptr);
47023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47025         this_ptr_conv.is_owned = false;
47026         LDKPaymentParameters val_conv;
47027         val_conv.inner = untag_ptr(val);
47028         val_conv.is_owned = ptr_is_owned(val);
47029         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47030         val_conv = PaymentParameters_clone(&val_conv);
47031         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
47032 }
47033
47034 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
47035         LDKRouteParameters this_ptr_conv;
47036         this_ptr_conv.inner = untag_ptr(this_ptr);
47037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47039         this_ptr_conv.is_owned = false;
47040         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
47041         return ret_conv;
47042 }
47043
47044 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
47045         LDKRouteParameters this_ptr_conv;
47046         this_ptr_conv.inner = untag_ptr(this_ptr);
47047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47049         this_ptr_conv.is_owned = false;
47050         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
47051 }
47052
47053 uint64_t  __attribute__((export_name("TS_RouteParameters_new"))) TS_RouteParameters_new(uint64_t payment_params_arg, int64_t final_value_msat_arg) {
47054         LDKPaymentParameters payment_params_arg_conv;
47055         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
47056         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
47057         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
47058         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
47059         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg);
47060         uint64_t ret_ref = 0;
47061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47063         return ret_ref;
47064 }
47065
47066 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
47067         LDKRouteParameters ret_var = RouteParameters_clone(arg);
47068         uint64_t ret_ref = 0;
47069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47071         return ret_ref;
47072 }
47073 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
47074         LDKRouteParameters arg_conv;
47075         arg_conv.inner = untag_ptr(arg);
47076         arg_conv.is_owned = ptr_is_owned(arg);
47077         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47078         arg_conv.is_owned = false;
47079         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
47080         return ret_conv;
47081 }
47082
47083 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
47084         LDKRouteParameters orig_conv;
47085         orig_conv.inner = untag_ptr(orig);
47086         orig_conv.is_owned = ptr_is_owned(orig);
47087         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47088         orig_conv.is_owned = false;
47089         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
47090         uint64_t ret_ref = 0;
47091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47093         return ret_ref;
47094 }
47095
47096 jboolean  __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) {
47097         LDKRouteParameters a_conv;
47098         a_conv.inner = untag_ptr(a);
47099         a_conv.is_owned = ptr_is_owned(a);
47100         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47101         a_conv.is_owned = false;
47102         LDKRouteParameters b_conv;
47103         b_conv.inner = untag_ptr(b);
47104         b_conv.is_owned = ptr_is_owned(b);
47105         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47106         b_conv.is_owned = false;
47107         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
47108         return ret_conv;
47109 }
47110
47111 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
47112         LDKRouteParameters obj_conv;
47113         obj_conv.inner = untag_ptr(obj);
47114         obj_conv.is_owned = ptr_is_owned(obj);
47115         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47116         obj_conv.is_owned = false;
47117         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
47118         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47119         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47120         CVec_u8Z_free(ret_var);
47121         return ret_arr;
47122 }
47123
47124 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
47125         LDKu8slice ser_ref;
47126         ser_ref.datalen = ser->arr_len;
47127         ser_ref.data = ser->elems;
47128         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
47129         *ret_conv = RouteParameters_read(ser_ref);
47130         FREE(ser);
47131         return tag_ptr(ret_conv, true);
47132 }
47133
47134 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
47135         LDKPaymentParameters this_obj_conv;
47136         this_obj_conv.inner = untag_ptr(this_obj);
47137         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47139         PaymentParameters_free(this_obj_conv);
47140 }
47141
47142 int8_tArray  __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint64_t this_ptr) {
47143         LDKPaymentParameters this_ptr_conv;
47144         this_ptr_conv.inner = untag_ptr(this_ptr);
47145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47147         this_ptr_conv.is_owned = false;
47148         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47149         memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
47150         return ret_arr;
47151 }
47152
47153 void  __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint64_t this_ptr, int8_tArray val) {
47154         LDKPaymentParameters this_ptr_conv;
47155         this_ptr_conv.inner = untag_ptr(this_ptr);
47156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47158         this_ptr_conv.is_owned = false;
47159         LDKPublicKey val_ref;
47160         CHECK(val->arr_len == 33);
47161         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47162         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
47163 }
47164
47165 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint64_t this_ptr) {
47166         LDKPaymentParameters this_ptr_conv;
47167         this_ptr_conv.inner = untag_ptr(this_ptr);
47168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47170         this_ptr_conv.is_owned = false;
47171         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
47172         uint64_t ret_ref = 0;
47173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47175         return ret_ref;
47176 }
47177
47178 void  __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint64_t this_ptr, uint64_t val) {
47179         LDKPaymentParameters this_ptr_conv;
47180         this_ptr_conv.inner = untag_ptr(this_ptr);
47181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47183         this_ptr_conv.is_owned = false;
47184         LDKInvoiceFeatures val_conv;
47185         val_conv.inner = untag_ptr(val);
47186         val_conv.is_owned = ptr_is_owned(val);
47187         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47188         val_conv = InvoiceFeatures_clone(&val_conv);
47189         PaymentParameters_set_features(&this_ptr_conv, val_conv);
47190 }
47191
47192 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint64_t this_ptr) {
47193         LDKPaymentParameters this_ptr_conv;
47194         this_ptr_conv.inner = untag_ptr(this_ptr);
47195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47197         this_ptr_conv.is_owned = false;
47198         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47199         *ret_copy = PaymentParameters_get_route_hints(&this_ptr_conv);
47200         uint64_t ret_ref = tag_ptr(ret_copy, true);
47201         return ret_ref;
47202 }
47203
47204 void  __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint64_t this_ptr, uint64_t val) {
47205         LDKPaymentParameters this_ptr_conv;
47206         this_ptr_conv.inner = untag_ptr(this_ptr);
47207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47209         this_ptr_conv.is_owned = false;
47210         void* val_ptr = untag_ptr(val);
47211         CHECK_ACCESS(val_ptr);
47212         LDKHints val_conv = *(LDKHints*)(val_ptr);
47213         val_conv = Hints_clone((LDKHints*)untag_ptr(val));
47214         PaymentParameters_set_route_hints(&this_ptr_conv, val_conv);
47215 }
47216
47217 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
47218         LDKPaymentParameters this_ptr_conv;
47219         this_ptr_conv.inner = untag_ptr(this_ptr);
47220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47222         this_ptr_conv.is_owned = false;
47223         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47224         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
47225         uint64_t ret_ref = tag_ptr(ret_copy, true);
47226         return ret_ref;
47227 }
47228
47229 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
47230         LDKPaymentParameters this_ptr_conv;
47231         this_ptr_conv.inner = untag_ptr(this_ptr);
47232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47234         this_ptr_conv.is_owned = false;
47235         void* val_ptr = untag_ptr(val);
47236         CHECK_ACCESS(val_ptr);
47237         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47238         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47239         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
47240 }
47241
47242 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) {
47243         LDKPaymentParameters this_ptr_conv;
47244         this_ptr_conv.inner = untag_ptr(this_ptr);
47245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47247         this_ptr_conv.is_owned = false;
47248         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
47249         return ret_conv;
47250 }
47251
47252 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) {
47253         LDKPaymentParameters this_ptr_conv;
47254         this_ptr_conv.inner = untag_ptr(this_ptr);
47255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47257         this_ptr_conv.is_owned = false;
47258         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
47259 }
47260
47261 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
47262         LDKPaymentParameters this_ptr_conv;
47263         this_ptr_conv.inner = untag_ptr(this_ptr);
47264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47266         this_ptr_conv.is_owned = false;
47267         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
47268         return ret_conv;
47269 }
47270
47271 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
47272         LDKPaymentParameters this_ptr_conv;
47273         this_ptr_conv.inner = untag_ptr(this_ptr);
47274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47276         this_ptr_conv.is_owned = false;
47277         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
47278 }
47279
47280 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) {
47281         LDKPaymentParameters this_ptr_conv;
47282         this_ptr_conv.inner = untag_ptr(this_ptr);
47283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47285         this_ptr_conv.is_owned = false;
47286         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
47287         return ret_conv;
47288 }
47289
47290 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) {
47291         LDKPaymentParameters this_ptr_conv;
47292         this_ptr_conv.inner = untag_ptr(this_ptr);
47293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47295         this_ptr_conv.is_owned = false;
47296         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
47297 }
47298
47299 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
47300         LDKPaymentParameters this_ptr_conv;
47301         this_ptr_conv.inner = untag_ptr(this_ptr);
47302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47304         this_ptr_conv.is_owned = false;
47305         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
47306         int64_tArray ret_arr = NULL;
47307         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
47308         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
47309         for (size_t i = 0; i < ret_var.datalen; i++) {
47310                 int64_t ret_conv_8_conv = ret_var.data[i];
47311                 ret_arr_ptr[i] = ret_conv_8_conv;
47312         }
47313         
47314         FREE(ret_var.data);
47315         return ret_arr;
47316 }
47317
47318 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
47319         LDKPaymentParameters this_ptr_conv;
47320         this_ptr_conv.inner = untag_ptr(this_ptr);
47321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47323         this_ptr_conv.is_owned = false;
47324         LDKCVec_u64Z val_constr;
47325         val_constr.datalen = val->arr_len;
47326         if (val_constr.datalen > 0)
47327                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
47328         else
47329                 val_constr.data = NULL;
47330         int64_t* val_vals = val->elems;
47331         for (size_t i = 0; i < val_constr.datalen; i++) {
47332                 int64_t val_conv_8 = val_vals[i];
47333                 val_constr.data[i] = val_conv_8;
47334         }
47335         FREE(val);
47336         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
47337 }
47338
47339 int32_t  __attribute__((export_name("TS_PaymentParameters_get_final_cltv_expiry_delta"))) TS_PaymentParameters_get_final_cltv_expiry_delta(uint64_t this_ptr) {
47340         LDKPaymentParameters this_ptr_conv;
47341         this_ptr_conv.inner = untag_ptr(this_ptr);
47342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47344         this_ptr_conv.is_owned = false;
47345         int32_t ret_conv = PaymentParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
47346         return ret_conv;
47347 }
47348
47349 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) {
47350         LDKPaymentParameters this_ptr_conv;
47351         this_ptr_conv.inner = untag_ptr(this_ptr);
47352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47354         this_ptr_conv.is_owned = false;
47355         PaymentParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
47356 }
47357
47358 uint64_t  __attribute__((export_name("TS_PaymentParameters_new"))) TS_PaymentParameters_new(int8_tArray payee_pubkey_arg, uint64_t features_arg, uint64_t 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) {
47359         LDKPublicKey payee_pubkey_arg_ref;
47360         CHECK(payee_pubkey_arg->arr_len == 33);
47361         memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
47362         LDKInvoiceFeatures features_arg_conv;
47363         features_arg_conv.inner = untag_ptr(features_arg);
47364         features_arg_conv.is_owned = ptr_is_owned(features_arg);
47365         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
47366         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
47367         void* route_hints_arg_ptr = untag_ptr(route_hints_arg);
47368         CHECK_ACCESS(route_hints_arg_ptr);
47369         LDKHints route_hints_arg_conv = *(LDKHints*)(route_hints_arg_ptr);
47370         route_hints_arg_conv = Hints_clone((LDKHints*)untag_ptr(route_hints_arg));
47371         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
47372         CHECK_ACCESS(expiry_time_arg_ptr);
47373         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
47374         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
47375         LDKCVec_u64Z previously_failed_channels_arg_constr;
47376         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
47377         if (previously_failed_channels_arg_constr.datalen > 0)
47378                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
47379         else
47380                 previously_failed_channels_arg_constr.data = NULL;
47381         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
47382         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
47383                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
47384                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
47385         }
47386         FREE(previously_failed_channels_arg);
47387         LDKPaymentParameters ret_var = PaymentParameters_new(payee_pubkey_arg_ref, features_arg_conv, route_hints_arg_conv, 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);
47388         uint64_t ret_ref = 0;
47389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47391         return ret_ref;
47392 }
47393
47394 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
47395         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
47396         uint64_t ret_ref = 0;
47397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47399         return ret_ref;
47400 }
47401 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
47402         LDKPaymentParameters arg_conv;
47403         arg_conv.inner = untag_ptr(arg);
47404         arg_conv.is_owned = ptr_is_owned(arg);
47405         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47406         arg_conv.is_owned = false;
47407         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
47408         return ret_conv;
47409 }
47410
47411 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
47412         LDKPaymentParameters orig_conv;
47413         orig_conv.inner = untag_ptr(orig);
47414         orig_conv.is_owned = ptr_is_owned(orig);
47415         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47416         orig_conv.is_owned = false;
47417         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
47418         uint64_t ret_ref = 0;
47419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47421         return ret_ref;
47422 }
47423
47424 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
47425         LDKPaymentParameters o_conv;
47426         o_conv.inner = untag_ptr(o);
47427         o_conv.is_owned = ptr_is_owned(o);
47428         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47429         o_conv.is_owned = false;
47430         int64_t ret_conv = PaymentParameters_hash(&o_conv);
47431         return ret_conv;
47432 }
47433
47434 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
47435         LDKPaymentParameters a_conv;
47436         a_conv.inner = untag_ptr(a);
47437         a_conv.is_owned = ptr_is_owned(a);
47438         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47439         a_conv.is_owned = false;
47440         LDKPaymentParameters b_conv;
47441         b_conv.inner = untag_ptr(b);
47442         b_conv.is_owned = ptr_is_owned(b);
47443         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47444         b_conv.is_owned = false;
47445         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
47446         return ret_conv;
47447 }
47448
47449 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
47450         LDKPaymentParameters obj_conv;
47451         obj_conv.inner = untag_ptr(obj);
47452         obj_conv.is_owned = ptr_is_owned(obj);
47453         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47454         obj_conv.is_owned = false;
47455         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
47456         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47457         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47458         CVec_u8Z_free(ret_var);
47459         return ret_arr;
47460 }
47461
47462 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) {
47463         LDKu8slice ser_ref;
47464         ser_ref.datalen = ser->arr_len;
47465         ser_ref.data = ser->elems;
47466         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
47467         *ret_conv = PaymentParameters_read(ser_ref, arg);
47468         FREE(ser);
47469         return tag_ptr(ret_conv, true);
47470 }
47471
47472 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) {
47473         LDKPublicKey payee_pubkey_ref;
47474         CHECK(payee_pubkey->arr_len == 33);
47475         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
47476         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
47477         uint64_t ret_ref = 0;
47478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47480         return ret_ref;
47481 }
47482
47483 uint64_t  __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) {
47484         LDKPublicKey payee_pubkey_ref;
47485         CHECK(payee_pubkey->arr_len == 33);
47486         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
47487         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta);
47488         uint64_t ret_ref = 0;
47489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47491         return ret_ref;
47492 }
47493
47494 void  __attribute__((export_name("TS_Hints_free"))) TS_Hints_free(uint64_t this_ptr) {
47495         if (!ptr_is_owned(this_ptr)) return;
47496         void* this_ptr_ptr = untag_ptr(this_ptr);
47497         CHECK_ACCESS(this_ptr_ptr);
47498         LDKHints this_ptr_conv = *(LDKHints*)(this_ptr_ptr);
47499         FREE(untag_ptr(this_ptr));
47500         Hints_free(this_ptr_conv);
47501 }
47502
47503 static inline uint64_t Hints_clone_ptr(LDKHints *NONNULL_PTR arg) {
47504         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47505         *ret_copy = Hints_clone(arg);
47506         uint64_t ret_ref = tag_ptr(ret_copy, true);
47507         return ret_ref;
47508 }
47509 int64_t  __attribute__((export_name("TS_Hints_clone_ptr"))) TS_Hints_clone_ptr(uint64_t arg) {
47510         LDKHints* arg_conv = (LDKHints*)untag_ptr(arg);
47511         int64_t ret_conv = Hints_clone_ptr(arg_conv);
47512         return ret_conv;
47513 }
47514
47515 uint64_t  __attribute__((export_name("TS_Hints_clone"))) TS_Hints_clone(uint64_t orig) {
47516         LDKHints* orig_conv = (LDKHints*)untag_ptr(orig);
47517         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47518         *ret_copy = Hints_clone(orig_conv);
47519         uint64_t ret_ref = tag_ptr(ret_copy, true);
47520         return ret_ref;
47521 }
47522
47523 uint64_t  __attribute__((export_name("TS_Hints_blinded"))) TS_Hints_blinded(uint64_tArray a) {
47524         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ a_constr;
47525         a_constr.datalen = a->arr_len;
47526         if (a_constr.datalen > 0)
47527                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
47528         else
47529                 a_constr.data = NULL;
47530         uint64_t* a_vals = a->elems;
47531         for (size_t l = 0; l < a_constr.datalen; l++) {
47532                 uint64_t a_conv_37 = a_vals[l];
47533                 void* a_conv_37_ptr = untag_ptr(a_conv_37);
47534                 CHECK_ACCESS(a_conv_37_ptr);
47535                 LDKC2Tuple_BlindedPayInfoBlindedPathZ a_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(a_conv_37_ptr);
47536                 a_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(a_conv_37));
47537                 a_constr.data[l] = a_conv_37_conv;
47538         }
47539         FREE(a);
47540         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47541         *ret_copy = Hints_blinded(a_constr);
47542         uint64_t ret_ref = tag_ptr(ret_copy, true);
47543         return ret_ref;
47544 }
47545
47546 uint64_t  __attribute__((export_name("TS_Hints_clear"))) TS_Hints_clear(uint64_tArray a) {
47547         LDKCVec_RouteHintZ a_constr;
47548         a_constr.datalen = a->arr_len;
47549         if (a_constr.datalen > 0)
47550                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
47551         else
47552                 a_constr.data = NULL;
47553         uint64_t* a_vals = a->elems;
47554         for (size_t l = 0; l < a_constr.datalen; l++) {
47555                 uint64_t a_conv_11 = a_vals[l];
47556                 LDKRouteHint a_conv_11_conv;
47557                 a_conv_11_conv.inner = untag_ptr(a_conv_11);
47558                 a_conv_11_conv.is_owned = ptr_is_owned(a_conv_11);
47559                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv_11_conv);
47560                 a_conv_11_conv = RouteHint_clone(&a_conv_11_conv);
47561                 a_constr.data[l] = a_conv_11_conv;
47562         }
47563         FREE(a);
47564         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47565         *ret_copy = Hints_clear(a_constr);
47566         uint64_t ret_ref = tag_ptr(ret_copy, true);
47567         return ret_ref;
47568 }
47569
47570 int64_t  __attribute__((export_name("TS_Hints_hash"))) TS_Hints_hash(uint64_t o) {
47571         LDKHints* o_conv = (LDKHints*)untag_ptr(o);
47572         int64_t ret_conv = Hints_hash(o_conv);
47573         return ret_conv;
47574 }
47575
47576 jboolean  __attribute__((export_name("TS_Hints_eq"))) TS_Hints_eq(uint64_t a, uint64_t b) {
47577         LDKHints* a_conv = (LDKHints*)untag_ptr(a);
47578         LDKHints* b_conv = (LDKHints*)untag_ptr(b);
47579         jboolean ret_conv = Hints_eq(a_conv, b_conv);
47580         return ret_conv;
47581 }
47582
47583 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
47584         LDKRouteHint this_obj_conv;
47585         this_obj_conv.inner = untag_ptr(this_obj);
47586         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47588         RouteHint_free(this_obj_conv);
47589 }
47590
47591 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
47592         LDKRouteHint this_ptr_conv;
47593         this_ptr_conv.inner = untag_ptr(this_ptr);
47594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47596         this_ptr_conv.is_owned = false;
47597         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
47598         uint64_tArray ret_arr = NULL;
47599         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
47600         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
47601         for (size_t o = 0; o < ret_var.datalen; o++) {
47602                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
47603                 uint64_t ret_conv_14_ref = 0;
47604                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
47605                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
47606                 ret_arr_ptr[o] = ret_conv_14_ref;
47607         }
47608         
47609         FREE(ret_var.data);
47610         return ret_arr;
47611 }
47612
47613 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
47614         LDKRouteHint this_ptr_conv;
47615         this_ptr_conv.inner = untag_ptr(this_ptr);
47616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47618         this_ptr_conv.is_owned = false;
47619         LDKCVec_RouteHintHopZ val_constr;
47620         val_constr.datalen = val->arr_len;
47621         if (val_constr.datalen > 0)
47622                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
47623         else
47624                 val_constr.data = NULL;
47625         uint64_t* val_vals = val->elems;
47626         for (size_t o = 0; o < val_constr.datalen; o++) {
47627                 uint64_t val_conv_14 = val_vals[o];
47628                 LDKRouteHintHop val_conv_14_conv;
47629                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
47630                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
47631                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
47632                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
47633                 val_constr.data[o] = val_conv_14_conv;
47634         }
47635         FREE(val);
47636         RouteHint_set_a(&this_ptr_conv, val_constr);
47637 }
47638
47639 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
47640         LDKCVec_RouteHintHopZ a_arg_constr;
47641         a_arg_constr.datalen = a_arg->arr_len;
47642         if (a_arg_constr.datalen > 0)
47643                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
47644         else
47645                 a_arg_constr.data = NULL;
47646         uint64_t* a_arg_vals = a_arg->elems;
47647         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
47648                 uint64_t a_arg_conv_14 = a_arg_vals[o];
47649                 LDKRouteHintHop a_arg_conv_14_conv;
47650                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
47651                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
47652                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
47653                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
47654                 a_arg_constr.data[o] = a_arg_conv_14_conv;
47655         }
47656         FREE(a_arg);
47657         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
47658         uint64_t ret_ref = 0;
47659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47661         return ret_ref;
47662 }
47663
47664 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
47665         LDKRouteHint ret_var = RouteHint_clone(arg);
47666         uint64_t ret_ref = 0;
47667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47669         return ret_ref;
47670 }
47671 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
47672         LDKRouteHint arg_conv;
47673         arg_conv.inner = untag_ptr(arg);
47674         arg_conv.is_owned = ptr_is_owned(arg);
47675         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47676         arg_conv.is_owned = false;
47677         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
47678         return ret_conv;
47679 }
47680
47681 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
47682         LDKRouteHint orig_conv;
47683         orig_conv.inner = untag_ptr(orig);
47684         orig_conv.is_owned = ptr_is_owned(orig);
47685         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47686         orig_conv.is_owned = false;
47687         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
47688         uint64_t ret_ref = 0;
47689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47691         return ret_ref;
47692 }
47693
47694 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
47695         LDKRouteHint o_conv;
47696         o_conv.inner = untag_ptr(o);
47697         o_conv.is_owned = ptr_is_owned(o);
47698         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47699         o_conv.is_owned = false;
47700         int64_t ret_conv = RouteHint_hash(&o_conv);
47701         return ret_conv;
47702 }
47703
47704 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
47705         LDKRouteHint a_conv;
47706         a_conv.inner = untag_ptr(a);
47707         a_conv.is_owned = ptr_is_owned(a);
47708         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47709         a_conv.is_owned = false;
47710         LDKRouteHint b_conv;
47711         b_conv.inner = untag_ptr(b);
47712         b_conv.is_owned = ptr_is_owned(b);
47713         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47714         b_conv.is_owned = false;
47715         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
47716         return ret_conv;
47717 }
47718
47719 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
47720         LDKRouteHint obj_conv;
47721         obj_conv.inner = untag_ptr(obj);
47722         obj_conv.is_owned = ptr_is_owned(obj);
47723         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47724         obj_conv.is_owned = false;
47725         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
47726         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47727         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47728         CVec_u8Z_free(ret_var);
47729         return ret_arr;
47730 }
47731
47732 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
47733         LDKu8slice ser_ref;
47734         ser_ref.datalen = ser->arr_len;
47735         ser_ref.data = ser->elems;
47736         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
47737         *ret_conv = RouteHint_read(ser_ref);
47738         FREE(ser);
47739         return tag_ptr(ret_conv, true);
47740 }
47741
47742 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
47743         LDKRouteHintHop this_obj_conv;
47744         this_obj_conv.inner = untag_ptr(this_obj);
47745         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47747         RouteHintHop_free(this_obj_conv);
47748 }
47749
47750 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
47751         LDKRouteHintHop this_ptr_conv;
47752         this_ptr_conv.inner = untag_ptr(this_ptr);
47753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47755         this_ptr_conv.is_owned = false;
47756         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47757         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
47758         return ret_arr;
47759 }
47760
47761 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
47762         LDKRouteHintHop this_ptr_conv;
47763         this_ptr_conv.inner = untag_ptr(this_ptr);
47764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47766         this_ptr_conv.is_owned = false;
47767         LDKPublicKey val_ref;
47768         CHECK(val->arr_len == 33);
47769         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47770         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
47771 }
47772
47773 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
47774         LDKRouteHintHop this_ptr_conv;
47775         this_ptr_conv.inner = untag_ptr(this_ptr);
47776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47778         this_ptr_conv.is_owned = false;
47779         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
47780         return ret_conv;
47781 }
47782
47783 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
47784         LDKRouteHintHop this_ptr_conv;
47785         this_ptr_conv.inner = untag_ptr(this_ptr);
47786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47788         this_ptr_conv.is_owned = false;
47789         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
47790 }
47791
47792 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
47793         LDKRouteHintHop this_ptr_conv;
47794         this_ptr_conv.inner = untag_ptr(this_ptr);
47795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47797         this_ptr_conv.is_owned = false;
47798         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
47799         uint64_t ret_ref = 0;
47800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47802         return ret_ref;
47803 }
47804
47805 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
47806         LDKRouteHintHop this_ptr_conv;
47807         this_ptr_conv.inner = untag_ptr(this_ptr);
47808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47810         this_ptr_conv.is_owned = false;
47811         LDKRoutingFees val_conv;
47812         val_conv.inner = untag_ptr(val);
47813         val_conv.is_owned = ptr_is_owned(val);
47814         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47815         val_conv = RoutingFees_clone(&val_conv);
47816         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
47817 }
47818
47819 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
47820         LDKRouteHintHop this_ptr_conv;
47821         this_ptr_conv.inner = untag_ptr(this_ptr);
47822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47824         this_ptr_conv.is_owned = false;
47825         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
47826         return ret_conv;
47827 }
47828
47829 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
47830         LDKRouteHintHop this_ptr_conv;
47831         this_ptr_conv.inner = untag_ptr(this_ptr);
47832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47834         this_ptr_conv.is_owned = false;
47835         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
47836 }
47837
47838 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
47839         LDKRouteHintHop this_ptr_conv;
47840         this_ptr_conv.inner = untag_ptr(this_ptr);
47841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47843         this_ptr_conv.is_owned = false;
47844         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47845         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
47846         uint64_t ret_ref = tag_ptr(ret_copy, true);
47847         return ret_ref;
47848 }
47849
47850 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
47851         LDKRouteHintHop this_ptr_conv;
47852         this_ptr_conv.inner = untag_ptr(this_ptr);
47853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47855         this_ptr_conv.is_owned = false;
47856         void* val_ptr = untag_ptr(val);
47857         CHECK_ACCESS(val_ptr);
47858         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47859         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47860         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
47861 }
47862
47863 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
47864         LDKRouteHintHop this_ptr_conv;
47865         this_ptr_conv.inner = untag_ptr(this_ptr);
47866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47868         this_ptr_conv.is_owned = false;
47869         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47870         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
47871         uint64_t ret_ref = tag_ptr(ret_copy, true);
47872         return ret_ref;
47873 }
47874
47875 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
47876         LDKRouteHintHop this_ptr_conv;
47877         this_ptr_conv.inner = untag_ptr(this_ptr);
47878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47880         this_ptr_conv.is_owned = false;
47881         void* val_ptr = untag_ptr(val);
47882         CHECK_ACCESS(val_ptr);
47883         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47884         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47885         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
47886 }
47887
47888 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) {
47889         LDKPublicKey src_node_id_arg_ref;
47890         CHECK(src_node_id_arg->arr_len == 33);
47891         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
47892         LDKRoutingFees fees_arg_conv;
47893         fees_arg_conv.inner = untag_ptr(fees_arg);
47894         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
47895         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
47896         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
47897         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
47898         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
47899         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
47900         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
47901         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
47902         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
47903         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
47904         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
47905         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);
47906         uint64_t ret_ref = 0;
47907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47909         return ret_ref;
47910 }
47911
47912 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
47913         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
47914         uint64_t ret_ref = 0;
47915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47917         return ret_ref;
47918 }
47919 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
47920         LDKRouteHintHop arg_conv;
47921         arg_conv.inner = untag_ptr(arg);
47922         arg_conv.is_owned = ptr_is_owned(arg);
47923         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47924         arg_conv.is_owned = false;
47925         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
47926         return ret_conv;
47927 }
47928
47929 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
47930         LDKRouteHintHop orig_conv;
47931         orig_conv.inner = untag_ptr(orig);
47932         orig_conv.is_owned = ptr_is_owned(orig);
47933         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47934         orig_conv.is_owned = false;
47935         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
47936         uint64_t ret_ref = 0;
47937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47939         return ret_ref;
47940 }
47941
47942 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
47943         LDKRouteHintHop o_conv;
47944         o_conv.inner = untag_ptr(o);
47945         o_conv.is_owned = ptr_is_owned(o);
47946         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47947         o_conv.is_owned = false;
47948         int64_t ret_conv = RouteHintHop_hash(&o_conv);
47949         return ret_conv;
47950 }
47951
47952 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
47953         LDKRouteHintHop a_conv;
47954         a_conv.inner = untag_ptr(a);
47955         a_conv.is_owned = ptr_is_owned(a);
47956         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47957         a_conv.is_owned = false;
47958         LDKRouteHintHop b_conv;
47959         b_conv.inner = untag_ptr(b);
47960         b_conv.is_owned = ptr_is_owned(b);
47961         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47962         b_conv.is_owned = false;
47963         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
47964         return ret_conv;
47965 }
47966
47967 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
47968         LDKRouteHintHop obj_conv;
47969         obj_conv.inner = untag_ptr(obj);
47970         obj_conv.is_owned = ptr_is_owned(obj);
47971         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47972         obj_conv.is_owned = false;
47973         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
47974         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47975         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47976         CVec_u8Z_free(ret_var);
47977         return ret_arr;
47978 }
47979
47980 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
47981         LDKu8slice ser_ref;
47982         ser_ref.datalen = ser->arr_len;
47983         ser_ref.data = ser->elems;
47984         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
47985         *ret_conv = RouteHintHop_read(ser_ref);
47986         FREE(ser);
47987         return tag_ptr(ret_conv, true);
47988 }
47989
47990 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) {
47991         LDKPublicKey our_node_pubkey_ref;
47992         CHECK(our_node_pubkey->arr_len == 33);
47993         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
47994         LDKRouteParameters route_params_conv;
47995         route_params_conv.inner = untag_ptr(route_params);
47996         route_params_conv.is_owned = ptr_is_owned(route_params);
47997         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
47998         route_params_conv.is_owned = false;
47999         LDKNetworkGraph network_graph_conv;
48000         network_graph_conv.inner = untag_ptr(network_graph);
48001         network_graph_conv.is_owned = ptr_is_owned(network_graph);
48002         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
48003         network_graph_conv.is_owned = false;
48004         LDKCVec_ChannelDetailsZ first_hops_constr;
48005         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
48006         if (first_hops != 0) {
48007                 first_hops_constr.datalen = first_hops->arr_len;
48008                 if (first_hops_constr.datalen > 0)
48009                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
48010                 else
48011                         first_hops_constr.data = NULL;
48012                 uint64_t* first_hops_vals = first_hops->elems;
48013                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
48014                         uint64_t first_hops_conv_16 = first_hops_vals[q];
48015                         LDKChannelDetails first_hops_conv_16_conv;
48016                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
48017                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
48018                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
48019                         first_hops_conv_16_conv.is_owned = false;
48020                         first_hops_constr.data[q] = first_hops_conv_16_conv;
48021                 }
48022                 FREE(first_hops);
48023                 first_hops_ptr = &first_hops_constr;
48024         }
48025         void* logger_ptr = untag_ptr(logger);
48026         CHECK_ACCESS(logger_ptr);
48027         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48028         if (logger_conv.free == LDKLogger_JCalls_free) {
48029                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48030                 LDKLogger_JCalls_cloned(&logger_conv);
48031         }
48032         void* scorer_ptr = untag_ptr(scorer);
48033         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
48034         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
48035         uint8_t random_seed_bytes_arr[32];
48036         CHECK(random_seed_bytes->arr_len == 32);
48037         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
48038         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
48039         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
48040         *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);
48041         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
48042         return tag_ptr(ret_conv, true);
48043 }
48044
48045 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) {
48046         LDKPublicKey our_node_pubkey_ref;
48047         CHECK(our_node_pubkey->arr_len == 33);
48048         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
48049         LDKCVec_PublicKeyZ hops_constr;
48050         hops_constr.datalen = hops->arr_len;
48051         if (hops_constr.datalen > 0)
48052                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
48053         else
48054                 hops_constr.data = NULL;
48055         int8_tArray* hops_vals = (void*) hops->elems;
48056         for (size_t m = 0; m < hops_constr.datalen; m++) {
48057                 int8_tArray hops_conv_12 = hops_vals[m];
48058                 LDKPublicKey hops_conv_12_ref;
48059                 CHECK(hops_conv_12->arr_len == 33);
48060                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
48061                 hops_constr.data[m] = hops_conv_12_ref;
48062         }
48063         FREE(hops);
48064         LDKRouteParameters route_params_conv;
48065         route_params_conv.inner = untag_ptr(route_params);
48066         route_params_conv.is_owned = ptr_is_owned(route_params);
48067         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
48068         route_params_conv.is_owned = false;
48069         LDKNetworkGraph network_graph_conv;
48070         network_graph_conv.inner = untag_ptr(network_graph);
48071         network_graph_conv.is_owned = ptr_is_owned(network_graph);
48072         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
48073         network_graph_conv.is_owned = false;
48074         void* logger_ptr = untag_ptr(logger);
48075         CHECK_ACCESS(logger_ptr);
48076         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48077         if (logger_conv.free == LDKLogger_JCalls_free) {
48078                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48079                 LDKLogger_JCalls_cloned(&logger_conv);
48080         }
48081         uint8_t random_seed_bytes_arr[32];
48082         CHECK(random_seed_bytes->arr_len == 32);
48083         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
48084         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
48085         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
48086         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
48087         return tag_ptr(ret_conv, true);
48088 }
48089
48090 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
48091         if (!ptr_is_owned(this_ptr)) return;
48092         void* this_ptr_ptr = untag_ptr(this_ptr);
48093         CHECK_ACCESS(this_ptr_ptr);
48094         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
48095         FREE(untag_ptr(this_ptr));
48096         Score_free(this_ptr_conv);
48097 }
48098
48099 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
48100         if (!ptr_is_owned(this_ptr)) return;
48101         void* this_ptr_ptr = untag_ptr(this_ptr);
48102         CHECK_ACCESS(this_ptr_ptr);
48103         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
48104         FREE(untag_ptr(this_ptr));
48105         LockableScore_free(this_ptr_conv);
48106 }
48107
48108 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
48109         if (!ptr_is_owned(this_ptr)) return;
48110         void* this_ptr_ptr = untag_ptr(this_ptr);
48111         CHECK_ACCESS(this_ptr_ptr);
48112         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
48113         FREE(untag_ptr(this_ptr));
48114         WriteableScore_free(this_ptr_conv);
48115 }
48116
48117 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
48118         LDKMultiThreadedLockableScore this_obj_conv;
48119         this_obj_conv.inner = untag_ptr(this_obj);
48120         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48122         MultiThreadedLockableScore_free(this_obj_conv);
48123 }
48124
48125 void  __attribute__((export_name("TS_MultiThreadedScoreLock_free"))) TS_MultiThreadedScoreLock_free(uint64_t this_obj) {
48126         LDKMultiThreadedScoreLock this_obj_conv;
48127         this_obj_conv.inner = untag_ptr(this_obj);
48128         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48130         MultiThreadedScoreLock_free(this_obj_conv);
48131 }
48132
48133 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLock_as_Score"))) TS_MultiThreadedScoreLock_as_Score(uint64_t this_arg) {
48134         LDKMultiThreadedScoreLock this_arg_conv;
48135         this_arg_conv.inner = untag_ptr(this_arg);
48136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48138         this_arg_conv.is_owned = false;
48139         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
48140         *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
48141         return tag_ptr(ret_ret, true);
48142 }
48143
48144 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLock_write"))) TS_MultiThreadedScoreLock_write(uint64_t obj) {
48145         LDKMultiThreadedScoreLock obj_conv;
48146         obj_conv.inner = untag_ptr(obj);
48147         obj_conv.is_owned = ptr_is_owned(obj);
48148         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48149         obj_conv.is_owned = false;
48150         LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
48151         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48152         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48153         CVec_u8Z_free(ret_var);
48154         return ret_arr;
48155 }
48156
48157 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
48158         LDKMultiThreadedLockableScore this_arg_conv;
48159         this_arg_conv.inner = untag_ptr(this_arg);
48160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48162         this_arg_conv.is_owned = false;
48163         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
48164         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
48165         return tag_ptr(ret_ret, true);
48166 }
48167
48168 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
48169         LDKMultiThreadedLockableScore obj_conv;
48170         obj_conv.inner = untag_ptr(obj);
48171         obj_conv.is_owned = ptr_is_owned(obj);
48172         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48173         obj_conv.is_owned = false;
48174         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
48175         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48176         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48177         CVec_u8Z_free(ret_var);
48178         return ret_arr;
48179 }
48180
48181 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
48182         LDKMultiThreadedLockableScore this_arg_conv;
48183         this_arg_conv.inner = untag_ptr(this_arg);
48184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48186         this_arg_conv.is_owned = false;
48187         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
48188         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
48189         return tag_ptr(ret_ret, true);
48190 }
48191
48192 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
48193         void* score_ptr = untag_ptr(score);
48194         CHECK_ACCESS(score_ptr);
48195         LDKScore score_conv = *(LDKScore*)(score_ptr);
48196         if (score_conv.free == LDKScore_JCalls_free) {
48197                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48198                 LDKScore_JCalls_cloned(&score_conv);
48199         }
48200         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
48201         uint64_t ret_ref = 0;
48202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48204         return ret_ref;
48205 }
48206
48207 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
48208         LDKChannelUsage this_obj_conv;
48209         this_obj_conv.inner = untag_ptr(this_obj);
48210         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48212         ChannelUsage_free(this_obj_conv);
48213 }
48214
48215 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
48216         LDKChannelUsage this_ptr_conv;
48217         this_ptr_conv.inner = untag_ptr(this_ptr);
48218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48220         this_ptr_conv.is_owned = false;
48221         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
48222         return ret_conv;
48223 }
48224
48225 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
48226         LDKChannelUsage this_ptr_conv;
48227         this_ptr_conv.inner = untag_ptr(this_ptr);
48228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48230         this_ptr_conv.is_owned = false;
48231         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
48232 }
48233
48234 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
48235         LDKChannelUsage this_ptr_conv;
48236         this_ptr_conv.inner = untag_ptr(this_ptr);
48237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48239         this_ptr_conv.is_owned = false;
48240         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
48241         return ret_conv;
48242 }
48243
48244 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
48245         LDKChannelUsage this_ptr_conv;
48246         this_ptr_conv.inner = untag_ptr(this_ptr);
48247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48249         this_ptr_conv.is_owned = false;
48250         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
48251 }
48252
48253 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
48254         LDKChannelUsage this_ptr_conv;
48255         this_ptr_conv.inner = untag_ptr(this_ptr);
48256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48258         this_ptr_conv.is_owned = false;
48259         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
48260         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
48261         uint64_t ret_ref = tag_ptr(ret_copy, true);
48262         return ret_ref;
48263 }
48264
48265 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
48266         LDKChannelUsage this_ptr_conv;
48267         this_ptr_conv.inner = untag_ptr(this_ptr);
48268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48270         this_ptr_conv.is_owned = false;
48271         void* val_ptr = untag_ptr(val);
48272         CHECK_ACCESS(val_ptr);
48273         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
48274         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
48275         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
48276 }
48277
48278 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) {
48279         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
48280         CHECK_ACCESS(effective_capacity_arg_ptr);
48281         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
48282         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
48283         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
48284         uint64_t ret_ref = 0;
48285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48287         return ret_ref;
48288 }
48289
48290 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
48291         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
48292         uint64_t ret_ref = 0;
48293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48295         return ret_ref;
48296 }
48297 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
48298         LDKChannelUsage arg_conv;
48299         arg_conv.inner = untag_ptr(arg);
48300         arg_conv.is_owned = ptr_is_owned(arg);
48301         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48302         arg_conv.is_owned = false;
48303         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
48304         return ret_conv;
48305 }
48306
48307 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
48308         LDKChannelUsage orig_conv;
48309         orig_conv.inner = untag_ptr(orig);
48310         orig_conv.is_owned = ptr_is_owned(orig);
48311         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48312         orig_conv.is_owned = false;
48313         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
48314         uint64_t ret_ref = 0;
48315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48317         return ret_ref;
48318 }
48319
48320 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
48321         LDKFixedPenaltyScorer this_obj_conv;
48322         this_obj_conv.inner = untag_ptr(this_obj);
48323         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48325         FixedPenaltyScorer_free(this_obj_conv);
48326 }
48327
48328 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
48329         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
48330         uint64_t ret_ref = 0;
48331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48333         return ret_ref;
48334 }
48335 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
48336         LDKFixedPenaltyScorer arg_conv;
48337         arg_conv.inner = untag_ptr(arg);
48338         arg_conv.is_owned = ptr_is_owned(arg);
48339         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48340         arg_conv.is_owned = false;
48341         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
48342         return ret_conv;
48343 }
48344
48345 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
48346         LDKFixedPenaltyScorer orig_conv;
48347         orig_conv.inner = untag_ptr(orig);
48348         orig_conv.is_owned = ptr_is_owned(orig);
48349         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48350         orig_conv.is_owned = false;
48351         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
48352         uint64_t ret_ref = 0;
48353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48355         return ret_ref;
48356 }
48357
48358 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
48359         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
48360         uint64_t ret_ref = 0;
48361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48363         return ret_ref;
48364 }
48365
48366 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint64_t this_arg) {
48367         LDKFixedPenaltyScorer this_arg_conv;
48368         this_arg_conv.inner = untag_ptr(this_arg);
48369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48371         this_arg_conv.is_owned = false;
48372         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
48373         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
48374         return tag_ptr(ret_ret, true);
48375 }
48376
48377 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
48378         LDKFixedPenaltyScorer obj_conv;
48379         obj_conv.inner = untag_ptr(obj);
48380         obj_conv.is_owned = ptr_is_owned(obj);
48381         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48382         obj_conv.is_owned = false;
48383         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
48384         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48385         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48386         CVec_u8Z_free(ret_var);
48387         return ret_arr;
48388 }
48389
48390 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
48391         LDKu8slice ser_ref;
48392         ser_ref.datalen = ser->arr_len;
48393         ser_ref.data = ser->elems;
48394         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
48395         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
48396         FREE(ser);
48397         return tag_ptr(ret_conv, true);
48398 }
48399
48400 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
48401         LDKProbabilisticScorer this_obj_conv;
48402         this_obj_conv.inner = untag_ptr(this_obj);
48403         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48405         ProbabilisticScorer_free(this_obj_conv);
48406 }
48407
48408 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint64_t this_obj) {
48409         LDKProbabilisticScoringParameters this_obj_conv;
48410         this_obj_conv.inner = untag_ptr(this_obj);
48411         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48413         ProbabilisticScoringParameters_free(this_obj_conv);
48414 }
48415
48416 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint64_t this_ptr) {
48417         LDKProbabilisticScoringParameters this_ptr_conv;
48418         this_ptr_conv.inner = untag_ptr(this_ptr);
48419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48421         this_ptr_conv.is_owned = false;
48422         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
48423         return ret_conv;
48424 }
48425
48426 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
48427         LDKProbabilisticScoringParameters this_ptr_conv;
48428         this_ptr_conv.inner = untag_ptr(this_ptr);
48429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48431         this_ptr_conv.is_owned = false;
48432         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
48433 }
48434
48435 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) {
48436         LDKProbabilisticScoringParameters this_ptr_conv;
48437         this_ptr_conv.inner = untag_ptr(this_ptr);
48438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48440         this_ptr_conv.is_owned = false;
48441         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
48442         return ret_conv;
48443 }
48444
48445 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) {
48446         LDKProbabilisticScoringParameters this_ptr_conv;
48447         this_ptr_conv.inner = untag_ptr(this_ptr);
48448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48450         this_ptr_conv.is_owned = false;
48451         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
48452 }
48453
48454 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
48455         LDKProbabilisticScoringParameters this_ptr_conv;
48456         this_ptr_conv.inner = untag_ptr(this_ptr);
48457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48459         this_ptr_conv.is_owned = false;
48460         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
48461         return ret_conv;
48462 }
48463
48464 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) {
48465         LDKProbabilisticScoringParameters this_ptr_conv;
48466         this_ptr_conv.inner = untag_ptr(this_ptr);
48467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48469         this_ptr_conv.is_owned = false;
48470         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
48471 }
48472
48473 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
48474         LDKProbabilisticScoringParameters this_ptr_conv;
48475         this_ptr_conv.inner = untag_ptr(this_ptr);
48476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48478         this_ptr_conv.is_owned = false;
48479         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
48480         return ret_conv;
48481 }
48482
48483 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) {
48484         LDKProbabilisticScoringParameters this_ptr_conv;
48485         this_ptr_conv.inner = untag_ptr(this_ptr);
48486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48488         this_ptr_conv.is_owned = false;
48489         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
48490 }
48491
48492 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) {
48493         LDKProbabilisticScoringParameters 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         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
48499         return ret_conv;
48500 }
48501
48502 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) {
48503         LDKProbabilisticScoringParameters this_ptr_conv;
48504         this_ptr_conv.inner = untag_ptr(this_ptr);
48505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48507         this_ptr_conv.is_owned = false;
48508         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
48509 }
48510
48511 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) {
48512         LDKProbabilisticScoringParameters this_ptr_conv;
48513         this_ptr_conv.inner = untag_ptr(this_ptr);
48514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48516         this_ptr_conv.is_owned = false;
48517         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
48518         return ret_conv;
48519 }
48520
48521 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) {
48522         LDKProbabilisticScoringParameters this_ptr_conv;
48523         this_ptr_conv.inner = untag_ptr(this_ptr);
48524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48526         this_ptr_conv.is_owned = false;
48527         ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
48528 }
48529
48530 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) {
48531         LDKProbabilisticScoringParameters this_ptr_conv;
48532         this_ptr_conv.inner = untag_ptr(this_ptr);
48533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48535         this_ptr_conv.is_owned = false;
48536         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
48537         return ret_conv;
48538 }
48539
48540 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) {
48541         LDKProbabilisticScoringParameters this_ptr_conv;
48542         this_ptr_conv.inner = untag_ptr(this_ptr);
48543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48545         this_ptr_conv.is_owned = false;
48546         ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
48547 }
48548
48549 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) {
48550         LDKProbabilisticScoringParameters this_ptr_conv;
48551         this_ptr_conv.inner = untag_ptr(this_ptr);
48552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48554         this_ptr_conv.is_owned = false;
48555         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_no_updates_half_life(&this_ptr_conv);
48556         return ret_conv;
48557 }
48558
48559 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) {
48560         LDKProbabilisticScoringParameters this_ptr_conv;
48561         this_ptr_conv.inner = untag_ptr(this_ptr);
48562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48564         this_ptr_conv.is_owned = false;
48565         ProbabilisticScoringParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
48566 }
48567
48568 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
48569         LDKProbabilisticScoringParameters this_ptr_conv;
48570         this_ptr_conv.inner = untag_ptr(this_ptr);
48571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48573         this_ptr_conv.is_owned = false;
48574         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
48575         return ret_conv;
48576 }
48577
48578 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) {
48579         LDKProbabilisticScoringParameters this_ptr_conv;
48580         this_ptr_conv.inner = untag_ptr(this_ptr);
48581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48583         this_ptr_conv.is_owned = false;
48584         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
48585 }
48586
48587 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
48588         LDKProbabilisticScoringParameters this_ptr_conv;
48589         this_ptr_conv.inner = untag_ptr(this_ptr);
48590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48592         this_ptr_conv.is_owned = false;
48593         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
48594         return ret_conv;
48595 }
48596
48597 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) {
48598         LDKProbabilisticScoringParameters this_ptr_conv;
48599         this_ptr_conv.inner = untag_ptr(this_ptr);
48600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48602         this_ptr_conv.is_owned = false;
48603         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
48604 }
48605
48606 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
48607         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
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 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint64_t arg) {
48614         LDKProbabilisticScoringParameters arg_conv;
48615         arg_conv.inner = untag_ptr(arg);
48616         arg_conv.is_owned = ptr_is_owned(arg);
48617         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48618         arg_conv.is_owned = false;
48619         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
48620         return ret_conv;
48621 }
48622
48623 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint64_t orig) {
48624         LDKProbabilisticScoringParameters orig_conv;
48625         orig_conv.inner = untag_ptr(orig);
48626         orig_conv.is_owned = ptr_is_owned(orig);
48627         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48628         orig_conv.is_owned = false;
48629         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
48630         uint64_t ret_ref = 0;
48631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48633         return ret_ref;
48634 }
48635
48636 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t params, uint64_t network_graph, uint64_t logger) {
48637         LDKProbabilisticScoringParameters params_conv;
48638         params_conv.inner = untag_ptr(params);
48639         params_conv.is_owned = ptr_is_owned(params);
48640         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
48641         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
48642         LDKNetworkGraph network_graph_conv;
48643         network_graph_conv.inner = untag_ptr(network_graph);
48644         network_graph_conv.is_owned = ptr_is_owned(network_graph);
48645         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
48646         network_graph_conv.is_owned = false;
48647         void* logger_ptr = untag_ptr(logger);
48648         CHECK_ACCESS(logger_ptr);
48649         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48650         if (logger_conv.free == LDKLogger_JCalls_free) {
48651                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48652                 LDKLogger_JCalls_cloned(&logger_conv);
48653         }
48654         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
48655         uint64_t ret_ref = 0;
48656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48658         return ret_ref;
48659 }
48660
48661 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
48662         LDKProbabilisticScorer this_arg_conv;
48663         this_arg_conv.inner = untag_ptr(this_arg);
48664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48666         this_arg_conv.is_owned = false;
48667         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
48668 }
48669
48670 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) {
48671         LDKProbabilisticScorer this_arg_conv;
48672         this_arg_conv.inner = untag_ptr(this_arg);
48673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48675         this_arg_conv.is_owned = false;
48676         LDKNodeId target_conv;
48677         target_conv.inner = untag_ptr(target);
48678         target_conv.is_owned = ptr_is_owned(target);
48679         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
48680         target_conv.is_owned = false;
48681         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
48682         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
48683         uint64_t ret_ref = tag_ptr(ret_copy, true);
48684         return ret_ref;
48685 }
48686
48687 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) {
48688         LDKProbabilisticScorer this_arg_conv;
48689         this_arg_conv.inner = untag_ptr(this_arg);
48690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48692         this_arg_conv.is_owned = false;
48693         LDKNodeId target_conv;
48694         target_conv.inner = untag_ptr(target);
48695         target_conv.is_owned = ptr_is_owned(target);
48696         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
48697         target_conv.is_owned = false;
48698         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
48699         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
48700         uint64_t ret_ref = tag_ptr(ret_copy, true);
48701         return ret_ref;
48702 }
48703
48704 void  __attribute__((export_name("TS_ProbabilisticScorer_add_banned"))) TS_ProbabilisticScorer_add_banned(uint64_t this_arg, uint64_t node_id) {
48705         LDKProbabilisticScorer this_arg_conv;
48706         this_arg_conv.inner = untag_ptr(this_arg);
48707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48709         this_arg_conv.is_owned = false;
48710         LDKNodeId node_id_conv;
48711         node_id_conv.inner = untag_ptr(node_id);
48712         node_id_conv.is_owned = ptr_is_owned(node_id);
48713         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
48714         node_id_conv.is_owned = false;
48715         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
48716 }
48717
48718 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_banned"))) TS_ProbabilisticScorer_remove_banned(uint64_t this_arg, uint64_t node_id) {
48719         LDKProbabilisticScorer this_arg_conv;
48720         this_arg_conv.inner = untag_ptr(this_arg);
48721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48723         this_arg_conv.is_owned = false;
48724         LDKNodeId node_id_conv;
48725         node_id_conv.inner = untag_ptr(node_id);
48726         node_id_conv.is_owned = ptr_is_owned(node_id);
48727         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
48728         node_id_conv.is_owned = false;
48729         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
48730 }
48731
48732 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) {
48733         LDKProbabilisticScorer this_arg_conv;
48734         this_arg_conv.inner = untag_ptr(this_arg);
48735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48737         this_arg_conv.is_owned = false;
48738         LDKNodeId node_id_conv;
48739         node_id_conv.inner = untag_ptr(node_id);
48740         node_id_conv.is_owned = ptr_is_owned(node_id);
48741         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
48742         node_id_conv.is_owned = false;
48743         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
48744 }
48745
48746 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_manual_penalty"))) TS_ProbabilisticScorer_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
48747         LDKProbabilisticScorer this_arg_conv;
48748         this_arg_conv.inner = untag_ptr(this_arg);
48749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48751         this_arg_conv.is_owned = false;
48752         LDKNodeId node_id_conv;
48753         node_id_conv.inner = untag_ptr(node_id);
48754         node_id_conv.is_owned = ptr_is_owned(node_id);
48755         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
48756         node_id_conv.is_owned = false;
48757         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
48758 }
48759
48760 void  __attribute__((export_name("TS_ProbabilisticScorer_clear_manual_penalties"))) TS_ProbabilisticScorer_clear_manual_penalties(uint64_t this_arg) {
48761         LDKProbabilisticScorer this_arg_conv;
48762         this_arg_conv.inner = untag_ptr(this_arg);
48763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48765         this_arg_conv.is_owned = false;
48766         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
48767 }
48768
48769 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_add_banned_from_list"))) TS_ProbabilisticScoringParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
48770         LDKProbabilisticScoringParameters this_arg_conv;
48771         this_arg_conv.inner = untag_ptr(this_arg);
48772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48774         this_arg_conv.is_owned = false;
48775         LDKCVec_NodeIdZ node_ids_constr;
48776         node_ids_constr.datalen = node_ids->arr_len;
48777         if (node_ids_constr.datalen > 0)
48778                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
48779         else
48780                 node_ids_constr.data = NULL;
48781         uint64_t* node_ids_vals = node_ids->elems;
48782         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
48783                 uint64_t node_ids_conv_8 = node_ids_vals[i];
48784                 LDKNodeId node_ids_conv_8_conv;
48785                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
48786                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
48787                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
48788                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
48789                 node_ids_constr.data[i] = node_ids_conv_8_conv;
48790         }
48791         FREE(node_ids);
48792         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
48793 }
48794
48795 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
48796         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
48797         uint64_t ret_ref = 0;
48798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48800         return ret_ref;
48801 }
48802
48803 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
48804         LDKProbabilisticScorer this_arg_conv;
48805         this_arg_conv.inner = untag_ptr(this_arg);
48806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48808         this_arg_conv.is_owned = false;
48809         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
48810         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
48811         return tag_ptr(ret_ret, true);
48812 }
48813
48814 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
48815         LDKProbabilisticScorer obj_conv;
48816         obj_conv.inner = untag_ptr(obj);
48817         obj_conv.is_owned = ptr_is_owned(obj);
48818         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48819         obj_conv.is_owned = false;
48820         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
48821         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48822         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48823         CVec_u8Z_free(ret_var);
48824         return ret_arr;
48825 }
48826
48827 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) {
48828         LDKu8slice ser_ref;
48829         ser_ref.datalen = ser->arr_len;
48830         ser_ref.data = ser->elems;
48831         LDKProbabilisticScoringParameters arg_a_conv;
48832         arg_a_conv.inner = untag_ptr(arg_a);
48833         arg_a_conv.is_owned = ptr_is_owned(arg_a);
48834         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
48835         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
48836         LDKNetworkGraph arg_b_conv;
48837         arg_b_conv.inner = untag_ptr(arg_b);
48838         arg_b_conv.is_owned = ptr_is_owned(arg_b);
48839         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
48840         arg_b_conv.is_owned = false;
48841         void* arg_c_ptr = untag_ptr(arg_c);
48842         CHECK_ACCESS(arg_c_ptr);
48843         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
48844         if (arg_c_conv.free == LDKLogger_JCalls_free) {
48845                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48846                 LDKLogger_JCalls_cloned(&arg_c_conv);
48847         }
48848         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
48849         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
48850         FREE(ser);
48851         return tag_ptr(ret_conv, true);
48852 }
48853
48854 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
48855         LDKOnionMessenger this_obj_conv;
48856         this_obj_conv.inner = untag_ptr(this_obj);
48857         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48859         OnionMessenger_free(this_obj_conv);
48860 }
48861
48862 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
48863         if (!ptr_is_owned(this_ptr)) return;
48864         void* this_ptr_ptr = untag_ptr(this_ptr);
48865         CHECK_ACCESS(this_ptr_ptr);
48866         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
48867         FREE(untag_ptr(this_ptr));
48868         Destination_free(this_ptr_conv);
48869 }
48870
48871 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
48872         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
48873         *ret_copy = Destination_clone(arg);
48874         uint64_t ret_ref = tag_ptr(ret_copy, true);
48875         return ret_ref;
48876 }
48877 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
48878         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
48879         int64_t ret_conv = Destination_clone_ptr(arg_conv);
48880         return ret_conv;
48881 }
48882
48883 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
48884         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
48885         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
48886         *ret_copy = Destination_clone(orig_conv);
48887         uint64_t ret_ref = tag_ptr(ret_copy, true);
48888         return ret_ref;
48889 }
48890
48891 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
48892         LDKPublicKey a_ref;
48893         CHECK(a->arr_len == 33);
48894         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
48895         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
48896         *ret_copy = Destination_node(a_ref);
48897         uint64_t ret_ref = tag_ptr(ret_copy, true);
48898         return ret_ref;
48899 }
48900
48901 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
48902         LDKBlindedPath a_conv;
48903         a_conv.inner = untag_ptr(a);
48904         a_conv.is_owned = ptr_is_owned(a);
48905         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48906         a_conv = BlindedPath_clone(&a_conv);
48907         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
48908         *ret_copy = Destination_blinded_path(a_conv);
48909         uint64_t ret_ref = tag_ptr(ret_copy, true);
48910         return ret_ref;
48911 }
48912
48913 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
48914         if (!ptr_is_owned(this_ptr)) return;
48915         void* this_ptr_ptr = untag_ptr(this_ptr);
48916         CHECK_ACCESS(this_ptr_ptr);
48917         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
48918         FREE(untag_ptr(this_ptr));
48919         SendError_free(this_ptr_conv);
48920 }
48921
48922 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
48923         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48924         *ret_copy = SendError_clone(arg);
48925         uint64_t ret_ref = tag_ptr(ret_copy, true);
48926         return ret_ref;
48927 }
48928 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
48929         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
48930         int64_t ret_conv = SendError_clone_ptr(arg_conv);
48931         return ret_conv;
48932 }
48933
48934 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
48935         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
48936         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48937         *ret_copy = SendError_clone(orig_conv);
48938         uint64_t ret_ref = tag_ptr(ret_copy, true);
48939         return ret_ref;
48940 }
48941
48942 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
48943         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
48944         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48945         *ret_copy = SendError_secp256k1(a_conv);
48946         uint64_t ret_ref = tag_ptr(ret_copy, true);
48947         return ret_ref;
48948 }
48949
48950 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
48951         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48952         *ret_copy = SendError_too_big_packet();
48953         uint64_t ret_ref = tag_ptr(ret_copy, true);
48954         return ret_ref;
48955 }
48956
48957 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
48958         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48959         *ret_copy = SendError_too_few_blinded_hops();
48960         uint64_t ret_ref = tag_ptr(ret_copy, true);
48961         return ret_ref;
48962 }
48963
48964 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
48965         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48966         *ret_copy = SendError_invalid_first_hop();
48967         uint64_t ret_ref = tag_ptr(ret_copy, true);
48968         return ret_ref;
48969 }
48970
48971 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
48972         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48973         *ret_copy = SendError_invalid_message();
48974         uint64_t ret_ref = tag_ptr(ret_copy, true);
48975         return ret_ref;
48976 }
48977
48978 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
48979         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48980         *ret_copy = SendError_buffer_full();
48981         uint64_t ret_ref = tag_ptr(ret_copy, true);
48982         return ret_ref;
48983 }
48984
48985 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
48986         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48987         *ret_copy = SendError_get_node_id_failed();
48988         uint64_t ret_ref = tag_ptr(ret_copy, true);
48989         return ret_ref;
48990 }
48991
48992 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
48993         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48994         *ret_copy = SendError_blinded_path_advance_failed();
48995         uint64_t ret_ref = tag_ptr(ret_copy, true);
48996         return ret_ref;
48997 }
48998
48999 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
49000         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
49001         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
49002         jboolean ret_conv = SendError_eq(a_conv, b_conv);
49003         return ret_conv;
49004 }
49005
49006 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
49007         if (!ptr_is_owned(this_ptr)) return;
49008         void* this_ptr_ptr = untag_ptr(this_ptr);
49009         CHECK_ACCESS(this_ptr_ptr);
49010         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
49011         FREE(untag_ptr(this_ptr));
49012         CustomOnionMessageHandler_free(this_ptr_conv);
49013 }
49014
49015 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) {
49016         void* entropy_source_ptr = untag_ptr(entropy_source);
49017         CHECK_ACCESS(entropy_source_ptr);
49018         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
49019         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
49020                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49021                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
49022         }
49023         void* node_signer_ptr = untag_ptr(node_signer);
49024         CHECK_ACCESS(node_signer_ptr);
49025         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
49026         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
49027                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49028                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
49029         }
49030         void* logger_ptr = untag_ptr(logger);
49031         CHECK_ACCESS(logger_ptr);
49032         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
49033         if (logger_conv.free == LDKLogger_JCalls_free) {
49034                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49035                 LDKLogger_JCalls_cloned(&logger_conv);
49036         }
49037         void* custom_handler_ptr = untag_ptr(custom_handler);
49038         CHECK_ACCESS(custom_handler_ptr);
49039         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
49040         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
49041                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49042                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
49043         }
49044         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, custom_handler_conv);
49045         uint64_t ret_ref = 0;
49046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49048         return ret_ref;
49049 }
49050
49051 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) {
49052         LDKOnionMessenger this_arg_conv;
49053         this_arg_conv.inner = untag_ptr(this_arg);
49054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49056         this_arg_conv.is_owned = false;
49057         LDKCVec_PublicKeyZ intermediate_nodes_constr;
49058         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
49059         if (intermediate_nodes_constr.datalen > 0)
49060                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
49061         else
49062                 intermediate_nodes_constr.data = NULL;
49063         int8_tArray* intermediate_nodes_vals = (void*) intermediate_nodes->elems;
49064         for (size_t m = 0; m < intermediate_nodes_constr.datalen; m++) {
49065                 int8_tArray intermediate_nodes_conv_12 = intermediate_nodes_vals[m];
49066                 LDKPublicKey intermediate_nodes_conv_12_ref;
49067                 CHECK(intermediate_nodes_conv_12->arr_len == 33);
49068                 memcpy(intermediate_nodes_conv_12_ref.compressed_form, intermediate_nodes_conv_12->elems, 33); FREE(intermediate_nodes_conv_12);
49069                 intermediate_nodes_constr.data[m] = intermediate_nodes_conv_12_ref;
49070         }
49071         FREE(intermediate_nodes);
49072         void* destination_ptr = untag_ptr(destination);
49073         CHECK_ACCESS(destination_ptr);
49074         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
49075         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
49076         void* message_ptr = untag_ptr(message);
49077         CHECK_ACCESS(message_ptr);
49078         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
49079         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
49080         LDKBlindedPath reply_path_conv;
49081         reply_path_conv.inner = untag_ptr(reply_path);
49082         reply_path_conv.is_owned = ptr_is_owned(reply_path);
49083         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
49084         reply_path_conv = BlindedPath_clone(&reply_path_conv);
49085         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
49086         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, intermediate_nodes_constr, destination_conv, message_conv, reply_path_conv);
49087         return tag_ptr(ret_conv, true);
49088 }
49089
49090 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
49091         LDKOnionMessenger this_arg_conv;
49092         this_arg_conv.inner = untag_ptr(this_arg);
49093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49095         this_arg_conv.is_owned = false;
49096         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
49097         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
49098         return tag_ptr(ret_ret, true);
49099 }
49100
49101 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageProvider"))) TS_OnionMessenger_as_OnionMessageProvider(uint64_t this_arg) {
49102         LDKOnionMessenger this_arg_conv;
49103         this_arg_conv.inner = untag_ptr(this_arg);
49104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49106         this_arg_conv.is_owned = false;
49107         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
49108         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
49109         return tag_ptr(ret_ret, true);
49110 }
49111
49112 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
49113         if (!ptr_is_owned(this_ptr)) return;
49114         void* this_ptr_ptr = untag_ptr(this_ptr);
49115         CHECK_ACCESS(this_ptr_ptr);
49116         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
49117         FREE(untag_ptr(this_ptr));
49118         OnionMessageContents_free(this_ptr_conv);
49119 }
49120
49121 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
49122         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
49123         *ret_copy = OnionMessageContents_clone(arg);
49124         uint64_t ret_ref = tag_ptr(ret_copy, true);
49125         return ret_ref;
49126 }
49127 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
49128         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg);
49129         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
49130         return ret_conv;
49131 }
49132
49133 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
49134         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig);
49135         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
49136         *ret_copy = OnionMessageContents_clone(orig_conv);
49137         uint64_t ret_ref = tag_ptr(ret_copy, true);
49138         return ret_ref;
49139 }
49140
49141 uint64_t  __attribute__((export_name("TS_OnionMessageContents_custom"))) TS_OnionMessageContents_custom(uint64_t a) {
49142         void* a_ptr = untag_ptr(a);
49143         CHECK_ACCESS(a_ptr);
49144         LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr);
49145         if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
49146                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49147                 LDKCustomOnionMessageContents_JCalls_cloned(&a_conv);
49148         }
49149         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
49150         *ret_copy = OnionMessageContents_custom(a_conv);
49151         uint64_t ret_ref = tag_ptr(ret_copy, true);
49152         return ret_ref;
49153 }
49154
49155 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
49156         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
49157         *ret_ret = CustomOnionMessageContents_clone(arg);
49158         return tag_ptr(ret_ret, true);
49159 }
49160 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone_ptr"))) TS_CustomOnionMessageContents_clone_ptr(uint64_t arg) {
49161         void* arg_ptr = untag_ptr(arg);
49162         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
49163         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
49164         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
49165         return ret_conv;
49166 }
49167
49168 uint64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone"))) TS_CustomOnionMessageContents_clone(uint64_t orig) {
49169         void* orig_ptr = untag_ptr(orig);
49170         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
49171         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
49172         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
49173         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
49174         return tag_ptr(ret_ret, true);
49175 }
49176
49177 void  __attribute__((export_name("TS_CustomOnionMessageContents_free"))) TS_CustomOnionMessageContents_free(uint64_t this_ptr) {
49178         if (!ptr_is_owned(this_ptr)) return;
49179         void* this_ptr_ptr = untag_ptr(this_ptr);
49180         CHECK_ACCESS(this_ptr_ptr);
49181         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
49182         FREE(untag_ptr(this_ptr));
49183         CustomOnionMessageContents_free(this_ptr_conv);
49184 }
49185
49186 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
49187         LDKBlindedPath this_obj_conv;
49188         this_obj_conv.inner = untag_ptr(this_obj);
49189         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49191         BlindedPath_free(this_obj_conv);
49192 }
49193
49194 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
49195         LDKBlindedPath ret_var = BlindedPath_clone(arg);
49196         uint64_t ret_ref = 0;
49197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49199         return ret_ref;
49200 }
49201 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
49202         LDKBlindedPath arg_conv;
49203         arg_conv.inner = untag_ptr(arg);
49204         arg_conv.is_owned = ptr_is_owned(arg);
49205         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49206         arg_conv.is_owned = false;
49207         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
49208         return ret_conv;
49209 }
49210
49211 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
49212         LDKBlindedPath orig_conv;
49213         orig_conv.inner = untag_ptr(orig);
49214         orig_conv.is_owned = ptr_is_owned(orig);
49215         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49216         orig_conv.is_owned = false;
49217         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
49218         uint64_t ret_ref = 0;
49219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49221         return ret_ref;
49222 }
49223
49224 int64_t  __attribute__((export_name("TS_BlindedPath_hash"))) TS_BlindedPath_hash(uint64_t o) {
49225         LDKBlindedPath o_conv;
49226         o_conv.inner = untag_ptr(o);
49227         o_conv.is_owned = ptr_is_owned(o);
49228         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49229         o_conv.is_owned = false;
49230         int64_t ret_conv = BlindedPath_hash(&o_conv);
49231         return ret_conv;
49232 }
49233
49234 jboolean  __attribute__((export_name("TS_BlindedPath_eq"))) TS_BlindedPath_eq(uint64_t a, uint64_t b) {
49235         LDKBlindedPath a_conv;
49236         a_conv.inner = untag_ptr(a);
49237         a_conv.is_owned = ptr_is_owned(a);
49238         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49239         a_conv.is_owned = false;
49240         LDKBlindedPath b_conv;
49241         b_conv.inner = untag_ptr(b);
49242         b_conv.is_owned = ptr_is_owned(b);
49243         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49244         b_conv.is_owned = false;
49245         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
49246         return ret_conv;
49247 }
49248
49249 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
49250         LDKBlindedHop this_obj_conv;
49251         this_obj_conv.inner = untag_ptr(this_obj);
49252         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49254         BlindedHop_free(this_obj_conv);
49255 }
49256
49257 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
49258         LDKBlindedHop ret_var = BlindedHop_clone(arg);
49259         uint64_t ret_ref = 0;
49260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49262         return ret_ref;
49263 }
49264 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
49265         LDKBlindedHop arg_conv;
49266         arg_conv.inner = untag_ptr(arg);
49267         arg_conv.is_owned = ptr_is_owned(arg);
49268         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49269         arg_conv.is_owned = false;
49270         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
49271         return ret_conv;
49272 }
49273
49274 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
49275         LDKBlindedHop orig_conv;
49276         orig_conv.inner = untag_ptr(orig);
49277         orig_conv.is_owned = ptr_is_owned(orig);
49278         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49279         orig_conv.is_owned = false;
49280         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
49281         uint64_t ret_ref = 0;
49282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49284         return ret_ref;
49285 }
49286
49287 int64_t  __attribute__((export_name("TS_BlindedHop_hash"))) TS_BlindedHop_hash(uint64_t o) {
49288         LDKBlindedHop o_conv;
49289         o_conv.inner = untag_ptr(o);
49290         o_conv.is_owned = ptr_is_owned(o);
49291         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49292         o_conv.is_owned = false;
49293         int64_t ret_conv = BlindedHop_hash(&o_conv);
49294         return ret_conv;
49295 }
49296
49297 jboolean  __attribute__((export_name("TS_BlindedHop_eq"))) TS_BlindedHop_eq(uint64_t a, uint64_t b) {
49298         LDKBlindedHop a_conv;
49299         a_conv.inner = untag_ptr(a);
49300         a_conv.is_owned = ptr_is_owned(a);
49301         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49302         a_conv.is_owned = false;
49303         LDKBlindedHop b_conv;
49304         b_conv.inner = untag_ptr(b);
49305         b_conv.is_owned = ptr_is_owned(b);
49306         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49307         b_conv.is_owned = false;
49308         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
49309         return ret_conv;
49310 }
49311
49312 uint64_t  __attribute__((export_name("TS_BlindedPath_new_for_message"))) TS_BlindedPath_new_for_message(ptrArray node_pks, uint64_t entropy_source) {
49313         LDKCVec_PublicKeyZ node_pks_constr;
49314         node_pks_constr.datalen = node_pks->arr_len;
49315         if (node_pks_constr.datalen > 0)
49316                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
49317         else
49318                 node_pks_constr.data = NULL;
49319         int8_tArray* node_pks_vals = (void*) node_pks->elems;
49320         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
49321                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
49322                 LDKPublicKey node_pks_conv_12_ref;
49323                 CHECK(node_pks_conv_12->arr_len == 33);
49324                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
49325                 node_pks_constr.data[m] = node_pks_conv_12_ref;
49326         }
49327         FREE(node_pks);
49328         void* entropy_source_ptr = untag_ptr(entropy_source);
49329         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
49330         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
49331         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
49332         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
49333         return tag_ptr(ret_conv, true);
49334 }
49335
49336 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
49337         LDKBlindedPath obj_conv;
49338         obj_conv.inner = untag_ptr(obj);
49339         obj_conv.is_owned = ptr_is_owned(obj);
49340         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49341         obj_conv.is_owned = false;
49342         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
49343         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49344         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49345         CVec_u8Z_free(ret_var);
49346         return ret_arr;
49347 }
49348
49349 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
49350         LDKu8slice ser_ref;
49351         ser_ref.datalen = ser->arr_len;
49352         ser_ref.data = ser->elems;
49353         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
49354         *ret_conv = BlindedPath_read(ser_ref);
49355         FREE(ser);
49356         return tag_ptr(ret_conv, true);
49357 }
49358
49359 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
49360         LDKBlindedHop obj_conv;
49361         obj_conv.inner = untag_ptr(obj);
49362         obj_conv.is_owned = ptr_is_owned(obj);
49363         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49364         obj_conv.is_owned = false;
49365         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
49366         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49367         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49368         CVec_u8Z_free(ret_var);
49369         return ret_arr;
49370 }
49371
49372 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
49373         LDKu8slice ser_ref;
49374         ser_ref.datalen = ser->arr_len;
49375         ser_ref.data = ser->elems;
49376         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
49377         *ret_conv = BlindedHop_read(ser_ref);
49378         FREE(ser);
49379         return tag_ptr(ret_conv, true);
49380 }
49381
49382 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
49383         if (!ptr_is_owned(this_ptr)) return;
49384         void* this_ptr_ptr = untag_ptr(this_ptr);
49385         CHECK_ACCESS(this_ptr_ptr);
49386         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
49387         FREE(untag_ptr(this_ptr));
49388         PaymentPurpose_free(this_ptr_conv);
49389 }
49390
49391 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
49392         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
49393         *ret_copy = PaymentPurpose_clone(arg);
49394         uint64_t ret_ref = tag_ptr(ret_copy, true);
49395         return ret_ref;
49396 }
49397 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
49398         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
49399         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
49400         return ret_conv;
49401 }
49402
49403 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
49404         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
49405         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
49406         *ret_copy = PaymentPurpose_clone(orig_conv);
49407         uint64_t ret_ref = tag_ptr(ret_copy, true);
49408         return ret_ref;
49409 }
49410
49411 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
49412         LDKThirtyTwoBytes payment_preimage_ref;
49413         CHECK(payment_preimage->arr_len == 32);
49414         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
49415         LDKThirtyTwoBytes payment_secret_ref;
49416         CHECK(payment_secret->arr_len == 32);
49417         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
49418         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
49419         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
49420         uint64_t ret_ref = tag_ptr(ret_copy, true);
49421         return ret_ref;
49422 }
49423
49424 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
49425         LDKThirtyTwoBytes a_ref;
49426         CHECK(a->arr_len == 32);
49427         memcpy(a_ref.data, a->elems, 32); FREE(a);
49428         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
49429         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
49430         uint64_t ret_ref = tag_ptr(ret_copy, true);
49431         return ret_ref;
49432 }
49433
49434 jboolean  __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) {
49435         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
49436         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
49437         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
49438         return ret_conv;
49439 }
49440
49441 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
49442         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
49443         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
49444         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49445         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49446         CVec_u8Z_free(ret_var);
49447         return ret_arr;
49448 }
49449
49450 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
49451         LDKu8slice ser_ref;
49452         ser_ref.datalen = ser->arr_len;
49453         ser_ref.data = ser->elems;
49454         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
49455         *ret_conv = PaymentPurpose_read(ser_ref);
49456         FREE(ser);
49457         return tag_ptr(ret_conv, true);
49458 }
49459
49460 void  __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_free(uint64_t this_ptr) {
49461         if (!ptr_is_owned(this_ptr)) return;
49462         void* this_ptr_ptr = untag_ptr(this_ptr);
49463         CHECK_ACCESS(this_ptr_ptr);
49464         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
49465         FREE(untag_ptr(this_ptr));
49466         PathFailure_free(this_ptr_conv);
49467 }
49468
49469 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
49470         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
49471         *ret_copy = PathFailure_clone(arg);
49472         uint64_t ret_ref = tag_ptr(ret_copy, true);
49473         return ret_ref;
49474 }
49475 int64_t  __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) {
49476         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
49477         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
49478         return ret_conv;
49479 }
49480
49481 uint64_t  __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) {
49482         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
49483         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
49484         *ret_copy = PathFailure_clone(orig_conv);
49485         uint64_t ret_ref = tag_ptr(ret_copy, true);
49486         return ret_ref;
49487 }
49488
49489 uint64_t  __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) {
49490         void* err_ptr = untag_ptr(err);
49491         CHECK_ACCESS(err_ptr);
49492         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
49493         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
49494         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
49495         *ret_copy = PathFailure_initial_send(err_conv);
49496         uint64_t ret_ref = tag_ptr(ret_copy, true);
49497         return ret_ref;
49498 }
49499
49500 uint64_t  __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) {
49501         void* network_update_ptr = untag_ptr(network_update);
49502         CHECK_ACCESS(network_update_ptr);
49503         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
49504         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
49505         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
49506         *ret_copy = PathFailure_on_path(network_update_conv);
49507         uint64_t ret_ref = tag_ptr(ret_copy, true);
49508         return ret_ref;
49509 }
49510
49511 jboolean  __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) {
49512         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
49513         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
49514         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
49515         return ret_conv;
49516 }
49517
49518 int8_tArray  __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) {
49519         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
49520         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
49521         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49522         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49523         CVec_u8Z_free(ret_var);
49524         return ret_arr;
49525 }
49526
49527 uint64_t  __attribute__((export_name("TS_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) {
49528         LDKu8slice ser_ref;
49529         ser_ref.datalen = ser->arr_len;
49530         ser_ref.data = ser->elems;
49531         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
49532         *ret_conv = PathFailure_read(ser_ref);
49533         FREE(ser);
49534         return tag_ptr(ret_conv, true);
49535 }
49536
49537 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
49538         if (!ptr_is_owned(this_ptr)) return;
49539         void* this_ptr_ptr = untag_ptr(this_ptr);
49540         CHECK_ACCESS(this_ptr_ptr);
49541         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
49542         FREE(untag_ptr(this_ptr));
49543         ClosureReason_free(this_ptr_conv);
49544 }
49545
49546 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
49547         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49548         *ret_copy = ClosureReason_clone(arg);
49549         uint64_t ret_ref = tag_ptr(ret_copy, true);
49550         return ret_ref;
49551 }
49552 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
49553         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
49554         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
49555         return ret_conv;
49556 }
49557
49558 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
49559         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
49560         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49561         *ret_copy = ClosureReason_clone(orig_conv);
49562         uint64_t ret_ref = tag_ptr(ret_copy, true);
49563         return ret_ref;
49564 }
49565
49566 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(uint64_t peer_msg) {
49567         LDKUntrustedString peer_msg_conv;
49568         peer_msg_conv.inner = untag_ptr(peer_msg);
49569         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
49570         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
49571         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
49572         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49573         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
49574         uint64_t ret_ref = tag_ptr(ret_copy, true);
49575         return ret_ref;
49576 }
49577
49578 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
49579         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49580         *ret_copy = ClosureReason_holder_force_closed();
49581         uint64_t ret_ref = tag_ptr(ret_copy, true);
49582         return ret_ref;
49583 }
49584
49585 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
49586         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49587         *ret_copy = ClosureReason_cooperative_closure();
49588         uint64_t ret_ref = tag_ptr(ret_copy, true);
49589         return ret_ref;
49590 }
49591
49592 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
49593         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49594         *ret_copy = ClosureReason_commitment_tx_confirmed();
49595         uint64_t ret_ref = tag_ptr(ret_copy, true);
49596         return ret_ref;
49597 }
49598
49599 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
49600         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49601         *ret_copy = ClosureReason_funding_timed_out();
49602         uint64_t ret_ref = tag_ptr(ret_copy, true);
49603         return ret_ref;
49604 }
49605
49606 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
49607         LDKStr err_conv = str_ref_to_owned_c(err);
49608         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49609         *ret_copy = ClosureReason_processing_error(err_conv);
49610         uint64_t ret_ref = tag_ptr(ret_copy, true);
49611         return ret_ref;
49612 }
49613
49614 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
49615         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49616         *ret_copy = ClosureReason_disconnected_peer();
49617         uint64_t ret_ref = tag_ptr(ret_copy, true);
49618         return ret_ref;
49619 }
49620
49621 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
49622         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49623         *ret_copy = ClosureReason_outdated_channel_manager();
49624         uint64_t ret_ref = tag_ptr(ret_copy, true);
49625         return ret_ref;
49626 }
49627
49628 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
49629         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
49630         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
49631         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
49632         return ret_conv;
49633 }
49634
49635 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
49636         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
49637         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
49638         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49639         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49640         CVec_u8Z_free(ret_var);
49641         return ret_arr;
49642 }
49643
49644 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
49645         LDKu8slice ser_ref;
49646         ser_ref.datalen = ser->arr_len;
49647         ser_ref.data = ser->elems;
49648         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
49649         *ret_conv = ClosureReason_read(ser_ref);
49650         FREE(ser);
49651         return tag_ptr(ret_conv, true);
49652 }
49653
49654 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
49655         if (!ptr_is_owned(this_ptr)) return;
49656         void* this_ptr_ptr = untag_ptr(this_ptr);
49657         CHECK_ACCESS(this_ptr_ptr);
49658         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
49659         FREE(untag_ptr(this_ptr));
49660         HTLCDestination_free(this_ptr_conv);
49661 }
49662
49663 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
49664         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49665         *ret_copy = HTLCDestination_clone(arg);
49666         uint64_t ret_ref = tag_ptr(ret_copy, true);
49667         return ret_ref;
49668 }
49669 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
49670         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
49671         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
49672         return ret_conv;
49673 }
49674
49675 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
49676         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
49677         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49678         *ret_copy = HTLCDestination_clone(orig_conv);
49679         uint64_t ret_ref = tag_ptr(ret_copy, true);
49680         return ret_ref;
49681 }
49682
49683 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
49684         LDKPublicKey node_id_ref;
49685         CHECK(node_id->arr_len == 33);
49686         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
49687         LDKThirtyTwoBytes channel_id_ref;
49688         CHECK(channel_id->arr_len == 32);
49689         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
49690         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49691         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
49692         uint64_t ret_ref = tag_ptr(ret_copy, true);
49693         return ret_ref;
49694 }
49695
49696 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
49697         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49698         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
49699         uint64_t ret_ref = tag_ptr(ret_copy, true);
49700         return ret_ref;
49701 }
49702
49703 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
49704         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49705         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
49706         uint64_t ret_ref = tag_ptr(ret_copy, true);
49707         return ret_ref;
49708 }
49709
49710 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
49711         LDKThirtyTwoBytes payment_hash_ref;
49712         CHECK(payment_hash->arr_len == 32);
49713         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49714         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49715         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
49716         uint64_t ret_ref = tag_ptr(ret_copy, true);
49717         return ret_ref;
49718 }
49719
49720 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
49721         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
49722         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
49723         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
49724         return ret_conv;
49725 }
49726
49727 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
49728         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
49729         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
49730         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49731         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49732         CVec_u8Z_free(ret_var);
49733         return ret_arr;
49734 }
49735
49736 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
49737         LDKu8slice ser_ref;
49738         ser_ref.datalen = ser->arr_len;
49739         ser_ref.data = ser->elems;
49740         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
49741         *ret_conv = HTLCDestination_read(ser_ref);
49742         FREE(ser);
49743         return tag_ptr(ret_conv, true);
49744 }
49745
49746 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_clone"))) TS_PaymentFailureReason_clone(uint64_t orig) {
49747         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
49748         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_clone(orig_conv));
49749         return ret_conv;
49750 }
49751
49752 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_recipient_rejected"))) TS_PaymentFailureReason_recipient_rejected() {
49753         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_recipient_rejected());
49754         return ret_conv;
49755 }
49756
49757 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_user_abandoned"))) TS_PaymentFailureReason_user_abandoned() {
49758         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_user_abandoned());
49759         return ret_conv;
49760 }
49761
49762 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_retries_exhausted"))) TS_PaymentFailureReason_retries_exhausted() {
49763         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_retries_exhausted());
49764         return ret_conv;
49765 }
49766
49767 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_payment_expired"))) TS_PaymentFailureReason_payment_expired() {
49768         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_payment_expired());
49769         return ret_conv;
49770 }
49771
49772 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_route_not_found"))) TS_PaymentFailureReason_route_not_found() {
49773         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_route_not_found());
49774         return ret_conv;
49775 }
49776
49777 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_unexpected_error"))) TS_PaymentFailureReason_unexpected_error() {
49778         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_unexpected_error());
49779         return ret_conv;
49780 }
49781
49782 jboolean  __attribute__((export_name("TS_PaymentFailureReason_eq"))) TS_PaymentFailureReason_eq(uint64_t a, uint64_t b) {
49783         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
49784         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
49785         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
49786         return ret_conv;
49787 }
49788
49789 int8_tArray  __attribute__((export_name("TS_PaymentFailureReason_write"))) TS_PaymentFailureReason_write(uint64_t obj) {
49790         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
49791         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
49792         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49793         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49794         CVec_u8Z_free(ret_var);
49795         return ret_arr;
49796 }
49797
49798 uint64_t  __attribute__((export_name("TS_PaymentFailureReason_read"))) TS_PaymentFailureReason_read(int8_tArray ser) {
49799         LDKu8slice ser_ref;
49800         ser_ref.datalen = ser->arr_len;
49801         ser_ref.data = ser->elems;
49802         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
49803         *ret_conv = PaymentFailureReason_read(ser_ref);
49804         FREE(ser);
49805         return tag_ptr(ret_conv, true);
49806 }
49807
49808 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
49809         if (!ptr_is_owned(this_ptr)) return;
49810         void* this_ptr_ptr = untag_ptr(this_ptr);
49811         CHECK_ACCESS(this_ptr_ptr);
49812         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
49813         FREE(untag_ptr(this_ptr));
49814         Event_free(this_ptr_conv);
49815 }
49816
49817 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
49818         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49819         *ret_copy = Event_clone(arg);
49820         uint64_t ret_ref = tag_ptr(ret_copy, true);
49821         return ret_ref;
49822 }
49823 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
49824         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
49825         int64_t ret_conv = Event_clone_ptr(arg_conv);
49826         return ret_conv;
49827 }
49828
49829 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
49830         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
49831         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49832         *ret_copy = Event_clone(orig_conv);
49833         uint64_t ret_ref = tag_ptr(ret_copy, true);
49834         return ret_ref;
49835 }
49836
49837 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) {
49838         LDKThirtyTwoBytes temporary_channel_id_ref;
49839         CHECK(temporary_channel_id->arr_len == 32);
49840         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
49841         LDKPublicKey counterparty_node_id_ref;
49842         CHECK(counterparty_node_id->arr_len == 33);
49843         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
49844         LDKCVec_u8Z output_script_ref;
49845         output_script_ref.datalen = output_script->arr_len;
49846         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
49847         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
49848         LDKU128 user_channel_id_ref;
49849         CHECK(user_channel_id->arr_len == 16);
49850         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
49851         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49852         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
49853         uint64_t ret_ref = tag_ptr(ret_copy, true);
49854         return ret_ref;
49855 }
49856
49857 uint64_t  __attribute__((export_name("TS_Event_payment_claimable"))) TS_Event_payment_claimable(int8_tArray receiver_node_id, int8_tArray payment_hash, uint64_t onion_fields, int64_t amount_msat, uint64_t purpose, int8_tArray via_channel_id, uint64_t via_user_channel_id, uint64_t claim_deadline) {
49858         LDKPublicKey receiver_node_id_ref;
49859         CHECK(receiver_node_id->arr_len == 33);
49860         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
49861         LDKThirtyTwoBytes payment_hash_ref;
49862         CHECK(payment_hash->arr_len == 32);
49863         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49864         LDKRecipientOnionFields onion_fields_conv;
49865         onion_fields_conv.inner = untag_ptr(onion_fields);
49866         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
49867         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
49868         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
49869         void* purpose_ptr = untag_ptr(purpose);
49870         CHECK_ACCESS(purpose_ptr);
49871         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
49872         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
49873         LDKThirtyTwoBytes via_channel_id_ref;
49874         CHECK(via_channel_id->arr_len == 32);
49875         memcpy(via_channel_id_ref.data, via_channel_id->elems, 32); FREE(via_channel_id);
49876         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
49877         CHECK_ACCESS(via_user_channel_id_ptr);
49878         LDKCOption_u128Z via_user_channel_id_conv = *(LDKCOption_u128Z*)(via_user_channel_id_ptr);
49879         via_user_channel_id_conv = COption_u128Z_clone((LDKCOption_u128Z*)untag_ptr(via_user_channel_id));
49880         void* claim_deadline_ptr = untag_ptr(claim_deadline);
49881         CHECK_ACCESS(claim_deadline_ptr);
49882         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
49883         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
49884         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49885         *ret_copy = Event_payment_claimable(receiver_node_id_ref, payment_hash_ref, onion_fields_conv, amount_msat, purpose_conv, via_channel_id_ref, via_user_channel_id_conv, claim_deadline_conv);
49886         uint64_t ret_ref = tag_ptr(ret_copy, true);
49887         return ret_ref;
49888 }
49889
49890 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) {
49891         LDKPublicKey receiver_node_id_ref;
49892         CHECK(receiver_node_id->arr_len == 33);
49893         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
49894         LDKThirtyTwoBytes payment_hash_ref;
49895         CHECK(payment_hash->arr_len == 32);
49896         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49897         void* purpose_ptr = untag_ptr(purpose);
49898         CHECK_ACCESS(purpose_ptr);
49899         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
49900         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
49901         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49902         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv);
49903         uint64_t ret_ref = tag_ptr(ret_copy, true);
49904         return ret_ref;
49905 }
49906
49907 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) {
49908         LDKThirtyTwoBytes payment_id_ref;
49909         CHECK(payment_id->arr_len == 32);
49910         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49911         LDKThirtyTwoBytes payment_preimage_ref;
49912         CHECK(payment_preimage->arr_len == 32);
49913         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
49914         LDKThirtyTwoBytes payment_hash_ref;
49915         CHECK(payment_hash->arr_len == 32);
49916         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49917         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
49918         CHECK_ACCESS(fee_paid_msat_ptr);
49919         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
49920         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
49921         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49922         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
49923         uint64_t ret_ref = tag_ptr(ret_copy, true);
49924         return ret_ref;
49925 }
49926
49927 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t reason) {
49928         LDKThirtyTwoBytes payment_id_ref;
49929         CHECK(payment_id->arr_len == 32);
49930         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49931         LDKThirtyTwoBytes payment_hash_ref;
49932         CHECK(payment_hash->arr_len == 32);
49933         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49934         void* reason_ptr = untag_ptr(reason);
49935         CHECK_ACCESS(reason_ptr);
49936         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
49937         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
49938         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49939         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
49940         uint64_t ret_ref = tag_ptr(ret_copy, true);
49941         return ret_ref;
49942 }
49943
49944 uint64_t  __attribute__((export_name("TS_Event_payment_path_successful"))) TS_Event_payment_path_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path) {
49945         LDKThirtyTwoBytes payment_id_ref;
49946         CHECK(payment_id->arr_len == 32);
49947         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49948         LDKThirtyTwoBytes payment_hash_ref;
49949         CHECK(payment_hash->arr_len == 32);
49950         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49951         LDKPath path_conv;
49952         path_conv.inner = untag_ptr(path);
49953         path_conv.is_owned = ptr_is_owned(path);
49954         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
49955         path_conv = Path_clone(&path_conv);
49956         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49957         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_conv);
49958         uint64_t ret_ref = tag_ptr(ret_copy, true);
49959         return ret_ref;
49960 }
49961
49962 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_t path, uint64_t short_channel_id) {
49963         LDKThirtyTwoBytes payment_id_ref;
49964         CHECK(payment_id->arr_len == 32);
49965         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49966         LDKThirtyTwoBytes payment_hash_ref;
49967         CHECK(payment_hash->arr_len == 32);
49968         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49969         void* failure_ptr = untag_ptr(failure);
49970         CHECK_ACCESS(failure_ptr);
49971         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
49972         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
49973         LDKPath path_conv;
49974         path_conv.inner = untag_ptr(path);
49975         path_conv.is_owned = ptr_is_owned(path);
49976         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
49977         path_conv = Path_clone(&path_conv);
49978         void* short_channel_id_ptr = untag_ptr(short_channel_id);
49979         CHECK_ACCESS(short_channel_id_ptr);
49980         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
49981         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
49982         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49983         *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
49984         uint64_t ret_ref = tag_ptr(ret_copy, true);
49985         return ret_ref;
49986 }
49987
49988 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path) {
49989         LDKThirtyTwoBytes payment_id_ref;
49990         CHECK(payment_id->arr_len == 32);
49991         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49992         LDKThirtyTwoBytes payment_hash_ref;
49993         CHECK(payment_hash->arr_len == 32);
49994         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49995         LDKPath path_conv;
49996         path_conv.inner = untag_ptr(path);
49997         path_conv.is_owned = ptr_is_owned(path);
49998         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
49999         path_conv = Path_clone(&path_conv);
50000         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50001         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
50002         uint64_t ret_ref = tag_ptr(ret_copy, true);
50003         return ret_ref;
50004 }
50005
50006 uint64_t  __attribute__((export_name("TS_Event_probe_failed"))) TS_Event_probe_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path, uint64_t short_channel_id) {
50007         LDKThirtyTwoBytes payment_id_ref;
50008         CHECK(payment_id->arr_len == 32);
50009         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
50010         LDKThirtyTwoBytes payment_hash_ref;
50011         CHECK(payment_hash->arr_len == 32);
50012         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
50013         LDKPath path_conv;
50014         path_conv.inner = untag_ptr(path);
50015         path_conv.is_owned = ptr_is_owned(path);
50016         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
50017         path_conv = Path_clone(&path_conv);
50018         void* short_channel_id_ptr = untag_ptr(short_channel_id);
50019         CHECK_ACCESS(short_channel_id_ptr);
50020         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
50021         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
50022         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50023         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
50024         uint64_t ret_ref = tag_ptr(ret_copy, true);
50025         return ret_ref;
50026 }
50027
50028 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
50029         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50030         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
50031         uint64_t ret_ref = tag_ptr(ret_copy, true);
50032         return ret_ref;
50033 }
50034
50035 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) {
50036         LDKThirtyTwoBytes intercept_id_ref;
50037         CHECK(intercept_id->arr_len == 32);
50038         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
50039         LDKThirtyTwoBytes payment_hash_ref;
50040         CHECK(payment_hash->arr_len == 32);
50041         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
50042         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50043         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
50044         uint64_t ret_ref = tag_ptr(ret_copy, true);
50045         return ret_ref;
50046 }
50047
50048 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs) {
50049         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
50050         outputs_constr.datalen = outputs->arr_len;
50051         if (outputs_constr.datalen > 0)
50052                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
50053         else
50054                 outputs_constr.data = NULL;
50055         uint64_t* outputs_vals = outputs->elems;
50056         for (size_t b = 0; b < outputs_constr.datalen; b++) {
50057                 uint64_t outputs_conv_27 = outputs_vals[b];
50058                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
50059                 CHECK_ACCESS(outputs_conv_27_ptr);
50060                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
50061                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
50062                 outputs_constr.data[b] = outputs_conv_27_conv;
50063         }
50064         FREE(outputs);
50065         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50066         *ret_copy = Event_spendable_outputs(outputs_constr);
50067         uint64_t ret_ref = tag_ptr(ret_copy, true);
50068         return ret_ref;
50069 }
50070
50071 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, uint64_t outbound_amount_forwarded_msat) {
50072         LDKThirtyTwoBytes prev_channel_id_ref;
50073         CHECK(prev_channel_id->arr_len == 32);
50074         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
50075         LDKThirtyTwoBytes next_channel_id_ref;
50076         CHECK(next_channel_id->arr_len == 32);
50077         memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
50078         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
50079         CHECK_ACCESS(fee_earned_msat_ptr);
50080         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
50081         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
50082         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
50083         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
50084         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
50085         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
50086         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50087         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
50088         uint64_t ret_ref = tag_ptr(ret_copy, true);
50089         return ret_ref;
50090 }
50091
50092 uint64_t  __attribute__((export_name("TS_Event_channel_pending"))) TS_Event_channel_pending(int8_tArray channel_id, int8_tArray user_channel_id, int8_tArray former_temporary_channel_id, int8_tArray counterparty_node_id, uint64_t funding_txo) {
50093         LDKThirtyTwoBytes channel_id_ref;
50094         CHECK(channel_id->arr_len == 32);
50095         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
50096         LDKU128 user_channel_id_ref;
50097         CHECK(user_channel_id->arr_len == 16);
50098         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
50099         LDKThirtyTwoBytes former_temporary_channel_id_ref;
50100         CHECK(former_temporary_channel_id->arr_len == 32);
50101         memcpy(former_temporary_channel_id_ref.data, former_temporary_channel_id->elems, 32); FREE(former_temporary_channel_id);
50102         LDKPublicKey counterparty_node_id_ref;
50103         CHECK(counterparty_node_id->arr_len == 33);
50104         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
50105         LDKOutPoint funding_txo_conv;
50106         funding_txo_conv.inner = untag_ptr(funding_txo);
50107         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
50108         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
50109         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
50110         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50111         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_ref, counterparty_node_id_ref, funding_txo_conv);
50112         uint64_t ret_ref = tag_ptr(ret_copy, true);
50113         return ret_ref;
50114 }
50115
50116 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) {
50117         LDKThirtyTwoBytes channel_id_ref;
50118         CHECK(channel_id->arr_len == 32);
50119         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
50120         LDKU128 user_channel_id_ref;
50121         CHECK(user_channel_id->arr_len == 16);
50122         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
50123         LDKPublicKey counterparty_node_id_ref;
50124         CHECK(counterparty_node_id->arr_len == 33);
50125         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
50126         LDKChannelTypeFeatures channel_type_conv;
50127         channel_type_conv.inner = untag_ptr(channel_type);
50128         channel_type_conv.is_owned = ptr_is_owned(channel_type);
50129         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
50130         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
50131         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50132         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
50133         uint64_t ret_ref = tag_ptr(ret_copy, true);
50134         return ret_ref;
50135 }
50136
50137 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) {
50138         LDKThirtyTwoBytes channel_id_ref;
50139         CHECK(channel_id->arr_len == 32);
50140         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
50141         LDKU128 user_channel_id_ref;
50142         CHECK(user_channel_id->arr_len == 16);
50143         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
50144         void* reason_ptr = untag_ptr(reason);
50145         CHECK_ACCESS(reason_ptr);
50146         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
50147         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
50148         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50149         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv);
50150         uint64_t ret_ref = tag_ptr(ret_copy, true);
50151         return ret_ref;
50152 }
50153
50154 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
50155         LDKThirtyTwoBytes channel_id_ref;
50156         CHECK(channel_id->arr_len == 32);
50157         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
50158         LDKTransaction transaction_ref;
50159         transaction_ref.datalen = transaction->arr_len;
50160         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
50161         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
50162         transaction_ref.data_is_owned = true;
50163         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50164         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
50165         uint64_t ret_ref = tag_ptr(ret_copy, true);
50166         return ret_ref;
50167 }
50168
50169 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) {
50170         LDKThirtyTwoBytes temporary_channel_id_ref;
50171         CHECK(temporary_channel_id->arr_len == 32);
50172         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
50173         LDKPublicKey counterparty_node_id_ref;
50174         CHECK(counterparty_node_id->arr_len == 33);
50175         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
50176         LDKChannelTypeFeatures channel_type_conv;
50177         channel_type_conv.inner = untag_ptr(channel_type);
50178         channel_type_conv.is_owned = ptr_is_owned(channel_type);
50179         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
50180         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
50181         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50182         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
50183         uint64_t ret_ref = tag_ptr(ret_copy, true);
50184         return ret_ref;
50185 }
50186
50187 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
50188         LDKThirtyTwoBytes prev_channel_id_ref;
50189         CHECK(prev_channel_id->arr_len == 32);
50190         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
50191         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
50192         CHECK_ACCESS(failed_next_destination_ptr);
50193         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
50194         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
50195         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50196         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
50197         uint64_t ret_ref = tag_ptr(ret_copy, true);
50198         return ret_ref;
50199 }
50200
50201 jboolean  __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) {
50202         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
50203         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
50204         jboolean ret_conv = Event_eq(a_conv, b_conv);
50205         return ret_conv;
50206 }
50207
50208 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
50209         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
50210         LDKCVec_u8Z ret_var = Event_write(obj_conv);
50211         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50212         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50213         CVec_u8Z_free(ret_var);
50214         return ret_arr;
50215 }
50216
50217 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
50218         LDKu8slice ser_ref;
50219         ser_ref.datalen = ser->arr_len;
50220         ser_ref.data = ser->elems;
50221         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
50222         *ret_conv = Event_read(ser_ref);
50223         FREE(ser);
50224         return tag_ptr(ret_conv, true);
50225 }
50226
50227 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
50228         if (!ptr_is_owned(this_ptr)) return;
50229         void* this_ptr_ptr = untag_ptr(this_ptr);
50230         CHECK_ACCESS(this_ptr_ptr);
50231         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
50232         FREE(untag_ptr(this_ptr));
50233         MessageSendEvent_free(this_ptr_conv);
50234 }
50235
50236 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
50237         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50238         *ret_copy = MessageSendEvent_clone(arg);
50239         uint64_t ret_ref = tag_ptr(ret_copy, true);
50240         return ret_ref;
50241 }
50242 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
50243         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
50244         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
50245         return ret_conv;
50246 }
50247
50248 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
50249         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
50250         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50251         *ret_copy = MessageSendEvent_clone(orig_conv);
50252         uint64_t ret_ref = tag_ptr(ret_copy, true);
50253         return ret_ref;
50254 }
50255
50256 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
50257         LDKPublicKey node_id_ref;
50258         CHECK(node_id->arr_len == 33);
50259         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50260         LDKAcceptChannel msg_conv;
50261         msg_conv.inner = untag_ptr(msg);
50262         msg_conv.is_owned = ptr_is_owned(msg);
50263         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50264         msg_conv = AcceptChannel_clone(&msg_conv);
50265         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50266         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
50267         uint64_t ret_ref = tag_ptr(ret_copy, true);
50268         return ret_ref;
50269 }
50270
50271 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
50272         LDKPublicKey node_id_ref;
50273         CHECK(node_id->arr_len == 33);
50274         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50275         LDKOpenChannel msg_conv;
50276         msg_conv.inner = untag_ptr(msg);
50277         msg_conv.is_owned = ptr_is_owned(msg);
50278         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50279         msg_conv = OpenChannel_clone(&msg_conv);
50280         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50281         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
50282         uint64_t ret_ref = tag_ptr(ret_copy, true);
50283         return ret_ref;
50284 }
50285
50286 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
50287         LDKPublicKey node_id_ref;
50288         CHECK(node_id->arr_len == 33);
50289         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50290         LDKFundingCreated msg_conv;
50291         msg_conv.inner = untag_ptr(msg);
50292         msg_conv.is_owned = ptr_is_owned(msg);
50293         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50294         msg_conv = FundingCreated_clone(&msg_conv);
50295         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50296         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
50297         uint64_t ret_ref = tag_ptr(ret_copy, true);
50298         return ret_ref;
50299 }
50300
50301 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
50302         LDKPublicKey node_id_ref;
50303         CHECK(node_id->arr_len == 33);
50304         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50305         LDKFundingSigned msg_conv;
50306         msg_conv.inner = untag_ptr(msg);
50307         msg_conv.is_owned = ptr_is_owned(msg);
50308         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50309         msg_conv = FundingSigned_clone(&msg_conv);
50310         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50311         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
50312         uint64_t ret_ref = tag_ptr(ret_copy, true);
50313         return ret_ref;
50314 }
50315
50316 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
50317         LDKPublicKey node_id_ref;
50318         CHECK(node_id->arr_len == 33);
50319         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50320         LDKChannelReady msg_conv;
50321         msg_conv.inner = untag_ptr(msg);
50322         msg_conv.is_owned = ptr_is_owned(msg);
50323         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50324         msg_conv = ChannelReady_clone(&msg_conv);
50325         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50326         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
50327         uint64_t ret_ref = tag_ptr(ret_copy, true);
50328         return ret_ref;
50329 }
50330
50331 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
50332         LDKPublicKey node_id_ref;
50333         CHECK(node_id->arr_len == 33);
50334         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50335         LDKAnnouncementSignatures msg_conv;
50336         msg_conv.inner = untag_ptr(msg);
50337         msg_conv.is_owned = ptr_is_owned(msg);
50338         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50339         msg_conv = AnnouncementSignatures_clone(&msg_conv);
50340         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50341         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
50342         uint64_t ret_ref = tag_ptr(ret_copy, true);
50343         return ret_ref;
50344 }
50345
50346 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
50347         LDKPublicKey node_id_ref;
50348         CHECK(node_id->arr_len == 33);
50349         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50350         LDKCommitmentUpdate updates_conv;
50351         updates_conv.inner = untag_ptr(updates);
50352         updates_conv.is_owned = ptr_is_owned(updates);
50353         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
50354         updates_conv = CommitmentUpdate_clone(&updates_conv);
50355         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50356         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
50357         uint64_t ret_ref = tag_ptr(ret_copy, true);
50358         return ret_ref;
50359 }
50360
50361 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
50362         LDKPublicKey node_id_ref;
50363         CHECK(node_id->arr_len == 33);
50364         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50365         LDKRevokeAndACK msg_conv;
50366         msg_conv.inner = untag_ptr(msg);
50367         msg_conv.is_owned = ptr_is_owned(msg);
50368         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50369         msg_conv = RevokeAndACK_clone(&msg_conv);
50370         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50371         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
50372         uint64_t ret_ref = tag_ptr(ret_copy, true);
50373         return ret_ref;
50374 }
50375
50376 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
50377         LDKPublicKey node_id_ref;
50378         CHECK(node_id->arr_len == 33);
50379         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50380         LDKClosingSigned msg_conv;
50381         msg_conv.inner = untag_ptr(msg);
50382         msg_conv.is_owned = ptr_is_owned(msg);
50383         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50384         msg_conv = ClosingSigned_clone(&msg_conv);
50385         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50386         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
50387         uint64_t ret_ref = tag_ptr(ret_copy, true);
50388         return ret_ref;
50389 }
50390
50391 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
50392         LDKPublicKey node_id_ref;
50393         CHECK(node_id->arr_len == 33);
50394         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50395         LDKShutdown msg_conv;
50396         msg_conv.inner = untag_ptr(msg);
50397         msg_conv.is_owned = ptr_is_owned(msg);
50398         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50399         msg_conv = Shutdown_clone(&msg_conv);
50400         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50401         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
50402         uint64_t ret_ref = tag_ptr(ret_copy, true);
50403         return ret_ref;
50404 }
50405
50406 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
50407         LDKPublicKey node_id_ref;
50408         CHECK(node_id->arr_len == 33);
50409         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50410         LDKChannelReestablish msg_conv;
50411         msg_conv.inner = untag_ptr(msg);
50412         msg_conv.is_owned = ptr_is_owned(msg);
50413         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50414         msg_conv = ChannelReestablish_clone(&msg_conv);
50415         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50416         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
50417         uint64_t ret_ref = tag_ptr(ret_copy, true);
50418         return ret_ref;
50419 }
50420
50421 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) {
50422         LDKPublicKey node_id_ref;
50423         CHECK(node_id->arr_len == 33);
50424         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50425         LDKChannelAnnouncement msg_conv;
50426         msg_conv.inner = untag_ptr(msg);
50427         msg_conv.is_owned = ptr_is_owned(msg);
50428         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50429         msg_conv = ChannelAnnouncement_clone(&msg_conv);
50430         LDKChannelUpdate update_msg_conv;
50431         update_msg_conv.inner = untag_ptr(update_msg);
50432         update_msg_conv.is_owned = ptr_is_owned(update_msg);
50433         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
50434         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
50435         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50436         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
50437         uint64_t ret_ref = tag_ptr(ret_copy, true);
50438         return ret_ref;
50439 }
50440
50441 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
50442         LDKChannelAnnouncement msg_conv;
50443         msg_conv.inner = untag_ptr(msg);
50444         msg_conv.is_owned = ptr_is_owned(msg);
50445         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50446         msg_conv = ChannelAnnouncement_clone(&msg_conv);
50447         LDKChannelUpdate update_msg_conv;
50448         update_msg_conv.inner = untag_ptr(update_msg);
50449         update_msg_conv.is_owned = ptr_is_owned(update_msg);
50450         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
50451         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
50452         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50453         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
50454         uint64_t ret_ref = tag_ptr(ret_copy, true);
50455         return ret_ref;
50456 }
50457
50458 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
50459         LDKChannelUpdate msg_conv;
50460         msg_conv.inner = untag_ptr(msg);
50461         msg_conv.is_owned = ptr_is_owned(msg);
50462         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50463         msg_conv = ChannelUpdate_clone(&msg_conv);
50464         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50465         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
50466         uint64_t ret_ref = tag_ptr(ret_copy, true);
50467         return ret_ref;
50468 }
50469
50470 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
50471         LDKNodeAnnouncement msg_conv;
50472         msg_conv.inner = untag_ptr(msg);
50473         msg_conv.is_owned = ptr_is_owned(msg);
50474         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50475         msg_conv = NodeAnnouncement_clone(&msg_conv);
50476         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50477         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
50478         uint64_t ret_ref = tag_ptr(ret_copy, true);
50479         return ret_ref;
50480 }
50481
50482 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
50483         LDKPublicKey node_id_ref;
50484         CHECK(node_id->arr_len == 33);
50485         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50486         LDKChannelUpdate msg_conv;
50487         msg_conv.inner = untag_ptr(msg);
50488         msg_conv.is_owned = ptr_is_owned(msg);
50489         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50490         msg_conv = ChannelUpdate_clone(&msg_conv);
50491         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50492         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
50493         uint64_t ret_ref = tag_ptr(ret_copy, true);
50494         return ret_ref;
50495 }
50496
50497 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
50498         LDKPublicKey node_id_ref;
50499         CHECK(node_id->arr_len == 33);
50500         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50501         void* action_ptr = untag_ptr(action);
50502         CHECK_ACCESS(action_ptr);
50503         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
50504         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
50505         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50506         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
50507         uint64_t ret_ref = tag_ptr(ret_copy, true);
50508         return ret_ref;
50509 }
50510
50511 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
50512         LDKPublicKey node_id_ref;
50513         CHECK(node_id->arr_len == 33);
50514         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50515         LDKQueryChannelRange msg_conv;
50516         msg_conv.inner = untag_ptr(msg);
50517         msg_conv.is_owned = ptr_is_owned(msg);
50518         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50519         msg_conv = QueryChannelRange_clone(&msg_conv);
50520         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50521         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
50522         uint64_t ret_ref = tag_ptr(ret_copy, true);
50523         return ret_ref;
50524 }
50525
50526 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
50527         LDKPublicKey node_id_ref;
50528         CHECK(node_id->arr_len == 33);
50529         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50530         LDKQueryShortChannelIds msg_conv;
50531         msg_conv.inner = untag_ptr(msg);
50532         msg_conv.is_owned = ptr_is_owned(msg);
50533         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50534         msg_conv = QueryShortChannelIds_clone(&msg_conv);
50535         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50536         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
50537         uint64_t ret_ref = tag_ptr(ret_copy, true);
50538         return ret_ref;
50539 }
50540
50541 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
50542         LDKPublicKey node_id_ref;
50543         CHECK(node_id->arr_len == 33);
50544         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50545         LDKReplyChannelRange msg_conv;
50546         msg_conv.inner = untag_ptr(msg);
50547         msg_conv.is_owned = ptr_is_owned(msg);
50548         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50549         msg_conv = ReplyChannelRange_clone(&msg_conv);
50550         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50551         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
50552         uint64_t ret_ref = tag_ptr(ret_copy, true);
50553         return ret_ref;
50554 }
50555
50556 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
50557         LDKPublicKey node_id_ref;
50558         CHECK(node_id->arr_len == 33);
50559         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50560         LDKGossipTimestampFilter msg_conv;
50561         msg_conv.inner = untag_ptr(msg);
50562         msg_conv.is_owned = ptr_is_owned(msg);
50563         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50564         msg_conv = GossipTimestampFilter_clone(&msg_conv);
50565         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50566         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
50567         uint64_t ret_ref = tag_ptr(ret_copy, true);
50568         return ret_ref;
50569 }
50570
50571 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
50572         if (!ptr_is_owned(this_ptr)) return;
50573         void* this_ptr_ptr = untag_ptr(this_ptr);
50574         CHECK_ACCESS(this_ptr_ptr);
50575         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
50576         FREE(untag_ptr(this_ptr));
50577         MessageSendEventsProvider_free(this_ptr_conv);
50578 }
50579
50580 void  __attribute__((export_name("TS_OnionMessageProvider_free"))) TS_OnionMessageProvider_free(uint64_t this_ptr) {
50581         if (!ptr_is_owned(this_ptr)) return;
50582         void* this_ptr_ptr = untag_ptr(this_ptr);
50583         CHECK_ACCESS(this_ptr_ptr);
50584         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
50585         FREE(untag_ptr(this_ptr));
50586         OnionMessageProvider_free(this_ptr_conv);
50587 }
50588
50589 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
50590         if (!ptr_is_owned(this_ptr)) return;
50591         void* this_ptr_ptr = untag_ptr(this_ptr);
50592         CHECK_ACCESS(this_ptr_ptr);
50593         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
50594         FREE(untag_ptr(this_ptr));
50595         EventsProvider_free(this_ptr_conv);
50596 }
50597
50598 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
50599         if (!ptr_is_owned(this_ptr)) return;
50600         void* this_ptr_ptr = untag_ptr(this_ptr);
50601         CHECK_ACCESS(this_ptr_ptr);
50602         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
50603         FREE(untag_ptr(this_ptr));
50604         EventHandler_free(this_ptr_conv);
50605 }
50606
50607 void  __attribute__((export_name("TS_GossipSync_free"))) TS_GossipSync_free(uint64_t this_ptr) {
50608         if (!ptr_is_owned(this_ptr)) return;
50609         void* this_ptr_ptr = untag_ptr(this_ptr);
50610         CHECK_ACCESS(this_ptr_ptr);
50611         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
50612         FREE(untag_ptr(this_ptr));
50613         GossipSync_free(this_ptr_conv);
50614 }
50615
50616 uint64_t  __attribute__((export_name("TS_GossipSync_p2_p"))) TS_GossipSync_p2_p(uint64_t a) {
50617         LDKP2PGossipSync a_conv;
50618         a_conv.inner = untag_ptr(a);
50619         a_conv.is_owned = ptr_is_owned(a);
50620         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50621         a_conv.is_owned = false;
50622         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
50623         *ret_copy = GossipSync_p2_p(&a_conv);
50624         uint64_t ret_ref = tag_ptr(ret_copy, true);
50625         return ret_ref;
50626 }
50627
50628 uint64_t  __attribute__((export_name("TS_GossipSync_rapid"))) TS_GossipSync_rapid(uint64_t a) {
50629         LDKRapidGossipSync a_conv;
50630         a_conv.inner = untag_ptr(a);
50631         a_conv.is_owned = ptr_is_owned(a);
50632         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50633         a_conv.is_owned = false;
50634         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
50635         *ret_copy = GossipSync_rapid(&a_conv);
50636         uint64_t ret_ref = tag_ptr(ret_copy, true);
50637         return ret_ref;
50638 }
50639
50640 uint64_t  __attribute__((export_name("TS_GossipSync_none"))) TS_GossipSync_none() {
50641         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
50642         *ret_copy = GossipSync_none();
50643         uint64_t ret_ref = tag_ptr(ret_copy, true);
50644         return ret_ref;
50645 }
50646
50647 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
50648         LDKRapidGossipSync this_obj_conv;
50649         this_obj_conv.inner = untag_ptr(this_obj);
50650         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50652         RapidGossipSync_free(this_obj_conv);
50653 }
50654
50655 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph, uint64_t logger) {
50656         LDKNetworkGraph network_graph_conv;
50657         network_graph_conv.inner = untag_ptr(network_graph);
50658         network_graph_conv.is_owned = ptr_is_owned(network_graph);
50659         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
50660         network_graph_conv.is_owned = false;
50661         void* logger_ptr = untag_ptr(logger);
50662         CHECK_ACCESS(logger_ptr);
50663         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
50664         if (logger_conv.free == LDKLogger_JCalls_free) {
50665                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50666                 LDKLogger_JCalls_cloned(&logger_conv);
50667         }
50668         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
50669         uint64_t ret_ref = 0;
50670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50672         return ret_ref;
50673 }
50674
50675 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) {
50676         LDKRapidGossipSync this_arg_conv;
50677         this_arg_conv.inner = untag_ptr(this_arg);
50678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50680         this_arg_conv.is_owned = false;
50681         LDKu8slice update_data_ref;
50682         update_data_ref.datalen = update_data->arr_len;
50683         update_data_ref.data = update_data->elems;
50684         void* current_time_unix_ptr = untag_ptr(current_time_unix);
50685         CHECK_ACCESS(current_time_unix_ptr);
50686         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
50687         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
50688         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
50689         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
50690         FREE(update_data);
50691         return tag_ptr(ret_conv, true);
50692 }
50693
50694 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
50695         LDKRapidGossipSync this_arg_conv;
50696         this_arg_conv.inner = untag_ptr(this_arg);
50697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50699         this_arg_conv.is_owned = false;
50700         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
50701         return ret_conv;
50702 }
50703
50704 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
50705         if (!ptr_is_owned(this_ptr)) return;
50706         void* this_ptr_ptr = untag_ptr(this_ptr);
50707         CHECK_ACCESS(this_ptr_ptr);
50708         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
50709         FREE(untag_ptr(this_ptr));
50710         GraphSyncError_free(this_ptr_conv);
50711 }
50712
50713 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
50714         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50715         *ret_copy = GraphSyncError_clone(arg);
50716         uint64_t ret_ref = tag_ptr(ret_copy, true);
50717         return ret_ref;
50718 }
50719 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
50720         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
50721         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
50722         return ret_conv;
50723 }
50724
50725 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
50726         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
50727         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50728         *ret_copy = GraphSyncError_clone(orig_conv);
50729         uint64_t ret_ref = tag_ptr(ret_copy, true);
50730         return ret_ref;
50731 }
50732
50733 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
50734         void* a_ptr = untag_ptr(a);
50735         CHECK_ACCESS(a_ptr);
50736         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
50737         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
50738         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50739         *ret_copy = GraphSyncError_decode_error(a_conv);
50740         uint64_t ret_ref = tag_ptr(ret_copy, true);
50741         return ret_ref;
50742 }
50743
50744 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
50745         LDKLightningError a_conv;
50746         a_conv.inner = untag_ptr(a);
50747         a_conv.is_owned = ptr_is_owned(a);
50748         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50749         a_conv = LightningError_clone(&a_conv);
50750         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50751         *ret_copy = GraphSyncError_lightning_error(a_conv);
50752         uint64_t ret_ref = tag_ptr(ret_copy, true);
50753         return ret_ref;
50754 }
50755
50756 void  __attribute__((export_name("TS_ParseError_free"))) TS_ParseError_free(uint64_t this_ptr) {
50757         if (!ptr_is_owned(this_ptr)) return;
50758         void* this_ptr_ptr = untag_ptr(this_ptr);
50759         CHECK_ACCESS(this_ptr_ptr);
50760         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
50761         FREE(untag_ptr(this_ptr));
50762         ParseError_free(this_ptr_conv);
50763 }
50764
50765 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
50766         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50767         *ret_copy = ParseError_clone(arg);
50768         uint64_t ret_ref = tag_ptr(ret_copy, true);
50769         return ret_ref;
50770 }
50771 int64_t  __attribute__((export_name("TS_ParseError_clone_ptr"))) TS_ParseError_clone_ptr(uint64_t arg) {
50772         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
50773         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
50774         return ret_conv;
50775 }
50776
50777 uint64_t  __attribute__((export_name("TS_ParseError_clone"))) TS_ParseError_clone(uint64_t orig) {
50778         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
50779         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50780         *ret_copy = ParseError_clone(orig_conv);
50781         uint64_t ret_ref = tag_ptr(ret_copy, true);
50782         return ret_ref;
50783 }
50784
50785 uint64_t  __attribute__((export_name("TS_ParseError_bech32_error"))) TS_ParseError_bech32_error(uint64_t a) {
50786         void* a_ptr = untag_ptr(a);
50787         CHECK_ACCESS(a_ptr);
50788         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
50789         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
50790         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50791         *ret_copy = ParseError_bech32_error(a_conv);
50792         uint64_t ret_ref = tag_ptr(ret_copy, true);
50793         return ret_ref;
50794 }
50795
50796 uint64_t  __attribute__((export_name("TS_ParseError_parse_amount_error"))) TS_ParseError_parse_amount_error(int32_t a) {
50797         
50798         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50799         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
50800         uint64_t ret_ref = tag_ptr(ret_copy, true);
50801         return ret_ref;
50802 }
50803
50804 uint64_t  __attribute__((export_name("TS_ParseError_malformed_signature"))) TS_ParseError_malformed_signature(uint32_t a) {
50805         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
50806         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50807         *ret_copy = ParseError_malformed_signature(a_conv);
50808         uint64_t ret_ref = tag_ptr(ret_copy, true);
50809         return ret_ref;
50810 }
50811
50812 uint64_t  __attribute__((export_name("TS_ParseError_bad_prefix"))) TS_ParseError_bad_prefix() {
50813         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50814         *ret_copy = ParseError_bad_prefix();
50815         uint64_t ret_ref = tag_ptr(ret_copy, true);
50816         return ret_ref;
50817 }
50818
50819 uint64_t  __attribute__((export_name("TS_ParseError_unknown_currency"))) TS_ParseError_unknown_currency() {
50820         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50821         *ret_copy = ParseError_unknown_currency();
50822         uint64_t ret_ref = tag_ptr(ret_copy, true);
50823         return ret_ref;
50824 }
50825
50826 uint64_t  __attribute__((export_name("TS_ParseError_unknown_si_prefix"))) TS_ParseError_unknown_si_prefix() {
50827         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50828         *ret_copy = ParseError_unknown_si_prefix();
50829         uint64_t ret_ref = tag_ptr(ret_copy, true);
50830         return ret_ref;
50831 }
50832
50833 uint64_t  __attribute__((export_name("TS_ParseError_malformed_hrp"))) TS_ParseError_malformed_hrp() {
50834         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50835         *ret_copy = ParseError_malformed_hrp();
50836         uint64_t ret_ref = tag_ptr(ret_copy, true);
50837         return ret_ref;
50838 }
50839
50840 uint64_t  __attribute__((export_name("TS_ParseError_too_short_data_part"))) TS_ParseError_too_short_data_part() {
50841         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50842         *ret_copy = ParseError_too_short_data_part();
50843         uint64_t ret_ref = tag_ptr(ret_copy, true);
50844         return ret_ref;
50845 }
50846
50847 uint64_t  __attribute__((export_name("TS_ParseError_unexpected_end_of_tagged_fields"))) TS_ParseError_unexpected_end_of_tagged_fields() {
50848         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50849         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
50850         uint64_t ret_ref = tag_ptr(ret_copy, true);
50851         return ret_ref;
50852 }
50853
50854 uint64_t  __attribute__((export_name("TS_ParseError_description_decode_error"))) TS_ParseError_description_decode_error(int32_t a) {
50855         
50856         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50857         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
50858         uint64_t ret_ref = tag_ptr(ret_copy, true);
50859         return ret_ref;
50860 }
50861
50862 uint64_t  __attribute__((export_name("TS_ParseError_padding_error"))) TS_ParseError_padding_error() {
50863         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50864         *ret_copy = ParseError_padding_error();
50865         uint64_t ret_ref = tag_ptr(ret_copy, true);
50866         return ret_ref;
50867 }
50868
50869 uint64_t  __attribute__((export_name("TS_ParseError_integer_overflow_error"))) TS_ParseError_integer_overflow_error() {
50870         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50871         *ret_copy = ParseError_integer_overflow_error();
50872         uint64_t ret_ref = tag_ptr(ret_copy, true);
50873         return ret_ref;
50874 }
50875
50876 uint64_t  __attribute__((export_name("TS_ParseError_invalid_seg_wit_program_length"))) TS_ParseError_invalid_seg_wit_program_length() {
50877         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50878         *ret_copy = ParseError_invalid_seg_wit_program_length();
50879         uint64_t ret_ref = tag_ptr(ret_copy, true);
50880         return ret_ref;
50881 }
50882
50883 uint64_t  __attribute__((export_name("TS_ParseError_invalid_pub_key_hash_length"))) TS_ParseError_invalid_pub_key_hash_length() {
50884         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50885         *ret_copy = ParseError_invalid_pub_key_hash_length();
50886         uint64_t ret_ref = tag_ptr(ret_copy, true);
50887         return ret_ref;
50888 }
50889
50890 uint64_t  __attribute__((export_name("TS_ParseError_invalid_script_hash_length"))) TS_ParseError_invalid_script_hash_length() {
50891         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50892         *ret_copy = ParseError_invalid_script_hash_length();
50893         uint64_t ret_ref = tag_ptr(ret_copy, true);
50894         return ret_ref;
50895 }
50896
50897 uint64_t  __attribute__((export_name("TS_ParseError_invalid_recovery_id"))) TS_ParseError_invalid_recovery_id() {
50898         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50899         *ret_copy = ParseError_invalid_recovery_id();
50900         uint64_t ret_ref = tag_ptr(ret_copy, true);
50901         return ret_ref;
50902 }
50903
50904 uint64_t  __attribute__((export_name("TS_ParseError_invalid_slice_length"))) TS_ParseError_invalid_slice_length(jstring a) {
50905         LDKStr a_conv = str_ref_to_owned_c(a);
50906         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50907         *ret_copy = ParseError_invalid_slice_length(a_conv);
50908         uint64_t ret_ref = tag_ptr(ret_copy, true);
50909         return ret_ref;
50910 }
50911
50912 uint64_t  __attribute__((export_name("TS_ParseError_skip"))) TS_ParseError_skip() {
50913         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50914         *ret_copy = ParseError_skip();
50915         uint64_t ret_ref = tag_ptr(ret_copy, true);
50916         return ret_ref;
50917 }
50918
50919 jboolean  __attribute__((export_name("TS_ParseError_eq"))) TS_ParseError_eq(uint64_t a, uint64_t b) {
50920         LDKParseError* a_conv = (LDKParseError*)untag_ptr(a);
50921         LDKParseError* b_conv = (LDKParseError*)untag_ptr(b);
50922         jboolean ret_conv = ParseError_eq(a_conv, b_conv);
50923         return ret_conv;
50924 }
50925
50926 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
50927         if (!ptr_is_owned(this_ptr)) return;
50928         void* this_ptr_ptr = untag_ptr(this_ptr);
50929         CHECK_ACCESS(this_ptr_ptr);
50930         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
50931         FREE(untag_ptr(this_ptr));
50932         ParseOrSemanticError_free(this_ptr_conv);
50933 }
50934
50935 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
50936         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
50937         *ret_copy = ParseOrSemanticError_clone(arg);
50938         uint64_t ret_ref = tag_ptr(ret_copy, true);
50939         return ret_ref;
50940 }
50941 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
50942         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
50943         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
50944         return ret_conv;
50945 }
50946
50947 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
50948         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
50949         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
50950         *ret_copy = ParseOrSemanticError_clone(orig_conv);
50951         uint64_t ret_ref = tag_ptr(ret_copy, true);
50952         return ret_ref;
50953 }
50954
50955 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
50956         void* a_ptr = untag_ptr(a);
50957         CHECK_ACCESS(a_ptr);
50958         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
50959         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
50960         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
50961         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
50962         uint64_t ret_ref = tag_ptr(ret_copy, true);
50963         return ret_ref;
50964 }
50965
50966 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
50967         LDKSemanticError a_conv = LDKSemanticError_from_js(a);
50968         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
50969         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
50970         uint64_t ret_ref = tag_ptr(ret_copy, true);
50971         return ret_ref;
50972 }
50973
50974 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
50975         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
50976         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
50977         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
50978         return ret_conv;
50979 }
50980
50981 void  __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint64_t this_obj) {
50982         LDKInvoice this_obj_conv;
50983         this_obj_conv.inner = untag_ptr(this_obj);
50984         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50986         Invoice_free(this_obj_conv);
50987 }
50988
50989 jboolean  __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint64_t a, uint64_t b) {
50990         LDKInvoice a_conv;
50991         a_conv.inner = untag_ptr(a);
50992         a_conv.is_owned = ptr_is_owned(a);
50993         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50994         a_conv.is_owned = false;
50995         LDKInvoice b_conv;
50996         b_conv.inner = untag_ptr(b);
50997         b_conv.is_owned = ptr_is_owned(b);
50998         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50999         b_conv.is_owned = false;
51000         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
51001         return ret_conv;
51002 }
51003
51004 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
51005         LDKInvoice ret_var = Invoice_clone(arg);
51006         uint64_t ret_ref = 0;
51007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51009         return ret_ref;
51010 }
51011 int64_t  __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint64_t arg) {
51012         LDKInvoice arg_conv;
51013         arg_conv.inner = untag_ptr(arg);
51014         arg_conv.is_owned = ptr_is_owned(arg);
51015         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51016         arg_conv.is_owned = false;
51017         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
51018         return ret_conv;
51019 }
51020
51021 uint64_t  __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint64_t orig) {
51022         LDKInvoice orig_conv;
51023         orig_conv.inner = untag_ptr(orig);
51024         orig_conv.is_owned = ptr_is_owned(orig);
51025         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51026         orig_conv.is_owned = false;
51027         LDKInvoice ret_var = Invoice_clone(&orig_conv);
51028         uint64_t ret_ref = 0;
51029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51031         return ret_ref;
51032 }
51033
51034 int64_t  __attribute__((export_name("TS_Invoice_hash"))) TS_Invoice_hash(uint64_t o) {
51035         LDKInvoice o_conv;
51036         o_conv.inner = untag_ptr(o);
51037         o_conv.is_owned = ptr_is_owned(o);
51038         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51039         o_conv.is_owned = false;
51040         int64_t ret_conv = Invoice_hash(&o_conv);
51041         return ret_conv;
51042 }
51043
51044 void  __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint64_t this_obj) {
51045         LDKSignedRawInvoice this_obj_conv;
51046         this_obj_conv.inner = untag_ptr(this_obj);
51047         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51049         SignedRawInvoice_free(this_obj_conv);
51050 }
51051
51052 jboolean  __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint64_t a, uint64_t b) {
51053         LDKSignedRawInvoice a_conv;
51054         a_conv.inner = untag_ptr(a);
51055         a_conv.is_owned = ptr_is_owned(a);
51056         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51057         a_conv.is_owned = false;
51058         LDKSignedRawInvoice b_conv;
51059         b_conv.inner = untag_ptr(b);
51060         b_conv.is_owned = ptr_is_owned(b);
51061         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51062         b_conv.is_owned = false;
51063         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
51064         return ret_conv;
51065 }
51066
51067 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
51068         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
51069         uint64_t ret_ref = 0;
51070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51072         return ret_ref;
51073 }
51074 int64_t  __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint64_t arg) {
51075         LDKSignedRawInvoice arg_conv;
51076         arg_conv.inner = untag_ptr(arg);
51077         arg_conv.is_owned = ptr_is_owned(arg);
51078         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51079         arg_conv.is_owned = false;
51080         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
51081         return ret_conv;
51082 }
51083
51084 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint64_t orig) {
51085         LDKSignedRawInvoice orig_conv;
51086         orig_conv.inner = untag_ptr(orig);
51087         orig_conv.is_owned = ptr_is_owned(orig);
51088         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51089         orig_conv.is_owned = false;
51090         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
51091         uint64_t ret_ref = 0;
51092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51094         return ret_ref;
51095 }
51096
51097 int64_t  __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint64_t o) {
51098         LDKSignedRawInvoice o_conv;
51099         o_conv.inner = untag_ptr(o);
51100         o_conv.is_owned = ptr_is_owned(o);
51101         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51102         o_conv.is_owned = false;
51103         int64_t ret_conv = SignedRawInvoice_hash(&o_conv);
51104         return ret_conv;
51105 }
51106
51107 void  __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint64_t this_obj) {
51108         LDKRawInvoice this_obj_conv;
51109         this_obj_conv.inner = untag_ptr(this_obj);
51110         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51112         RawInvoice_free(this_obj_conv);
51113 }
51114
51115 uint64_t  __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint64_t this_ptr) {
51116         LDKRawInvoice this_ptr_conv;
51117         this_ptr_conv.inner = untag_ptr(this_ptr);
51118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51120         this_ptr_conv.is_owned = false;
51121         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
51122         uint64_t ret_ref = 0;
51123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51125         return ret_ref;
51126 }
51127
51128 void  __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint64_t this_ptr, uint64_t val) {
51129         LDKRawInvoice this_ptr_conv;
51130         this_ptr_conv.inner = untag_ptr(this_ptr);
51131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51133         this_ptr_conv.is_owned = false;
51134         LDKRawDataPart val_conv;
51135         val_conv.inner = untag_ptr(val);
51136         val_conv.is_owned = ptr_is_owned(val);
51137         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51138         val_conv = RawDataPart_clone(&val_conv);
51139         RawInvoice_set_data(&this_ptr_conv, val_conv);
51140 }
51141
51142 jboolean  __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint64_t a, uint64_t b) {
51143         LDKRawInvoice a_conv;
51144         a_conv.inner = untag_ptr(a);
51145         a_conv.is_owned = ptr_is_owned(a);
51146         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51147         a_conv.is_owned = false;
51148         LDKRawInvoice b_conv;
51149         b_conv.inner = untag_ptr(b);
51150         b_conv.is_owned = ptr_is_owned(b);
51151         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51152         b_conv.is_owned = false;
51153         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
51154         return ret_conv;
51155 }
51156
51157 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
51158         LDKRawInvoice ret_var = RawInvoice_clone(arg);
51159         uint64_t ret_ref = 0;
51160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51162         return ret_ref;
51163 }
51164 int64_t  __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint64_t arg) {
51165         LDKRawInvoice arg_conv;
51166         arg_conv.inner = untag_ptr(arg);
51167         arg_conv.is_owned = ptr_is_owned(arg);
51168         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51169         arg_conv.is_owned = false;
51170         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
51171         return ret_conv;
51172 }
51173
51174 uint64_t  __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint64_t orig) {
51175         LDKRawInvoice orig_conv;
51176         orig_conv.inner = untag_ptr(orig);
51177         orig_conv.is_owned = ptr_is_owned(orig);
51178         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51179         orig_conv.is_owned = false;
51180         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
51181         uint64_t ret_ref = 0;
51182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51184         return ret_ref;
51185 }
51186
51187 int64_t  __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint64_t o) {
51188         LDKRawInvoice o_conv;
51189         o_conv.inner = untag_ptr(o);
51190         o_conv.is_owned = ptr_is_owned(o);
51191         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51192         o_conv.is_owned = false;
51193         int64_t ret_conv = RawInvoice_hash(&o_conv);
51194         return ret_conv;
51195 }
51196
51197 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
51198         LDKRawDataPart this_obj_conv;
51199         this_obj_conv.inner = untag_ptr(this_obj);
51200         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51202         RawDataPart_free(this_obj_conv);
51203 }
51204
51205 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
51206         LDKRawDataPart this_ptr_conv;
51207         this_ptr_conv.inner = untag_ptr(this_ptr);
51208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51210         this_ptr_conv.is_owned = false;
51211         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
51212         uint64_t ret_ref = 0;
51213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51215         return ret_ref;
51216 }
51217
51218 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
51219         LDKRawDataPart this_ptr_conv;
51220         this_ptr_conv.inner = untag_ptr(this_ptr);
51221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51223         this_ptr_conv.is_owned = false;
51224         LDKPositiveTimestamp val_conv;
51225         val_conv.inner = untag_ptr(val);
51226         val_conv.is_owned = ptr_is_owned(val);
51227         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51228         val_conv = PositiveTimestamp_clone(&val_conv);
51229         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
51230 }
51231
51232 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
51233         LDKRawDataPart a_conv;
51234         a_conv.inner = untag_ptr(a);
51235         a_conv.is_owned = ptr_is_owned(a);
51236         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51237         a_conv.is_owned = false;
51238         LDKRawDataPart b_conv;
51239         b_conv.inner = untag_ptr(b);
51240         b_conv.is_owned = ptr_is_owned(b);
51241         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51242         b_conv.is_owned = false;
51243         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
51244         return ret_conv;
51245 }
51246
51247 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
51248         LDKRawDataPart ret_var = RawDataPart_clone(arg);
51249         uint64_t ret_ref = 0;
51250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51252         return ret_ref;
51253 }
51254 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
51255         LDKRawDataPart arg_conv;
51256         arg_conv.inner = untag_ptr(arg);
51257         arg_conv.is_owned = ptr_is_owned(arg);
51258         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51259         arg_conv.is_owned = false;
51260         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
51261         return ret_conv;
51262 }
51263
51264 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
51265         LDKRawDataPart orig_conv;
51266         orig_conv.inner = untag_ptr(orig);
51267         orig_conv.is_owned = ptr_is_owned(orig);
51268         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51269         orig_conv.is_owned = false;
51270         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
51271         uint64_t ret_ref = 0;
51272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51274         return ret_ref;
51275 }
51276
51277 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
51278         LDKRawDataPart o_conv;
51279         o_conv.inner = untag_ptr(o);
51280         o_conv.is_owned = ptr_is_owned(o);
51281         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51282         o_conv.is_owned = false;
51283         int64_t ret_conv = RawDataPart_hash(&o_conv);
51284         return ret_conv;
51285 }
51286
51287 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
51288         LDKPositiveTimestamp this_obj_conv;
51289         this_obj_conv.inner = untag_ptr(this_obj);
51290         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51292         PositiveTimestamp_free(this_obj_conv);
51293 }
51294
51295 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
51296         LDKPositiveTimestamp a_conv;
51297         a_conv.inner = untag_ptr(a);
51298         a_conv.is_owned = ptr_is_owned(a);
51299         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51300         a_conv.is_owned = false;
51301         LDKPositiveTimestamp b_conv;
51302         b_conv.inner = untag_ptr(b);
51303         b_conv.is_owned = ptr_is_owned(b);
51304         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51305         b_conv.is_owned = false;
51306         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
51307         return ret_conv;
51308 }
51309
51310 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
51311         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
51312         uint64_t ret_ref = 0;
51313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51315         return ret_ref;
51316 }
51317 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
51318         LDKPositiveTimestamp arg_conv;
51319         arg_conv.inner = untag_ptr(arg);
51320         arg_conv.is_owned = ptr_is_owned(arg);
51321         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51322         arg_conv.is_owned = false;
51323         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
51324         return ret_conv;
51325 }
51326
51327 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
51328         LDKPositiveTimestamp orig_conv;
51329         orig_conv.inner = untag_ptr(orig);
51330         orig_conv.is_owned = ptr_is_owned(orig);
51331         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51332         orig_conv.is_owned = false;
51333         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
51334         uint64_t ret_ref = 0;
51335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51337         return ret_ref;
51338 }
51339
51340 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
51341         LDKPositiveTimestamp o_conv;
51342         o_conv.inner = untag_ptr(o);
51343         o_conv.is_owned = ptr_is_owned(o);
51344         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51345         o_conv.is_owned = false;
51346         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
51347         return ret_conv;
51348 }
51349
51350 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
51351         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
51352         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
51353         return ret_conv;
51354 }
51355
51356 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
51357         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
51358         return ret_conv;
51359 }
51360
51361 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
51362         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
51363         return ret_conv;
51364 }
51365
51366 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
51367         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
51368         return ret_conv;
51369 }
51370
51371 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
51372         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
51373         return ret_conv;
51374 }
51375
51376 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
51377         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
51378         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
51379         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
51380         return ret_conv;
51381 }
51382
51383 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
51384         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
51385         int64_t ret_conv = SiPrefix_hash(o_conv);
51386         return ret_conv;
51387 }
51388
51389 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
51390         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
51391         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
51392         return ret_conv;
51393 }
51394
51395 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
51396         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
51397         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
51398         return ret_conv;
51399 }
51400
51401 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
51402         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
51403         return ret_conv;
51404 }
51405
51406 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
51407         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
51408         return ret_conv;
51409 }
51410
51411 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
51412         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
51413         return ret_conv;
51414 }
51415
51416 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
51417         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
51418         return ret_conv;
51419 }
51420
51421 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
51422         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
51423         return ret_conv;
51424 }
51425
51426 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
51427         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
51428         int64_t ret_conv = Currency_hash(o_conv);
51429         return ret_conv;
51430 }
51431
51432 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
51433         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
51434         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
51435         jboolean ret_conv = Currency_eq(a_conv, b_conv);
51436         return ret_conv;
51437 }
51438
51439 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
51440         LDKSha256 this_obj_conv;
51441         this_obj_conv.inner = untag_ptr(this_obj);
51442         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51444         Sha256_free(this_obj_conv);
51445 }
51446
51447 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
51448         LDKSha256 ret_var = Sha256_clone(arg);
51449         uint64_t ret_ref = 0;
51450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51452         return ret_ref;
51453 }
51454 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
51455         LDKSha256 arg_conv;
51456         arg_conv.inner = untag_ptr(arg);
51457         arg_conv.is_owned = ptr_is_owned(arg);
51458         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51459         arg_conv.is_owned = false;
51460         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
51461         return ret_conv;
51462 }
51463
51464 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
51465         LDKSha256 orig_conv;
51466         orig_conv.inner = untag_ptr(orig);
51467         orig_conv.is_owned = ptr_is_owned(orig);
51468         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51469         orig_conv.is_owned = false;
51470         LDKSha256 ret_var = Sha256_clone(&orig_conv);
51471         uint64_t ret_ref = 0;
51472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51474         return ret_ref;
51475 }
51476
51477 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
51478         LDKSha256 o_conv;
51479         o_conv.inner = untag_ptr(o);
51480         o_conv.is_owned = ptr_is_owned(o);
51481         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51482         o_conv.is_owned = false;
51483         int64_t ret_conv = Sha256_hash(&o_conv);
51484         return ret_conv;
51485 }
51486
51487 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
51488         LDKSha256 a_conv;
51489         a_conv.inner = untag_ptr(a);
51490         a_conv.is_owned = ptr_is_owned(a);
51491         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51492         a_conv.is_owned = false;
51493         LDKSha256 b_conv;
51494         b_conv.inner = untag_ptr(b);
51495         b_conv.is_owned = ptr_is_owned(b);
51496         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51497         b_conv.is_owned = false;
51498         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
51499         return ret_conv;
51500 }
51501
51502 uint64_t  __attribute__((export_name("TS_Sha256_from_bytes"))) TS_Sha256_from_bytes(int8_tArray bytes) {
51503         uint8_t bytes_arr[32];
51504         CHECK(bytes->arr_len == 32);
51505         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
51506         uint8_t (*bytes_ref)[32] = &bytes_arr;
51507         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
51508         uint64_t ret_ref = 0;
51509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51511         return ret_ref;
51512 }
51513
51514 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
51515         LDKDescription this_obj_conv;
51516         this_obj_conv.inner = untag_ptr(this_obj);
51517         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51519         Description_free(this_obj_conv);
51520 }
51521
51522 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
51523         LDKDescription ret_var = Description_clone(arg);
51524         uint64_t ret_ref = 0;
51525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51527         return ret_ref;
51528 }
51529 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
51530         LDKDescription arg_conv;
51531         arg_conv.inner = untag_ptr(arg);
51532         arg_conv.is_owned = ptr_is_owned(arg);
51533         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51534         arg_conv.is_owned = false;
51535         int64_t ret_conv = Description_clone_ptr(&arg_conv);
51536         return ret_conv;
51537 }
51538
51539 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
51540         LDKDescription orig_conv;
51541         orig_conv.inner = untag_ptr(orig);
51542         orig_conv.is_owned = ptr_is_owned(orig);
51543         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51544         orig_conv.is_owned = false;
51545         LDKDescription ret_var = Description_clone(&orig_conv);
51546         uint64_t ret_ref = 0;
51547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51549         return ret_ref;
51550 }
51551
51552 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
51553         LDKDescription o_conv;
51554         o_conv.inner = untag_ptr(o);
51555         o_conv.is_owned = ptr_is_owned(o);
51556         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51557         o_conv.is_owned = false;
51558         int64_t ret_conv = Description_hash(&o_conv);
51559         return ret_conv;
51560 }
51561
51562 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
51563         LDKDescription a_conv;
51564         a_conv.inner = untag_ptr(a);
51565         a_conv.is_owned = ptr_is_owned(a);
51566         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51567         a_conv.is_owned = false;
51568         LDKDescription b_conv;
51569         b_conv.inner = untag_ptr(b);
51570         b_conv.is_owned = ptr_is_owned(b);
51571         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51572         b_conv.is_owned = false;
51573         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
51574         return ret_conv;
51575 }
51576
51577 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
51578         LDKPayeePubKey this_obj_conv;
51579         this_obj_conv.inner = untag_ptr(this_obj);
51580         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51582         PayeePubKey_free(this_obj_conv);
51583 }
51584
51585 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
51586         LDKPayeePubKey this_ptr_conv;
51587         this_ptr_conv.inner = untag_ptr(this_ptr);
51588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51590         this_ptr_conv.is_owned = false;
51591         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
51592         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
51593         return ret_arr;
51594 }
51595
51596 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
51597         LDKPayeePubKey this_ptr_conv;
51598         this_ptr_conv.inner = untag_ptr(this_ptr);
51599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51601         this_ptr_conv.is_owned = false;
51602         LDKPublicKey val_ref;
51603         CHECK(val->arr_len == 33);
51604         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
51605         PayeePubKey_set_a(&this_ptr_conv, val_ref);
51606 }
51607
51608 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
51609         LDKPublicKey a_arg_ref;
51610         CHECK(a_arg->arr_len == 33);
51611         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
51612         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
51613         uint64_t ret_ref = 0;
51614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51616         return ret_ref;
51617 }
51618
51619 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
51620         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
51621         uint64_t ret_ref = 0;
51622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51624         return ret_ref;
51625 }
51626 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
51627         LDKPayeePubKey arg_conv;
51628         arg_conv.inner = untag_ptr(arg);
51629         arg_conv.is_owned = ptr_is_owned(arg);
51630         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51631         arg_conv.is_owned = false;
51632         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
51633         return ret_conv;
51634 }
51635
51636 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
51637         LDKPayeePubKey orig_conv;
51638         orig_conv.inner = untag_ptr(orig);
51639         orig_conv.is_owned = ptr_is_owned(orig);
51640         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51641         orig_conv.is_owned = false;
51642         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
51643         uint64_t ret_ref = 0;
51644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51646         return ret_ref;
51647 }
51648
51649 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
51650         LDKPayeePubKey o_conv;
51651         o_conv.inner = untag_ptr(o);
51652         o_conv.is_owned = ptr_is_owned(o);
51653         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51654         o_conv.is_owned = false;
51655         int64_t ret_conv = PayeePubKey_hash(&o_conv);
51656         return ret_conv;
51657 }
51658
51659 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
51660         LDKPayeePubKey a_conv;
51661         a_conv.inner = untag_ptr(a);
51662         a_conv.is_owned = ptr_is_owned(a);
51663         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51664         a_conv.is_owned = false;
51665         LDKPayeePubKey b_conv;
51666         b_conv.inner = untag_ptr(b);
51667         b_conv.is_owned = ptr_is_owned(b);
51668         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51669         b_conv.is_owned = false;
51670         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
51671         return ret_conv;
51672 }
51673
51674 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
51675         LDKExpiryTime this_obj_conv;
51676         this_obj_conv.inner = untag_ptr(this_obj);
51677         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51679         ExpiryTime_free(this_obj_conv);
51680 }
51681
51682 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
51683         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
51684         uint64_t ret_ref = 0;
51685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51687         return ret_ref;
51688 }
51689 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
51690         LDKExpiryTime arg_conv;
51691         arg_conv.inner = untag_ptr(arg);
51692         arg_conv.is_owned = ptr_is_owned(arg);
51693         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51694         arg_conv.is_owned = false;
51695         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
51696         return ret_conv;
51697 }
51698
51699 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
51700         LDKExpiryTime orig_conv;
51701         orig_conv.inner = untag_ptr(orig);
51702         orig_conv.is_owned = ptr_is_owned(orig);
51703         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51704         orig_conv.is_owned = false;
51705         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
51706         uint64_t ret_ref = 0;
51707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51709         return ret_ref;
51710 }
51711
51712 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
51713         LDKExpiryTime o_conv;
51714         o_conv.inner = untag_ptr(o);
51715         o_conv.is_owned = ptr_is_owned(o);
51716         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51717         o_conv.is_owned = false;
51718         int64_t ret_conv = ExpiryTime_hash(&o_conv);
51719         return ret_conv;
51720 }
51721
51722 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
51723         LDKExpiryTime a_conv;
51724         a_conv.inner = untag_ptr(a);
51725         a_conv.is_owned = ptr_is_owned(a);
51726         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51727         a_conv.is_owned = false;
51728         LDKExpiryTime b_conv;
51729         b_conv.inner = untag_ptr(b);
51730         b_conv.is_owned = ptr_is_owned(b);
51731         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51732         b_conv.is_owned = false;
51733         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
51734         return ret_conv;
51735 }
51736
51737 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_free"))) TS_MinFinalCltvExpiryDelta_free(uint64_t this_obj) {
51738         LDKMinFinalCltvExpiryDelta this_obj_conv;
51739         this_obj_conv.inner = untag_ptr(this_obj);
51740         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51742         MinFinalCltvExpiryDelta_free(this_obj_conv);
51743 }
51744
51745 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_get_a"))) TS_MinFinalCltvExpiryDelta_get_a(uint64_t this_ptr) {
51746         LDKMinFinalCltvExpiryDelta this_ptr_conv;
51747         this_ptr_conv.inner = untag_ptr(this_ptr);
51748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51750         this_ptr_conv.is_owned = false;
51751         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
51752         return ret_conv;
51753 }
51754
51755 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_set_a"))) TS_MinFinalCltvExpiryDelta_set_a(uint64_t this_ptr, int64_t val) {
51756         LDKMinFinalCltvExpiryDelta this_ptr_conv;
51757         this_ptr_conv.inner = untag_ptr(this_ptr);
51758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51760         this_ptr_conv.is_owned = false;
51761         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
51762 }
51763
51764 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_new"))) TS_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
51765         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
51766         uint64_t ret_ref = 0;
51767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51769         return ret_ref;
51770 }
51771
51772 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
51773         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
51774         uint64_t ret_ref = 0;
51775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51777         return ret_ref;
51778 }
51779 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone_ptr"))) TS_MinFinalCltvExpiryDelta_clone_ptr(uint64_t arg) {
51780         LDKMinFinalCltvExpiryDelta arg_conv;
51781         arg_conv.inner = untag_ptr(arg);
51782         arg_conv.is_owned = ptr_is_owned(arg);
51783         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51784         arg_conv.is_owned = false;
51785         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
51786         return ret_conv;
51787 }
51788
51789 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone"))) TS_MinFinalCltvExpiryDelta_clone(uint64_t orig) {
51790         LDKMinFinalCltvExpiryDelta orig_conv;
51791         orig_conv.inner = untag_ptr(orig);
51792         orig_conv.is_owned = ptr_is_owned(orig);
51793         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51794         orig_conv.is_owned = false;
51795         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
51796         uint64_t ret_ref = 0;
51797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51799         return ret_ref;
51800 }
51801
51802 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_hash"))) TS_MinFinalCltvExpiryDelta_hash(uint64_t o) {
51803         LDKMinFinalCltvExpiryDelta o_conv;
51804         o_conv.inner = untag_ptr(o);
51805         o_conv.is_owned = ptr_is_owned(o);
51806         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51807         o_conv.is_owned = false;
51808         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
51809         return ret_conv;
51810 }
51811
51812 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_eq"))) TS_MinFinalCltvExpiryDelta_eq(uint64_t a, uint64_t b) {
51813         LDKMinFinalCltvExpiryDelta a_conv;
51814         a_conv.inner = untag_ptr(a);
51815         a_conv.is_owned = ptr_is_owned(a);
51816         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51817         a_conv.is_owned = false;
51818         LDKMinFinalCltvExpiryDelta b_conv;
51819         b_conv.inner = untag_ptr(b);
51820         b_conv.is_owned = ptr_is_owned(b);
51821         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51822         b_conv.is_owned = false;
51823         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
51824         return ret_conv;
51825 }
51826
51827 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
51828         if (!ptr_is_owned(this_ptr)) return;
51829         void* this_ptr_ptr = untag_ptr(this_ptr);
51830         CHECK_ACCESS(this_ptr_ptr);
51831         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
51832         FREE(untag_ptr(this_ptr));
51833         Fallback_free(this_ptr_conv);
51834 }
51835
51836 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
51837         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51838         *ret_copy = Fallback_clone(arg);
51839         uint64_t ret_ref = tag_ptr(ret_copy, true);
51840         return ret_ref;
51841 }
51842 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
51843         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
51844         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
51845         return ret_conv;
51846 }
51847
51848 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
51849         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
51850         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51851         *ret_copy = Fallback_clone(orig_conv);
51852         uint64_t ret_ref = tag_ptr(ret_copy, true);
51853         return ret_ref;
51854 }
51855
51856 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
51857         
51858         LDKCVec_u8Z program_ref;
51859         program_ref.datalen = program->arr_len;
51860         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
51861         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
51862         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51863         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
51864         uint64_t ret_ref = tag_ptr(ret_copy, true);
51865         return ret_ref;
51866 }
51867
51868 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
51869         LDKTwentyBytes a_ref;
51870         CHECK(a->arr_len == 20);
51871         memcpy(a_ref.data, a->elems, 20); FREE(a);
51872         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51873         *ret_copy = Fallback_pub_key_hash(a_ref);
51874         uint64_t ret_ref = tag_ptr(ret_copy, true);
51875         return ret_ref;
51876 }
51877
51878 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
51879         LDKTwentyBytes a_ref;
51880         CHECK(a->arr_len == 20);
51881         memcpy(a_ref.data, a->elems, 20); FREE(a);
51882         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51883         *ret_copy = Fallback_script_hash(a_ref);
51884         uint64_t ret_ref = tag_ptr(ret_copy, true);
51885         return ret_ref;
51886 }
51887
51888 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
51889         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
51890         int64_t ret_conv = Fallback_hash(o_conv);
51891         return ret_conv;
51892 }
51893
51894 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
51895         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
51896         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
51897         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
51898         return ret_conv;
51899 }
51900
51901 void  __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint64_t this_obj) {
51902         LDKInvoiceSignature this_obj_conv;
51903         this_obj_conv.inner = untag_ptr(this_obj);
51904         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51906         InvoiceSignature_free(this_obj_conv);
51907 }
51908
51909 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
51910         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
51911         uint64_t ret_ref = 0;
51912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51914         return ret_ref;
51915 }
51916 int64_t  __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint64_t arg) {
51917         LDKInvoiceSignature arg_conv;
51918         arg_conv.inner = untag_ptr(arg);
51919         arg_conv.is_owned = ptr_is_owned(arg);
51920         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51921         arg_conv.is_owned = false;
51922         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
51923         return ret_conv;
51924 }
51925
51926 uint64_t  __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint64_t orig) {
51927         LDKInvoiceSignature orig_conv;
51928         orig_conv.inner = untag_ptr(orig);
51929         orig_conv.is_owned = ptr_is_owned(orig);
51930         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51931         orig_conv.is_owned = false;
51932         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
51933         uint64_t ret_ref = 0;
51934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51936         return ret_ref;
51937 }
51938
51939 int64_t  __attribute__((export_name("TS_InvoiceSignature_hash"))) TS_InvoiceSignature_hash(uint64_t o) {
51940         LDKInvoiceSignature o_conv;
51941         o_conv.inner = untag_ptr(o);
51942         o_conv.is_owned = ptr_is_owned(o);
51943         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51944         o_conv.is_owned = false;
51945         int64_t ret_conv = InvoiceSignature_hash(&o_conv);
51946         return ret_conv;
51947 }
51948
51949 jboolean  __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint64_t a, uint64_t b) {
51950         LDKInvoiceSignature a_conv;
51951         a_conv.inner = untag_ptr(a);
51952         a_conv.is_owned = ptr_is_owned(a);
51953         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51954         a_conv.is_owned = false;
51955         LDKInvoiceSignature b_conv;
51956         b_conv.inner = untag_ptr(b);
51957         b_conv.is_owned = ptr_is_owned(b);
51958         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51959         b_conv.is_owned = false;
51960         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
51961         return ret_conv;
51962 }
51963
51964 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
51965         LDKPrivateRoute this_obj_conv;
51966         this_obj_conv.inner = untag_ptr(this_obj);
51967         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51969         PrivateRoute_free(this_obj_conv);
51970 }
51971
51972 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
51973         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
51974         uint64_t ret_ref = 0;
51975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51977         return ret_ref;
51978 }
51979 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
51980         LDKPrivateRoute arg_conv;
51981         arg_conv.inner = untag_ptr(arg);
51982         arg_conv.is_owned = ptr_is_owned(arg);
51983         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51984         arg_conv.is_owned = false;
51985         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
51986         return ret_conv;
51987 }
51988
51989 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
51990         LDKPrivateRoute orig_conv;
51991         orig_conv.inner = untag_ptr(orig);
51992         orig_conv.is_owned = ptr_is_owned(orig);
51993         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51994         orig_conv.is_owned = false;
51995         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
51996         uint64_t ret_ref = 0;
51997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51999         return ret_ref;
52000 }
52001
52002 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
52003         LDKPrivateRoute o_conv;
52004         o_conv.inner = untag_ptr(o);
52005         o_conv.is_owned = ptr_is_owned(o);
52006         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52007         o_conv.is_owned = false;
52008         int64_t ret_conv = PrivateRoute_hash(&o_conv);
52009         return ret_conv;
52010 }
52011
52012 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
52013         LDKPrivateRoute a_conv;
52014         a_conv.inner = untag_ptr(a);
52015         a_conv.is_owned = ptr_is_owned(a);
52016         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52017         a_conv.is_owned = false;
52018         LDKPrivateRoute b_conv;
52019         b_conv.inner = untag_ptr(b);
52020         b_conv.is_owned = ptr_is_owned(b);
52021         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52022         b_conv.is_owned = false;
52023         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
52024         return ret_conv;
52025 }
52026
52027 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint64_t this_arg) {
52028         LDKSignedRawInvoice this_arg_conv;
52029         this_arg_conv.inner = untag_ptr(this_arg);
52030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52032         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
52033         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
52034         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
52035         return tag_ptr(ret_conv, true);
52036 }
52037
52038 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint64_t this_arg) {
52039         LDKSignedRawInvoice this_arg_conv;
52040         this_arg_conv.inner = untag_ptr(this_arg);
52041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52043         this_arg_conv.is_owned = false;
52044         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
52045         uint64_t ret_ref = 0;
52046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52048         return ret_ref;
52049 }
52050
52051 int8_tArray  __attribute__((export_name("TS_SignedRawInvoice_signable_hash"))) TS_SignedRawInvoice_signable_hash(uint64_t this_arg) {
52052         LDKSignedRawInvoice this_arg_conv;
52053         this_arg_conv.inner = untag_ptr(this_arg);
52054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52056         this_arg_conv.is_owned = false;
52057         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52058         memcpy(ret_arr->elems, *SignedRawInvoice_signable_hash(&this_arg_conv), 32);
52059         return ret_arr;
52060 }
52061
52062 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint64_t this_arg) {
52063         LDKSignedRawInvoice this_arg_conv;
52064         this_arg_conv.inner = untag_ptr(this_arg);
52065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52067         this_arg_conv.is_owned = false;
52068         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
52069         uint64_t ret_ref = 0;
52070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52072         return ret_ref;
52073 }
52074
52075 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint64_t this_arg) {
52076         LDKSignedRawInvoice this_arg_conv;
52077         this_arg_conv.inner = untag_ptr(this_arg);
52078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52080         this_arg_conv.is_owned = false;
52081         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
52082         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
52083         return tag_ptr(ret_conv, true);
52084 }
52085
52086 jboolean  __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint64_t this_arg) {
52087         LDKSignedRawInvoice this_arg_conv;
52088         this_arg_conv.inner = untag_ptr(this_arg);
52089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52091         this_arg_conv.is_owned = false;
52092         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
52093         return ret_conv;
52094 }
52095
52096 int8_tArray  __attribute__((export_name("TS_RawInvoice_signable_hash"))) TS_RawInvoice_signable_hash(uint64_t this_arg) {
52097         LDKRawInvoice this_arg_conv;
52098         this_arg_conv.inner = untag_ptr(this_arg);
52099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52101         this_arg_conv.is_owned = false;
52102         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52103         memcpy(ret_arr->elems, RawInvoice_signable_hash(&this_arg_conv).data, 32);
52104         return ret_arr;
52105 }
52106
52107 uint64_t  __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint64_t this_arg) {
52108         LDKRawInvoice this_arg_conv;
52109         this_arg_conv.inner = untag_ptr(this_arg);
52110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52112         this_arg_conv.is_owned = false;
52113         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
52114         uint64_t ret_ref = 0;
52115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52117         return ret_ref;
52118 }
52119
52120 uint64_t  __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint64_t this_arg) {
52121         LDKRawInvoice this_arg_conv;
52122         this_arg_conv.inner = untag_ptr(this_arg);
52123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52125         this_arg_conv.is_owned = false;
52126         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
52127         uint64_t ret_ref = 0;
52128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52130         return ret_ref;
52131 }
52132
52133 uint64_t  __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint64_t this_arg) {
52134         LDKRawInvoice this_arg_conv;
52135         this_arg_conv.inner = untag_ptr(this_arg);
52136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52138         this_arg_conv.is_owned = false;
52139         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
52140         uint64_t ret_ref = 0;
52141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52143         return ret_ref;
52144 }
52145
52146 uint64_t  __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint64_t this_arg) {
52147         LDKRawInvoice this_arg_conv;
52148         this_arg_conv.inner = untag_ptr(this_arg);
52149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52151         this_arg_conv.is_owned = false;
52152         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
52153         uint64_t ret_ref = 0;
52154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52156         return ret_ref;
52157 }
52158
52159 uint64_t  __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint64_t this_arg) {
52160         LDKRawInvoice this_arg_conv;
52161         this_arg_conv.inner = untag_ptr(this_arg);
52162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52164         this_arg_conv.is_owned = false;
52165         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
52166         uint64_t ret_ref = 0;
52167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52169         return ret_ref;
52170 }
52171
52172 uint64_t  __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry_delta"))) TS_RawInvoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
52173         LDKRawInvoice this_arg_conv;
52174         this_arg_conv.inner = untag_ptr(this_arg);
52175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52177         this_arg_conv.is_owned = false;
52178         LDKMinFinalCltvExpiryDelta ret_var = RawInvoice_min_final_cltv_expiry_delta(&this_arg_conv);
52179         uint64_t ret_ref = 0;
52180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52182         return ret_ref;
52183 }
52184
52185 int8_tArray  __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint64_t this_arg) {
52186         LDKRawInvoice this_arg_conv;
52187         this_arg_conv.inner = untag_ptr(this_arg);
52188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52190         this_arg_conv.is_owned = false;
52191         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52192         memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
52193         return ret_arr;
52194 }
52195
52196 uint64_t  __attribute__((export_name("TS_RawInvoice_payment_metadata"))) TS_RawInvoice_payment_metadata(uint64_t this_arg) {
52197         LDKRawInvoice this_arg_conv;
52198         this_arg_conv.inner = untag_ptr(this_arg);
52199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52201         this_arg_conv.is_owned = false;
52202         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
52203         *ret_copy = RawInvoice_payment_metadata(&this_arg_conv);
52204         uint64_t ret_ref = tag_ptr(ret_copy, true);
52205         return ret_ref;
52206 }
52207
52208 uint64_t  __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint64_t this_arg) {
52209         LDKRawInvoice this_arg_conv;
52210         this_arg_conv.inner = untag_ptr(this_arg);
52211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52213         this_arg_conv.is_owned = false;
52214         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
52215         uint64_t ret_ref = 0;
52216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52218         return ret_ref;
52219 }
52220
52221 uint64_tArray  __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint64_t this_arg) {
52222         LDKRawInvoice this_arg_conv;
52223         this_arg_conv.inner = untag_ptr(this_arg);
52224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52226         this_arg_conv.is_owned = false;
52227         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
52228         uint64_tArray ret_arr = NULL;
52229         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52230         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52231         for (size_t o = 0; o < ret_var.datalen; o++) {
52232                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
52233                 uint64_t ret_conv_14_ref = 0;
52234                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
52235                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
52236                 ret_arr_ptr[o] = ret_conv_14_ref;
52237         }
52238         
52239         FREE(ret_var.data);
52240         return ret_arr;
52241 }
52242
52243 uint64_t  __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint64_t this_arg) {
52244         LDKRawInvoice this_arg_conv;
52245         this_arg_conv.inner = untag_ptr(this_arg);
52246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52248         this_arg_conv.is_owned = false;
52249         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
52250         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
52251         uint64_t ret_ref = tag_ptr(ret_copy, true);
52252         return ret_ref;
52253 }
52254
52255 uint32_t  __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint64_t this_arg) {
52256         LDKRawInvoice this_arg_conv;
52257         this_arg_conv.inner = untag_ptr(this_arg);
52258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52260         this_arg_conv.is_owned = false;
52261         uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
52262         return ret_conv;
52263 }
52264
52265 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
52266         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
52267         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
52268         return tag_ptr(ret_conv, true);
52269 }
52270
52271 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
52272         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
52273         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
52274         return tag_ptr(ret_conv, true);
52275 }
52276
52277 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
52278         LDKPositiveTimestamp this_arg_conv;
52279         this_arg_conv.inner = untag_ptr(this_arg);
52280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52282         this_arg_conv.is_owned = false;
52283         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
52284         return ret_conv;
52285 }
52286
52287 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
52288         LDKPositiveTimestamp this_arg_conv;
52289         this_arg_conv.inner = untag_ptr(this_arg);
52290         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52292         this_arg_conv.is_owned = false;
52293         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
52294         return ret_conv;
52295 }
52296
52297 int8_tArray  __attribute__((export_name("TS_Invoice_signable_hash"))) TS_Invoice_signable_hash(uint64_t this_arg) {
52298         LDKInvoice this_arg_conv;
52299         this_arg_conv.inner = untag_ptr(this_arg);
52300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52302         this_arg_conv.is_owned = false;
52303         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52304         memcpy(ret_arr->elems, Invoice_signable_hash(&this_arg_conv).data, 32);
52305         return ret_arr;
52306 }
52307
52308 uint64_t  __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint64_t this_arg) {
52309         LDKInvoice this_arg_conv;
52310         this_arg_conv.inner = untag_ptr(this_arg);
52311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52313         this_arg_conv = Invoice_clone(&this_arg_conv);
52314         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
52315         uint64_t ret_ref = 0;
52316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52318         return ret_ref;
52319 }
52320
52321 uint64_t  __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint64_t this_arg) {
52322         LDKInvoice this_arg_conv;
52323         this_arg_conv.inner = untag_ptr(this_arg);
52324         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52326         this_arg_conv.is_owned = false;
52327         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
52328         *ret_conv = Invoice_check_signature(&this_arg_conv);
52329         return tag_ptr(ret_conv, true);
52330 }
52331
52332 uint64_t  __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint64_t signed_invoice) {
52333         LDKSignedRawInvoice signed_invoice_conv;
52334         signed_invoice_conv.inner = untag_ptr(signed_invoice);
52335         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
52336         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
52337         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
52338         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
52339         *ret_conv = Invoice_from_signed(signed_invoice_conv);
52340         return tag_ptr(ret_conv, true);
52341 }
52342
52343 int64_t  __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint64_t this_arg) {
52344         LDKInvoice this_arg_conv;
52345         this_arg_conv.inner = untag_ptr(this_arg);
52346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52348         this_arg_conv.is_owned = false;
52349         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
52350         return ret_conv;
52351 }
52352
52353 int8_tArray  __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint64_t this_arg) {
52354         LDKInvoice this_arg_conv;
52355         this_arg_conv.inner = untag_ptr(this_arg);
52356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52358         this_arg_conv.is_owned = false;
52359         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52360         memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
52361         return ret_arr;
52362 }
52363
52364 int8_tArray  __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint64_t this_arg) {
52365         LDKInvoice this_arg_conv;
52366         this_arg_conv.inner = untag_ptr(this_arg);
52367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52369         this_arg_conv.is_owned = false;
52370         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52371         memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
52372         return ret_arr;
52373 }
52374
52375 int8_tArray  __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint64_t this_arg) {
52376         LDKInvoice this_arg_conv;
52377         this_arg_conv.inner = untag_ptr(this_arg);
52378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52380         this_arg_conv.is_owned = false;
52381         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52382         memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
52383         return ret_arr;
52384 }
52385
52386 uint64_t  __attribute__((export_name("TS_Invoice_payment_metadata"))) TS_Invoice_payment_metadata(uint64_t this_arg) {
52387         LDKInvoice this_arg_conv;
52388         this_arg_conv.inner = untag_ptr(this_arg);
52389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52391         this_arg_conv.is_owned = false;
52392         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
52393         *ret_copy = Invoice_payment_metadata(&this_arg_conv);
52394         uint64_t ret_ref = tag_ptr(ret_copy, true);
52395         return ret_ref;
52396 }
52397
52398 uint64_t  __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint64_t this_arg) {
52399         LDKInvoice this_arg_conv;
52400         this_arg_conv.inner = untag_ptr(this_arg);
52401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52403         this_arg_conv.is_owned = false;
52404         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
52405         uint64_t ret_ref = 0;
52406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52408         return ret_ref;
52409 }
52410
52411 int8_tArray  __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint64_t this_arg) {
52412         LDKInvoice this_arg_conv;
52413         this_arg_conv.inner = untag_ptr(this_arg);
52414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52416         this_arg_conv.is_owned = false;
52417         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52418         memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
52419         return ret_arr;
52420 }
52421
52422 uint64_t  __attribute__((export_name("TS_Invoice_expires_at"))) TS_Invoice_expires_at(uint64_t this_arg) {
52423         LDKInvoice this_arg_conv;
52424         this_arg_conv.inner = untag_ptr(this_arg);
52425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52427         this_arg_conv.is_owned = false;
52428         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
52429         *ret_copy = Invoice_expires_at(&this_arg_conv);
52430         uint64_t ret_ref = tag_ptr(ret_copy, true);
52431         return ret_ref;
52432 }
52433
52434 int64_t  __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint64_t this_arg) {
52435         LDKInvoice this_arg_conv;
52436         this_arg_conv.inner = untag_ptr(this_arg);
52437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52439         this_arg_conv.is_owned = false;
52440         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
52441         return ret_conv;
52442 }
52443
52444 int64_t  __attribute__((export_name("TS_Invoice_expiration_remaining_from_epoch"))) TS_Invoice_expiration_remaining_from_epoch(uint64_t this_arg, int64_t time) {
52445         LDKInvoice this_arg_conv;
52446         this_arg_conv.inner = untag_ptr(this_arg);
52447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52449         this_arg_conv.is_owned = false;
52450         int64_t ret_conv = Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
52451         return ret_conv;
52452 }
52453
52454 jboolean  __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
52455         LDKInvoice this_arg_conv;
52456         this_arg_conv.inner = untag_ptr(this_arg);
52457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52459         this_arg_conv.is_owned = false;
52460         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
52461         return ret_conv;
52462 }
52463
52464 int64_t  __attribute__((export_name("TS_Invoice_min_final_cltv_expiry_delta"))) TS_Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
52465         LDKInvoice this_arg_conv;
52466         this_arg_conv.inner = untag_ptr(this_arg);
52467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52469         this_arg_conv.is_owned = false;
52470         int64_t ret_conv = Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
52471         return ret_conv;
52472 }
52473
52474 ptrArray  __attribute__((export_name("TS_Invoice_fallback_addresses"))) TS_Invoice_fallback_addresses(uint64_t this_arg) {
52475         LDKInvoice this_arg_conv;
52476         this_arg_conv.inner = untag_ptr(this_arg);
52477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52479         this_arg_conv.is_owned = false;
52480         LDKCVec_AddressZ ret_var = Invoice_fallback_addresses(&this_arg_conv);
52481         ptrArray ret_arr = NULL;
52482         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
52483         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
52484         for (size_t i = 0; i < ret_var.datalen; i++) {
52485                 LDKStr ret_conv_8_str = ret_var.data[i];
52486                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
52487                 Str_free(ret_conv_8_str);
52488                 ret_arr_ptr[i] = ret_conv_8_conv;
52489         }
52490         
52491         FREE(ret_var.data);
52492         return ret_arr;
52493 }
52494
52495 uint64_tArray  __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint64_t this_arg) {
52496         LDKInvoice this_arg_conv;
52497         this_arg_conv.inner = untag_ptr(this_arg);
52498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52500         this_arg_conv.is_owned = false;
52501         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
52502         uint64_tArray ret_arr = NULL;
52503         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52504         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52505         for (size_t o = 0; o < ret_var.datalen; o++) {
52506                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
52507                 uint64_t ret_conv_14_ref = 0;
52508                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
52509                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
52510                 ret_arr_ptr[o] = ret_conv_14_ref;
52511         }
52512         
52513         FREE(ret_var.data);
52514         return ret_arr;
52515 }
52516
52517 uint64_tArray  __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint64_t this_arg) {
52518         LDKInvoice this_arg_conv;
52519         this_arg_conv.inner = untag_ptr(this_arg);
52520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52522         this_arg_conv.is_owned = false;
52523         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
52524         uint64_tArray ret_arr = NULL;
52525         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52526         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52527         for (size_t l = 0; l < ret_var.datalen; l++) {
52528                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
52529                 uint64_t ret_conv_11_ref = 0;
52530                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
52531                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
52532                 ret_arr_ptr[l] = ret_conv_11_ref;
52533         }
52534         
52535         FREE(ret_var.data);
52536         return ret_arr;
52537 }
52538
52539 uint32_t  __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint64_t this_arg) {
52540         LDKInvoice this_arg_conv;
52541         this_arg_conv.inner = untag_ptr(this_arg);
52542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52544         this_arg_conv.is_owned = false;
52545         uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
52546         return ret_conv;
52547 }
52548
52549 uint64_t  __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint64_t this_arg) {
52550         LDKInvoice this_arg_conv;
52551         this_arg_conv.inner = untag_ptr(this_arg);
52552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52554         this_arg_conv.is_owned = false;
52555         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
52556         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
52557         uint64_t ret_ref = tag_ptr(ret_copy, true);
52558         return ret_ref;
52559 }
52560
52561 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
52562         LDKStr description_conv = str_ref_to_owned_c(description);
52563         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
52564         *ret_conv = Description_new(description_conv);
52565         return tag_ptr(ret_conv, true);
52566 }
52567
52568 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
52569         LDKDescription this_arg_conv;
52570         this_arg_conv.inner = untag_ptr(this_arg);
52571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52573         this_arg_conv = Description_clone(&this_arg_conv);
52574         LDKStr ret_str = Description_into_inner(this_arg_conv);
52575         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
52576         Str_free(ret_str);
52577         return ret_conv;
52578 }
52579
52580 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
52581         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
52582         uint64_t ret_ref = 0;
52583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52585         return ret_ref;
52586 }
52587
52588 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
52589         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
52590         uint64_t ret_ref = 0;
52591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52593         return ret_ref;
52594 }
52595
52596 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
52597         LDKExpiryTime this_arg_conv;
52598         this_arg_conv.inner = untag_ptr(this_arg);
52599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52601         this_arg_conv.is_owned = false;
52602         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
52603         return ret_conv;
52604 }
52605
52606 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
52607         LDKExpiryTime this_arg_conv;
52608         this_arg_conv.inner = untag_ptr(this_arg);
52609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52611         this_arg_conv.is_owned = false;
52612         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
52613         return ret_conv;
52614 }
52615
52616 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
52617         LDKRouteHint hops_conv;
52618         hops_conv.inner = untag_ptr(hops);
52619         hops_conv.is_owned = ptr_is_owned(hops);
52620         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
52621         hops_conv = RouteHint_clone(&hops_conv);
52622         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
52623         *ret_conv = PrivateRoute_new(hops_conv);
52624         return tag_ptr(ret_conv, true);
52625 }
52626
52627 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
52628         LDKPrivateRoute this_arg_conv;
52629         this_arg_conv.inner = untag_ptr(this_arg);
52630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52632         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
52633         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
52634         uint64_t ret_ref = 0;
52635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52637         return ret_ref;
52638 }
52639
52640 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
52641         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
52642         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
52643         return ret_conv;
52644 }
52645
52646 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
52647         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
52648         return ret_conv;
52649 }
52650
52651 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
52652         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
52653         return ret_conv;
52654 }
52655
52656 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
52657         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
52658         return ret_conv;
52659 }
52660
52661 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
52662         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
52663         return ret_conv;
52664 }
52665
52666 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
52667         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
52668         return ret_conv;
52669 }
52670
52671 uint32_t  __attribute__((export_name("TS_CreationError_min_final_cltv_expiry_delta_too_short"))) TS_CreationError_min_final_cltv_expiry_delta_too_short() {
52672         uint32_t ret_conv = LDKCreationError_to_js(CreationError_min_final_cltv_expiry_delta_too_short());
52673         return ret_conv;
52674 }
52675
52676 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
52677         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
52678         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
52679         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
52680         return ret_conv;
52681 }
52682
52683 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
52684         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
52685         LDKStr ret_str = CreationError_to_str(o_conv);
52686         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
52687         Str_free(ret_str);
52688         return ret_conv;
52689 }
52690
52691 uint32_t  __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint64_t orig) {
52692         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
52693         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
52694         return ret_conv;
52695 }
52696
52697 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
52698         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
52699         return ret_conv;
52700 }
52701
52702 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
52703         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
52704         return ret_conv;
52705 }
52706
52707 uint32_t  __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
52708         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
52709         return ret_conv;
52710 }
52711
52712 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
52713         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
52714         return ret_conv;
52715 }
52716
52717 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
52718         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
52719         return ret_conv;
52720 }
52721
52722 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
52723         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
52724         return ret_conv;
52725 }
52726
52727 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
52728         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
52729         return ret_conv;
52730 }
52731
52732 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
52733         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
52734         return ret_conv;
52735 }
52736
52737 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
52738         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
52739         return ret_conv;
52740 }
52741
52742 uint32_t  __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
52743         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
52744         return ret_conv;
52745 }
52746
52747 jboolean  __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint64_t a, uint64_t b) {
52748         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
52749         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
52750         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
52751         return ret_conv;
52752 }
52753
52754 jstring  __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint64_t o) {
52755         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
52756         LDKStr ret_str = SemanticError_to_str(o_conv);
52757         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
52758         Str_free(ret_str);
52759         return ret_conv;
52760 }
52761
52762 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
52763         if (!ptr_is_owned(this_ptr)) return;
52764         void* this_ptr_ptr = untag_ptr(this_ptr);
52765         CHECK_ACCESS(this_ptr_ptr);
52766         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
52767         FREE(untag_ptr(this_ptr));
52768         SignOrCreationError_free(this_ptr_conv);
52769 }
52770
52771 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
52772         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
52773         *ret_copy = SignOrCreationError_clone(arg);
52774         uint64_t ret_ref = tag_ptr(ret_copy, true);
52775         return ret_ref;
52776 }
52777 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
52778         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
52779         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
52780         return ret_conv;
52781 }
52782
52783 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
52784         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
52785         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
52786         *ret_copy = SignOrCreationError_clone(orig_conv);
52787         uint64_t ret_ref = tag_ptr(ret_copy, true);
52788         return ret_ref;
52789 }
52790
52791 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
52792         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
52793         *ret_copy = SignOrCreationError_sign_error();
52794         uint64_t ret_ref = tag_ptr(ret_copy, true);
52795         return ret_ref;
52796 }
52797
52798 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
52799         LDKCreationError a_conv = LDKCreationError_from_js(a);
52800         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
52801         *ret_copy = SignOrCreationError_creation_error(a_conv);
52802         uint64_t ret_ref = tag_ptr(ret_copy, true);
52803         return ret_ref;
52804 }
52805
52806 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
52807         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
52808         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
52809         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
52810         return ret_conv;
52811 }
52812
52813 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
52814         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
52815         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
52816         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
52817         Str_free(ret_str);
52818         return ret_conv;
52819 }
52820
52821 uint64_t  __attribute__((export_name("TS_pay_invoice"))) TS_pay_invoice(uint64_t invoice, uint64_t retry_strategy, uint64_t channelmanager) {
52822         LDKInvoice invoice_conv;
52823         invoice_conv.inner = untag_ptr(invoice);
52824         invoice_conv.is_owned = ptr_is_owned(invoice);
52825         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
52826         invoice_conv.is_owned = false;
52827         void* retry_strategy_ptr = untag_ptr(retry_strategy);
52828         CHECK_ACCESS(retry_strategy_ptr);
52829         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
52830         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
52831         LDKChannelManager channelmanager_conv;
52832         channelmanager_conv.inner = untag_ptr(channelmanager);
52833         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
52834         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
52835         channelmanager_conv.is_owned = false;
52836         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
52837         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
52838         return tag_ptr(ret_conv, true);
52839 }
52840
52841 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) {
52842         LDKInvoice invoice_conv;
52843         invoice_conv.inner = untag_ptr(invoice);
52844         invoice_conv.is_owned = ptr_is_owned(invoice);
52845         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
52846         invoice_conv.is_owned = false;
52847         LDKThirtyTwoBytes payment_id_ref;
52848         CHECK(payment_id->arr_len == 32);
52849         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
52850         void* retry_strategy_ptr = untag_ptr(retry_strategy);
52851         CHECK_ACCESS(retry_strategy_ptr);
52852         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
52853         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
52854         LDKChannelManager channelmanager_conv;
52855         channelmanager_conv.inner = untag_ptr(channelmanager);
52856         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
52857         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
52858         channelmanager_conv.is_owned = false;
52859         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
52860         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
52861         return tag_ptr(ret_conv, true);
52862 }
52863
52864 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) {
52865         LDKInvoice invoice_conv;
52866         invoice_conv.inner = untag_ptr(invoice);
52867         invoice_conv.is_owned = ptr_is_owned(invoice);
52868         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
52869         invoice_conv.is_owned = false;
52870         void* retry_strategy_ptr = untag_ptr(retry_strategy);
52871         CHECK_ACCESS(retry_strategy_ptr);
52872         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
52873         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
52874         LDKChannelManager channelmanager_conv;
52875         channelmanager_conv.inner = untag_ptr(channelmanager);
52876         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
52877         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
52878         channelmanager_conv.is_owned = false;
52879         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
52880         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv);
52881         return tag_ptr(ret_conv, true);
52882 }
52883
52884 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) {
52885         LDKInvoice invoice_conv;
52886         invoice_conv.inner = untag_ptr(invoice);
52887         invoice_conv.is_owned = ptr_is_owned(invoice);
52888         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
52889         invoice_conv.is_owned = false;
52890         LDKThirtyTwoBytes payment_id_ref;
52891         CHECK(payment_id->arr_len == 32);
52892         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
52893         void* retry_strategy_ptr = untag_ptr(retry_strategy);
52894         CHECK_ACCESS(retry_strategy_ptr);
52895         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
52896         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
52897         LDKChannelManager channelmanager_conv;
52898         channelmanager_conv.inner = untag_ptr(channelmanager);
52899         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
52900         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
52901         channelmanager_conv.is_owned = false;
52902         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
52903         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
52904         return tag_ptr(ret_conv, true);
52905 }
52906
52907 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
52908         if (!ptr_is_owned(this_ptr)) return;
52909         void* this_ptr_ptr = untag_ptr(this_ptr);
52910         CHECK_ACCESS(this_ptr_ptr);
52911         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
52912         FREE(untag_ptr(this_ptr));
52913         PaymentError_free(this_ptr_conv);
52914 }
52915
52916 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
52917         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
52918         *ret_copy = PaymentError_clone(arg);
52919         uint64_t ret_ref = tag_ptr(ret_copy, true);
52920         return ret_ref;
52921 }
52922 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
52923         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
52924         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
52925         return ret_conv;
52926 }
52927
52928 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
52929         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
52930         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
52931         *ret_copy = PaymentError_clone(orig_conv);
52932         uint64_t ret_ref = tag_ptr(ret_copy, true);
52933         return ret_ref;
52934 }
52935
52936 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
52937         LDKStr a_conv = str_ref_to_owned_c(a);
52938         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
52939         *ret_copy = PaymentError_invoice(a_conv);
52940         uint64_t ret_ref = tag_ptr(ret_copy, true);
52941         return ret_ref;
52942 }
52943
52944 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) {
52945         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_js(a);
52946         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
52947         *ret_copy = PaymentError_sending(a_conv);
52948         uint64_t ret_ref = tag_ptr(ret_copy, true);
52949         return ret_ref;
52950 }
52951
52952 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) {
52953         void* amt_msat_ptr = untag_ptr(amt_msat);
52954         CHECK_ACCESS(amt_msat_ptr);
52955         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
52956         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
52957         LDKThirtyTwoBytes payment_hash_ref;
52958         CHECK(payment_hash->arr_len == 32);
52959         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
52960         LDKStr description_conv = str_ref_to_owned_c(description);
52961         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
52962         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
52963         if (phantom_route_hints_constr.datalen > 0)
52964                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
52965         else
52966                 phantom_route_hints_constr.data = NULL;
52967         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
52968         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
52969                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
52970                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
52971                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
52972                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
52973                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
52974                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
52975                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
52976         }
52977         FREE(phantom_route_hints);
52978         void* entropy_source_ptr = untag_ptr(entropy_source);
52979         CHECK_ACCESS(entropy_source_ptr);
52980         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
52981         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
52982                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52983                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
52984         }
52985         void* node_signer_ptr = untag_ptr(node_signer);
52986         CHECK_ACCESS(node_signer_ptr);
52987         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
52988         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
52989                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52990                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
52991         }
52992         void* logger_ptr = untag_ptr(logger);
52993         CHECK_ACCESS(logger_ptr);
52994         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
52995         if (logger_conv.free == LDKLogger_JCalls_free) {
52996                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52997                 LDKLogger_JCalls_cloned(&logger_conv);
52998         }
52999         LDKCurrency network_conv = LDKCurrency_from_js(network);
53000         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
53001         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
53002         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
53003         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
53004         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
53005         *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);
53006         return tag_ptr(ret_conv, true);
53007 }
53008
53009 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) {
53010         void* amt_msat_ptr = untag_ptr(amt_msat);
53011         CHECK_ACCESS(amt_msat_ptr);
53012         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
53013         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
53014         LDKThirtyTwoBytes payment_hash_ref;
53015         CHECK(payment_hash->arr_len == 32);
53016         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
53017         LDKSha256 description_hash_conv;
53018         description_hash_conv.inner = untag_ptr(description_hash);
53019         description_hash_conv.is_owned = ptr_is_owned(description_hash);
53020         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
53021         description_hash_conv = Sha256_clone(&description_hash_conv);
53022         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
53023         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
53024         if (phantom_route_hints_constr.datalen > 0)
53025                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
53026         else
53027                 phantom_route_hints_constr.data = NULL;
53028         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
53029         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
53030                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
53031                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
53032                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
53033                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
53034                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
53035                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
53036                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
53037         }
53038         FREE(phantom_route_hints);
53039         void* entropy_source_ptr = untag_ptr(entropy_source);
53040         CHECK_ACCESS(entropy_source_ptr);
53041         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
53042         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
53043                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53044                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
53045         }
53046         void* node_signer_ptr = untag_ptr(node_signer);
53047         CHECK_ACCESS(node_signer_ptr);
53048         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
53049         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
53050                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53051                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
53052         }
53053         void* logger_ptr = untag_ptr(logger);
53054         CHECK_ACCESS(logger_ptr);
53055         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53056         if (logger_conv.free == LDKLogger_JCalls_free) {
53057                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53058                 LDKLogger_JCalls_cloned(&logger_conv);
53059         }
53060         LDKCurrency network_conv = LDKCurrency_from_js(network);
53061         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
53062         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
53063         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
53064         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
53065         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
53066         *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);
53067         return tag_ptr(ret_conv, true);
53068 }
53069
53070 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) {
53071         LDKChannelManager channelmanager_conv;
53072         channelmanager_conv.inner = untag_ptr(channelmanager);
53073         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
53074         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
53075         channelmanager_conv.is_owned = false;
53076         void* node_signer_ptr = untag_ptr(node_signer);
53077         CHECK_ACCESS(node_signer_ptr);
53078         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
53079         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
53080                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53081                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
53082         }
53083         void* logger_ptr = untag_ptr(logger);
53084         CHECK_ACCESS(logger_ptr);
53085         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53086         if (logger_conv.free == LDKLogger_JCalls_free) {
53087                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53088                 LDKLogger_JCalls_cloned(&logger_conv);
53089         }
53090         LDKCurrency network_conv = LDKCurrency_from_js(network);
53091         void* amt_msat_ptr = untag_ptr(amt_msat);
53092         CHECK_ACCESS(amt_msat_ptr);
53093         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
53094         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
53095         LDKSha256 description_hash_conv;
53096         description_hash_conv.inner = untag_ptr(description_hash);
53097         description_hash_conv.is_owned = ptr_is_owned(description_hash);
53098         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
53099         description_hash_conv = Sha256_clone(&description_hash_conv);
53100         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
53101         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
53102         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
53103         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
53104         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
53105         *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);
53106         return tag_ptr(ret_conv, true);
53107 }
53108
53109 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) {
53110         LDKChannelManager channelmanager_conv;
53111         channelmanager_conv.inner = untag_ptr(channelmanager);
53112         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
53113         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
53114         channelmanager_conv.is_owned = false;
53115         void* node_signer_ptr = untag_ptr(node_signer);
53116         CHECK_ACCESS(node_signer_ptr);
53117         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
53118         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
53119                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53120                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
53121         }
53122         void* logger_ptr = untag_ptr(logger);
53123         CHECK_ACCESS(logger_ptr);
53124         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53125         if (logger_conv.free == LDKLogger_JCalls_free) {
53126                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53127                 LDKLogger_JCalls_cloned(&logger_conv);
53128         }
53129         LDKCurrency network_conv = LDKCurrency_from_js(network);
53130         void* amt_msat_ptr = untag_ptr(amt_msat);
53131         CHECK_ACCESS(amt_msat_ptr);
53132         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
53133         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
53134         LDKStr description_conv = str_ref_to_owned_c(description);
53135         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
53136         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
53137         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
53138         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
53139         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
53140         *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);
53141         return tag_ptr(ret_conv, true);
53142 }
53143
53144 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) {
53145         LDKChannelManager channelmanager_conv;
53146         channelmanager_conv.inner = untag_ptr(channelmanager);
53147         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
53148         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
53149         channelmanager_conv.is_owned = false;
53150         void* node_signer_ptr = untag_ptr(node_signer);
53151         CHECK_ACCESS(node_signer_ptr);
53152         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
53153         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
53154                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53155                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
53156         }
53157         void* logger_ptr = untag_ptr(logger);
53158         CHECK_ACCESS(logger_ptr);
53159         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53160         if (logger_conv.free == LDKLogger_JCalls_free) {
53161                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53162                 LDKLogger_JCalls_cloned(&logger_conv);
53163         }
53164         LDKCurrency network_conv = LDKCurrency_from_js(network);
53165         void* amt_msat_ptr = untag_ptr(amt_msat);
53166         CHECK_ACCESS(amt_msat_ptr);
53167         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
53168         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
53169         LDKStr description_conv = str_ref_to_owned_c(description);
53170         LDKThirtyTwoBytes payment_hash_ref;
53171         CHECK(payment_hash->arr_len == 32);
53172         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
53173         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
53174         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
53175         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
53176         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
53177         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
53178         *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);
53179         return tag_ptr(ret_conv, true);
53180 }
53181
53182 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
53183         LDKStr s_conv = str_ref_to_owned_c(s);
53184         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
53185         *ret_conv = SiPrefix_from_str(s_conv);
53186         return tag_ptr(ret_conv, true);
53187 }
53188
53189 uint64_t  __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
53190         LDKStr s_conv = str_ref_to_owned_c(s);
53191         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
53192         *ret_conv = Invoice_from_str(s_conv);
53193         return tag_ptr(ret_conv, true);
53194 }
53195
53196 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
53197         LDKStr s_conv = str_ref_to_owned_c(s);
53198         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
53199         *ret_conv = SignedRawInvoice_from_str(s_conv);
53200         return tag_ptr(ret_conv, true);
53201 }
53202
53203 jstring  __attribute__((export_name("TS_ParseError_to_str"))) TS_ParseError_to_str(uint64_t o) {
53204         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
53205         LDKStr ret_str = ParseError_to_str(o_conv);
53206         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53207         Str_free(ret_str);
53208         return ret_conv;
53209 }
53210
53211 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
53212         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
53213         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
53214         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53215         Str_free(ret_str);
53216         return ret_conv;
53217 }
53218
53219 jstring  __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint64_t o) {
53220         LDKInvoice o_conv;
53221         o_conv.inner = untag_ptr(o);
53222         o_conv.is_owned = ptr_is_owned(o);
53223         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53224         o_conv.is_owned = false;
53225         LDKStr ret_str = Invoice_to_str(&o_conv);
53226         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53227         Str_free(ret_str);
53228         return ret_conv;
53229 }
53230
53231 jstring  __attribute__((export_name("TS_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint64_t o) {
53232         LDKSignedRawInvoice o_conv;
53233         o_conv.inner = untag_ptr(o);
53234         o_conv.is_owned = ptr_is_owned(o);
53235         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53236         o_conv.is_owned = false;
53237         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
53238         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53239         Str_free(ret_str);
53240         return ret_conv;
53241 }
53242
53243 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
53244         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
53245         LDKStr ret_str = Currency_to_str(o_conv);
53246         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53247         Str_free(ret_str);
53248         return ret_conv;
53249 }
53250
53251 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
53252         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
53253         LDKStr ret_str = SiPrefix_to_str(o_conv);
53254         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53255         Str_free(ret_str);
53256         return ret_conv;
53257 }
53258