Merge pull request #128 from TheBlueMatt/main
[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         // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ
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 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_ok"))) TS_CResult_SharedSecretNoneZ_ok(int8_tArray o) {
16623         LDKThirtyTwoBytes o_ref;
16624         CHECK(o->arr_len == 32);
16625         memcpy(o_ref.data, o->elems, 32); FREE(o);
16626         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16627         *ret_conv = CResult_SharedSecretNoneZ_ok(o_ref);
16628         return tag_ptr(ret_conv, true);
16629 }
16630
16631 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_err"))) TS_CResult_SharedSecretNoneZ_err() {
16632         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16633         *ret_conv = CResult_SharedSecretNoneZ_err();
16634         return tag_ptr(ret_conv, true);
16635 }
16636
16637 jboolean  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_is_ok"))) TS_CResult_SharedSecretNoneZ_is_ok(uint64_t o) {
16638         LDKCResult_SharedSecretNoneZ* o_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(o);
16639         jboolean ret_conv = CResult_SharedSecretNoneZ_is_ok(o_conv);
16640         return ret_conv;
16641 }
16642
16643 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_free"))) TS_CResult_SharedSecretNoneZ_free(uint64_t _res) {
16644         if (!ptr_is_owned(_res)) return;
16645         void* _res_ptr = untag_ptr(_res);
16646         CHECK_ACCESS(_res_ptr);
16647         LDKCResult_SharedSecretNoneZ _res_conv = *(LDKCResult_SharedSecretNoneZ*)(_res_ptr);
16648         FREE(untag_ptr(_res));
16649         CResult_SharedSecretNoneZ_free(_res_conv);
16650 }
16651
16652 static inline uint64_t CResult_SharedSecretNoneZ_clone_ptr(LDKCResult_SharedSecretNoneZ *NONNULL_PTR arg) {
16653         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16654         *ret_conv = CResult_SharedSecretNoneZ_clone(arg);
16655         return tag_ptr(ret_conv, true);
16656 }
16657 int64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone_ptr"))) TS_CResult_SharedSecretNoneZ_clone_ptr(uint64_t arg) {
16658         LDKCResult_SharedSecretNoneZ* arg_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(arg);
16659         int64_t ret_conv = CResult_SharedSecretNoneZ_clone_ptr(arg_conv);
16660         return ret_conv;
16661 }
16662
16663 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone"))) TS_CResult_SharedSecretNoneZ_clone(uint64_t orig) {
16664         LDKCResult_SharedSecretNoneZ* orig_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(orig);
16665         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16666         *ret_conv = CResult_SharedSecretNoneZ_clone(orig_conv);
16667         return tag_ptr(ret_conv, true);
16668 }
16669
16670 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
16671         LDKCVec_U5Z _res_constr;
16672         _res_constr.datalen = _res->arr_len;
16673         if (_res_constr.datalen > 0)
16674                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
16675         else
16676                 _res_constr.data = NULL;
16677         int8_t* _res_vals = (void*) _res->elems;
16678         for (size_t h = 0; h < _res_constr.datalen; h++) {
16679                 int8_t _res_conv_7 = _res_vals[h];
16680                 
16681                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
16682         }
16683         FREE(_res);
16684         CVec_U5Z_free(_res_constr);
16685 }
16686
16687 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
16688         LDKRecoverableSignature o_ref;
16689         CHECK(o->arr_len == 68);
16690         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
16691         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16692         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
16693         return tag_ptr(ret_conv, true);
16694 }
16695
16696 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
16697         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16698         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
16699         return tag_ptr(ret_conv, true);
16700 }
16701
16702 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
16703         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
16704         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
16705         return ret_conv;
16706 }
16707
16708 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
16709         if (!ptr_is_owned(_res)) return;
16710         void* _res_ptr = untag_ptr(_res);
16711         CHECK_ACCESS(_res_ptr);
16712         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
16713         FREE(untag_ptr(_res));
16714         CResult_RecoverableSignatureNoneZ_free(_res_conv);
16715 }
16716
16717 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
16718         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16719         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
16720         return tag_ptr(ret_conv, true);
16721 }
16722 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
16723         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
16724         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
16725         return ret_conv;
16726 }
16727
16728 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
16729         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
16730         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16731         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
16732         return tag_ptr(ret_conv, true);
16733 }
16734
16735 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(uint64_t o) {
16736         void* o_ptr = untag_ptr(o);
16737         CHECK_ACCESS(o_ptr);
16738         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
16739         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
16740                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16741                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
16742         }
16743         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16744         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
16745         return tag_ptr(ret_conv, true);
16746 }
16747
16748 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(uint64_t e) {
16749         void* e_ptr = untag_ptr(e);
16750         CHECK_ACCESS(e_ptr);
16751         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16752         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16753         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16754         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
16755         return tag_ptr(ret_conv, true);
16756 }
16757
16758 jboolean  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(uint64_t o) {
16759         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
16760         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
16761         return ret_conv;
16762 }
16763
16764 void  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(uint64_t _res) {
16765         if (!ptr_is_owned(_res)) return;
16766         void* _res_ptr = untag_ptr(_res);
16767         CHECK_ACCESS(_res_ptr);
16768         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
16769         FREE(untag_ptr(_res));
16770         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
16771 }
16772
16773 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
16774         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16775         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
16776         return tag_ptr(ret_conv, true);
16777 }
16778 int64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16779         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
16780         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
16781         return ret_conv;
16782 }
16783
16784 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(uint64_t orig) {
16785         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
16786         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16787         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
16788         return tag_ptr(ret_conv, true);
16789 }
16790
16791 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
16792         LDKCVec_CVec_u8ZZ _res_constr;
16793         _res_constr.datalen = _res->arr_len;
16794         if (_res_constr.datalen > 0)
16795                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16796         else
16797                 _res_constr.data = NULL;
16798         int8_tArray* _res_vals = (void*) _res->elems;
16799         for (size_t m = 0; m < _res_constr.datalen; m++) {
16800                 int8_tArray _res_conv_12 = _res_vals[m];
16801                 LDKCVec_u8Z _res_conv_12_ref;
16802                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
16803                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16804                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
16805                 _res_constr.data[m] = _res_conv_12_ref;
16806         }
16807         FREE(_res);
16808         CVec_CVec_u8ZZ_free(_res_constr);
16809 }
16810
16811 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
16812         LDKCVec_CVec_u8ZZ o_constr;
16813         o_constr.datalen = o->arr_len;
16814         if (o_constr.datalen > 0)
16815                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16816         else
16817                 o_constr.data = NULL;
16818         int8_tArray* o_vals = (void*) o->elems;
16819         for (size_t m = 0; m < o_constr.datalen; m++) {
16820                 int8_tArray o_conv_12 = o_vals[m];
16821                 LDKCVec_u8Z o_conv_12_ref;
16822                 o_conv_12_ref.datalen = o_conv_12->arr_len;
16823                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16824                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
16825                 o_constr.data[m] = o_conv_12_ref;
16826         }
16827         FREE(o);
16828         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16829         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
16830         return tag_ptr(ret_conv, true);
16831 }
16832
16833 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
16834         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16835         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
16836         return tag_ptr(ret_conv, true);
16837 }
16838
16839 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
16840         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
16841         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
16842         return ret_conv;
16843 }
16844
16845 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
16846         if (!ptr_is_owned(_res)) return;
16847         void* _res_ptr = untag_ptr(_res);
16848         CHECK_ACCESS(_res_ptr);
16849         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
16850         FREE(untag_ptr(_res));
16851         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
16852 }
16853
16854 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
16855         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16856         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
16857         return tag_ptr(ret_conv, true);
16858 }
16859 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
16860         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
16861         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
16862         return ret_conv;
16863 }
16864
16865 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
16866         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
16867         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16868         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
16869         return tag_ptr(ret_conv, true);
16870 }
16871
16872 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
16873         LDKInMemorySigner o_conv;
16874         o_conv.inner = untag_ptr(o);
16875         o_conv.is_owned = ptr_is_owned(o);
16876         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16877         o_conv = InMemorySigner_clone(&o_conv);
16878         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16879         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
16880         return tag_ptr(ret_conv, true);
16881 }
16882
16883 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
16884         void* e_ptr = untag_ptr(e);
16885         CHECK_ACCESS(e_ptr);
16886         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16887         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16888         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16889         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
16890         return tag_ptr(ret_conv, true);
16891 }
16892
16893 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
16894         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
16895         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
16896         return ret_conv;
16897 }
16898
16899 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
16900         if (!ptr_is_owned(_res)) return;
16901         void* _res_ptr = untag_ptr(_res);
16902         CHECK_ACCESS(_res_ptr);
16903         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
16904         FREE(untag_ptr(_res));
16905         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
16906 }
16907
16908 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
16909         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16910         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
16911         return tag_ptr(ret_conv, true);
16912 }
16913 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16914         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
16915         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
16916         return ret_conv;
16917 }
16918
16919 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
16920         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
16921         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16922         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
16923         return tag_ptr(ret_conv, true);
16924 }
16925
16926 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
16927         LDKCVec_TxOutZ _res_constr;
16928         _res_constr.datalen = _res->arr_len;
16929         if (_res_constr.datalen > 0)
16930                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16931         else
16932                 _res_constr.data = NULL;
16933         uint64_t* _res_vals = _res->elems;
16934         for (size_t h = 0; h < _res_constr.datalen; h++) {
16935                 uint64_t _res_conv_7 = _res_vals[h];
16936                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
16937                 CHECK_ACCESS(_res_conv_7_ptr);
16938                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
16939                 FREE(untag_ptr(_res_conv_7));
16940                 _res_constr.data[h] = _res_conv_7_conv;
16941         }
16942         FREE(_res);
16943         CVec_TxOutZ_free(_res_constr);
16944 }
16945
16946 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
16947         LDKTransaction o_ref;
16948         o_ref.datalen = o->arr_len;
16949         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
16950         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16951         o_ref.data_is_owned = true;
16952         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16953         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
16954         return tag_ptr(ret_conv, true);
16955 }
16956
16957 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
16958         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16959         *ret_conv = CResult_TransactionNoneZ_err();
16960         return tag_ptr(ret_conv, true);
16961 }
16962
16963 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
16964         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
16965         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
16966         return ret_conv;
16967 }
16968
16969 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
16970         if (!ptr_is_owned(_res)) return;
16971         void* _res_ptr = untag_ptr(_res);
16972         CHECK_ACCESS(_res_ptr);
16973         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
16974         FREE(untag_ptr(_res));
16975         CResult_TransactionNoneZ_free(_res_conv);
16976 }
16977
16978 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
16979         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16980         *ret_conv = CResult_TransactionNoneZ_clone(arg);
16981         return tag_ptr(ret_conv, true);
16982 }
16983 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
16984         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
16985         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
16986         return ret_conv;
16987 }
16988
16989 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
16990         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
16991         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16992         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
16993         return tag_ptr(ret_conv, true);
16994 }
16995
16996 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
16997         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16998         *ret_copy = COption_u16Z_some(o);
16999         uint64_t ret_ref = tag_ptr(ret_copy, true);
17000         return ret_ref;
17001 }
17002
17003 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
17004         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17005         *ret_copy = COption_u16Z_none();
17006         uint64_t ret_ref = tag_ptr(ret_copy, true);
17007         return ret_ref;
17008 }
17009
17010 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
17011         if (!ptr_is_owned(_res)) return;
17012         void* _res_ptr = untag_ptr(_res);
17013         CHECK_ACCESS(_res_ptr);
17014         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
17015         FREE(untag_ptr(_res));
17016         COption_u16Z_free(_res_conv);
17017 }
17018
17019 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
17020         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17021         *ret_copy = COption_u16Z_clone(arg);
17022         uint64_t ret_ref = tag_ptr(ret_copy, true);
17023         return ret_ref;
17024 }
17025 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
17026         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
17027         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
17028         return ret_conv;
17029 }
17030
17031 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
17032         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
17033         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17034         *ret_copy = COption_u16Z_clone(orig_conv);
17035         uint64_t ret_ref = tag_ptr(ret_copy, true);
17036         return ret_ref;
17037 }
17038
17039 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
17040         LDKThirtyTwoBytes o_ref;
17041         CHECK(o->arr_len == 32);
17042         memcpy(o_ref.data, o->elems, 32); FREE(o);
17043         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17044         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
17045         return tag_ptr(ret_conv, true);
17046 }
17047
17048 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint64_t e) {
17049         void* e_ptr = untag_ptr(e);
17050         CHECK_ACCESS(e_ptr);
17051         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17052         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17053         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17054         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
17055         return tag_ptr(ret_conv, true);
17056 }
17057
17058 jboolean  __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint64_t o) {
17059         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
17060         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
17061         return ret_conv;
17062 }
17063
17064 void  __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint64_t _res) {
17065         if (!ptr_is_owned(_res)) return;
17066         void* _res_ptr = untag_ptr(_res);
17067         CHECK_ACCESS(_res_ptr);
17068         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
17069         FREE(untag_ptr(_res));
17070         CResult__u832APIErrorZ_free(_res_conv);
17071 }
17072
17073 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
17074         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17075         *ret_conv = CResult__u832APIErrorZ_clone(arg);
17076         return tag_ptr(ret_conv, true);
17077 }
17078 int64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint64_t arg) {
17079         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
17080         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
17081         return ret_conv;
17082 }
17083
17084 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint64_t orig) {
17085         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
17086         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17087         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
17088         return tag_ptr(ret_conv, true);
17089 }
17090
17091 void  __attribute__((export_name("TS_CVec_RecentPaymentDetailsZ_free"))) TS_CVec_RecentPaymentDetailsZ_free(uint64_tArray _res) {
17092         LDKCVec_RecentPaymentDetailsZ _res_constr;
17093         _res_constr.datalen = _res->arr_len;
17094         if (_res_constr.datalen > 0)
17095                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
17096         else
17097                 _res_constr.data = NULL;
17098         uint64_t* _res_vals = _res->elems;
17099         for (size_t w = 0; w < _res_constr.datalen; w++) {
17100                 uint64_t _res_conv_22 = _res_vals[w];
17101                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
17102                 CHECK_ACCESS(_res_conv_22_ptr);
17103                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
17104                 FREE(untag_ptr(_res_conv_22));
17105                 _res_constr.data[w] = _res_conv_22_conv;
17106         }
17107         FREE(_res);
17108         CVec_RecentPaymentDetailsZ_free(_res_constr);
17109 }
17110
17111 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
17112         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17113         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
17114         return tag_ptr(ret_conv, true);
17115 }
17116
17117 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
17118         void* e_ptr = untag_ptr(e);
17119         CHECK_ACCESS(e_ptr);
17120         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17121         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
17122         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17123         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
17124         return tag_ptr(ret_conv, true);
17125 }
17126
17127 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
17128         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
17129         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
17130         return ret_conv;
17131 }
17132
17133 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
17134         if (!ptr_is_owned(_res)) return;
17135         void* _res_ptr = untag_ptr(_res);
17136         CHECK_ACCESS(_res_ptr);
17137         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
17138         FREE(untag_ptr(_res));
17139         CResult_NonePaymentSendFailureZ_free(_res_conv);
17140 }
17141
17142 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
17143         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17144         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
17145         return tag_ptr(ret_conv, true);
17146 }
17147 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
17148         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
17149         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
17150         return ret_conv;
17151 }
17152
17153 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
17154         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
17155         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17156         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
17157         return tag_ptr(ret_conv, true);
17158 }
17159
17160 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_ok"))) TS_CResult_NoneRetryableSendFailureZ_ok() {
17161         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
17162         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
17163         return tag_ptr(ret_conv, true);
17164 }
17165
17166 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_err"))) TS_CResult_NoneRetryableSendFailureZ_err(uint32_t e) {
17167         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
17168         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
17169         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
17170         return tag_ptr(ret_conv, true);
17171 }
17172
17173 jboolean  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_is_ok"))) TS_CResult_NoneRetryableSendFailureZ_is_ok(uint64_t o) {
17174         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
17175         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
17176         return ret_conv;
17177 }
17178
17179 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_free"))) TS_CResult_NoneRetryableSendFailureZ_free(uint64_t _res) {
17180         if (!ptr_is_owned(_res)) return;
17181         void* _res_ptr = untag_ptr(_res);
17182         CHECK_ACCESS(_res_ptr);
17183         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
17184         FREE(untag_ptr(_res));
17185         CResult_NoneRetryableSendFailureZ_free(_res_conv);
17186 }
17187
17188 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
17189         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
17190         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
17191         return tag_ptr(ret_conv, true);
17192 }
17193 int64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone_ptr"))) TS_CResult_NoneRetryableSendFailureZ_clone_ptr(uint64_t arg) {
17194         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
17195         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
17196         return ret_conv;
17197 }
17198
17199 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone"))) TS_CResult_NoneRetryableSendFailureZ_clone(uint64_t orig) {
17200         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
17201         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
17202         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
17203         return tag_ptr(ret_conv, true);
17204 }
17205
17206 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) {
17207         LDKThirtyTwoBytes o_ref;
17208         CHECK(o->arr_len == 32);
17209         memcpy(o_ref.data, o->elems, 32); FREE(o);
17210         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
17211         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
17212         return tag_ptr(ret_conv, true);
17213 }
17214
17215 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint64_t e) {
17216         void* e_ptr = untag_ptr(e);
17217         CHECK_ACCESS(e_ptr);
17218         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17219         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
17220         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
17221         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
17222         return tag_ptr(ret_conv, true);
17223 }
17224
17225 jboolean  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_is_ok(uint64_t o) {
17226         LDKCResult_PaymentHashPaymentSendFailureZ* o_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(o);
17227         jboolean ret_conv = CResult_PaymentHashPaymentSendFailureZ_is_ok(o_conv);
17228         return ret_conv;
17229 }
17230
17231 void  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_free"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint64_t _res) {
17232         if (!ptr_is_owned(_res)) return;
17233         void* _res_ptr = untag_ptr(_res);
17234         CHECK_ACCESS(_res_ptr);
17235         LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(_res_ptr);
17236         FREE(untag_ptr(_res));
17237         CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
17238 }
17239
17240 static inline uint64_t CResult_PaymentHashPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR arg) {
17241         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
17242         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(arg);
17243         return tag_ptr(ret_conv, true);
17244 }
17245 int64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr(uint64_t arg) {
17246         LDKCResult_PaymentHashPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(arg);
17247         int64_t ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone_ptr(arg_conv);
17248         return ret_conv;
17249 }
17250
17251 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint64_t orig) {
17252         LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(orig);
17253         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
17254         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
17255         return tag_ptr(ret_conv, true);
17256 }
17257
17258 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_ok(int8_tArray o) {
17259         LDKThirtyTwoBytes o_ref;
17260         CHECK(o->arr_len == 32);
17261         memcpy(o_ref.data, o->elems, 32); FREE(o);
17262         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
17263         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_ok(o_ref);
17264         return tag_ptr(ret_conv, true);
17265 }
17266
17267 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_err"))) TS_CResult_PaymentHashRetryableSendFailureZ_err(uint32_t e) {
17268         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
17269         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
17270         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_err(e_conv);
17271         return tag_ptr(ret_conv, true);
17272 }
17273
17274 jboolean  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_is_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_is_ok(uint64_t o) {
17275         LDKCResult_PaymentHashRetryableSendFailureZ* o_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(o);
17276         jboolean ret_conv = CResult_PaymentHashRetryableSendFailureZ_is_ok(o_conv);
17277         return ret_conv;
17278 }
17279
17280 void  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_free"))) TS_CResult_PaymentHashRetryableSendFailureZ_free(uint64_t _res) {
17281         if (!ptr_is_owned(_res)) return;
17282         void* _res_ptr = untag_ptr(_res);
17283         CHECK_ACCESS(_res_ptr);
17284         LDKCResult_PaymentHashRetryableSendFailureZ _res_conv = *(LDKCResult_PaymentHashRetryableSendFailureZ*)(_res_ptr);
17285         FREE(untag_ptr(_res));
17286         CResult_PaymentHashRetryableSendFailureZ_free(_res_conv);
17287 }
17288
17289 static inline uint64_t CResult_PaymentHashRetryableSendFailureZ_clone_ptr(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR arg) {
17290         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
17291         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(arg);
17292         return tag_ptr(ret_conv, true);
17293 }
17294 int64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashRetryableSendFailureZ_clone_ptr(uint64_t arg) {
17295         LDKCResult_PaymentHashRetryableSendFailureZ* arg_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(arg);
17296         int64_t ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone_ptr(arg_conv);
17297         return ret_conv;
17298 }
17299
17300 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_clone"))) TS_CResult_PaymentHashRetryableSendFailureZ_clone(uint64_t orig) {
17301         LDKCResult_PaymentHashRetryableSendFailureZ* orig_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(orig);
17302         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
17303         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(orig_conv);
17304         return tag_ptr(ret_conv, true);
17305 }
17306
17307 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
17308         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17309         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
17310         return tag_ptr(ret_conv, true);
17311 }
17312 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint64_t arg) {
17313         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
17314         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
17315         return ret_conv;
17316 }
17317
17318 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint64_t orig) {
17319         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
17320         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17321         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
17322         return tag_ptr(ret_conv, true);
17323 }
17324
17325 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
17326         LDKThirtyTwoBytes a_ref;
17327         CHECK(a->arr_len == 32);
17328         memcpy(a_ref.data, a->elems, 32); FREE(a);
17329         LDKThirtyTwoBytes b_ref;
17330         CHECK(b->arr_len == 32);
17331         memcpy(b_ref.data, b->elems, 32); FREE(b);
17332         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17333         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
17334         return tag_ptr(ret_conv, true);
17335 }
17336
17337 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint64_t _res) {
17338         if (!ptr_is_owned(_res)) return;
17339         void* _res_ptr = untag_ptr(_res);
17340         CHECK_ACCESS(_res_ptr);
17341         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
17342         FREE(untag_ptr(_res));
17343         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
17344 }
17345
17346 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint64_t o) {
17347         void* o_ptr = untag_ptr(o);
17348         CHECK_ACCESS(o_ptr);
17349         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
17350         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
17351         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17352         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
17353         return tag_ptr(ret_conv, true);
17354 }
17355
17356 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint64_t e) {
17357         void* e_ptr = untag_ptr(e);
17358         CHECK_ACCESS(e_ptr);
17359         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17360         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
17361         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17362         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
17363         return tag_ptr(ret_conv, true);
17364 }
17365
17366 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint64_t o) {
17367         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
17368         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
17369         return ret_conv;
17370 }
17371
17372 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint64_t _res) {
17373         if (!ptr_is_owned(_res)) return;
17374         void* _res_ptr = untag_ptr(_res);
17375         CHECK_ACCESS(_res_ptr);
17376         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
17377         FREE(untag_ptr(_res));
17378         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
17379 }
17380
17381 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
17382         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17383         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
17384         return tag_ptr(ret_conv, true);
17385 }
17386 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
17387         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
17388         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
17389         return ret_conv;
17390 }
17391
17392 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint64_t orig) {
17393         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
17394         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17395         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
17396         return tag_ptr(ret_conv, true);
17397 }
17398
17399 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
17400         LDKCVec_ThirtyTwoBytesZ _res_constr;
17401         _res_constr.datalen = _res->arr_len;
17402         if (_res_constr.datalen > 0)
17403                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
17404         else
17405                 _res_constr.data = NULL;
17406         int8_tArray* _res_vals = (void*) _res->elems;
17407         for (size_t m = 0; m < _res_constr.datalen; m++) {
17408                 int8_tArray _res_conv_12 = _res_vals[m];
17409                 LDKThirtyTwoBytes _res_conv_12_ref;
17410                 CHECK(_res_conv_12->arr_len == 32);
17411                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
17412                 _res_constr.data[m] = _res_conv_12_ref;
17413         }
17414         FREE(_res);
17415         CVec_ThirtyTwoBytesZ_free(_res_constr);
17416 }
17417
17418 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
17419         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17420         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
17421         return tag_ptr(ret_conv, true);
17422 }
17423 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint64_t arg) {
17424         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
17425         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
17426         return ret_conv;
17427 }
17428
17429 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint64_t orig) {
17430         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
17431         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17432         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
17433         return tag_ptr(ret_conv, true);
17434 }
17435
17436 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
17437         LDKThirtyTwoBytes a_ref;
17438         CHECK(a->arr_len == 32);
17439         memcpy(a_ref.data, a->elems, 32); FREE(a);
17440         LDKThirtyTwoBytes b_ref;
17441         CHECK(b->arr_len == 32);
17442         memcpy(b_ref.data, b->elems, 32); FREE(b);
17443         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17444         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
17445         return tag_ptr(ret_conv, true);
17446 }
17447
17448 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint64_t _res) {
17449         if (!ptr_is_owned(_res)) return;
17450         void* _res_ptr = untag_ptr(_res);
17451         CHECK_ACCESS(_res_ptr);
17452         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
17453         FREE(untag_ptr(_res));
17454         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
17455 }
17456
17457 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint64_t o) {
17458         void* o_ptr = untag_ptr(o);
17459         CHECK_ACCESS(o_ptr);
17460         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
17461         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
17462         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17463         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
17464         return tag_ptr(ret_conv, true);
17465 }
17466
17467 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
17468         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17469         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
17470         return tag_ptr(ret_conv, true);
17471 }
17472
17473 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint64_t o) {
17474         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
17475         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
17476         return ret_conv;
17477 }
17478
17479 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint64_t _res) {
17480         if (!ptr_is_owned(_res)) return;
17481         void* _res_ptr = untag_ptr(_res);
17482         CHECK_ACCESS(_res_ptr);
17483         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
17484         FREE(untag_ptr(_res));
17485         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
17486 }
17487
17488 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
17489         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17490         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
17491         return tag_ptr(ret_conv, true);
17492 }
17493 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint64_t arg) {
17494         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
17495         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
17496         return ret_conv;
17497 }
17498
17499 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint64_t orig) {
17500         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
17501         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17502         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
17503         return tag_ptr(ret_conv, true);
17504 }
17505
17506 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint64_t o) {
17507         void* o_ptr = untag_ptr(o);
17508         CHECK_ACCESS(o_ptr);
17509         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
17510         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
17511         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17512         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
17513         return tag_ptr(ret_conv, true);
17514 }
17515
17516 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint64_t e) {
17517         void* e_ptr = untag_ptr(e);
17518         CHECK_ACCESS(e_ptr);
17519         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17520         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17521         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17522         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
17523         return tag_ptr(ret_conv, true);
17524 }
17525
17526 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint64_t o) {
17527         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
17528         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
17529         return ret_conv;
17530 }
17531
17532 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint64_t _res) {
17533         if (!ptr_is_owned(_res)) return;
17534         void* _res_ptr = untag_ptr(_res);
17535         CHECK_ACCESS(_res_ptr);
17536         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
17537         FREE(untag_ptr(_res));
17538         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
17539 }
17540
17541 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
17542         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17543         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
17544         return tag_ptr(ret_conv, true);
17545 }
17546 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint64_t arg) {
17547         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
17548         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
17549         return ret_conv;
17550 }
17551
17552 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint64_t orig) {
17553         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
17554         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17555         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
17556         return tag_ptr(ret_conv, true);
17557 }
17558
17559 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
17560         LDKThirtyTwoBytes o_ref;
17561         CHECK(o->arr_len == 32);
17562         memcpy(o_ref.data, o->elems, 32); FREE(o);
17563         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17564         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
17565         return tag_ptr(ret_conv, true);
17566 }
17567
17568 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
17569         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17570         *ret_conv = CResult_PaymentSecretNoneZ_err();
17571         return tag_ptr(ret_conv, true);
17572 }
17573
17574 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint64_t o) {
17575         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
17576         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
17577         return ret_conv;
17578 }
17579
17580 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint64_t _res) {
17581         if (!ptr_is_owned(_res)) return;
17582         void* _res_ptr = untag_ptr(_res);
17583         CHECK_ACCESS(_res_ptr);
17584         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
17585         FREE(untag_ptr(_res));
17586         CResult_PaymentSecretNoneZ_free(_res_conv);
17587 }
17588
17589 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
17590         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17591         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
17592         return tag_ptr(ret_conv, true);
17593 }
17594 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint64_t arg) {
17595         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
17596         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
17597         return ret_conv;
17598 }
17599
17600 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint64_t orig) {
17601         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
17602         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17603         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
17604         return tag_ptr(ret_conv, true);
17605 }
17606
17607 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
17608         LDKThirtyTwoBytes o_ref;
17609         CHECK(o->arr_len == 32);
17610         memcpy(o_ref.data, o->elems, 32); FREE(o);
17611         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17612         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
17613         return tag_ptr(ret_conv, true);
17614 }
17615
17616 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint64_t e) {
17617         void* e_ptr = untag_ptr(e);
17618         CHECK_ACCESS(e_ptr);
17619         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17620         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17621         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17622         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
17623         return tag_ptr(ret_conv, true);
17624 }
17625
17626 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint64_t o) {
17627         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
17628         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
17629         return ret_conv;
17630 }
17631
17632 void  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint64_t _res) {
17633         if (!ptr_is_owned(_res)) return;
17634         void* _res_ptr = untag_ptr(_res);
17635         CHECK_ACCESS(_res_ptr);
17636         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
17637         FREE(untag_ptr(_res));
17638         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
17639 }
17640
17641 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
17642         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17643         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
17644         return tag_ptr(ret_conv, true);
17645 }
17646 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint64_t arg) {
17647         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
17648         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
17649         return ret_conv;
17650 }
17651
17652 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint64_t orig) {
17653         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
17654         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17655         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
17656         return tag_ptr(ret_conv, true);
17657 }
17658
17659 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
17660         LDKThirtyTwoBytes o_ref;
17661         CHECK(o->arr_len == 32);
17662         memcpy(o_ref.data, o->elems, 32); FREE(o);
17663         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17664         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
17665         return tag_ptr(ret_conv, true);
17666 }
17667
17668 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint64_t e) {
17669         void* e_ptr = untag_ptr(e);
17670         CHECK_ACCESS(e_ptr);
17671         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17672         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17673         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17674         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
17675         return tag_ptr(ret_conv, true);
17676 }
17677
17678 jboolean  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint64_t o) {
17679         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
17680         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
17681         return ret_conv;
17682 }
17683
17684 void  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint64_t _res) {
17685         if (!ptr_is_owned(_res)) return;
17686         void* _res_ptr = untag_ptr(_res);
17687         CHECK_ACCESS(_res_ptr);
17688         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
17689         FREE(untag_ptr(_res));
17690         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
17691 }
17692
17693 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
17694         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17695         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
17696         return tag_ptr(ret_conv, true);
17697 }
17698 int64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint64_t arg) {
17699         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
17700         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
17701         return ret_conv;
17702 }
17703
17704 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint64_t orig) {
17705         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
17706         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17707         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
17708         return tag_ptr(ret_conv, true);
17709 }
17710
17711 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
17712         LDKCounterpartyForwardingInfo o_conv;
17713         o_conv.inner = untag_ptr(o);
17714         o_conv.is_owned = ptr_is_owned(o);
17715         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17716         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
17717         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17718         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
17719         return tag_ptr(ret_conv, true);
17720 }
17721
17722 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
17723         void* e_ptr = untag_ptr(e);
17724         CHECK_ACCESS(e_ptr);
17725         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17726         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17727         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17728         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
17729         return tag_ptr(ret_conv, true);
17730 }
17731
17732 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
17733         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
17734         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
17735         return ret_conv;
17736 }
17737
17738 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
17739         if (!ptr_is_owned(_res)) return;
17740         void* _res_ptr = untag_ptr(_res);
17741         CHECK_ACCESS(_res_ptr);
17742         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
17743         FREE(untag_ptr(_res));
17744         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
17745 }
17746
17747 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
17748         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17749         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
17750         return tag_ptr(ret_conv, true);
17751 }
17752 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
17753         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
17754         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
17755         return ret_conv;
17756 }
17757
17758 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
17759         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
17760         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17761         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
17762         return tag_ptr(ret_conv, true);
17763 }
17764
17765 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
17766         LDKChannelCounterparty o_conv;
17767         o_conv.inner = untag_ptr(o);
17768         o_conv.is_owned = ptr_is_owned(o);
17769         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17770         o_conv = ChannelCounterparty_clone(&o_conv);
17771         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17772         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
17773         return tag_ptr(ret_conv, true);
17774 }
17775
17776 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
17777         void* e_ptr = untag_ptr(e);
17778         CHECK_ACCESS(e_ptr);
17779         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17780         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17781         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17782         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
17783         return tag_ptr(ret_conv, true);
17784 }
17785
17786 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
17787         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
17788         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
17789         return ret_conv;
17790 }
17791
17792 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
17793         if (!ptr_is_owned(_res)) return;
17794         void* _res_ptr = untag_ptr(_res);
17795         CHECK_ACCESS(_res_ptr);
17796         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
17797         FREE(untag_ptr(_res));
17798         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
17799 }
17800
17801 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
17802         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17803         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
17804         return tag_ptr(ret_conv, true);
17805 }
17806 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
17807         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
17808         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
17809         return ret_conv;
17810 }
17811
17812 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
17813         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
17814         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17815         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
17816         return tag_ptr(ret_conv, true);
17817 }
17818
17819 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
17820         LDKChannelDetails o_conv;
17821         o_conv.inner = untag_ptr(o);
17822         o_conv.is_owned = ptr_is_owned(o);
17823         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17824         o_conv = ChannelDetails_clone(&o_conv);
17825         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17826         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
17827         return tag_ptr(ret_conv, true);
17828 }
17829
17830 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
17831         void* e_ptr = untag_ptr(e);
17832         CHECK_ACCESS(e_ptr);
17833         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17834         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17835         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17836         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
17837         return tag_ptr(ret_conv, true);
17838 }
17839
17840 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
17841         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
17842         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
17843         return ret_conv;
17844 }
17845
17846 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
17847         if (!ptr_is_owned(_res)) return;
17848         void* _res_ptr = untag_ptr(_res);
17849         CHECK_ACCESS(_res_ptr);
17850         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
17851         FREE(untag_ptr(_res));
17852         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
17853 }
17854
17855 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
17856         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17857         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
17858         return tag_ptr(ret_conv, true);
17859 }
17860 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
17861         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
17862         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
17863         return ret_conv;
17864 }
17865
17866 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
17867         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
17868         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17869         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
17870         return tag_ptr(ret_conv, true);
17871 }
17872
17873 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
17874         LDKPhantomRouteHints o_conv;
17875         o_conv.inner = untag_ptr(o);
17876         o_conv.is_owned = ptr_is_owned(o);
17877         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17878         o_conv = PhantomRouteHints_clone(&o_conv);
17879         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17880         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
17881         return tag_ptr(ret_conv, true);
17882 }
17883
17884 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
17885         void* e_ptr = untag_ptr(e);
17886         CHECK_ACCESS(e_ptr);
17887         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17888         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17889         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17890         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
17891         return tag_ptr(ret_conv, true);
17892 }
17893
17894 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
17895         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
17896         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
17897         return ret_conv;
17898 }
17899
17900 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
17901         if (!ptr_is_owned(_res)) return;
17902         void* _res_ptr = untag_ptr(_res);
17903         CHECK_ACCESS(_res_ptr);
17904         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
17905         FREE(untag_ptr(_res));
17906         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
17907 }
17908
17909 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
17910         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17911         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
17912         return tag_ptr(ret_conv, true);
17913 }
17914 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
17915         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
17916         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
17917         return ret_conv;
17918 }
17919
17920 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
17921         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
17922         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17923         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
17924         return tag_ptr(ret_conv, true);
17925 }
17926
17927 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
17928         LDKCVec_ChannelMonitorZ _res_constr;
17929         _res_constr.datalen = _res->arr_len;
17930         if (_res_constr.datalen > 0)
17931                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
17932         else
17933                 _res_constr.data = NULL;
17934         uint64_t* _res_vals = _res->elems;
17935         for (size_t q = 0; q < _res_constr.datalen; q++) {
17936                 uint64_t _res_conv_16 = _res_vals[q];
17937                 LDKChannelMonitor _res_conv_16_conv;
17938                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
17939                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
17940                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17941                 _res_constr.data[q] = _res_conv_16_conv;
17942         }
17943         FREE(_res);
17944         CVec_ChannelMonitorZ_free(_res_constr);
17945 }
17946
17947 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint64_t b) {
17948         LDKThirtyTwoBytes a_ref;
17949         CHECK(a->arr_len == 32);
17950         memcpy(a_ref.data, a->elems, 32); FREE(a);
17951         LDKChannelManager b_conv;
17952         b_conv.inner = untag_ptr(b);
17953         b_conv.is_owned = ptr_is_owned(b);
17954         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17955         // WARNING: we need a move here but no clone is available for LDKChannelManager
17956         
17957         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
17958         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
17959         return tag_ptr(ret_conv, true);
17960 }
17961
17962 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint64_t _res) {
17963         if (!ptr_is_owned(_res)) return;
17964         void* _res_ptr = untag_ptr(_res);
17965         CHECK_ACCESS(_res_ptr);
17966         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
17967         FREE(untag_ptr(_res));
17968         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
17969 }
17970
17971 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint64_t o) {
17972         void* o_ptr = untag_ptr(o);
17973         CHECK_ACCESS(o_ptr);
17974         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
17975         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
17976         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
17977         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
17978         return tag_ptr(ret_conv, true);
17979 }
17980
17981 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint64_t e) {
17982         void* e_ptr = untag_ptr(e);
17983         CHECK_ACCESS(e_ptr);
17984         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17985         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17986         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
17987         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
17988         return tag_ptr(ret_conv, true);
17989 }
17990
17991 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
17992         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
17993         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
17994         return ret_conv;
17995 }
17996
17997 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint64_t _res) {
17998         if (!ptr_is_owned(_res)) return;
17999         void* _res_ptr = untag_ptr(_res);
18000         CHECK_ACCESS(_res_ptr);
18001         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
18002         FREE(untag_ptr(_res));
18003         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
18004 }
18005
18006 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
18007         LDKChannelConfig o_conv;
18008         o_conv.inner = untag_ptr(o);
18009         o_conv.is_owned = ptr_is_owned(o);
18010         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18011         o_conv = ChannelConfig_clone(&o_conv);
18012         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18013         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
18014         return tag_ptr(ret_conv, true);
18015 }
18016
18017 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
18018         void* e_ptr = untag_ptr(e);
18019         CHECK_ACCESS(e_ptr);
18020         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18021         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18022         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18023         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
18024         return tag_ptr(ret_conv, true);
18025 }
18026
18027 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
18028         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
18029         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
18030         return ret_conv;
18031 }
18032
18033 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
18034         if (!ptr_is_owned(_res)) return;
18035         void* _res_ptr = untag_ptr(_res);
18036         CHECK_ACCESS(_res_ptr);
18037         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
18038         FREE(untag_ptr(_res));
18039         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
18040 }
18041
18042 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
18043         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18044         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
18045         return tag_ptr(ret_conv, true);
18046 }
18047 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
18048         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
18049         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
18050         return ret_conv;
18051 }
18052
18053 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
18054         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
18055         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18056         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
18057         return tag_ptr(ret_conv, true);
18058 }
18059
18060 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_some"))) TS_COption_APIErrorZ_some(uint64_t o) {
18061         void* o_ptr = untag_ptr(o);
18062         CHECK_ACCESS(o_ptr);
18063         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
18064         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
18065         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
18066         *ret_copy = COption_APIErrorZ_some(o_conv);
18067         uint64_t ret_ref = tag_ptr(ret_copy, true);
18068         return ret_ref;
18069 }
18070
18071 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_none"))) TS_COption_APIErrorZ_none() {
18072         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
18073         *ret_copy = COption_APIErrorZ_none();
18074         uint64_t ret_ref = tag_ptr(ret_copy, true);
18075         return ret_ref;
18076 }
18077
18078 void  __attribute__((export_name("TS_COption_APIErrorZ_free"))) TS_COption_APIErrorZ_free(uint64_t _res) {
18079         if (!ptr_is_owned(_res)) return;
18080         void* _res_ptr = untag_ptr(_res);
18081         CHECK_ACCESS(_res_ptr);
18082         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
18083         FREE(untag_ptr(_res));
18084         COption_APIErrorZ_free(_res_conv);
18085 }
18086
18087 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
18088         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
18089         *ret_copy = COption_APIErrorZ_clone(arg);
18090         uint64_t ret_ref = tag_ptr(ret_copy, true);
18091         return ret_ref;
18092 }
18093 int64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone_ptr"))) TS_COption_APIErrorZ_clone_ptr(uint64_t arg) {
18094         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
18095         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
18096         return ret_conv;
18097 }
18098
18099 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone"))) TS_COption_APIErrorZ_clone(uint64_t orig) {
18100         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
18101         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
18102         *ret_copy = COption_APIErrorZ_clone(orig_conv);
18103         uint64_t ret_ref = tag_ptr(ret_copy, true);
18104         return ret_ref;
18105 }
18106
18107 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_ok(uint64_t o) {
18108         void* o_ptr = untag_ptr(o);
18109         CHECK_ACCESS(o_ptr);
18110         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
18111         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
18112         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
18113         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
18114         return tag_ptr(ret_conv, true);
18115 }
18116
18117 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_err(uint64_t e) {
18118         void* e_ptr = untag_ptr(e);
18119         CHECK_ACCESS(e_ptr);
18120         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18121         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18122         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
18123         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
18124         return tag_ptr(ret_conv, true);
18125 }
18126
18127 jboolean  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok(uint64_t o) {
18128         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
18129         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
18130         return ret_conv;
18131 }
18132
18133 void  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_free"))) TS_CResult_COption_APIErrorZDecodeErrorZ_free(uint64_t _res) {
18134         if (!ptr_is_owned(_res)) return;
18135         void* _res_ptr = untag_ptr(_res);
18136         CHECK_ACCESS(_res_ptr);
18137         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
18138         FREE(untag_ptr(_res));
18139         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
18140 }
18141
18142 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
18143         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
18144         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
18145         return tag_ptr(ret_conv, true);
18146 }
18147 int64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(uint64_t arg) {
18148         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
18149         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
18150         return ret_conv;
18151 }
18152
18153 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone(uint64_t orig) {
18154         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
18155         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
18156         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
18157         return tag_ptr(ret_conv, true);
18158 }
18159
18160 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_ok(uint64_t o) {
18161         LDKUntrustedString o_conv;
18162         o_conv.inner = untag_ptr(o);
18163         o_conv.is_owned = ptr_is_owned(o);
18164         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18165         o_conv = UntrustedString_clone(&o_conv);
18166         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
18167         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
18168         return tag_ptr(ret_conv, true);
18169 }
18170
18171 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_err"))) TS_CResult_UntrustedStringDecodeErrorZ_err(uint64_t e) {
18172         void* e_ptr = untag_ptr(e);
18173         CHECK_ACCESS(e_ptr);
18174         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18175         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18176         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
18177         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
18178         return tag_ptr(ret_conv, true);
18179 }
18180
18181 jboolean  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_is_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_is_ok(uint64_t o) {
18182         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
18183         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
18184         return ret_conv;
18185 }
18186
18187 void  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_free"))) TS_CResult_UntrustedStringDecodeErrorZ_free(uint64_t _res) {
18188         if (!ptr_is_owned(_res)) return;
18189         void* _res_ptr = untag_ptr(_res);
18190         CHECK_ACCESS(_res_ptr);
18191         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
18192         FREE(untag_ptr(_res));
18193         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
18194 }
18195
18196 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
18197         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
18198         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
18199         return tag_ptr(ret_conv, true);
18200 }
18201 int64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr"))) TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr(uint64_t arg) {
18202         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
18203         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
18204         return ret_conv;
18205 }
18206
18207 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone"))) TS_CResult_UntrustedStringDecodeErrorZ_clone(uint64_t orig) {
18208         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
18209         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
18210         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
18211         return tag_ptr(ret_conv, true);
18212 }
18213
18214 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
18215         LDKOutPoint o_conv;
18216         o_conv.inner = untag_ptr(o);
18217         o_conv.is_owned = ptr_is_owned(o);
18218         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18219         o_conv = OutPoint_clone(&o_conv);
18220         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18221         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
18222         return tag_ptr(ret_conv, true);
18223 }
18224
18225 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
18226         void* e_ptr = untag_ptr(e);
18227         CHECK_ACCESS(e_ptr);
18228         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18229         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18230         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18231         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
18232         return tag_ptr(ret_conv, true);
18233 }
18234
18235 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
18236         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
18237         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
18238         return ret_conv;
18239 }
18240
18241 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
18242         if (!ptr_is_owned(_res)) return;
18243         void* _res_ptr = untag_ptr(_res);
18244         CHECK_ACCESS(_res_ptr);
18245         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
18246         FREE(untag_ptr(_res));
18247         CResult_OutPointDecodeErrorZ_free(_res_conv);
18248 }
18249
18250 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
18251         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18252         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
18253         return tag_ptr(ret_conv, true);
18254 }
18255 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
18256         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
18257         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
18258         return ret_conv;
18259 }
18260
18261 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
18262         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
18263         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18264         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
18265         return tag_ptr(ret_conv, true);
18266 }
18267
18268 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
18269         void* o_ptr = untag_ptr(o);
18270         CHECK_ACCESS(o_ptr);
18271         LDKType o_conv = *(LDKType*)(o_ptr);
18272         if (o_conv.free == LDKType_JCalls_free) {
18273                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18274                 LDKType_JCalls_cloned(&o_conv);
18275         }
18276         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18277         *ret_copy = COption_TypeZ_some(o_conv);
18278         uint64_t ret_ref = tag_ptr(ret_copy, true);
18279         return ret_ref;
18280 }
18281
18282 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
18283         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18284         *ret_copy = COption_TypeZ_none();
18285         uint64_t ret_ref = tag_ptr(ret_copy, true);
18286         return ret_ref;
18287 }
18288
18289 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
18290         if (!ptr_is_owned(_res)) return;
18291         void* _res_ptr = untag_ptr(_res);
18292         CHECK_ACCESS(_res_ptr);
18293         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
18294         FREE(untag_ptr(_res));
18295         COption_TypeZ_free(_res_conv);
18296 }
18297
18298 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
18299         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18300         *ret_copy = COption_TypeZ_clone(arg);
18301         uint64_t ret_ref = tag_ptr(ret_copy, true);
18302         return ret_ref;
18303 }
18304 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
18305         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
18306         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
18307         return ret_conv;
18308 }
18309
18310 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
18311         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
18312         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18313         *ret_copy = COption_TypeZ_clone(orig_conv);
18314         uint64_t ret_ref = tag_ptr(ret_copy, true);
18315         return ret_ref;
18316 }
18317
18318 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
18319         void* o_ptr = untag_ptr(o);
18320         CHECK_ACCESS(o_ptr);
18321         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
18322         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
18323         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18324         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
18325         return tag_ptr(ret_conv, true);
18326 }
18327
18328 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
18329         void* e_ptr = untag_ptr(e);
18330         CHECK_ACCESS(e_ptr);
18331         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18332         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18333         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18334         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
18335         return tag_ptr(ret_conv, true);
18336 }
18337
18338 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
18339         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
18340         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
18341         return ret_conv;
18342 }
18343
18344 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
18345         if (!ptr_is_owned(_res)) return;
18346         void* _res_ptr = untag_ptr(_res);
18347         CHECK_ACCESS(_res_ptr);
18348         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
18349         FREE(untag_ptr(_res));
18350         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
18351 }
18352
18353 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
18354         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18355         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
18356         return tag_ptr(ret_conv, true);
18357 }
18358 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
18359         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
18360         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
18361         return ret_conv;
18362 }
18363
18364 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
18365         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
18366         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18367         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
18368         return tag_ptr(ret_conv, true);
18369 }
18370
18371 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
18372         LDKThirtyTwoBytes o_ref;
18373         CHECK(o->arr_len == 32);
18374         memcpy(o_ref.data, o->elems, 32); FREE(o);
18375         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18376         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
18377         return tag_ptr(ret_conv, true);
18378 }
18379
18380 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint64_t e) {
18381         void* e_ptr = untag_ptr(e);
18382         CHECK_ACCESS(e_ptr);
18383         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
18384         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
18385         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18386         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
18387         return tag_ptr(ret_conv, true);
18388 }
18389
18390 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint64_t o) {
18391         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
18392         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
18393         return ret_conv;
18394 }
18395
18396 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint64_t _res) {
18397         if (!ptr_is_owned(_res)) return;
18398         void* _res_ptr = untag_ptr(_res);
18399         CHECK_ACCESS(_res_ptr);
18400         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
18401         FREE(untag_ptr(_res));
18402         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
18403 }
18404
18405 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
18406         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18407         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
18408         return tag_ptr(ret_conv, true);
18409 }
18410 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint64_t arg) {
18411         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
18412         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
18413         return ret_conv;
18414 }
18415
18416 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint64_t orig) {
18417         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
18418         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18419         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
18420         return tag_ptr(ret_conv, true);
18421 }
18422
18423 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_ok"))) TS_CResult_NonePaymentErrorZ_ok() {
18424         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
18425         *ret_conv = CResult_NonePaymentErrorZ_ok();
18426         return tag_ptr(ret_conv, true);
18427 }
18428
18429 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_err"))) TS_CResult_NonePaymentErrorZ_err(uint64_t e) {
18430         void* e_ptr = untag_ptr(e);
18431         CHECK_ACCESS(e_ptr);
18432         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
18433         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
18434         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
18435         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
18436         return tag_ptr(ret_conv, true);
18437 }
18438
18439 jboolean  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_is_ok"))) TS_CResult_NonePaymentErrorZ_is_ok(uint64_t o) {
18440         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
18441         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
18442         return ret_conv;
18443 }
18444
18445 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_free"))) TS_CResult_NonePaymentErrorZ_free(uint64_t _res) {
18446         if (!ptr_is_owned(_res)) return;
18447         void* _res_ptr = untag_ptr(_res);
18448         CHECK_ACCESS(_res_ptr);
18449         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
18450         FREE(untag_ptr(_res));
18451         CResult_NonePaymentErrorZ_free(_res_conv);
18452 }
18453
18454 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
18455         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
18456         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
18457         return tag_ptr(ret_conv, true);
18458 }
18459 int64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone_ptr"))) TS_CResult_NonePaymentErrorZ_clone_ptr(uint64_t arg) {
18460         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
18461         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
18462         return ret_conv;
18463 }
18464
18465 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone"))) TS_CResult_NonePaymentErrorZ_clone(uint64_t orig) {
18466         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
18467         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
18468         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
18469         return tag_ptr(ret_conv, true);
18470 }
18471
18472 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
18473         LDKStr o_conv = str_ref_to_owned_c(o);
18474         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18475         *ret_conv = CResult_StringErrorZ_ok(o_conv);
18476         return tag_ptr(ret_conv, true);
18477 }
18478
18479 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
18480         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
18481         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18482         *ret_conv = CResult_StringErrorZ_err(e_conv);
18483         return tag_ptr(ret_conv, true);
18484 }
18485
18486 jboolean  __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint64_t o) {
18487         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
18488         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
18489         return ret_conv;
18490 }
18491
18492 void  __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint64_t _res) {
18493         if (!ptr_is_owned(_res)) return;
18494         void* _res_ptr = untag_ptr(_res);
18495         CHECK_ACCESS(_res_ptr);
18496         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
18497         FREE(untag_ptr(_res));
18498         CResult_StringErrorZ_free(_res_conv);
18499 }
18500
18501 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
18502         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18503         *ret_conv = CResult_StringErrorZ_clone(arg);
18504         return tag_ptr(ret_conv, true);
18505 }
18506 int64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint64_t arg) {
18507         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
18508         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
18509         return ret_conv;
18510 }
18511
18512 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint64_t orig) {
18513         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
18514         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18515         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
18516         return tag_ptr(ret_conv, true);
18517 }
18518
18519 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
18520         LDKChannelMonitorUpdate o_conv;
18521         o_conv.inner = untag_ptr(o);
18522         o_conv.is_owned = ptr_is_owned(o);
18523         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18524         o_conv = ChannelMonitorUpdate_clone(&o_conv);
18525         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18526         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
18527         return tag_ptr(ret_conv, true);
18528 }
18529
18530 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
18531         void* e_ptr = untag_ptr(e);
18532         CHECK_ACCESS(e_ptr);
18533         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18534         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18535         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18536         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
18537         return tag_ptr(ret_conv, true);
18538 }
18539
18540 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
18541         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
18542         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
18543         return ret_conv;
18544 }
18545
18546 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
18547         if (!ptr_is_owned(_res)) return;
18548         void* _res_ptr = untag_ptr(_res);
18549         CHECK_ACCESS(_res_ptr);
18550         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
18551         FREE(untag_ptr(_res));
18552         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
18553 }
18554
18555 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
18556         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18557         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
18558         return tag_ptr(ret_conv, true);
18559 }
18560 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
18561         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
18562         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
18563         return ret_conv;
18564 }
18565
18566 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
18567         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
18568         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18569         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
18570         return tag_ptr(ret_conv, true);
18571 }
18572
18573 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
18574         void* o_ptr = untag_ptr(o);
18575         CHECK_ACCESS(o_ptr);
18576         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
18577         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
18578         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18579         *ret_copy = COption_MonitorEventZ_some(o_conv);
18580         uint64_t ret_ref = tag_ptr(ret_copy, true);
18581         return ret_ref;
18582 }
18583
18584 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
18585         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18586         *ret_copy = COption_MonitorEventZ_none();
18587         uint64_t ret_ref = tag_ptr(ret_copy, true);
18588         return ret_ref;
18589 }
18590
18591 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
18592         if (!ptr_is_owned(_res)) return;
18593         void* _res_ptr = untag_ptr(_res);
18594         CHECK_ACCESS(_res_ptr);
18595         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
18596         FREE(untag_ptr(_res));
18597         COption_MonitorEventZ_free(_res_conv);
18598 }
18599
18600 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
18601         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18602         *ret_copy = COption_MonitorEventZ_clone(arg);
18603         uint64_t ret_ref = tag_ptr(ret_copy, true);
18604         return ret_ref;
18605 }
18606 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
18607         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
18608         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
18609         return ret_conv;
18610 }
18611
18612 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
18613         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
18614         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
18615         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
18616         uint64_t ret_ref = tag_ptr(ret_copy, true);
18617         return ret_ref;
18618 }
18619
18620 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
18621         void* o_ptr = untag_ptr(o);
18622         CHECK_ACCESS(o_ptr);
18623         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
18624         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
18625         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18626         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
18627         return tag_ptr(ret_conv, true);
18628 }
18629
18630 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
18631         void* e_ptr = untag_ptr(e);
18632         CHECK_ACCESS(e_ptr);
18633         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18634         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18635         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18636         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
18637         return tag_ptr(ret_conv, true);
18638 }
18639
18640 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
18641         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
18642         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
18643         return ret_conv;
18644 }
18645
18646 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
18647         if (!ptr_is_owned(_res)) return;
18648         void* _res_ptr = untag_ptr(_res);
18649         CHECK_ACCESS(_res_ptr);
18650         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
18651         FREE(untag_ptr(_res));
18652         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
18653 }
18654
18655 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
18656         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18657         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
18658         return tag_ptr(ret_conv, true);
18659 }
18660 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
18661         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
18662         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
18663         return ret_conv;
18664 }
18665
18666 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
18667         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
18668         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18669         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
18670         return tag_ptr(ret_conv, true);
18671 }
18672
18673 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
18674         LDKHTLCUpdate o_conv;
18675         o_conv.inner = untag_ptr(o);
18676         o_conv.is_owned = ptr_is_owned(o);
18677         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18678         o_conv = HTLCUpdate_clone(&o_conv);
18679         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18680         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
18681         return tag_ptr(ret_conv, true);
18682 }
18683
18684 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
18685         void* e_ptr = untag_ptr(e);
18686         CHECK_ACCESS(e_ptr);
18687         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18688         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18689         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18690         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
18691         return tag_ptr(ret_conv, true);
18692 }
18693
18694 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
18695         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
18696         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
18697         return ret_conv;
18698 }
18699
18700 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
18701         if (!ptr_is_owned(_res)) return;
18702         void* _res_ptr = untag_ptr(_res);
18703         CHECK_ACCESS(_res_ptr);
18704         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
18705         FREE(untag_ptr(_res));
18706         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
18707 }
18708
18709 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
18710         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18711         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
18712         return tag_ptr(ret_conv, true);
18713 }
18714 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
18715         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
18716         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
18717         return ret_conv;
18718 }
18719
18720 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
18721         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
18722         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18723         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
18724         return tag_ptr(ret_conv, true);
18725 }
18726
18727 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
18728         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18729         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
18730         return tag_ptr(ret_conv, true);
18731 }
18732 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint64_t arg) {
18733         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
18734         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
18735         return ret_conv;
18736 }
18737
18738 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint64_t orig) {
18739         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
18740         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18741         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
18742         return tag_ptr(ret_conv, true);
18743 }
18744
18745 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint64_t a, int8_tArray b) {
18746         LDKOutPoint a_conv;
18747         a_conv.inner = untag_ptr(a);
18748         a_conv.is_owned = ptr_is_owned(a);
18749         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18750         a_conv = OutPoint_clone(&a_conv);
18751         LDKCVec_u8Z b_ref;
18752         b_ref.datalen = b->arr_len;
18753         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18754         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18755         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18756         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
18757         return tag_ptr(ret_conv, true);
18758 }
18759
18760 void  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint64_t _res) {
18761         if (!ptr_is_owned(_res)) return;
18762         void* _res_ptr = untag_ptr(_res);
18763         CHECK_ACCESS(_res_ptr);
18764         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
18765         FREE(untag_ptr(_res));
18766         C2Tuple_OutPointScriptZ_free(_res_conv);
18767 }
18768
18769 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
18770         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18771         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
18772         return tag_ptr(ret_conv, true);
18773 }
18774 int64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint64_t arg) {
18775         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
18776         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
18777         return ret_conv;
18778 }
18779
18780 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint64_t orig) {
18781         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
18782         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18783         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
18784         return tag_ptr(ret_conv, true);
18785 }
18786
18787 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
18788         LDKCVec_u8Z b_ref;
18789         b_ref.datalen = b->arr_len;
18790         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18791         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18792         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18793         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
18794         return tag_ptr(ret_conv, true);
18795 }
18796
18797 void  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint64_t _res) {
18798         if (!ptr_is_owned(_res)) return;
18799         void* _res_ptr = untag_ptr(_res);
18800         CHECK_ACCESS(_res_ptr);
18801         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
18802         FREE(untag_ptr(_res));
18803         C2Tuple_u32ScriptZ_free(_res_conv);
18804 }
18805
18806 void  __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint64_tArray _res) {
18807         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
18808         _res_constr.datalen = _res->arr_len;
18809         if (_res_constr.datalen > 0)
18810                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
18811         else
18812                 _res_constr.data = NULL;
18813         uint64_t* _res_vals = _res->elems;
18814         for (size_t v = 0; v < _res_constr.datalen; v++) {
18815                 uint64_t _res_conv_21 = _res_vals[v];
18816                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
18817                 CHECK_ACCESS(_res_conv_21_ptr);
18818                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
18819                 FREE(untag_ptr(_res_conv_21));
18820                 _res_constr.data[v] = _res_conv_21_conv;
18821         }
18822         FREE(_res);
18823         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
18824 }
18825
18826 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
18827         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18828         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
18829         return tag_ptr(ret_conv, true);
18830 }
18831 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint64_t arg) {
18832         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
18833         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
18834         return ret_conv;
18835 }
18836
18837 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint64_t orig) {
18838         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
18839         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18840         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
18841         return tag_ptr(ret_conv, true);
18842 }
18843
18844 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint64_tArray b) {
18845         LDKThirtyTwoBytes a_ref;
18846         CHECK(a->arr_len == 32);
18847         memcpy(a_ref.data, a->elems, 32); FREE(a);
18848         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
18849         b_constr.datalen = b->arr_len;
18850         if (b_constr.datalen > 0)
18851                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
18852         else
18853                 b_constr.data = NULL;
18854         uint64_t* b_vals = b->elems;
18855         for (size_t v = 0; v < b_constr.datalen; v++) {
18856                 uint64_t b_conv_21 = b_vals[v];
18857                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
18858                 CHECK_ACCESS(b_conv_21_ptr);
18859                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
18860                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
18861                 b_constr.data[v] = b_conv_21_conv;
18862         }
18863         FREE(b);
18864         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18865         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
18866         return tag_ptr(ret_conv, true);
18867 }
18868
18869 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint64_t _res) {
18870         if (!ptr_is_owned(_res)) return;
18871         void* _res_ptr = untag_ptr(_res);
18872         CHECK_ACCESS(_res_ptr);
18873         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
18874         FREE(untag_ptr(_res));
18875         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
18876 }
18877
18878 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint64_tArray _res) {
18879         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
18880         _res_constr.datalen = _res->arr_len;
18881         if (_res_constr.datalen > 0)
18882                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
18883         else
18884                 _res_constr.data = NULL;
18885         uint64_t* _res_vals = _res->elems;
18886         for (size_t o = 0; o < _res_constr.datalen; o++) {
18887                 uint64_t _res_conv_40 = _res_vals[o];
18888                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
18889                 CHECK_ACCESS(_res_conv_40_ptr);
18890                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
18891                 FREE(untag_ptr(_res_conv_40));
18892                 _res_constr.data[o] = _res_conv_40_conv;
18893         }
18894         FREE(_res);
18895         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
18896 }
18897
18898 void  __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint64_tArray _res) {
18899         LDKCVec_EventZ _res_constr;
18900         _res_constr.datalen = _res->arr_len;
18901         if (_res_constr.datalen > 0)
18902                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
18903         else
18904                 _res_constr.data = NULL;
18905         uint64_t* _res_vals = _res->elems;
18906         for (size_t h = 0; h < _res_constr.datalen; h++) {
18907                 uint64_t _res_conv_7 = _res_vals[h];
18908                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
18909                 CHECK_ACCESS(_res_conv_7_ptr);
18910                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
18911                 FREE(untag_ptr(_res_conv_7));
18912                 _res_constr.data[h] = _res_conv_7_conv;
18913         }
18914         FREE(_res);
18915         CVec_EventZ_free(_res_constr);
18916 }
18917
18918 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
18919         LDKCVec_TransactionZ _res_constr;
18920         _res_constr.datalen = _res->arr_len;
18921         if (_res_constr.datalen > 0)
18922                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
18923         else
18924                 _res_constr.data = NULL;
18925         int8_tArray* _res_vals = (void*) _res->elems;
18926         for (size_t m = 0; m < _res_constr.datalen; m++) {
18927                 int8_tArray _res_conv_12 = _res_vals[m];
18928                 LDKTransaction _res_conv_12_ref;
18929                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
18930                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
18931                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
18932                 _res_conv_12_ref.data_is_owned = true;
18933                 _res_constr.data[m] = _res_conv_12_ref;
18934         }
18935         FREE(_res);
18936         CVec_TransactionZ_free(_res_constr);
18937 }
18938
18939 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
18940         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18941         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
18942         return tag_ptr(ret_conv, true);
18943 }
18944 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
18945         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
18946         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
18947         return ret_conv;
18948 }
18949
18950 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
18951         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
18952         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18953         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
18954         return tag_ptr(ret_conv, true);
18955 }
18956
18957 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
18958         void* b_ptr = untag_ptr(b);
18959         CHECK_ACCESS(b_ptr);
18960         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
18961         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
18962         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18963         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
18964         return tag_ptr(ret_conv, true);
18965 }
18966
18967 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
18968         if (!ptr_is_owned(_res)) return;
18969         void* _res_ptr = untag_ptr(_res);
18970         CHECK_ACCESS(_res_ptr);
18971         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
18972         FREE(untag_ptr(_res));
18973         C2Tuple_u32TxOutZ_free(_res_conv);
18974 }
18975
18976 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
18977         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
18978         _res_constr.datalen = _res->arr_len;
18979         if (_res_constr.datalen > 0)
18980                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18981         else
18982                 _res_constr.data = NULL;
18983         uint64_t* _res_vals = _res->elems;
18984         for (size_t u = 0; u < _res_constr.datalen; u++) {
18985                 uint64_t _res_conv_20 = _res_vals[u];
18986                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
18987                 CHECK_ACCESS(_res_conv_20_ptr);
18988                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
18989                 FREE(untag_ptr(_res_conv_20));
18990                 _res_constr.data[u] = _res_conv_20_conv;
18991         }
18992         FREE(_res);
18993         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
18994 }
18995
18996 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
18997         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18998         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
18999         return tag_ptr(ret_conv, true);
19000 }
19001 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
19002         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
19003         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
19004         return ret_conv;
19005 }
19006
19007 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
19008         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
19009         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19010         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
19011         return tag_ptr(ret_conv, true);
19012 }
19013
19014 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
19015         LDKThirtyTwoBytes a_ref;
19016         CHECK(a->arr_len == 32);
19017         memcpy(a_ref.data, a->elems, 32); FREE(a);
19018         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
19019         b_constr.datalen = b->arr_len;
19020         if (b_constr.datalen > 0)
19021                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
19022         else
19023                 b_constr.data = NULL;
19024         uint64_t* b_vals = b->elems;
19025         for (size_t u = 0; u < b_constr.datalen; u++) {
19026                 uint64_t b_conv_20 = b_vals[u];
19027                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
19028                 CHECK_ACCESS(b_conv_20_ptr);
19029                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
19030                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
19031                 b_constr.data[u] = b_conv_20_conv;
19032         }
19033         FREE(b);
19034         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19035         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
19036         return tag_ptr(ret_conv, true);
19037 }
19038
19039 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
19040         if (!ptr_is_owned(_res)) return;
19041         void* _res_ptr = untag_ptr(_res);
19042         CHECK_ACCESS(_res_ptr);
19043         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
19044         FREE(untag_ptr(_res));
19045         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
19046 }
19047
19048 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
19049         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
19050         _res_constr.datalen = _res->arr_len;
19051         if (_res_constr.datalen > 0)
19052                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
19053         else
19054                 _res_constr.data = NULL;
19055         uint64_t* _res_vals = _res->elems;
19056         for (size_t n = 0; n < _res_constr.datalen; n++) {
19057                 uint64_t _res_conv_39 = _res_vals[n];
19058                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
19059                 CHECK_ACCESS(_res_conv_39_ptr);
19060                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
19061                 FREE(untag_ptr(_res_conv_39));
19062                 _res_constr.data[n] = _res_conv_39_conv;
19063         }
19064         FREE(_res);
19065         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
19066 }
19067
19068 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
19069         LDKCVec_BalanceZ _res_constr;
19070         _res_constr.datalen = _res->arr_len;
19071         if (_res_constr.datalen > 0)
19072                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
19073         else
19074                 _res_constr.data = NULL;
19075         uint64_t* _res_vals = _res->elems;
19076         for (size_t j = 0; j < _res_constr.datalen; j++) {
19077                 uint64_t _res_conv_9 = _res_vals[j];
19078                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
19079                 CHECK_ACCESS(_res_conv_9_ptr);
19080                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
19081                 FREE(untag_ptr(_res_conv_9));
19082                 _res_constr.data[j] = _res_conv_9_conv;
19083         }
19084         FREE(_res);
19085         CVec_BalanceZ_free(_res_constr);
19086 }
19087
19088 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
19089         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19090         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
19091         return tag_ptr(ret_conv, true);
19092 }
19093 int64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint64_t arg) {
19094         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
19095         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
19096         return ret_conv;
19097 }
19098
19099 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint64_t orig) {
19100         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
19101         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19102         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
19103         return tag_ptr(ret_conv, true);
19104 }
19105
19106 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint64_t b) {
19107         LDKThirtyTwoBytes a_ref;
19108         CHECK(a->arr_len == 32);
19109         memcpy(a_ref.data, a->elems, 32); FREE(a);
19110         LDKChannelMonitor b_conv;
19111         b_conv.inner = untag_ptr(b);
19112         b_conv.is_owned = ptr_is_owned(b);
19113         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19114         b_conv = ChannelMonitor_clone(&b_conv);
19115         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19116         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
19117         return tag_ptr(ret_conv, true);
19118 }
19119
19120 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint64_t _res) {
19121         if (!ptr_is_owned(_res)) return;
19122         void* _res_ptr = untag_ptr(_res);
19123         CHECK_ACCESS(_res_ptr);
19124         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
19125         FREE(untag_ptr(_res));
19126         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
19127 }
19128
19129 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
19130         void* o_ptr = untag_ptr(o);
19131         CHECK_ACCESS(o_ptr);
19132         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
19133         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
19134         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19135         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
19136         return tag_ptr(ret_conv, true);
19137 }
19138
19139 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint64_t e) {
19140         void* e_ptr = untag_ptr(e);
19141         CHECK_ACCESS(e_ptr);
19142         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19143         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19144         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19145         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
19146         return tag_ptr(ret_conv, true);
19147 }
19148
19149 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
19150         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
19151         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
19152         return ret_conv;
19153 }
19154
19155 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
19156         if (!ptr_is_owned(_res)) return;
19157         void* _res_ptr = untag_ptr(_res);
19158         CHECK_ACCESS(_res_ptr);
19159         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
19160         FREE(untag_ptr(_res));
19161         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
19162 }
19163
19164 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
19165         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19166         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
19167         return tag_ptr(ret_conv, true);
19168 }
19169 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
19170         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
19171         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
19172         return ret_conv;
19173 }
19174
19175 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
19176         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
19177         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19178         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
19179         return tag_ptr(ret_conv, true);
19180 }
19181
19182 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
19183         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19184         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
19185         return tag_ptr(ret_conv, true);
19186 }
19187 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
19188         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
19189         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
19190         return ret_conv;
19191 }
19192
19193 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
19194         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
19195         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19196         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
19197         return tag_ptr(ret_conv, true);
19198 }
19199
19200 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
19201         LDKPublicKey a_ref;
19202         CHECK(a->arr_len == 33);
19203         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
19204         void* b_ptr = untag_ptr(b);
19205         CHECK_ACCESS(b_ptr);
19206         LDKType b_conv = *(LDKType*)(b_ptr);
19207         if (b_conv.free == LDKType_JCalls_free) {
19208                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19209                 LDKType_JCalls_cloned(&b_conv);
19210         }
19211         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19212         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
19213         return tag_ptr(ret_conv, true);
19214 }
19215
19216 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
19217         if (!ptr_is_owned(_res)) return;
19218         void* _res_ptr = untag_ptr(_res);
19219         CHECK_ACCESS(_res_ptr);
19220         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
19221         FREE(untag_ptr(_res));
19222         C2Tuple_PublicKeyTypeZ_free(_res_conv);
19223 }
19224
19225 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
19226         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
19227         _res_constr.datalen = _res->arr_len;
19228         if (_res_constr.datalen > 0)
19229                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
19230         else
19231                 _res_constr.data = NULL;
19232         uint64_t* _res_vals = _res->elems;
19233         for (size_t z = 0; z < _res_constr.datalen; z++) {
19234                 uint64_t _res_conv_25 = _res_vals[z];
19235                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
19236                 CHECK_ACCESS(_res_conv_25_ptr);
19237                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
19238                 FREE(untag_ptr(_res_conv_25));
19239                 _res_constr.data[z] = _res_conv_25_conv;
19240         }
19241         FREE(_res);
19242         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
19243 }
19244
19245 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_some"))) TS_COption_CustomOnionMessageContentsZ_some(uint64_t o) {
19246         void* o_ptr = untag_ptr(o);
19247         CHECK_ACCESS(o_ptr);
19248         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
19249         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
19250                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19251                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
19252         }
19253         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
19254         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
19255         uint64_t ret_ref = tag_ptr(ret_copy, true);
19256         return ret_ref;
19257 }
19258
19259 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_none"))) TS_COption_CustomOnionMessageContentsZ_none() {
19260         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
19261         *ret_copy = COption_CustomOnionMessageContentsZ_none();
19262         uint64_t ret_ref = tag_ptr(ret_copy, true);
19263         return ret_ref;
19264 }
19265
19266 void  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_free"))) TS_COption_CustomOnionMessageContentsZ_free(uint64_t _res) {
19267         if (!ptr_is_owned(_res)) return;
19268         void* _res_ptr = untag_ptr(_res);
19269         CHECK_ACCESS(_res_ptr);
19270         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
19271         FREE(untag_ptr(_res));
19272         COption_CustomOnionMessageContentsZ_free(_res_conv);
19273 }
19274
19275 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
19276         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
19277         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
19278         uint64_t ret_ref = tag_ptr(ret_copy, true);
19279         return ret_ref;
19280 }
19281 int64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone_ptr"))) TS_COption_CustomOnionMessageContentsZ_clone_ptr(uint64_t arg) {
19282         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
19283         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
19284         return ret_conv;
19285 }
19286
19287 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone"))) TS_COption_CustomOnionMessageContentsZ_clone(uint64_t orig) {
19288         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
19289         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
19290         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
19291         uint64_t ret_ref = tag_ptr(ret_copy, true);
19292         return ret_ref;
19293 }
19294
19295 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
19296         void* o_ptr = untag_ptr(o);
19297         CHECK_ACCESS(o_ptr);
19298         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
19299         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
19300         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
19301         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
19302         return tag_ptr(ret_conv, true);
19303 }
19304
19305 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
19306         void* e_ptr = untag_ptr(e);
19307         CHECK_ACCESS(e_ptr);
19308         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19309         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19310         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
19311         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
19312         return tag_ptr(ret_conv, true);
19313 }
19314
19315 jboolean  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
19316         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
19317         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
19318         return ret_conv;
19319 }
19320
19321 void  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
19322         if (!ptr_is_owned(_res)) return;
19323         void* _res_ptr = untag_ptr(_res);
19324         CHECK_ACCESS(_res_ptr);
19325         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
19326         FREE(untag_ptr(_res));
19327         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
19328 }
19329
19330 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
19331         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
19332         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
19333         return tag_ptr(ret_conv, true);
19334 }
19335 int64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
19336         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
19337         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
19338         return ret_conv;
19339 }
19340
19341 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
19342         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
19343         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
19344         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
19345         return tag_ptr(ret_conv, true);
19346 }
19347
19348 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint64_t o) {
19349         void* o_ptr = untag_ptr(o);
19350         CHECK_ACCESS(o_ptr);
19351         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
19352         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
19353         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
19354         *ret_copy = COption_NetAddressZ_some(o_conv);
19355         uint64_t ret_ref = tag_ptr(ret_copy, true);
19356         return ret_ref;
19357 }
19358
19359 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
19360         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
19361         *ret_copy = COption_NetAddressZ_none();
19362         uint64_t ret_ref = tag_ptr(ret_copy, true);
19363         return ret_ref;
19364 }
19365
19366 void  __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint64_t _res) {
19367         if (!ptr_is_owned(_res)) return;
19368         void* _res_ptr = untag_ptr(_res);
19369         CHECK_ACCESS(_res_ptr);
19370         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
19371         FREE(untag_ptr(_res));
19372         COption_NetAddressZ_free(_res_conv);
19373 }
19374
19375 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
19376         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
19377         *ret_copy = COption_NetAddressZ_clone(arg);
19378         uint64_t ret_ref = tag_ptr(ret_copy, true);
19379         return ret_ref;
19380 }
19381 int64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint64_t arg) {
19382         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
19383         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
19384         return ret_conv;
19385 }
19386
19387 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint64_t orig) {
19388         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
19389         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
19390         *ret_copy = COption_NetAddressZ_clone(orig_conv);
19391         uint64_t ret_ref = tag_ptr(ret_copy, true);
19392         return ret_ref;
19393 }
19394
19395 static inline uint64_t C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR arg) {
19396         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
19397         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(arg);
19398         return tag_ptr(ret_conv, true);
19399 }
19400 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(uint64_t arg) {
19401         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(arg);
19402         int64_t ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(arg_conv);
19403         return ret_conv;
19404 }
19405
19406 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone(uint64_t orig) {
19407         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(orig);
19408         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
19409         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig_conv);
19410         return tag_ptr(ret_conv, true);
19411 }
19412
19413 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_new"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_new(int8_tArray a, uint64_t b) {
19414         LDKPublicKey a_ref;
19415         CHECK(a->arr_len == 33);
19416         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
19417         void* b_ptr = untag_ptr(b);
19418         CHECK_ACCESS(b_ptr);
19419         LDKCOption_NetAddressZ b_conv = *(LDKCOption_NetAddressZ*)(b_ptr);
19420         b_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(b));
19421         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
19422         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_new(a_ref, b_conv);
19423         return tag_ptr(ret_conv, true);
19424 }
19425
19426 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_free"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_free(uint64_t _res) {
19427         if (!ptr_is_owned(_res)) return;
19428         void* _res_ptr = untag_ptr(_res);
19429         CHECK_ACCESS(_res_ptr);
19430         LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_ptr);
19431         FREE(untag_ptr(_res));
19432         C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res_conv);
19433 }
19434
19435 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(uint64_tArray _res) {
19436         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res_constr;
19437         _res_constr.datalen = _res->arr_len;
19438         if (_res_constr.datalen > 0)
19439                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ Elements");
19440         else
19441                 _res_constr.data = NULL;
19442         uint64_t* _res_vals = _res->elems;
19443         for (size_t o = 0; o < _res_constr.datalen; o++) {
19444                 uint64_t _res_conv_40 = _res_vals[o];
19445                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
19446                 CHECK_ACCESS(_res_conv_40_ptr);
19447                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_conv_40_ptr);
19448                 FREE(untag_ptr(_res_conv_40));
19449                 _res_constr.data[o] = _res_conv_40_conv;
19450         }
19451         FREE(_res);
19452         CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res_constr);
19453 }
19454
19455 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
19456         LDKCVec_u8Z o_ref;
19457         o_ref.datalen = o->arr_len;
19458         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
19459         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
19460         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19461         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
19462         return tag_ptr(ret_conv, true);
19463 }
19464
19465 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
19466         LDKPeerHandleError e_conv;
19467         e_conv.inner = untag_ptr(e);
19468         e_conv.is_owned = ptr_is_owned(e);
19469         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19470         e_conv = PeerHandleError_clone(&e_conv);
19471         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19472         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
19473         return tag_ptr(ret_conv, true);
19474 }
19475
19476 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
19477         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
19478         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
19479         return ret_conv;
19480 }
19481
19482 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
19483         if (!ptr_is_owned(_res)) return;
19484         void* _res_ptr = untag_ptr(_res);
19485         CHECK_ACCESS(_res_ptr);
19486         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
19487         FREE(untag_ptr(_res));
19488         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
19489 }
19490
19491 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
19492         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19493         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
19494         return tag_ptr(ret_conv, true);
19495 }
19496 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
19497         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
19498         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
19499         return ret_conv;
19500 }
19501
19502 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
19503         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
19504         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19505         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
19506         return tag_ptr(ret_conv, true);
19507 }
19508
19509 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
19510         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19511         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
19512         return tag_ptr(ret_conv, true);
19513 }
19514
19515 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
19516         LDKPeerHandleError e_conv;
19517         e_conv.inner = untag_ptr(e);
19518         e_conv.is_owned = ptr_is_owned(e);
19519         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19520         e_conv = PeerHandleError_clone(&e_conv);
19521         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19522         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
19523         return tag_ptr(ret_conv, true);
19524 }
19525
19526 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
19527         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
19528         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
19529         return ret_conv;
19530 }
19531
19532 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
19533         if (!ptr_is_owned(_res)) return;
19534         void* _res_ptr = untag_ptr(_res);
19535         CHECK_ACCESS(_res_ptr);
19536         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
19537         FREE(untag_ptr(_res));
19538         CResult_NonePeerHandleErrorZ_free(_res_conv);
19539 }
19540
19541 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
19542         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19543         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
19544         return tag_ptr(ret_conv, true);
19545 }
19546 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
19547         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
19548         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
19549         return ret_conv;
19550 }
19551
19552 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
19553         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
19554         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19555         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
19556         return tag_ptr(ret_conv, true);
19557 }
19558
19559 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
19560         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19561         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
19562         return tag_ptr(ret_conv, true);
19563 }
19564
19565 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
19566         LDKPeerHandleError e_conv;
19567         e_conv.inner = untag_ptr(e);
19568         e_conv.is_owned = ptr_is_owned(e);
19569         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19570         e_conv = PeerHandleError_clone(&e_conv);
19571         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19572         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
19573         return tag_ptr(ret_conv, true);
19574 }
19575
19576 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
19577         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
19578         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
19579         return ret_conv;
19580 }
19581
19582 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
19583         if (!ptr_is_owned(_res)) return;
19584         void* _res_ptr = untag_ptr(_res);
19585         CHECK_ACCESS(_res_ptr);
19586         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
19587         FREE(untag_ptr(_res));
19588         CResult_boolPeerHandleErrorZ_free(_res_conv);
19589 }
19590
19591 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
19592         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19593         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
19594         return tag_ptr(ret_conv, true);
19595 }
19596 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
19597         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
19598         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
19599         return ret_conv;
19600 }
19601
19602 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
19603         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
19604         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19605         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
19606         return tag_ptr(ret_conv, true);
19607 }
19608
19609 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_ok(uint64_t o) {
19610         void* o_ptr = untag_ptr(o);
19611         CHECK_ACCESS(o_ptr);
19612         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
19613         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
19614         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19615         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
19616         return tag_ptr(ret_conv, true);
19617 }
19618
19619 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_err"))) TS_CResult_TxOutUtxoLookupErrorZ_err(uint32_t e) {
19620         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_js(e);
19621         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19622         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
19623         return tag_ptr(ret_conv, true);
19624 }
19625
19626 jboolean  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_is_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_is_ok(uint64_t o) {
19627         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
19628         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
19629         return ret_conv;
19630 }
19631
19632 void  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_free"))) TS_CResult_TxOutUtxoLookupErrorZ_free(uint64_t _res) {
19633         if (!ptr_is_owned(_res)) return;
19634         void* _res_ptr = untag_ptr(_res);
19635         CHECK_ACCESS(_res_ptr);
19636         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
19637         FREE(untag_ptr(_res));
19638         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
19639 }
19640
19641 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
19642         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19643         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
19644         return tag_ptr(ret_conv, true);
19645 }
19646 int64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr"))) TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr(uint64_t arg) {
19647         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
19648         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
19649         return ret_conv;
19650 }
19651
19652 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone"))) TS_CResult_TxOutUtxoLookupErrorZ_clone(uint64_t orig) {
19653         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
19654         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
19655         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
19656         return tag_ptr(ret_conv, true);
19657 }
19658
19659 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() {
19660         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
19661         *ret_conv = CResult_NoneSendErrorZ_ok();
19662         return tag_ptr(ret_conv, true);
19663 }
19664
19665 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) {
19666         void* e_ptr = untag_ptr(e);
19667         CHECK_ACCESS(e_ptr);
19668         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
19669         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
19670         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
19671         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
19672         return tag_ptr(ret_conv, true);
19673 }
19674
19675 jboolean  __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) {
19676         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
19677         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
19678         return ret_conv;
19679 }
19680
19681 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) {
19682         if (!ptr_is_owned(_res)) return;
19683         void* _res_ptr = untag_ptr(_res);
19684         CHECK_ACCESS(_res_ptr);
19685         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
19686         FREE(untag_ptr(_res));
19687         CResult_NoneSendErrorZ_free(_res_conv);
19688 }
19689
19690 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
19691         LDKBlindedPath o_conv;
19692         o_conv.inner = untag_ptr(o);
19693         o_conv.is_owned = ptr_is_owned(o);
19694         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19695         o_conv = BlindedPath_clone(&o_conv);
19696         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
19697         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
19698         return tag_ptr(ret_conv, true);
19699 }
19700
19701 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
19702         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
19703         *ret_conv = CResult_BlindedPathNoneZ_err();
19704         return tag_ptr(ret_conv, true);
19705 }
19706
19707 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
19708         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
19709         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
19710         return ret_conv;
19711 }
19712
19713 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
19714         if (!ptr_is_owned(_res)) return;
19715         void* _res_ptr = untag_ptr(_res);
19716         CHECK_ACCESS(_res_ptr);
19717         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
19718         FREE(untag_ptr(_res));
19719         CResult_BlindedPathNoneZ_free(_res_conv);
19720 }
19721
19722 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
19723         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
19724         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
19725         return tag_ptr(ret_conv, true);
19726 }
19727 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
19728         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
19729         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
19730         return ret_conv;
19731 }
19732
19733 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
19734         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
19735         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
19736         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
19737         return tag_ptr(ret_conv, true);
19738 }
19739
19740 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
19741         LDKBlindedPath o_conv;
19742         o_conv.inner = untag_ptr(o);
19743         o_conv.is_owned = ptr_is_owned(o);
19744         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19745         o_conv = BlindedPath_clone(&o_conv);
19746         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
19747         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
19748         return tag_ptr(ret_conv, true);
19749 }
19750
19751 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
19752         void* e_ptr = untag_ptr(e);
19753         CHECK_ACCESS(e_ptr);
19754         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19755         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19756         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
19757         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
19758         return tag_ptr(ret_conv, true);
19759 }
19760
19761 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
19762         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
19763         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
19764         return ret_conv;
19765 }
19766
19767 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
19768         if (!ptr_is_owned(_res)) return;
19769         void* _res_ptr = untag_ptr(_res);
19770         CHECK_ACCESS(_res_ptr);
19771         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
19772         FREE(untag_ptr(_res));
19773         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
19774 }
19775
19776 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
19777         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
19778         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
19779         return tag_ptr(ret_conv, true);
19780 }
19781 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
19782         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
19783         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
19784         return ret_conv;
19785 }
19786
19787 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
19788         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
19789         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
19790         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
19791         return tag_ptr(ret_conv, true);
19792 }
19793
19794 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
19795         LDKBlindedHop o_conv;
19796         o_conv.inner = untag_ptr(o);
19797         o_conv.is_owned = ptr_is_owned(o);
19798         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19799         o_conv = BlindedHop_clone(&o_conv);
19800         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
19801         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
19802         return tag_ptr(ret_conv, true);
19803 }
19804
19805 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
19806         void* e_ptr = untag_ptr(e);
19807         CHECK_ACCESS(e_ptr);
19808         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19809         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19810         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
19811         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
19812         return tag_ptr(ret_conv, true);
19813 }
19814
19815 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
19816         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
19817         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
19818         return ret_conv;
19819 }
19820
19821 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
19822         if (!ptr_is_owned(_res)) return;
19823         void* _res_ptr = untag_ptr(_res);
19824         CHECK_ACCESS(_res_ptr);
19825         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
19826         FREE(untag_ptr(_res));
19827         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
19828 }
19829
19830 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
19831         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
19832         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
19833         return tag_ptr(ret_conv, true);
19834 }
19835 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
19836         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
19837         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
19838         return ret_conv;
19839 }
19840
19841 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
19842         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
19843         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
19844         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
19845         return tag_ptr(ret_conv, true);
19846 }
19847
19848 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
19849         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
19850         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
19851         return tag_ptr(ret_conv, true);
19852 }
19853
19854 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
19855         void* e_ptr = untag_ptr(e);
19856         CHECK_ACCESS(e_ptr);
19857         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
19858         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
19859         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
19860         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
19861         return tag_ptr(ret_conv, true);
19862 }
19863
19864 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
19865         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
19866         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
19867         return ret_conv;
19868 }
19869
19870 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
19871         if (!ptr_is_owned(_res)) return;
19872         void* _res_ptr = untag_ptr(_res);
19873         CHECK_ACCESS(_res_ptr);
19874         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
19875         FREE(untag_ptr(_res));
19876         CResult_u32GraphSyncErrorZ_free(_res_conv);
19877 }
19878
19879 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
19880         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19881         *ret_conv = CResult_NoneErrorZ_ok();
19882         return tag_ptr(ret_conv, true);
19883 }
19884
19885 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
19886         LDKIOError e_conv = LDKIOError_from_js(e);
19887         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19888         *ret_conv = CResult_NoneErrorZ_err(e_conv);
19889         return tag_ptr(ret_conv, true);
19890 }
19891
19892 jboolean  __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint64_t o) {
19893         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
19894         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
19895         return ret_conv;
19896 }
19897
19898 void  __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint64_t _res) {
19899         if (!ptr_is_owned(_res)) return;
19900         void* _res_ptr = untag_ptr(_res);
19901         CHECK_ACCESS(_res_ptr);
19902         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
19903         FREE(untag_ptr(_res));
19904         CResult_NoneErrorZ_free(_res_conv);
19905 }
19906
19907 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
19908         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19909         *ret_conv = CResult_NoneErrorZ_clone(arg);
19910         return tag_ptr(ret_conv, true);
19911 }
19912 int64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint64_t arg) {
19913         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
19914         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
19915         return ret_conv;
19916 }
19917
19918 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint64_t orig) {
19919         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
19920         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19921         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
19922         return tag_ptr(ret_conv, true);
19923 }
19924
19925 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint64_t o) {
19926         void* o_ptr = untag_ptr(o);
19927         CHECK_ACCESS(o_ptr);
19928         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
19929         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
19930         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19931         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
19932         return tag_ptr(ret_conv, true);
19933 }
19934
19935 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint64_t e) {
19936         void* e_ptr = untag_ptr(e);
19937         CHECK_ACCESS(e_ptr);
19938         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19939         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19940         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19941         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
19942         return tag_ptr(ret_conv, true);
19943 }
19944
19945 jboolean  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint64_t o) {
19946         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
19947         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
19948         return ret_conv;
19949 }
19950
19951 void  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint64_t _res) {
19952         if (!ptr_is_owned(_res)) return;
19953         void* _res_ptr = untag_ptr(_res);
19954         CHECK_ACCESS(_res_ptr);
19955         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
19956         FREE(untag_ptr(_res));
19957         CResult_NetAddressDecodeErrorZ_free(_res_conv);
19958 }
19959
19960 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
19961         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19962         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
19963         return tag_ptr(ret_conv, true);
19964 }
19965 int64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
19966         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
19967         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
19968         return ret_conv;
19969 }
19970
19971 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint64_t orig) {
19972         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
19973         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19974         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
19975         return tag_ptr(ret_conv, true);
19976 }
19977
19978 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
19979         LDKCVec_UpdateAddHTLCZ _res_constr;
19980         _res_constr.datalen = _res->arr_len;
19981         if (_res_constr.datalen > 0)
19982                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19983         else
19984                 _res_constr.data = NULL;
19985         uint64_t* _res_vals = _res->elems;
19986         for (size_t p = 0; p < _res_constr.datalen; p++) {
19987                 uint64_t _res_conv_15 = _res_vals[p];
19988                 LDKUpdateAddHTLC _res_conv_15_conv;
19989                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
19990                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
19991                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
19992                 _res_constr.data[p] = _res_conv_15_conv;
19993         }
19994         FREE(_res);
19995         CVec_UpdateAddHTLCZ_free(_res_constr);
19996 }
19997
19998 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
19999         LDKCVec_UpdateFulfillHTLCZ _res_constr;
20000         _res_constr.datalen = _res->arr_len;
20001         if (_res_constr.datalen > 0)
20002                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
20003         else
20004                 _res_constr.data = NULL;
20005         uint64_t* _res_vals = _res->elems;
20006         for (size_t t = 0; t < _res_constr.datalen; t++) {
20007                 uint64_t _res_conv_19 = _res_vals[t];
20008                 LDKUpdateFulfillHTLC _res_conv_19_conv;
20009                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
20010                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
20011                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
20012                 _res_constr.data[t] = _res_conv_19_conv;
20013         }
20014         FREE(_res);
20015         CVec_UpdateFulfillHTLCZ_free(_res_constr);
20016 }
20017
20018 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
20019         LDKCVec_UpdateFailHTLCZ _res_constr;
20020         _res_constr.datalen = _res->arr_len;
20021         if (_res_constr.datalen > 0)
20022                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
20023         else
20024                 _res_constr.data = NULL;
20025         uint64_t* _res_vals = _res->elems;
20026         for (size_t q = 0; q < _res_constr.datalen; q++) {
20027                 uint64_t _res_conv_16 = _res_vals[q];
20028                 LDKUpdateFailHTLC _res_conv_16_conv;
20029                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
20030                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
20031                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20032                 _res_constr.data[q] = _res_conv_16_conv;
20033         }
20034         FREE(_res);
20035         CVec_UpdateFailHTLCZ_free(_res_constr);
20036 }
20037
20038 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
20039         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
20040         _res_constr.datalen = _res->arr_len;
20041         if (_res_constr.datalen > 0)
20042                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
20043         else
20044                 _res_constr.data = NULL;
20045         uint64_t* _res_vals = _res->elems;
20046         for (size_t z = 0; z < _res_constr.datalen; z++) {
20047                 uint64_t _res_conv_25 = _res_vals[z];
20048                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
20049                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
20050                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
20051                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
20052                 _res_constr.data[z] = _res_conv_25_conv;
20053         }
20054         FREE(_res);
20055         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
20056 }
20057
20058 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
20059         LDKAcceptChannel o_conv;
20060         o_conv.inner = untag_ptr(o);
20061         o_conv.is_owned = ptr_is_owned(o);
20062         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20063         o_conv = AcceptChannel_clone(&o_conv);
20064         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20065         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
20066         return tag_ptr(ret_conv, true);
20067 }
20068
20069 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
20070         void* e_ptr = untag_ptr(e);
20071         CHECK_ACCESS(e_ptr);
20072         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20073         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20074         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20075         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
20076         return tag_ptr(ret_conv, true);
20077 }
20078
20079 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
20080         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
20081         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
20082         return ret_conv;
20083 }
20084
20085 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
20086         if (!ptr_is_owned(_res)) return;
20087         void* _res_ptr = untag_ptr(_res);
20088         CHECK_ACCESS(_res_ptr);
20089         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
20090         FREE(untag_ptr(_res));
20091         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
20092 }
20093
20094 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
20095         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20096         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
20097         return tag_ptr(ret_conv, true);
20098 }
20099 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
20100         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
20101         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
20102         return ret_conv;
20103 }
20104
20105 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
20106         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
20107         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20108         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
20109         return tag_ptr(ret_conv, true);
20110 }
20111
20112 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
20113         LDKAnnouncementSignatures o_conv;
20114         o_conv.inner = untag_ptr(o);
20115         o_conv.is_owned = ptr_is_owned(o);
20116         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20117         o_conv = AnnouncementSignatures_clone(&o_conv);
20118         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20119         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
20120         return tag_ptr(ret_conv, true);
20121 }
20122
20123 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
20124         void* e_ptr = untag_ptr(e);
20125         CHECK_ACCESS(e_ptr);
20126         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20127         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20128         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20129         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
20130         return tag_ptr(ret_conv, true);
20131 }
20132
20133 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
20134         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
20135         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
20136         return ret_conv;
20137 }
20138
20139 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
20140         if (!ptr_is_owned(_res)) return;
20141         void* _res_ptr = untag_ptr(_res);
20142         CHECK_ACCESS(_res_ptr);
20143         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
20144         FREE(untag_ptr(_res));
20145         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
20146 }
20147
20148 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
20149         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20150         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
20151         return tag_ptr(ret_conv, true);
20152 }
20153 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
20154         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
20155         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
20156         return ret_conv;
20157 }
20158
20159 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
20160         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
20161         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20162         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
20163         return tag_ptr(ret_conv, true);
20164 }
20165
20166 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
20167         LDKChannelReestablish o_conv;
20168         o_conv.inner = untag_ptr(o);
20169         o_conv.is_owned = ptr_is_owned(o);
20170         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20171         o_conv = ChannelReestablish_clone(&o_conv);
20172         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20173         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
20174         return tag_ptr(ret_conv, true);
20175 }
20176
20177 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
20178         void* e_ptr = untag_ptr(e);
20179         CHECK_ACCESS(e_ptr);
20180         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20181         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20182         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20183         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
20184         return tag_ptr(ret_conv, true);
20185 }
20186
20187 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
20188         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
20189         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
20190         return ret_conv;
20191 }
20192
20193 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
20194         if (!ptr_is_owned(_res)) return;
20195         void* _res_ptr = untag_ptr(_res);
20196         CHECK_ACCESS(_res_ptr);
20197         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
20198         FREE(untag_ptr(_res));
20199         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
20200 }
20201
20202 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
20203         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20204         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
20205         return tag_ptr(ret_conv, true);
20206 }
20207 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
20208         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
20209         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
20210         return ret_conv;
20211 }
20212
20213 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
20214         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
20215         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20216         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
20217         return tag_ptr(ret_conv, true);
20218 }
20219
20220 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
20221         LDKClosingSigned o_conv;
20222         o_conv.inner = untag_ptr(o);
20223         o_conv.is_owned = ptr_is_owned(o);
20224         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20225         o_conv = ClosingSigned_clone(&o_conv);
20226         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20227         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
20228         return tag_ptr(ret_conv, true);
20229 }
20230
20231 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
20232         void* e_ptr = untag_ptr(e);
20233         CHECK_ACCESS(e_ptr);
20234         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20235         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20236         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20237         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
20238         return tag_ptr(ret_conv, true);
20239 }
20240
20241 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
20242         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
20243         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
20244         return ret_conv;
20245 }
20246
20247 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
20248         if (!ptr_is_owned(_res)) return;
20249         void* _res_ptr = untag_ptr(_res);
20250         CHECK_ACCESS(_res_ptr);
20251         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
20252         FREE(untag_ptr(_res));
20253         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
20254 }
20255
20256 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
20257         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20258         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
20259         return tag_ptr(ret_conv, true);
20260 }
20261 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
20262         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
20263         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
20264         return ret_conv;
20265 }
20266
20267 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
20268         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
20269         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20270         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
20271         return tag_ptr(ret_conv, true);
20272 }
20273
20274 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
20275         LDKClosingSignedFeeRange o_conv;
20276         o_conv.inner = untag_ptr(o);
20277         o_conv.is_owned = ptr_is_owned(o);
20278         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20279         o_conv = ClosingSignedFeeRange_clone(&o_conv);
20280         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20281         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
20282         return tag_ptr(ret_conv, true);
20283 }
20284
20285 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
20286         void* e_ptr = untag_ptr(e);
20287         CHECK_ACCESS(e_ptr);
20288         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20289         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20290         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20291         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
20292         return tag_ptr(ret_conv, true);
20293 }
20294
20295 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
20296         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
20297         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
20298         return ret_conv;
20299 }
20300
20301 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
20302         if (!ptr_is_owned(_res)) return;
20303         void* _res_ptr = untag_ptr(_res);
20304         CHECK_ACCESS(_res_ptr);
20305         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
20306         FREE(untag_ptr(_res));
20307         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
20308 }
20309
20310 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
20311         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20312         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
20313         return tag_ptr(ret_conv, true);
20314 }
20315 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
20316         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
20317         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
20318         return ret_conv;
20319 }
20320
20321 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
20322         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
20323         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20324         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
20325         return tag_ptr(ret_conv, true);
20326 }
20327
20328 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
20329         LDKCommitmentSigned o_conv;
20330         o_conv.inner = untag_ptr(o);
20331         o_conv.is_owned = ptr_is_owned(o);
20332         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20333         o_conv = CommitmentSigned_clone(&o_conv);
20334         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20335         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
20336         return tag_ptr(ret_conv, true);
20337 }
20338
20339 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
20340         void* e_ptr = untag_ptr(e);
20341         CHECK_ACCESS(e_ptr);
20342         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20343         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20344         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20345         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
20346         return tag_ptr(ret_conv, true);
20347 }
20348
20349 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
20350         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
20351         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
20352         return ret_conv;
20353 }
20354
20355 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
20356         if (!ptr_is_owned(_res)) return;
20357         void* _res_ptr = untag_ptr(_res);
20358         CHECK_ACCESS(_res_ptr);
20359         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
20360         FREE(untag_ptr(_res));
20361         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
20362 }
20363
20364 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
20365         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20366         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
20367         return tag_ptr(ret_conv, true);
20368 }
20369 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
20370         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
20371         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
20372         return ret_conv;
20373 }
20374
20375 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
20376         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
20377         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20378         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
20379         return tag_ptr(ret_conv, true);
20380 }
20381
20382 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
20383         LDKFundingCreated o_conv;
20384         o_conv.inner = untag_ptr(o);
20385         o_conv.is_owned = ptr_is_owned(o);
20386         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20387         o_conv = FundingCreated_clone(&o_conv);
20388         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20389         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
20390         return tag_ptr(ret_conv, true);
20391 }
20392
20393 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
20394         void* e_ptr = untag_ptr(e);
20395         CHECK_ACCESS(e_ptr);
20396         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20397         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20398         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20399         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
20400         return tag_ptr(ret_conv, true);
20401 }
20402
20403 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
20404         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
20405         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
20406         return ret_conv;
20407 }
20408
20409 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
20410         if (!ptr_is_owned(_res)) return;
20411         void* _res_ptr = untag_ptr(_res);
20412         CHECK_ACCESS(_res_ptr);
20413         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
20414         FREE(untag_ptr(_res));
20415         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
20416 }
20417
20418 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
20419         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20420         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
20421         return tag_ptr(ret_conv, true);
20422 }
20423 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
20424         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
20425         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
20426         return ret_conv;
20427 }
20428
20429 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
20430         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
20431         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20432         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
20433         return tag_ptr(ret_conv, true);
20434 }
20435
20436 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
20437         LDKFundingSigned o_conv;
20438         o_conv.inner = untag_ptr(o);
20439         o_conv.is_owned = ptr_is_owned(o);
20440         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20441         o_conv = FundingSigned_clone(&o_conv);
20442         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20443         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
20444         return tag_ptr(ret_conv, true);
20445 }
20446
20447 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
20448         void* e_ptr = untag_ptr(e);
20449         CHECK_ACCESS(e_ptr);
20450         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20451         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20452         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20453         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
20454         return tag_ptr(ret_conv, true);
20455 }
20456
20457 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
20458         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
20459         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
20460         return ret_conv;
20461 }
20462
20463 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
20464         if (!ptr_is_owned(_res)) return;
20465         void* _res_ptr = untag_ptr(_res);
20466         CHECK_ACCESS(_res_ptr);
20467         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
20468         FREE(untag_ptr(_res));
20469         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
20470 }
20471
20472 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
20473         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20474         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
20475         return tag_ptr(ret_conv, true);
20476 }
20477 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
20478         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
20479         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
20480         return ret_conv;
20481 }
20482
20483 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
20484         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
20485         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20486         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
20487         return tag_ptr(ret_conv, true);
20488 }
20489
20490 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
20491         LDKChannelReady o_conv;
20492         o_conv.inner = untag_ptr(o);
20493         o_conv.is_owned = ptr_is_owned(o);
20494         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20495         o_conv = ChannelReady_clone(&o_conv);
20496         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20497         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
20498         return tag_ptr(ret_conv, true);
20499 }
20500
20501 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
20502         void* e_ptr = untag_ptr(e);
20503         CHECK_ACCESS(e_ptr);
20504         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20505         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20506         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20507         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
20508         return tag_ptr(ret_conv, true);
20509 }
20510
20511 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
20512         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
20513         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
20514         return ret_conv;
20515 }
20516
20517 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
20518         if (!ptr_is_owned(_res)) return;
20519         void* _res_ptr = untag_ptr(_res);
20520         CHECK_ACCESS(_res_ptr);
20521         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
20522         FREE(untag_ptr(_res));
20523         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
20524 }
20525
20526 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
20527         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20528         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
20529         return tag_ptr(ret_conv, true);
20530 }
20531 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
20532         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
20533         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
20534         return ret_conv;
20535 }
20536
20537 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
20538         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
20539         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20540         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
20541         return tag_ptr(ret_conv, true);
20542 }
20543
20544 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
20545         LDKInit o_conv;
20546         o_conv.inner = untag_ptr(o);
20547         o_conv.is_owned = ptr_is_owned(o);
20548         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20549         o_conv = Init_clone(&o_conv);
20550         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20551         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
20552         return tag_ptr(ret_conv, true);
20553 }
20554
20555 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
20556         void* e_ptr = untag_ptr(e);
20557         CHECK_ACCESS(e_ptr);
20558         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20559         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20560         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20561         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
20562         return tag_ptr(ret_conv, true);
20563 }
20564
20565 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
20566         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
20567         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
20568         return ret_conv;
20569 }
20570
20571 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
20572         if (!ptr_is_owned(_res)) return;
20573         void* _res_ptr = untag_ptr(_res);
20574         CHECK_ACCESS(_res_ptr);
20575         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
20576         FREE(untag_ptr(_res));
20577         CResult_InitDecodeErrorZ_free(_res_conv);
20578 }
20579
20580 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
20581         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20582         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
20583         return tag_ptr(ret_conv, true);
20584 }
20585 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
20586         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
20587         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
20588         return ret_conv;
20589 }
20590
20591 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
20592         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
20593         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20594         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
20595         return tag_ptr(ret_conv, true);
20596 }
20597
20598 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
20599         LDKOpenChannel o_conv;
20600         o_conv.inner = untag_ptr(o);
20601         o_conv.is_owned = ptr_is_owned(o);
20602         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20603         o_conv = OpenChannel_clone(&o_conv);
20604         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20605         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
20606         return tag_ptr(ret_conv, true);
20607 }
20608
20609 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
20610         void* e_ptr = untag_ptr(e);
20611         CHECK_ACCESS(e_ptr);
20612         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20613         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20614         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20615         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
20616         return tag_ptr(ret_conv, true);
20617 }
20618
20619 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
20620         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
20621         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
20622         return ret_conv;
20623 }
20624
20625 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
20626         if (!ptr_is_owned(_res)) return;
20627         void* _res_ptr = untag_ptr(_res);
20628         CHECK_ACCESS(_res_ptr);
20629         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
20630         FREE(untag_ptr(_res));
20631         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
20632 }
20633
20634 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
20635         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20636         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
20637         return tag_ptr(ret_conv, true);
20638 }
20639 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
20640         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
20641         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
20642         return ret_conv;
20643 }
20644
20645 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
20646         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
20647         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20648         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
20649         return tag_ptr(ret_conv, true);
20650 }
20651
20652 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
20653         LDKRevokeAndACK o_conv;
20654         o_conv.inner = untag_ptr(o);
20655         o_conv.is_owned = ptr_is_owned(o);
20656         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20657         o_conv = RevokeAndACK_clone(&o_conv);
20658         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20659         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
20660         return tag_ptr(ret_conv, true);
20661 }
20662
20663 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
20664         void* e_ptr = untag_ptr(e);
20665         CHECK_ACCESS(e_ptr);
20666         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20667         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20668         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20669         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
20670         return tag_ptr(ret_conv, true);
20671 }
20672
20673 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
20674         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
20675         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
20676         return ret_conv;
20677 }
20678
20679 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
20680         if (!ptr_is_owned(_res)) return;
20681         void* _res_ptr = untag_ptr(_res);
20682         CHECK_ACCESS(_res_ptr);
20683         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
20684         FREE(untag_ptr(_res));
20685         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
20686 }
20687
20688 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
20689         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20690         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
20691         return tag_ptr(ret_conv, true);
20692 }
20693 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
20694         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
20695         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
20696         return ret_conv;
20697 }
20698
20699 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
20700         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
20701         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20702         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
20703         return tag_ptr(ret_conv, true);
20704 }
20705
20706 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
20707         LDKShutdown o_conv;
20708         o_conv.inner = untag_ptr(o);
20709         o_conv.is_owned = ptr_is_owned(o);
20710         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20711         o_conv = Shutdown_clone(&o_conv);
20712         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20713         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
20714         return tag_ptr(ret_conv, true);
20715 }
20716
20717 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
20718         void* e_ptr = untag_ptr(e);
20719         CHECK_ACCESS(e_ptr);
20720         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20721         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20722         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20723         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
20724         return tag_ptr(ret_conv, true);
20725 }
20726
20727 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
20728         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
20729         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
20730         return ret_conv;
20731 }
20732
20733 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
20734         if (!ptr_is_owned(_res)) return;
20735         void* _res_ptr = untag_ptr(_res);
20736         CHECK_ACCESS(_res_ptr);
20737         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
20738         FREE(untag_ptr(_res));
20739         CResult_ShutdownDecodeErrorZ_free(_res_conv);
20740 }
20741
20742 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
20743         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20744         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
20745         return tag_ptr(ret_conv, true);
20746 }
20747 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
20748         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
20749         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
20750         return ret_conv;
20751 }
20752
20753 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
20754         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
20755         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20756         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
20757         return tag_ptr(ret_conv, true);
20758 }
20759
20760 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
20761         LDKUpdateFailHTLC o_conv;
20762         o_conv.inner = untag_ptr(o);
20763         o_conv.is_owned = ptr_is_owned(o);
20764         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20765         o_conv = UpdateFailHTLC_clone(&o_conv);
20766         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20767         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
20768         return tag_ptr(ret_conv, true);
20769 }
20770
20771 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
20772         void* e_ptr = untag_ptr(e);
20773         CHECK_ACCESS(e_ptr);
20774         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20775         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20776         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20777         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
20778         return tag_ptr(ret_conv, true);
20779 }
20780
20781 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
20782         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
20783         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
20784         return ret_conv;
20785 }
20786
20787 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
20788         if (!ptr_is_owned(_res)) return;
20789         void* _res_ptr = untag_ptr(_res);
20790         CHECK_ACCESS(_res_ptr);
20791         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
20792         FREE(untag_ptr(_res));
20793         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
20794 }
20795
20796 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
20797         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20798         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
20799         return tag_ptr(ret_conv, true);
20800 }
20801 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20802         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
20803         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
20804         return ret_conv;
20805 }
20806
20807 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
20808         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
20809         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20810         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
20811         return tag_ptr(ret_conv, true);
20812 }
20813
20814 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
20815         LDKUpdateFailMalformedHTLC o_conv;
20816         o_conv.inner = untag_ptr(o);
20817         o_conv.is_owned = ptr_is_owned(o);
20818         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20819         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
20820         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20821         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
20822         return tag_ptr(ret_conv, true);
20823 }
20824
20825 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
20826         void* e_ptr = untag_ptr(e);
20827         CHECK_ACCESS(e_ptr);
20828         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20829         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20830         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20831         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
20832         return tag_ptr(ret_conv, true);
20833 }
20834
20835 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
20836         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
20837         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
20838         return ret_conv;
20839 }
20840
20841 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
20842         if (!ptr_is_owned(_res)) return;
20843         void* _res_ptr = untag_ptr(_res);
20844         CHECK_ACCESS(_res_ptr);
20845         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
20846         FREE(untag_ptr(_res));
20847         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
20848 }
20849
20850 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
20851         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20852         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
20853         return tag_ptr(ret_conv, true);
20854 }
20855 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20856         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
20857         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
20858         return ret_conv;
20859 }
20860
20861 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
20862         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
20863         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20864         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
20865         return tag_ptr(ret_conv, true);
20866 }
20867
20868 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
20869         LDKUpdateFee o_conv;
20870         o_conv.inner = untag_ptr(o);
20871         o_conv.is_owned = ptr_is_owned(o);
20872         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20873         o_conv = UpdateFee_clone(&o_conv);
20874         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20875         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
20876         return tag_ptr(ret_conv, true);
20877 }
20878
20879 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
20880         void* e_ptr = untag_ptr(e);
20881         CHECK_ACCESS(e_ptr);
20882         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20883         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20884         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20885         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
20886         return tag_ptr(ret_conv, true);
20887 }
20888
20889 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
20890         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
20891         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
20892         return ret_conv;
20893 }
20894
20895 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
20896         if (!ptr_is_owned(_res)) return;
20897         void* _res_ptr = untag_ptr(_res);
20898         CHECK_ACCESS(_res_ptr);
20899         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
20900         FREE(untag_ptr(_res));
20901         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
20902 }
20903
20904 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
20905         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20906         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
20907         return tag_ptr(ret_conv, true);
20908 }
20909 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
20910         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
20911         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
20912         return ret_conv;
20913 }
20914
20915 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
20916         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
20917         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20918         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
20919         return tag_ptr(ret_conv, true);
20920 }
20921
20922 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
20923         LDKUpdateFulfillHTLC o_conv;
20924         o_conv.inner = untag_ptr(o);
20925         o_conv.is_owned = ptr_is_owned(o);
20926         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20927         o_conv = UpdateFulfillHTLC_clone(&o_conv);
20928         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20929         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
20930         return tag_ptr(ret_conv, true);
20931 }
20932
20933 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
20934         void* e_ptr = untag_ptr(e);
20935         CHECK_ACCESS(e_ptr);
20936         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20937         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20938         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20939         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
20940         return tag_ptr(ret_conv, true);
20941 }
20942
20943 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
20944         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
20945         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
20946         return ret_conv;
20947 }
20948
20949 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
20950         if (!ptr_is_owned(_res)) return;
20951         void* _res_ptr = untag_ptr(_res);
20952         CHECK_ACCESS(_res_ptr);
20953         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
20954         FREE(untag_ptr(_res));
20955         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
20956 }
20957
20958 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
20959         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20960         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
20961         return tag_ptr(ret_conv, true);
20962 }
20963 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20964         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
20965         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
20966         return ret_conv;
20967 }
20968
20969 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
20970         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
20971         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20972         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
20973         return tag_ptr(ret_conv, true);
20974 }
20975
20976 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
20977         LDKUpdateAddHTLC o_conv;
20978         o_conv.inner = untag_ptr(o);
20979         o_conv.is_owned = ptr_is_owned(o);
20980         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20981         o_conv = UpdateAddHTLC_clone(&o_conv);
20982         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20983         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
20984         return tag_ptr(ret_conv, true);
20985 }
20986
20987 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
20988         void* e_ptr = untag_ptr(e);
20989         CHECK_ACCESS(e_ptr);
20990         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20991         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20992         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20993         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
20994         return tag_ptr(ret_conv, true);
20995 }
20996
20997 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
20998         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
20999         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
21000         return ret_conv;
21001 }
21002
21003 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
21004         if (!ptr_is_owned(_res)) return;
21005         void* _res_ptr = untag_ptr(_res);
21006         CHECK_ACCESS(_res_ptr);
21007         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
21008         FREE(untag_ptr(_res));
21009         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
21010 }
21011
21012 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
21013         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21014         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
21015         return tag_ptr(ret_conv, true);
21016 }
21017 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
21018         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
21019         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
21020         return ret_conv;
21021 }
21022
21023 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
21024         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
21025         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21026         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
21027         return tag_ptr(ret_conv, true);
21028 }
21029
21030 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
21031         LDKOnionMessage o_conv;
21032         o_conv.inner = untag_ptr(o);
21033         o_conv.is_owned = ptr_is_owned(o);
21034         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21035         o_conv = OnionMessage_clone(&o_conv);
21036         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
21037         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
21038         return tag_ptr(ret_conv, true);
21039 }
21040
21041 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
21042         void* e_ptr = untag_ptr(e);
21043         CHECK_ACCESS(e_ptr);
21044         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21045         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21046         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
21047         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
21048         return tag_ptr(ret_conv, true);
21049 }
21050
21051 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
21052         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
21053         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
21054         return ret_conv;
21055 }
21056
21057 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
21058         if (!ptr_is_owned(_res)) return;
21059         void* _res_ptr = untag_ptr(_res);
21060         CHECK_ACCESS(_res_ptr);
21061         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
21062         FREE(untag_ptr(_res));
21063         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
21064 }
21065
21066 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
21067         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
21068         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
21069         return tag_ptr(ret_conv, true);
21070 }
21071 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
21072         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
21073         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
21074         return ret_conv;
21075 }
21076
21077 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
21078         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
21079         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
21080         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
21081         return tag_ptr(ret_conv, true);
21082 }
21083
21084 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
21085         LDKPing o_conv;
21086         o_conv.inner = untag_ptr(o);
21087         o_conv.is_owned = ptr_is_owned(o);
21088         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21089         o_conv = Ping_clone(&o_conv);
21090         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21091         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
21092         return tag_ptr(ret_conv, true);
21093 }
21094
21095 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
21096         void* e_ptr = untag_ptr(e);
21097         CHECK_ACCESS(e_ptr);
21098         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21099         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21100         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21101         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
21102         return tag_ptr(ret_conv, true);
21103 }
21104
21105 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
21106         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
21107         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
21108         return ret_conv;
21109 }
21110
21111 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
21112         if (!ptr_is_owned(_res)) return;
21113         void* _res_ptr = untag_ptr(_res);
21114         CHECK_ACCESS(_res_ptr);
21115         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
21116         FREE(untag_ptr(_res));
21117         CResult_PingDecodeErrorZ_free(_res_conv);
21118 }
21119
21120 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
21121         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21122         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
21123         return tag_ptr(ret_conv, true);
21124 }
21125 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
21126         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
21127         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
21128         return ret_conv;
21129 }
21130
21131 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
21132         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
21133         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21134         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
21135         return tag_ptr(ret_conv, true);
21136 }
21137
21138 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
21139         LDKPong o_conv;
21140         o_conv.inner = untag_ptr(o);
21141         o_conv.is_owned = ptr_is_owned(o);
21142         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21143         o_conv = Pong_clone(&o_conv);
21144         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21145         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
21146         return tag_ptr(ret_conv, true);
21147 }
21148
21149 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
21150         void* e_ptr = untag_ptr(e);
21151         CHECK_ACCESS(e_ptr);
21152         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21153         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21154         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21155         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
21156         return tag_ptr(ret_conv, true);
21157 }
21158
21159 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
21160         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
21161         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
21162         return ret_conv;
21163 }
21164
21165 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
21166         if (!ptr_is_owned(_res)) return;
21167         void* _res_ptr = untag_ptr(_res);
21168         CHECK_ACCESS(_res_ptr);
21169         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
21170         FREE(untag_ptr(_res));
21171         CResult_PongDecodeErrorZ_free(_res_conv);
21172 }
21173
21174 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
21175         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21176         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
21177         return tag_ptr(ret_conv, true);
21178 }
21179 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
21180         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
21181         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
21182         return ret_conv;
21183 }
21184
21185 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
21186         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
21187         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21188         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
21189         return tag_ptr(ret_conv, true);
21190 }
21191
21192 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
21193         LDKUnsignedChannelAnnouncement o_conv;
21194         o_conv.inner = untag_ptr(o);
21195         o_conv.is_owned = ptr_is_owned(o);
21196         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21197         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
21198         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21199         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
21200         return tag_ptr(ret_conv, true);
21201 }
21202
21203 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
21204         void* e_ptr = untag_ptr(e);
21205         CHECK_ACCESS(e_ptr);
21206         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21207         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21208         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21209         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
21210         return tag_ptr(ret_conv, true);
21211 }
21212
21213 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21214         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
21215         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
21216         return ret_conv;
21217 }
21218
21219 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
21220         if (!ptr_is_owned(_res)) return;
21221         void* _res_ptr = untag_ptr(_res);
21222         CHECK_ACCESS(_res_ptr);
21223         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
21224         FREE(untag_ptr(_res));
21225         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
21226 }
21227
21228 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21229         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21230         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
21231         return tag_ptr(ret_conv, true);
21232 }
21233 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21234         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
21235         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21236         return ret_conv;
21237 }
21238
21239 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21240         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
21241         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21242         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
21243         return tag_ptr(ret_conv, true);
21244 }
21245
21246 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
21247         LDKChannelAnnouncement o_conv;
21248         o_conv.inner = untag_ptr(o);
21249         o_conv.is_owned = ptr_is_owned(o);
21250         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21251         o_conv = ChannelAnnouncement_clone(&o_conv);
21252         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21253         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
21254         return tag_ptr(ret_conv, true);
21255 }
21256
21257 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
21258         void* e_ptr = untag_ptr(e);
21259         CHECK_ACCESS(e_ptr);
21260         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21261         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21262         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21263         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
21264         return tag_ptr(ret_conv, true);
21265 }
21266
21267 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21268         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
21269         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
21270         return ret_conv;
21271 }
21272
21273 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
21274         if (!ptr_is_owned(_res)) return;
21275         void* _res_ptr = untag_ptr(_res);
21276         CHECK_ACCESS(_res_ptr);
21277         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
21278         FREE(untag_ptr(_res));
21279         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
21280 }
21281
21282 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21283         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21284         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
21285         return tag_ptr(ret_conv, true);
21286 }
21287 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21288         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
21289         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21290         return ret_conv;
21291 }
21292
21293 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21294         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
21295         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21296         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
21297         return tag_ptr(ret_conv, true);
21298 }
21299
21300 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
21301         LDKUnsignedChannelUpdate o_conv;
21302         o_conv.inner = untag_ptr(o);
21303         o_conv.is_owned = ptr_is_owned(o);
21304         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21305         o_conv = UnsignedChannelUpdate_clone(&o_conv);
21306         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21307         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
21308         return tag_ptr(ret_conv, true);
21309 }
21310
21311 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
21312         void* e_ptr = untag_ptr(e);
21313         CHECK_ACCESS(e_ptr);
21314         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21315         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21316         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21317         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
21318         return tag_ptr(ret_conv, true);
21319 }
21320
21321 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
21322         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
21323         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
21324         return ret_conv;
21325 }
21326
21327 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
21328         if (!ptr_is_owned(_res)) return;
21329         void* _res_ptr = untag_ptr(_res);
21330         CHECK_ACCESS(_res_ptr);
21331         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
21332         FREE(untag_ptr(_res));
21333         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
21334 }
21335
21336 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
21337         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21338         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
21339         return tag_ptr(ret_conv, true);
21340 }
21341 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21342         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
21343         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
21344         return ret_conv;
21345 }
21346
21347 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
21348         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
21349         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21350         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
21351         return tag_ptr(ret_conv, true);
21352 }
21353
21354 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
21355         LDKChannelUpdate o_conv;
21356         o_conv.inner = untag_ptr(o);
21357         o_conv.is_owned = ptr_is_owned(o);
21358         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21359         o_conv = ChannelUpdate_clone(&o_conv);
21360         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21361         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
21362         return tag_ptr(ret_conv, true);
21363 }
21364
21365 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
21366         void* e_ptr = untag_ptr(e);
21367         CHECK_ACCESS(e_ptr);
21368         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21369         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21370         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21371         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
21372         return tag_ptr(ret_conv, true);
21373 }
21374
21375 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
21376         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
21377         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
21378         return ret_conv;
21379 }
21380
21381 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
21382         if (!ptr_is_owned(_res)) return;
21383         void* _res_ptr = untag_ptr(_res);
21384         CHECK_ACCESS(_res_ptr);
21385         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
21386         FREE(untag_ptr(_res));
21387         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
21388 }
21389
21390 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
21391         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21392         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
21393         return tag_ptr(ret_conv, true);
21394 }
21395 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21396         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
21397         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
21398         return ret_conv;
21399 }
21400
21401 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
21402         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
21403         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21404         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
21405         return tag_ptr(ret_conv, true);
21406 }
21407
21408 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
21409         LDKErrorMessage o_conv;
21410         o_conv.inner = untag_ptr(o);
21411         o_conv.is_owned = ptr_is_owned(o);
21412         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21413         o_conv = ErrorMessage_clone(&o_conv);
21414         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21415         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
21416         return tag_ptr(ret_conv, true);
21417 }
21418
21419 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
21420         void* e_ptr = untag_ptr(e);
21421         CHECK_ACCESS(e_ptr);
21422         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21423         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21424         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21425         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
21426         return tag_ptr(ret_conv, true);
21427 }
21428
21429 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
21430         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
21431         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
21432         return ret_conv;
21433 }
21434
21435 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
21436         if (!ptr_is_owned(_res)) return;
21437         void* _res_ptr = untag_ptr(_res);
21438         CHECK_ACCESS(_res_ptr);
21439         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
21440         FREE(untag_ptr(_res));
21441         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
21442 }
21443
21444 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
21445         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21446         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
21447         return tag_ptr(ret_conv, true);
21448 }
21449 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
21450         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
21451         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
21452         return ret_conv;
21453 }
21454
21455 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
21456         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
21457         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21458         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
21459         return tag_ptr(ret_conv, true);
21460 }
21461
21462 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
21463         LDKWarningMessage o_conv;
21464         o_conv.inner = untag_ptr(o);
21465         o_conv.is_owned = ptr_is_owned(o);
21466         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21467         o_conv = WarningMessage_clone(&o_conv);
21468         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21469         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
21470         return tag_ptr(ret_conv, true);
21471 }
21472
21473 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
21474         void* e_ptr = untag_ptr(e);
21475         CHECK_ACCESS(e_ptr);
21476         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21477         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21478         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21479         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
21480         return tag_ptr(ret_conv, true);
21481 }
21482
21483 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
21484         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
21485         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
21486         return ret_conv;
21487 }
21488
21489 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
21490         if (!ptr_is_owned(_res)) return;
21491         void* _res_ptr = untag_ptr(_res);
21492         CHECK_ACCESS(_res_ptr);
21493         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
21494         FREE(untag_ptr(_res));
21495         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
21496 }
21497
21498 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
21499         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21500         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
21501         return tag_ptr(ret_conv, true);
21502 }
21503 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
21504         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
21505         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
21506         return ret_conv;
21507 }
21508
21509 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
21510         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
21511         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
21512         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
21513         return tag_ptr(ret_conv, true);
21514 }
21515
21516 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
21517         LDKUnsignedNodeAnnouncement o_conv;
21518         o_conv.inner = untag_ptr(o);
21519         o_conv.is_owned = ptr_is_owned(o);
21520         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21521         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
21522         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21523         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
21524         return tag_ptr(ret_conv, true);
21525 }
21526
21527 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
21528         void* e_ptr = untag_ptr(e);
21529         CHECK_ACCESS(e_ptr);
21530         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21531         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21532         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21533         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
21534         return tag_ptr(ret_conv, true);
21535 }
21536
21537 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21538         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
21539         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
21540         return ret_conv;
21541 }
21542
21543 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
21544         if (!ptr_is_owned(_res)) return;
21545         void* _res_ptr = untag_ptr(_res);
21546         CHECK_ACCESS(_res_ptr);
21547         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
21548         FREE(untag_ptr(_res));
21549         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
21550 }
21551
21552 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21553         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21554         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
21555         return tag_ptr(ret_conv, true);
21556 }
21557 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21558         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
21559         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21560         return ret_conv;
21561 }
21562
21563 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21564         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
21565         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21566         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
21567         return tag_ptr(ret_conv, true);
21568 }
21569
21570 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
21571         LDKNodeAnnouncement o_conv;
21572         o_conv.inner = untag_ptr(o);
21573         o_conv.is_owned = ptr_is_owned(o);
21574         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21575         o_conv = NodeAnnouncement_clone(&o_conv);
21576         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21577         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
21578         return tag_ptr(ret_conv, true);
21579 }
21580
21581 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
21582         void* e_ptr = untag_ptr(e);
21583         CHECK_ACCESS(e_ptr);
21584         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21585         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21586         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21587         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
21588         return tag_ptr(ret_conv, true);
21589 }
21590
21591 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21592         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
21593         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
21594         return ret_conv;
21595 }
21596
21597 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
21598         if (!ptr_is_owned(_res)) return;
21599         void* _res_ptr = untag_ptr(_res);
21600         CHECK_ACCESS(_res_ptr);
21601         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
21602         FREE(untag_ptr(_res));
21603         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
21604 }
21605
21606 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21607         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21608         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
21609         return tag_ptr(ret_conv, true);
21610 }
21611 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21612         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
21613         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21614         return ret_conv;
21615 }
21616
21617 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21618         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
21619         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21620         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
21621         return tag_ptr(ret_conv, true);
21622 }
21623
21624 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
21625         LDKQueryShortChannelIds o_conv;
21626         o_conv.inner = untag_ptr(o);
21627         o_conv.is_owned = ptr_is_owned(o);
21628         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21629         o_conv = QueryShortChannelIds_clone(&o_conv);
21630         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21631         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
21632         return tag_ptr(ret_conv, true);
21633 }
21634
21635 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
21636         void* e_ptr = untag_ptr(e);
21637         CHECK_ACCESS(e_ptr);
21638         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21639         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21640         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21641         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
21642         return tag_ptr(ret_conv, true);
21643 }
21644
21645 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
21646         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
21647         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
21648         return ret_conv;
21649 }
21650
21651 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
21652         if (!ptr_is_owned(_res)) return;
21653         void* _res_ptr = untag_ptr(_res);
21654         CHECK_ACCESS(_res_ptr);
21655         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
21656         FREE(untag_ptr(_res));
21657         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
21658 }
21659
21660 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
21661         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21662         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
21663         return tag_ptr(ret_conv, true);
21664 }
21665 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
21666         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
21667         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
21668         return ret_conv;
21669 }
21670
21671 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
21672         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
21673         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21674         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
21675         return tag_ptr(ret_conv, true);
21676 }
21677
21678 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
21679         LDKReplyShortChannelIdsEnd o_conv;
21680         o_conv.inner = untag_ptr(o);
21681         o_conv.is_owned = ptr_is_owned(o);
21682         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21683         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
21684         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21685         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
21686         return tag_ptr(ret_conv, true);
21687 }
21688
21689 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
21690         void* e_ptr = untag_ptr(e);
21691         CHECK_ACCESS(e_ptr);
21692         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21693         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21694         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21695         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
21696         return tag_ptr(ret_conv, true);
21697 }
21698
21699 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
21700         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
21701         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
21702         return ret_conv;
21703 }
21704
21705 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
21706         if (!ptr_is_owned(_res)) return;
21707         void* _res_ptr = untag_ptr(_res);
21708         CHECK_ACCESS(_res_ptr);
21709         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
21710         FREE(untag_ptr(_res));
21711         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
21712 }
21713
21714 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
21715         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21716         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
21717         return tag_ptr(ret_conv, true);
21718 }
21719 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
21720         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
21721         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
21722         return ret_conv;
21723 }
21724
21725 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
21726         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
21727         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21728         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
21729         return tag_ptr(ret_conv, true);
21730 }
21731
21732 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
21733         LDKQueryChannelRange o_conv;
21734         o_conv.inner = untag_ptr(o);
21735         o_conv.is_owned = ptr_is_owned(o);
21736         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21737         o_conv = QueryChannelRange_clone(&o_conv);
21738         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21739         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
21740         return tag_ptr(ret_conv, true);
21741 }
21742
21743 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
21744         void* e_ptr = untag_ptr(e);
21745         CHECK_ACCESS(e_ptr);
21746         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21747         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21748         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21749         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
21750         return tag_ptr(ret_conv, true);
21751 }
21752
21753 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
21754         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
21755         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
21756         return ret_conv;
21757 }
21758
21759 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
21760         if (!ptr_is_owned(_res)) return;
21761         void* _res_ptr = untag_ptr(_res);
21762         CHECK_ACCESS(_res_ptr);
21763         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
21764         FREE(untag_ptr(_res));
21765         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
21766 }
21767
21768 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
21769         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21770         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
21771         return tag_ptr(ret_conv, true);
21772 }
21773 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
21774         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
21775         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
21776         return ret_conv;
21777 }
21778
21779 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
21780         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
21781         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21782         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
21783         return tag_ptr(ret_conv, true);
21784 }
21785
21786 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
21787         LDKReplyChannelRange o_conv;
21788         o_conv.inner = untag_ptr(o);
21789         o_conv.is_owned = ptr_is_owned(o);
21790         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21791         o_conv = ReplyChannelRange_clone(&o_conv);
21792         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21793         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
21794         return tag_ptr(ret_conv, true);
21795 }
21796
21797 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
21798         void* e_ptr = untag_ptr(e);
21799         CHECK_ACCESS(e_ptr);
21800         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21801         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21802         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21803         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
21804         return tag_ptr(ret_conv, true);
21805 }
21806
21807 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
21808         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
21809         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
21810         return ret_conv;
21811 }
21812
21813 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
21814         if (!ptr_is_owned(_res)) return;
21815         void* _res_ptr = untag_ptr(_res);
21816         CHECK_ACCESS(_res_ptr);
21817         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
21818         FREE(untag_ptr(_res));
21819         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
21820 }
21821
21822 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
21823         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21824         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
21825         return tag_ptr(ret_conv, true);
21826 }
21827 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
21828         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
21829         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
21830         return ret_conv;
21831 }
21832
21833 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
21834         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
21835         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21836         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
21837         return tag_ptr(ret_conv, true);
21838 }
21839
21840 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
21841         LDKGossipTimestampFilter o_conv;
21842         o_conv.inner = untag_ptr(o);
21843         o_conv.is_owned = ptr_is_owned(o);
21844         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21845         o_conv = GossipTimestampFilter_clone(&o_conv);
21846         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21847         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
21848         return tag_ptr(ret_conv, true);
21849 }
21850
21851 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
21852         void* e_ptr = untag_ptr(e);
21853         CHECK_ACCESS(e_ptr);
21854         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21855         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21856         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21857         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
21858         return tag_ptr(ret_conv, true);
21859 }
21860
21861 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
21862         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
21863         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
21864         return ret_conv;
21865 }
21866
21867 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
21868         if (!ptr_is_owned(_res)) return;
21869         void* _res_ptr = untag_ptr(_res);
21870         CHECK_ACCESS(_res_ptr);
21871         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
21872         FREE(untag_ptr(_res));
21873         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
21874 }
21875
21876 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
21877         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21878         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
21879         return tag_ptr(ret_conv, true);
21880 }
21881 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
21882         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
21883         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
21884         return ret_conv;
21885 }
21886
21887 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
21888         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
21889         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21890         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
21891         return tag_ptr(ret_conv, true);
21892 }
21893
21894 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
21895         void* o_ptr = untag_ptr(o);
21896         CHECK_ACCESS(o_ptr);
21897         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
21898         if (o_conv.free == LDKFilter_JCalls_free) {
21899                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21900                 LDKFilter_JCalls_cloned(&o_conv);
21901         }
21902         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
21903         *ret_copy = COption_FilterZ_some(o_conv);
21904         uint64_t ret_ref = tag_ptr(ret_copy, true);
21905         return ret_ref;
21906 }
21907
21908 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
21909         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
21910         *ret_copy = COption_FilterZ_none();
21911         uint64_t ret_ref = tag_ptr(ret_copy, true);
21912         return ret_ref;
21913 }
21914
21915 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
21916         if (!ptr_is_owned(_res)) return;
21917         void* _res_ptr = untag_ptr(_res);
21918         CHECK_ACCESS(_res_ptr);
21919         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
21920         FREE(untag_ptr(_res));
21921         COption_FilterZ_free(_res_conv);
21922 }
21923
21924 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
21925         LDKLockedChannelMonitor o_conv;
21926         o_conv.inner = untag_ptr(o);
21927         o_conv.is_owned = ptr_is_owned(o);
21928         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21929         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
21930         
21931         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21932         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
21933         return tag_ptr(ret_conv, true);
21934 }
21935
21936 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
21937         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21938         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
21939         return tag_ptr(ret_conv, true);
21940 }
21941
21942 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
21943         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
21944         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
21945         return ret_conv;
21946 }
21947
21948 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
21949         if (!ptr_is_owned(_res)) return;
21950         void* _res_ptr = untag_ptr(_res);
21951         CHECK_ACCESS(_res_ptr);
21952         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
21953         FREE(untag_ptr(_res));
21954         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
21955 }
21956
21957 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
21958         LDKCVec_OutPointZ _res_constr;
21959         _res_constr.datalen = _res->arr_len;
21960         if (_res_constr.datalen > 0)
21961                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
21962         else
21963                 _res_constr.data = NULL;
21964         uint64_t* _res_vals = _res->elems;
21965         for (size_t k = 0; k < _res_constr.datalen; k++) {
21966                 uint64_t _res_conv_10 = _res_vals[k];
21967                 LDKOutPoint _res_conv_10_conv;
21968                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
21969                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
21970                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
21971                 _res_constr.data[k] = _res_conv_10_conv;
21972         }
21973         FREE(_res);
21974         CVec_OutPointZ_free(_res_constr);
21975 }
21976
21977 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
21978         LDKCVec_MonitorUpdateIdZ _res_constr;
21979         _res_constr.datalen = _res->arr_len;
21980         if (_res_constr.datalen > 0)
21981                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
21982         else
21983                 _res_constr.data = NULL;
21984         uint64_t* _res_vals = _res->elems;
21985         for (size_t r = 0; r < _res_constr.datalen; r++) {
21986                 uint64_t _res_conv_17 = _res_vals[r];
21987                 LDKMonitorUpdateId _res_conv_17_conv;
21988                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
21989                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
21990                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
21991                 _res_constr.data[r] = _res_conv_17_conv;
21992         }
21993         FREE(_res);
21994         CVec_MonitorUpdateIdZ_free(_res_constr);
21995 }
21996
21997 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
21998         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
21999         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
22000         return tag_ptr(ret_conv, true);
22001 }
22002 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
22003         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
22004         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
22005         return ret_conv;
22006 }
22007
22008 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
22009         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
22010         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
22011         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
22012         return tag_ptr(ret_conv, true);
22013 }
22014
22015 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
22016         LDKOutPoint a_conv;
22017         a_conv.inner = untag_ptr(a);
22018         a_conv.is_owned = ptr_is_owned(a);
22019         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22020         a_conv = OutPoint_clone(&a_conv);
22021         LDKCVec_MonitorUpdateIdZ b_constr;
22022         b_constr.datalen = b->arr_len;
22023         if (b_constr.datalen > 0)
22024                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
22025         else
22026                 b_constr.data = NULL;
22027         uint64_t* b_vals = b->elems;
22028         for (size_t r = 0; r < b_constr.datalen; r++) {
22029                 uint64_t b_conv_17 = b_vals[r];
22030                 LDKMonitorUpdateId b_conv_17_conv;
22031                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
22032                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
22033                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
22034                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
22035                 b_constr.data[r] = b_conv_17_conv;
22036         }
22037         FREE(b);
22038         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
22039         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
22040         return tag_ptr(ret_conv, true);
22041 }
22042
22043 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
22044         if (!ptr_is_owned(_res)) return;
22045         void* _res_ptr = untag_ptr(_res);
22046         CHECK_ACCESS(_res_ptr);
22047         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
22048         FREE(untag_ptr(_res));
22049         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
22050 }
22051
22052 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
22053         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
22054         _res_constr.datalen = _res->arr_len;
22055         if (_res_constr.datalen > 0)
22056                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
22057         else
22058                 _res_constr.data = NULL;
22059         uint64_t* _res_vals = _res->elems;
22060         for (size_t p = 0; p < _res_constr.datalen; p++) {
22061                 uint64_t _res_conv_41 = _res_vals[p];
22062                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
22063                 CHECK_ACCESS(_res_conv_41_ptr);
22064                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
22065                 FREE(untag_ptr(_res_conv_41));
22066                 _res_constr.data[p] = _res_conv_41_conv;
22067         }
22068         FREE(_res);
22069         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
22070 }
22071
22072 void  __attribute__((export_name("TS_CVec_PhantomRouteHintsZ_free"))) TS_CVec_PhantomRouteHintsZ_free(uint64_tArray _res) {
22073         LDKCVec_PhantomRouteHintsZ _res_constr;
22074         _res_constr.datalen = _res->arr_len;
22075         if (_res_constr.datalen > 0)
22076                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
22077         else
22078                 _res_constr.data = NULL;
22079         uint64_t* _res_vals = _res->elems;
22080         for (size_t t = 0; t < _res_constr.datalen; t++) {
22081                 uint64_t _res_conv_19 = _res_vals[t];
22082                 LDKPhantomRouteHints _res_conv_19_conv;
22083                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
22084                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
22085                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
22086                 _res_constr.data[t] = _res_conv_19_conv;
22087         }
22088         FREE(_res);
22089         CVec_PhantomRouteHintsZ_free(_res_constr);
22090 }
22091
22092 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
22093         LDKInvoice o_conv;
22094         o_conv.inner = untag_ptr(o);
22095         o_conv.is_owned = ptr_is_owned(o);
22096         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22097         o_conv = Invoice_clone(&o_conv);
22098         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22099         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
22100         return tag_ptr(ret_conv, true);
22101 }
22102
22103 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint64_t e) {
22104         void* e_ptr = untag_ptr(e);
22105         CHECK_ACCESS(e_ptr);
22106         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
22107         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
22108         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22109         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
22110         return tag_ptr(ret_conv, true);
22111 }
22112
22113 jboolean  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
22114         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
22115         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
22116         return ret_conv;
22117 }
22118
22119 void  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
22120         if (!ptr_is_owned(_res)) return;
22121         void* _res_ptr = untag_ptr(_res);
22122         CHECK_ACCESS(_res_ptr);
22123         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
22124         FREE(untag_ptr(_res));
22125         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
22126 }
22127
22128 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
22129         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22130         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
22131         return tag_ptr(ret_conv, true);
22132 }
22133 int64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
22134         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
22135         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
22136         return ret_conv;
22137 }
22138
22139 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
22140         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
22141         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22142         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
22143         return tag_ptr(ret_conv, true);
22144 }
22145
22146 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) {
22147         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
22148         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
22149         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
22150         return tag_ptr(ret_conv, true);
22151 }
22152
22153 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint64_t e) {
22154         void* e_ptr = untag_ptr(e);
22155         CHECK_ACCESS(e_ptr);
22156         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
22157         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
22158         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
22159         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
22160         return tag_ptr(ret_conv, true);
22161 }
22162
22163 jboolean  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint64_t o) {
22164         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
22165         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
22166         return ret_conv;
22167 }
22168
22169 void  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint64_t _res) {
22170         if (!ptr_is_owned(_res)) return;
22171         void* _res_ptr = untag_ptr(_res);
22172         CHECK_ACCESS(_res_ptr);
22173         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
22174         FREE(untag_ptr(_res));
22175         CResult_SiPrefixParseErrorZ_free(_res_conv);
22176 }
22177
22178 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
22179         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
22180         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
22181         return tag_ptr(ret_conv, true);
22182 }
22183 int64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint64_t arg) {
22184         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
22185         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
22186         return ret_conv;
22187 }
22188
22189 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint64_t orig) {
22190         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
22191         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
22192         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
22193         return tag_ptr(ret_conv, true);
22194 }
22195
22196 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
22197         LDKInvoice o_conv;
22198         o_conv.inner = untag_ptr(o);
22199         o_conv.is_owned = ptr_is_owned(o);
22200         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22201         o_conv = Invoice_clone(&o_conv);
22202         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
22203         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
22204         return tag_ptr(ret_conv, true);
22205 }
22206
22207 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
22208         void* e_ptr = untag_ptr(e);
22209         CHECK_ACCESS(e_ptr);
22210         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
22211         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
22212         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
22213         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
22214         return tag_ptr(ret_conv, true);
22215 }
22216
22217 jboolean  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
22218         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
22219         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
22220         return ret_conv;
22221 }
22222
22223 void  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
22224         if (!ptr_is_owned(_res)) return;
22225         void* _res_ptr = untag_ptr(_res);
22226         CHECK_ACCESS(_res_ptr);
22227         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
22228         FREE(untag_ptr(_res));
22229         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
22230 }
22231
22232 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
22233         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
22234         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
22235         return tag_ptr(ret_conv, true);
22236 }
22237 int64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
22238         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
22239         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
22240         return ret_conv;
22241 }
22242
22243 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
22244         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
22245         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
22246         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
22247         return tag_ptr(ret_conv, true);
22248 }
22249
22250 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint64_t o) {
22251         LDKSignedRawInvoice o_conv;
22252         o_conv.inner = untag_ptr(o);
22253         o_conv.is_owned = ptr_is_owned(o);
22254         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22255         o_conv = SignedRawInvoice_clone(&o_conv);
22256         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
22257         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
22258         return tag_ptr(ret_conv, true);
22259 }
22260
22261 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint64_t e) {
22262         void* e_ptr = untag_ptr(e);
22263         CHECK_ACCESS(e_ptr);
22264         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
22265         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
22266         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
22267         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
22268         return tag_ptr(ret_conv, true);
22269 }
22270
22271 jboolean  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint64_t o) {
22272         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
22273         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
22274         return ret_conv;
22275 }
22276
22277 void  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint64_t _res) {
22278         if (!ptr_is_owned(_res)) return;
22279         void* _res_ptr = untag_ptr(_res);
22280         CHECK_ACCESS(_res_ptr);
22281         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
22282         FREE(untag_ptr(_res));
22283         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
22284 }
22285
22286 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
22287         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
22288         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
22289         return tag_ptr(ret_conv, true);
22290 }
22291 int64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint64_t arg) {
22292         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
22293         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
22294         return ret_conv;
22295 }
22296
22297 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint64_t orig) {
22298         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
22299         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
22300         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
22301         return tag_ptr(ret_conv, true);
22302 }
22303
22304 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
22305         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
22306         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
22307         return tag_ptr(ret_conv, true);
22308 }
22309 int64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint64_t arg) {
22310         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
22311         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
22312         return ret_conv;
22313 }
22314
22315 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint64_t orig) {
22316         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
22317         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
22318         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
22319         return tag_ptr(ret_conv, true);
22320 }
22321
22322 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
22323         LDKRawInvoice a_conv;
22324         a_conv.inner = untag_ptr(a);
22325         a_conv.is_owned = ptr_is_owned(a);
22326         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22327         a_conv = RawInvoice_clone(&a_conv);
22328         LDKThirtyTwoBytes b_ref;
22329         CHECK(b->arr_len == 32);
22330         memcpy(b_ref.data, b->elems, 32); FREE(b);
22331         LDKInvoiceSignature c_conv;
22332         c_conv.inner = untag_ptr(c);
22333         c_conv.is_owned = ptr_is_owned(c);
22334         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
22335         c_conv = InvoiceSignature_clone(&c_conv);
22336         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
22337         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
22338         return tag_ptr(ret_conv, true);
22339 }
22340
22341 void  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint64_t _res) {
22342         if (!ptr_is_owned(_res)) return;
22343         void* _res_ptr = untag_ptr(_res);
22344         CHECK_ACCESS(_res_ptr);
22345         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
22346         FREE(untag_ptr(_res));
22347         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
22348 }
22349
22350 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint64_t o) {
22351         LDKPayeePubKey o_conv;
22352         o_conv.inner = untag_ptr(o);
22353         o_conv.is_owned = ptr_is_owned(o);
22354         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22355         o_conv = PayeePubKey_clone(&o_conv);
22356         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
22357         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
22358         return tag_ptr(ret_conv, true);
22359 }
22360
22361 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
22362         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
22363         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
22364         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
22365         return tag_ptr(ret_conv, true);
22366 }
22367
22368 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint64_t o) {
22369         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
22370         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
22371         return ret_conv;
22372 }
22373
22374 void  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint64_t _res) {
22375         if (!ptr_is_owned(_res)) return;
22376         void* _res_ptr = untag_ptr(_res);
22377         CHECK_ACCESS(_res_ptr);
22378         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
22379         FREE(untag_ptr(_res));
22380         CResult_PayeePubKeyErrorZ_free(_res_conv);
22381 }
22382
22383 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
22384         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
22385         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
22386         return tag_ptr(ret_conv, true);
22387 }
22388 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint64_t arg) {
22389         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
22390         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
22391         return ret_conv;
22392 }
22393
22394 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint64_t orig) {
22395         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
22396         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
22397         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
22398         return tag_ptr(ret_conv, true);
22399 }
22400
22401 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
22402         LDKCVec_PrivateRouteZ _res_constr;
22403         _res_constr.datalen = _res->arr_len;
22404         if (_res_constr.datalen > 0)
22405                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
22406         else
22407                 _res_constr.data = NULL;
22408         uint64_t* _res_vals = _res->elems;
22409         for (size_t o = 0; o < _res_constr.datalen; o++) {
22410                 uint64_t _res_conv_14 = _res_vals[o];
22411                 LDKPrivateRoute _res_conv_14_conv;
22412                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
22413                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
22414                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
22415                 _res_constr.data[o] = _res_conv_14_conv;
22416         }
22417         FREE(_res);
22418         CVec_PrivateRouteZ_free(_res_constr);
22419 }
22420
22421 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
22422         LDKPositiveTimestamp o_conv;
22423         o_conv.inner = untag_ptr(o);
22424         o_conv.is_owned = ptr_is_owned(o);
22425         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22426         o_conv = PositiveTimestamp_clone(&o_conv);
22427         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
22428         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
22429         return tag_ptr(ret_conv, true);
22430 }
22431
22432 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
22433         LDKCreationError e_conv = LDKCreationError_from_js(e);
22434         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
22435         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
22436         return tag_ptr(ret_conv, true);
22437 }
22438
22439 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
22440         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
22441         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
22442         return ret_conv;
22443 }
22444
22445 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
22446         if (!ptr_is_owned(_res)) return;
22447         void* _res_ptr = untag_ptr(_res);
22448         CHECK_ACCESS(_res_ptr);
22449         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
22450         FREE(untag_ptr(_res));
22451         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
22452 }
22453
22454 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
22455         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
22456         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
22457         return tag_ptr(ret_conv, true);
22458 }
22459 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
22460         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
22461         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
22462         return ret_conv;
22463 }
22464
22465 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
22466         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
22467         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
22468         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
22469         return tag_ptr(ret_conv, true);
22470 }
22471
22472 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
22473         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
22474         *ret_conv = CResult_NoneSemanticErrorZ_ok();
22475         return tag_ptr(ret_conv, true);
22476 }
22477
22478 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
22479         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
22480         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
22481         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
22482         return tag_ptr(ret_conv, true);
22483 }
22484
22485 jboolean  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint64_t o) {
22486         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
22487         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
22488         return ret_conv;
22489 }
22490
22491 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint64_t _res) {
22492         if (!ptr_is_owned(_res)) return;
22493         void* _res_ptr = untag_ptr(_res);
22494         CHECK_ACCESS(_res_ptr);
22495         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
22496         FREE(untag_ptr(_res));
22497         CResult_NoneSemanticErrorZ_free(_res_conv);
22498 }
22499
22500 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
22501         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
22502         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
22503         return tag_ptr(ret_conv, true);
22504 }
22505 int64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint64_t arg) {
22506         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
22507         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
22508         return ret_conv;
22509 }
22510
22511 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint64_t orig) {
22512         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
22513         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
22514         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
22515         return tag_ptr(ret_conv, true);
22516 }
22517
22518 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint64_t o) {
22519         LDKInvoice o_conv;
22520         o_conv.inner = untag_ptr(o);
22521         o_conv.is_owned = ptr_is_owned(o);
22522         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22523         o_conv = Invoice_clone(&o_conv);
22524         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
22525         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
22526         return tag_ptr(ret_conv, true);
22527 }
22528
22529 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
22530         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
22531         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
22532         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
22533         return tag_ptr(ret_conv, true);
22534 }
22535
22536 jboolean  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint64_t o) {
22537         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
22538         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
22539         return ret_conv;
22540 }
22541
22542 void  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint64_t _res) {
22543         if (!ptr_is_owned(_res)) return;
22544         void* _res_ptr = untag_ptr(_res);
22545         CHECK_ACCESS(_res_ptr);
22546         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
22547         FREE(untag_ptr(_res));
22548         CResult_InvoiceSemanticErrorZ_free(_res_conv);
22549 }
22550
22551 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
22552         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
22553         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
22554         return tag_ptr(ret_conv, true);
22555 }
22556 int64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint64_t arg) {
22557         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
22558         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
22559         return ret_conv;
22560 }
22561
22562 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint64_t orig) {
22563         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
22564         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
22565         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
22566         return tag_ptr(ret_conv, true);
22567 }
22568
22569 void  __attribute__((export_name("TS_CVec_AddressZ_free"))) TS_CVec_AddressZ_free(ptrArray _res) {
22570         LDKCVec_AddressZ _res_constr;
22571         _res_constr.datalen = _res->arr_len;
22572         if (_res_constr.datalen > 0)
22573                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_AddressZ Elements");
22574         else
22575                 _res_constr.data = NULL;
22576         jstring* _res_vals = (void*) _res->elems;
22577         for (size_t i = 0; i < _res_constr.datalen; i++) {
22578                 jstring _res_conv_8 = _res_vals[i];
22579                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
22580                 _res_constr.data[i] = dummy;
22581         }
22582         FREE(_res);
22583         CVec_AddressZ_free(_res_constr);
22584 }
22585
22586 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
22587         LDKDescription o_conv;
22588         o_conv.inner = untag_ptr(o);
22589         o_conv.is_owned = ptr_is_owned(o);
22590         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22591         o_conv = Description_clone(&o_conv);
22592         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
22593         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
22594         return tag_ptr(ret_conv, true);
22595 }
22596
22597 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
22598         LDKCreationError e_conv = LDKCreationError_from_js(e);
22599         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
22600         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
22601         return tag_ptr(ret_conv, true);
22602 }
22603
22604 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
22605         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
22606         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
22607         return ret_conv;
22608 }
22609
22610 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
22611         if (!ptr_is_owned(_res)) return;
22612         void* _res_ptr = untag_ptr(_res);
22613         CHECK_ACCESS(_res_ptr);
22614         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
22615         FREE(untag_ptr(_res));
22616         CResult_DescriptionCreationErrorZ_free(_res_conv);
22617 }
22618
22619 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
22620         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
22621         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
22622         return tag_ptr(ret_conv, true);
22623 }
22624 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
22625         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
22626         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
22627         return ret_conv;
22628 }
22629
22630 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
22631         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
22632         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
22633         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
22634         return tag_ptr(ret_conv, true);
22635 }
22636
22637 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
22638         LDKPrivateRoute o_conv;
22639         o_conv.inner = untag_ptr(o);
22640         o_conv.is_owned = ptr_is_owned(o);
22641         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22642         o_conv = PrivateRoute_clone(&o_conv);
22643         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
22644         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
22645         return tag_ptr(ret_conv, true);
22646 }
22647
22648 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
22649         LDKCreationError e_conv = LDKCreationError_from_js(e);
22650         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
22651         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
22652         return tag_ptr(ret_conv, true);
22653 }
22654
22655 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
22656         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
22657         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
22658         return ret_conv;
22659 }
22660
22661 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
22662         if (!ptr_is_owned(_res)) return;
22663         void* _res_ptr = untag_ptr(_res);
22664         CHECK_ACCESS(_res_ptr);
22665         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
22666         FREE(untag_ptr(_res));
22667         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
22668 }
22669
22670 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
22671         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
22672         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
22673         return tag_ptr(ret_conv, true);
22674 }
22675 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
22676         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
22677         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
22678         return ret_conv;
22679 }
22680
22681 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
22682         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
22683         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
22684         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
22685         return tag_ptr(ret_conv, true);
22686 }
22687
22688 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
22689         if (!ptr_is_owned(this_ptr)) return;
22690         void* this_ptr_ptr = untag_ptr(this_ptr);
22691         CHECK_ACCESS(this_ptr_ptr);
22692         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
22693         FREE(untag_ptr(this_ptr));
22694         APIError_free(this_ptr_conv);
22695 }
22696
22697 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
22698         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22699         *ret_copy = APIError_clone(arg);
22700         uint64_t ret_ref = tag_ptr(ret_copy, true);
22701         return ret_ref;
22702 }
22703 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
22704         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
22705         int64_t ret_conv = APIError_clone_ptr(arg_conv);
22706         return ret_conv;
22707 }
22708
22709 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
22710         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
22711         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22712         *ret_copy = APIError_clone(orig_conv);
22713         uint64_t ret_ref = tag_ptr(ret_copy, true);
22714         return ret_ref;
22715 }
22716
22717 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
22718         LDKStr err_conv = str_ref_to_owned_c(err);
22719         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22720         *ret_copy = APIError_apimisuse_error(err_conv);
22721         uint64_t ret_ref = tag_ptr(ret_copy, true);
22722         return ret_ref;
22723 }
22724
22725 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
22726         LDKStr err_conv = str_ref_to_owned_c(err);
22727         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22728         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
22729         uint64_t ret_ref = tag_ptr(ret_copy, true);
22730         return ret_ref;
22731 }
22732
22733 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
22734         LDKStr err_conv = str_ref_to_owned_c(err);
22735         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22736         *ret_copy = APIError_invalid_route(err_conv);
22737         uint64_t ret_ref = tag_ptr(ret_copy, true);
22738         return ret_ref;
22739 }
22740
22741 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
22742         LDKStr err_conv = str_ref_to_owned_c(err);
22743         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22744         *ret_copy = APIError_channel_unavailable(err_conv);
22745         uint64_t ret_ref = tag_ptr(ret_copy, true);
22746         return ret_ref;
22747 }
22748
22749 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
22750         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22751         *ret_copy = APIError_monitor_update_in_progress();
22752         uint64_t ret_ref = tag_ptr(ret_copy, true);
22753         return ret_ref;
22754 }
22755
22756 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
22757         LDKShutdownScript script_conv;
22758         script_conv.inner = untag_ptr(script);
22759         script_conv.is_owned = ptr_is_owned(script);
22760         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
22761         script_conv = ShutdownScript_clone(&script_conv);
22762         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22763         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
22764         uint64_t ret_ref = tag_ptr(ret_copy, true);
22765         return ret_ref;
22766 }
22767
22768 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
22769         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
22770         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
22771         jboolean ret_conv = APIError_eq(a_conv, b_conv);
22772         return ret_conv;
22773 }
22774
22775 int8_tArray  __attribute__((export_name("TS_APIError_write"))) TS_APIError_write(uint64_t obj) {
22776         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
22777         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
22778         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22779         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22780         CVec_u8Z_free(ret_var);
22781         return ret_arr;
22782 }
22783
22784 uint64_t  __attribute__((export_name("TS_APIError_read"))) TS_APIError_read(int8_tArray ser) {
22785         LDKu8slice ser_ref;
22786         ser_ref.datalen = ser->arr_len;
22787         ser_ref.data = ser->elems;
22788         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
22789         *ret_conv = APIError_read(ser_ref);
22790         FREE(ser);
22791         return tag_ptr(ret_conv, true);
22792 }
22793
22794 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
22795         LDKBigSize this_obj_conv;
22796         this_obj_conv.inner = untag_ptr(this_obj);
22797         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22799         BigSize_free(this_obj_conv);
22800 }
22801
22802 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
22803         LDKBigSize this_ptr_conv;
22804         this_ptr_conv.inner = untag_ptr(this_ptr);
22805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22807         this_ptr_conv.is_owned = false;
22808         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
22809         return ret_conv;
22810 }
22811
22812 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
22813         LDKBigSize this_ptr_conv;
22814         this_ptr_conv.inner = untag_ptr(this_ptr);
22815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22817         this_ptr_conv.is_owned = false;
22818         BigSize_set_a(&this_ptr_conv, val);
22819 }
22820
22821 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
22822         LDKBigSize ret_var = BigSize_new(a_arg);
22823         uint64_t ret_ref = 0;
22824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22826         return ret_ref;
22827 }
22828
22829 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
22830         LDKHostname this_obj_conv;
22831         this_obj_conv.inner = untag_ptr(this_obj);
22832         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22834         Hostname_free(this_obj_conv);
22835 }
22836
22837 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
22838         LDKHostname ret_var = Hostname_clone(arg);
22839         uint64_t ret_ref = 0;
22840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22842         return ret_ref;
22843 }
22844 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
22845         LDKHostname arg_conv;
22846         arg_conv.inner = untag_ptr(arg);
22847         arg_conv.is_owned = ptr_is_owned(arg);
22848         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22849         arg_conv.is_owned = false;
22850         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
22851         return ret_conv;
22852 }
22853
22854 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
22855         LDKHostname orig_conv;
22856         orig_conv.inner = untag_ptr(orig);
22857         orig_conv.is_owned = ptr_is_owned(orig);
22858         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22859         orig_conv.is_owned = false;
22860         LDKHostname ret_var = Hostname_clone(&orig_conv);
22861         uint64_t ret_ref = 0;
22862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22864         return ret_ref;
22865 }
22866
22867 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
22868         LDKHostname a_conv;
22869         a_conv.inner = untag_ptr(a);
22870         a_conv.is_owned = ptr_is_owned(a);
22871         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22872         a_conv.is_owned = false;
22873         LDKHostname b_conv;
22874         b_conv.inner = untag_ptr(b);
22875         b_conv.is_owned = ptr_is_owned(b);
22876         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22877         b_conv.is_owned = false;
22878         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
22879         return ret_conv;
22880 }
22881
22882 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
22883         LDKHostname this_arg_conv;
22884         this_arg_conv.inner = untag_ptr(this_arg);
22885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22887         this_arg_conv.is_owned = false;
22888         int8_t ret_conv = Hostname_len(&this_arg_conv);
22889         return ret_conv;
22890 }
22891
22892 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
22893         LDKu8slice msg_ref;
22894         msg_ref.datalen = msg->arr_len;
22895         msg_ref.data = msg->elems;
22896         uint8_t sk_arr[32];
22897         CHECK(sk->arr_len == 32);
22898         memcpy(sk_arr, sk->elems, 32); FREE(sk);
22899         uint8_t (*sk_ref)[32] = &sk_arr;
22900         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22901         *ret_conv = sign(msg_ref, sk_ref);
22902         FREE(msg);
22903         return tag_ptr(ret_conv, true);
22904 }
22905
22906 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
22907         LDKu8slice msg_ref;
22908         msg_ref.datalen = msg->arr_len;
22909         msg_ref.data = msg->elems;
22910         LDKStr sig_conv = str_ref_to_owned_c(sig);
22911         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22912         *ret_conv = recover_pk(msg_ref, sig_conv);
22913         FREE(msg);
22914         return tag_ptr(ret_conv, true);
22915 }
22916
22917 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
22918         LDKu8slice msg_ref;
22919         msg_ref.datalen = msg->arr_len;
22920         msg_ref.data = msg->elems;
22921         LDKStr sig_conv = str_ref_to_owned_c(sig);
22922         LDKPublicKey pk_ref;
22923         CHECK(pk->arr_len == 33);
22924         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
22925         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
22926         FREE(msg);
22927         return ret_conv;
22928 }
22929
22930 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
22931         LDKu8slice hrp_bytes_ref;
22932         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
22933         hrp_bytes_ref.data = hrp_bytes->elems;
22934         LDKCVec_U5Z data_without_signature_constr;
22935         data_without_signature_constr.datalen = data_without_signature->arr_len;
22936         if (data_without_signature_constr.datalen > 0)
22937                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
22938         else
22939                 data_without_signature_constr.data = NULL;
22940         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
22941         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
22942                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
22943                 
22944                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
22945         }
22946         FREE(data_without_signature);
22947         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
22948         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22949         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22950         CVec_u8Z_free(ret_var);
22951         FREE(hrp_bytes);
22952         return ret_arr;
22953 }
22954
22955 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
22956         if (!ptr_is_owned(this_ptr)) return;
22957         void* this_ptr_ptr = untag_ptr(this_ptr);
22958         CHECK_ACCESS(this_ptr_ptr);
22959         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
22960         FREE(untag_ptr(this_ptr));
22961         Persister_free(this_ptr_conv);
22962 }
22963
22964 void  __attribute__((export_name("TS_UntrustedString_free"))) TS_UntrustedString_free(uint64_t this_obj) {
22965         LDKUntrustedString this_obj_conv;
22966         this_obj_conv.inner = untag_ptr(this_obj);
22967         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22969         UntrustedString_free(this_obj_conv);
22970 }
22971
22972 jstring  __attribute__((export_name("TS_UntrustedString_get_a"))) TS_UntrustedString_get_a(uint64_t this_ptr) {
22973         LDKUntrustedString this_ptr_conv;
22974         this_ptr_conv.inner = untag_ptr(this_ptr);
22975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22977         this_ptr_conv.is_owned = false;
22978         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
22979         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22980         Str_free(ret_str);
22981         return ret_conv;
22982 }
22983
22984 void  __attribute__((export_name("TS_UntrustedString_set_a"))) TS_UntrustedString_set_a(uint64_t this_ptr, jstring val) {
22985         LDKUntrustedString this_ptr_conv;
22986         this_ptr_conv.inner = untag_ptr(this_ptr);
22987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22989         this_ptr_conv.is_owned = false;
22990         LDKStr val_conv = str_ref_to_owned_c(val);
22991         UntrustedString_set_a(&this_ptr_conv, val_conv);
22992 }
22993
22994 uint64_t  __attribute__((export_name("TS_UntrustedString_new"))) TS_UntrustedString_new(jstring a_arg) {
22995         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
22996         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
22997         uint64_t ret_ref = 0;
22998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23000         return ret_ref;
23001 }
23002
23003 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
23004         LDKUntrustedString ret_var = UntrustedString_clone(arg);
23005         uint64_t ret_ref = 0;
23006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23008         return ret_ref;
23009 }
23010 int64_t  __attribute__((export_name("TS_UntrustedString_clone_ptr"))) TS_UntrustedString_clone_ptr(uint64_t arg) {
23011         LDKUntrustedString arg_conv;
23012         arg_conv.inner = untag_ptr(arg);
23013         arg_conv.is_owned = ptr_is_owned(arg);
23014         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23015         arg_conv.is_owned = false;
23016         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
23017         return ret_conv;
23018 }
23019
23020 uint64_t  __attribute__((export_name("TS_UntrustedString_clone"))) TS_UntrustedString_clone(uint64_t orig) {
23021         LDKUntrustedString orig_conv;
23022         orig_conv.inner = untag_ptr(orig);
23023         orig_conv.is_owned = ptr_is_owned(orig);
23024         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23025         orig_conv.is_owned = false;
23026         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
23027         uint64_t ret_ref = 0;
23028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23030         return ret_ref;
23031 }
23032
23033 jboolean  __attribute__((export_name("TS_UntrustedString_eq"))) TS_UntrustedString_eq(uint64_t a, uint64_t b) {
23034         LDKUntrustedString a_conv;
23035         a_conv.inner = untag_ptr(a);
23036         a_conv.is_owned = ptr_is_owned(a);
23037         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23038         a_conv.is_owned = false;
23039         LDKUntrustedString b_conv;
23040         b_conv.inner = untag_ptr(b);
23041         b_conv.is_owned = ptr_is_owned(b);
23042         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23043         b_conv.is_owned = false;
23044         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
23045         return ret_conv;
23046 }
23047
23048 int8_tArray  __attribute__((export_name("TS_UntrustedString_write"))) TS_UntrustedString_write(uint64_t obj) {
23049         LDKUntrustedString obj_conv;
23050         obj_conv.inner = untag_ptr(obj);
23051         obj_conv.is_owned = ptr_is_owned(obj);
23052         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23053         obj_conv.is_owned = false;
23054         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
23055         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23056         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23057         CVec_u8Z_free(ret_var);
23058         return ret_arr;
23059 }
23060
23061 uint64_t  __attribute__((export_name("TS_UntrustedString_read"))) TS_UntrustedString_read(int8_tArray ser) {
23062         LDKu8slice ser_ref;
23063         ser_ref.datalen = ser->arr_len;
23064         ser_ref.data = ser->elems;
23065         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
23066         *ret_conv = UntrustedString_read(ser_ref);
23067         FREE(ser);
23068         return tag_ptr(ret_conv, true);
23069 }
23070
23071 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
23072         LDKPrintableString this_obj_conv;
23073         this_obj_conv.inner = untag_ptr(this_obj);
23074         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23076         PrintableString_free(this_obj_conv);
23077 }
23078
23079 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
23080         LDKPrintableString this_ptr_conv;
23081         this_ptr_conv.inner = untag_ptr(this_ptr);
23082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23084         this_ptr_conv.is_owned = false;
23085         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
23086         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23087         Str_free(ret_str);
23088         return ret_conv;
23089 }
23090
23091 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
23092         LDKPrintableString this_ptr_conv;
23093         this_ptr_conv.inner = untag_ptr(this_ptr);
23094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23096         this_ptr_conv.is_owned = false;
23097         LDKStr val_conv = str_ref_to_owned_c(val);
23098         PrintableString_set_a(&this_ptr_conv, val_conv);
23099 }
23100
23101 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
23102         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
23103         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
23104         uint64_t ret_ref = 0;
23105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23107         return ret_ref;
23108 }
23109
23110 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
23111         if (!ptr_is_owned(this_ptr)) return;
23112         void* this_ptr_ptr = untag_ptr(this_ptr);
23113         CHECK_ACCESS(this_ptr_ptr);
23114         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
23115         FREE(untag_ptr(this_ptr));
23116         FutureCallback_free(this_ptr_conv);
23117 }
23118
23119 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
23120         LDKFuture this_obj_conv;
23121         this_obj_conv.inner = untag_ptr(this_obj);
23122         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23124         Future_free(this_obj_conv);
23125 }
23126
23127 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
23128         LDKFuture ret_var = Future_clone(arg);
23129         uint64_t ret_ref = 0;
23130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23132         return ret_ref;
23133 }
23134 int64_t  __attribute__((export_name("TS_Future_clone_ptr"))) TS_Future_clone_ptr(uint64_t arg) {
23135         LDKFuture arg_conv;
23136         arg_conv.inner = untag_ptr(arg);
23137         arg_conv.is_owned = ptr_is_owned(arg);
23138         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23139         arg_conv.is_owned = false;
23140         int64_t ret_conv = Future_clone_ptr(&arg_conv);
23141         return ret_conv;
23142 }
23143
23144 uint64_t  __attribute__((export_name("TS_Future_clone"))) TS_Future_clone(uint64_t orig) {
23145         LDKFuture orig_conv;
23146         orig_conv.inner = untag_ptr(orig);
23147         orig_conv.is_owned = ptr_is_owned(orig);
23148         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23149         orig_conv.is_owned = false;
23150         LDKFuture ret_var = Future_clone(&orig_conv);
23151         uint64_t ret_ref = 0;
23152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23154         return ret_ref;
23155 }
23156
23157 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
23158         LDKFuture this_arg_conv;
23159         this_arg_conv.inner = untag_ptr(this_arg);
23160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23162         this_arg_conv.is_owned = false;
23163         void* callback_ptr = untag_ptr(callback);
23164         CHECK_ACCESS(callback_ptr);
23165         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
23166         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
23167                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23168                 LDKFutureCallback_JCalls_cloned(&callback_conv);
23169         }
23170         Future_register_callback_fn(&this_arg_conv, callback_conv);
23171 }
23172
23173 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
23174         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
23175         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
23176         return ret_conv;
23177 }
23178
23179 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
23180         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
23181         return ret_conv;
23182 }
23183
23184 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
23185         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
23186         return ret_conv;
23187 }
23188
23189 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
23190         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
23191         return ret_conv;
23192 }
23193
23194 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
23195         uint32_t ret_conv = LDKLevel_to_js(Level_info());
23196         return ret_conv;
23197 }
23198
23199 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
23200         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
23201         return ret_conv;
23202 }
23203
23204 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
23205         uint32_t ret_conv = LDKLevel_to_js(Level_error());
23206         return ret_conv;
23207 }
23208
23209 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
23210         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
23211         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
23212         jboolean ret_conv = Level_eq(a_conv, b_conv);
23213         return ret_conv;
23214 }
23215
23216 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
23217         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
23218         int64_t ret_conv = Level_hash(o_conv);
23219         return ret_conv;
23220 }
23221
23222 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
23223         uint32_t ret_conv = LDKLevel_to_js(Level_max());
23224         return ret_conv;
23225 }
23226
23227 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
23228         LDKRecord this_obj_conv;
23229         this_obj_conv.inner = untag_ptr(this_obj);
23230         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23232         Record_free(this_obj_conv);
23233 }
23234
23235 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
23236         LDKRecord this_ptr_conv;
23237         this_ptr_conv.inner = untag_ptr(this_ptr);
23238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23240         this_ptr_conv.is_owned = false;
23241         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
23242         return ret_conv;
23243 }
23244
23245 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
23246         LDKRecord this_ptr_conv;
23247         this_ptr_conv.inner = untag_ptr(this_ptr);
23248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23250         this_ptr_conv.is_owned = false;
23251         LDKLevel val_conv = LDKLevel_from_js(val);
23252         Record_set_level(&this_ptr_conv, val_conv);
23253 }
23254
23255 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(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         LDKStr ret_str = Record_get_args(&this_ptr_conv);
23262         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23263         Str_free(ret_str);
23264         return ret_conv;
23265 }
23266
23267 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
23268         LDKRecord this_ptr_conv;
23269         this_ptr_conv.inner = untag_ptr(this_ptr);
23270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23272         this_ptr_conv.is_owned = false;
23273         LDKStr val_conv = str_ref_to_owned_c(val);
23274         Record_set_args(&this_ptr_conv, val_conv);
23275 }
23276
23277 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
23278         LDKRecord this_ptr_conv;
23279         this_ptr_conv.inner = untag_ptr(this_ptr);
23280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23282         this_ptr_conv.is_owned = false;
23283         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
23284         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23285         Str_free(ret_str);
23286         return ret_conv;
23287 }
23288
23289 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
23290         LDKRecord this_ptr_conv;
23291         this_ptr_conv.inner = untag_ptr(this_ptr);
23292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23294         this_ptr_conv.is_owned = false;
23295         LDKStr val_conv = str_ref_to_owned_c(val);
23296         Record_set_module_path(&this_ptr_conv, val_conv);
23297 }
23298
23299 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
23300         LDKRecord this_ptr_conv;
23301         this_ptr_conv.inner = untag_ptr(this_ptr);
23302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23304         this_ptr_conv.is_owned = false;
23305         LDKStr ret_str = Record_get_file(&this_ptr_conv);
23306         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23307         Str_free(ret_str);
23308         return ret_conv;
23309 }
23310
23311 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
23312         LDKRecord this_ptr_conv;
23313         this_ptr_conv.inner = untag_ptr(this_ptr);
23314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23316         this_ptr_conv.is_owned = false;
23317         LDKStr val_conv = str_ref_to_owned_c(val);
23318         Record_set_file(&this_ptr_conv, val_conv);
23319 }
23320
23321 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
23322         LDKRecord this_ptr_conv;
23323         this_ptr_conv.inner = untag_ptr(this_ptr);
23324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23326         this_ptr_conv.is_owned = false;
23327         int32_t ret_conv = Record_get_line(&this_ptr_conv);
23328         return ret_conv;
23329 }
23330
23331 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t 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         Record_set_line(&this_ptr_conv, val);
23338 }
23339
23340 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
23341         LDKRecord ret_var = Record_clone(arg);
23342         uint64_t ret_ref = 0;
23343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23345         return ret_ref;
23346 }
23347 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
23348         LDKRecord arg_conv;
23349         arg_conv.inner = untag_ptr(arg);
23350         arg_conv.is_owned = ptr_is_owned(arg);
23351         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23352         arg_conv.is_owned = false;
23353         int64_t ret_conv = Record_clone_ptr(&arg_conv);
23354         return ret_conv;
23355 }
23356
23357 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
23358         LDKRecord orig_conv;
23359         orig_conv.inner = untag_ptr(orig);
23360         orig_conv.is_owned = ptr_is_owned(orig);
23361         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23362         orig_conv.is_owned = false;
23363         LDKRecord ret_var = Record_clone(&orig_conv);
23364         uint64_t ret_ref = 0;
23365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23367         return ret_ref;
23368 }
23369
23370 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
23371         if (!ptr_is_owned(this_ptr)) return;
23372         void* this_ptr_ptr = untag_ptr(this_ptr);
23373         CHECK_ACCESS(this_ptr_ptr);
23374         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
23375         FREE(untag_ptr(this_ptr));
23376         Logger_free(this_ptr_conv);
23377 }
23378
23379 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
23380         LDKChannelHandshakeConfig this_obj_conv;
23381         this_obj_conv.inner = untag_ptr(this_obj);
23382         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23384         ChannelHandshakeConfig_free(this_obj_conv);
23385 }
23386
23387 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
23388         LDKChannelHandshakeConfig this_ptr_conv;
23389         this_ptr_conv.inner = untag_ptr(this_ptr);
23390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23392         this_ptr_conv.is_owned = false;
23393         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
23394         return ret_conv;
23395 }
23396
23397 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
23398         LDKChannelHandshakeConfig this_ptr_conv;
23399         this_ptr_conv.inner = untag_ptr(this_ptr);
23400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23402         this_ptr_conv.is_owned = false;
23403         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
23404 }
23405
23406 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
23407         LDKChannelHandshakeConfig this_ptr_conv;
23408         this_ptr_conv.inner = untag_ptr(this_ptr);
23409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23411         this_ptr_conv.is_owned = false;
23412         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
23413         return ret_conv;
23414 }
23415
23416 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) {
23417         LDKChannelHandshakeConfig this_ptr_conv;
23418         this_ptr_conv.inner = untag_ptr(this_ptr);
23419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23421         this_ptr_conv.is_owned = false;
23422         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
23423 }
23424
23425 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
23426         LDKChannelHandshakeConfig this_ptr_conv;
23427         this_ptr_conv.inner = untag_ptr(this_ptr);
23428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23430         this_ptr_conv.is_owned = false;
23431         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
23432         return ret_conv;
23433 }
23434
23435 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) {
23436         LDKChannelHandshakeConfig this_ptr_conv;
23437         this_ptr_conv.inner = untag_ptr(this_ptr);
23438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23440         this_ptr_conv.is_owned = false;
23441         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
23442 }
23443
23444 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) {
23445         LDKChannelHandshakeConfig this_ptr_conv;
23446         this_ptr_conv.inner = untag_ptr(this_ptr);
23447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23449         this_ptr_conv.is_owned = false;
23450         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
23451         return ret_conv;
23452 }
23453
23454 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) {
23455         LDKChannelHandshakeConfig this_ptr_conv;
23456         this_ptr_conv.inner = untag_ptr(this_ptr);
23457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23459         this_ptr_conv.is_owned = false;
23460         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
23461 }
23462
23463 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
23464         LDKChannelHandshakeConfig this_ptr_conv;
23465         this_ptr_conv.inner = untag_ptr(this_ptr);
23466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23468         this_ptr_conv.is_owned = false;
23469         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
23470         return ret_conv;
23471 }
23472
23473 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
23474         LDKChannelHandshakeConfig this_ptr_conv;
23475         this_ptr_conv.inner = untag_ptr(this_ptr);
23476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23478         this_ptr_conv.is_owned = false;
23479         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
23480 }
23481
23482 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
23483         LDKChannelHandshakeConfig this_ptr_conv;
23484         this_ptr_conv.inner = untag_ptr(this_ptr);
23485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23487         this_ptr_conv.is_owned = false;
23488         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
23489         return ret_conv;
23490 }
23491
23492 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
23493         LDKChannelHandshakeConfig this_ptr_conv;
23494         this_ptr_conv.inner = untag_ptr(this_ptr);
23495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23497         this_ptr_conv.is_owned = false;
23498         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
23499 }
23500
23501 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
23502         LDKChannelHandshakeConfig this_ptr_conv;
23503         this_ptr_conv.inner = untag_ptr(this_ptr);
23504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23506         this_ptr_conv.is_owned = false;
23507         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
23508         return ret_conv;
23509 }
23510
23511 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
23512         LDKChannelHandshakeConfig this_ptr_conv;
23513         this_ptr_conv.inner = untag_ptr(this_ptr);
23514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23516         this_ptr_conv.is_owned = false;
23517         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
23518 }
23519
23520 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) {
23521         LDKChannelHandshakeConfig this_ptr_conv;
23522         this_ptr_conv.inner = untag_ptr(this_ptr);
23523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23525         this_ptr_conv.is_owned = false;
23526         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
23527         return ret_conv;
23528 }
23529
23530 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) {
23531         LDKChannelHandshakeConfig this_ptr_conv;
23532         this_ptr_conv.inner = untag_ptr(this_ptr);
23533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23535         this_ptr_conv.is_owned = false;
23536         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
23537 }
23538
23539 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs"))) TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs(uint64_t this_ptr) {
23540         LDKChannelHandshakeConfig this_ptr_conv;
23541         this_ptr_conv.inner = untag_ptr(this_ptr);
23542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23544         this_ptr_conv.is_owned = false;
23545         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
23546         return ret_conv;
23547 }
23548
23549 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) {
23550         LDKChannelHandshakeConfig this_ptr_conv;
23551         this_ptr_conv.inner = untag_ptr(this_ptr);
23552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23554         this_ptr_conv.is_owned = false;
23555         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
23556 }
23557
23558 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) {
23559         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);
23560         uint64_t ret_ref = 0;
23561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23563         return ret_ref;
23564 }
23565
23566 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
23567         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
23568         uint64_t ret_ref = 0;
23569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23571         return ret_ref;
23572 }
23573 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
23574         LDKChannelHandshakeConfig arg_conv;
23575         arg_conv.inner = untag_ptr(arg);
23576         arg_conv.is_owned = ptr_is_owned(arg);
23577         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23578         arg_conv.is_owned = false;
23579         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
23580         return ret_conv;
23581 }
23582
23583 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
23584         LDKChannelHandshakeConfig orig_conv;
23585         orig_conv.inner = untag_ptr(orig);
23586         orig_conv.is_owned = ptr_is_owned(orig);
23587         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23588         orig_conv.is_owned = false;
23589         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
23590         uint64_t ret_ref = 0;
23591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23593         return ret_ref;
23594 }
23595
23596 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
23597         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
23598         uint64_t ret_ref = 0;
23599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23601         return ret_ref;
23602 }
23603
23604 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
23605         LDKChannelHandshakeLimits this_obj_conv;
23606         this_obj_conv.inner = untag_ptr(this_obj);
23607         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23609         ChannelHandshakeLimits_free(this_obj_conv);
23610 }
23611
23612 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
23613         LDKChannelHandshakeLimits this_ptr_conv;
23614         this_ptr_conv.inner = untag_ptr(this_ptr);
23615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23617         this_ptr_conv.is_owned = false;
23618         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
23619         return ret_conv;
23620 }
23621
23622 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
23623         LDKChannelHandshakeLimits this_ptr_conv;
23624         this_ptr_conv.inner = untag_ptr(this_ptr);
23625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23627         this_ptr_conv.is_owned = false;
23628         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
23629 }
23630
23631 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
23632         LDKChannelHandshakeLimits this_ptr_conv;
23633         this_ptr_conv.inner = untag_ptr(this_ptr);
23634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23636         this_ptr_conv.is_owned = false;
23637         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
23638         return ret_conv;
23639 }
23640
23641 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
23642         LDKChannelHandshakeLimits this_ptr_conv;
23643         this_ptr_conv.inner = untag_ptr(this_ptr);
23644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23646         this_ptr_conv.is_owned = false;
23647         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
23648 }
23649
23650 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
23651         LDKChannelHandshakeLimits this_ptr_conv;
23652         this_ptr_conv.inner = untag_ptr(this_ptr);
23653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23655         this_ptr_conv.is_owned = false;
23656         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
23657         return ret_conv;
23658 }
23659
23660 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) {
23661         LDKChannelHandshakeLimits this_ptr_conv;
23662         this_ptr_conv.inner = untag_ptr(this_ptr);
23663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23665         this_ptr_conv.is_owned = false;
23666         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
23667 }
23668
23669 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) {
23670         LDKChannelHandshakeLimits this_ptr_conv;
23671         this_ptr_conv.inner = untag_ptr(this_ptr);
23672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23674         this_ptr_conv.is_owned = false;
23675         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
23676         return ret_conv;
23677 }
23678
23679 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) {
23680         LDKChannelHandshakeLimits this_ptr_conv;
23681         this_ptr_conv.inner = untag_ptr(this_ptr);
23682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23684         this_ptr_conv.is_owned = false;
23685         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
23686 }
23687
23688 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
23689         LDKChannelHandshakeLimits this_ptr_conv;
23690         this_ptr_conv.inner = untag_ptr(this_ptr);
23691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23693         this_ptr_conv.is_owned = false;
23694         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
23695         return ret_conv;
23696 }
23697
23698 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) {
23699         LDKChannelHandshakeLimits this_ptr_conv;
23700         this_ptr_conv.inner = untag_ptr(this_ptr);
23701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23703         this_ptr_conv.is_owned = false;
23704         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
23705 }
23706
23707 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
23708         LDKChannelHandshakeLimits this_ptr_conv;
23709         this_ptr_conv.inner = untag_ptr(this_ptr);
23710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23712         this_ptr_conv.is_owned = false;
23713         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
23714         return ret_conv;
23715 }
23716
23717 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) {
23718         LDKChannelHandshakeLimits this_ptr_conv;
23719         this_ptr_conv.inner = untag_ptr(this_ptr);
23720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23722         this_ptr_conv.is_owned = false;
23723         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
23724 }
23725
23726 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
23727         LDKChannelHandshakeLimits this_ptr_conv;
23728         this_ptr_conv.inner = untag_ptr(this_ptr);
23729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23731         this_ptr_conv.is_owned = false;
23732         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
23733         return ret_conv;
23734 }
23735
23736 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
23737         LDKChannelHandshakeLimits this_ptr_conv;
23738         this_ptr_conv.inner = untag_ptr(this_ptr);
23739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23741         this_ptr_conv.is_owned = false;
23742         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
23743 }
23744
23745 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
23746         LDKChannelHandshakeLimits this_ptr_conv;
23747         this_ptr_conv.inner = untag_ptr(this_ptr);
23748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23750         this_ptr_conv.is_owned = false;
23751         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
23752         return ret_conv;
23753 }
23754
23755 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
23756         LDKChannelHandshakeLimits this_ptr_conv;
23757         this_ptr_conv.inner = untag_ptr(this_ptr);
23758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23760         this_ptr_conv.is_owned = false;
23761         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
23762 }
23763
23764 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
23765         LDKChannelHandshakeLimits this_ptr_conv;
23766         this_ptr_conv.inner = untag_ptr(this_ptr);
23767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23769         this_ptr_conv.is_owned = false;
23770         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
23771         return ret_conv;
23772 }
23773
23774 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
23775         LDKChannelHandshakeLimits this_ptr_conv;
23776         this_ptr_conv.inner = untag_ptr(this_ptr);
23777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23779         this_ptr_conv.is_owned = false;
23780         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
23781 }
23782
23783 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
23784         LDKChannelHandshakeLimits this_ptr_conv;
23785         this_ptr_conv.inner = untag_ptr(this_ptr);
23786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23788         this_ptr_conv.is_owned = false;
23789         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
23790         return ret_conv;
23791 }
23792
23793 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) {
23794         LDKChannelHandshakeLimits this_ptr_conv;
23795         this_ptr_conv.inner = untag_ptr(this_ptr);
23796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23798         this_ptr_conv.is_owned = false;
23799         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
23800 }
23801
23802 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) {
23803         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);
23804         uint64_t ret_ref = 0;
23805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23807         return ret_ref;
23808 }
23809
23810 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
23811         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
23812         uint64_t ret_ref = 0;
23813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23815         return ret_ref;
23816 }
23817 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
23818         LDKChannelHandshakeLimits arg_conv;
23819         arg_conv.inner = untag_ptr(arg);
23820         arg_conv.is_owned = ptr_is_owned(arg);
23821         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23822         arg_conv.is_owned = false;
23823         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
23824         return ret_conv;
23825 }
23826
23827 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
23828         LDKChannelHandshakeLimits orig_conv;
23829         orig_conv.inner = untag_ptr(orig);
23830         orig_conv.is_owned = ptr_is_owned(orig);
23831         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23832         orig_conv.is_owned = false;
23833         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
23834         uint64_t ret_ref = 0;
23835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23837         return ret_ref;
23838 }
23839
23840 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
23841         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
23842         uint64_t ret_ref = 0;
23843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23845         return ret_ref;
23846 }
23847
23848 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
23849         LDKChannelConfig this_obj_conv;
23850         this_obj_conv.inner = untag_ptr(this_obj);
23851         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23853         ChannelConfig_free(this_obj_conv);
23854 }
23855
23856 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
23857         LDKChannelConfig this_ptr_conv;
23858         this_ptr_conv.inner = untag_ptr(this_ptr);
23859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23861         this_ptr_conv.is_owned = false;
23862         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
23863         return ret_conv;
23864 }
23865
23866 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) {
23867         LDKChannelConfig this_ptr_conv;
23868         this_ptr_conv.inner = untag_ptr(this_ptr);
23869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23871         this_ptr_conv.is_owned = false;
23872         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
23873 }
23874
23875 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
23876         LDKChannelConfig this_ptr_conv;
23877         this_ptr_conv.inner = untag_ptr(this_ptr);
23878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23880         this_ptr_conv.is_owned = false;
23881         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
23882         return ret_conv;
23883 }
23884
23885 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) {
23886         LDKChannelConfig this_ptr_conv;
23887         this_ptr_conv.inner = untag_ptr(this_ptr);
23888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23890         this_ptr_conv.is_owned = false;
23891         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
23892 }
23893
23894 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
23895         LDKChannelConfig this_ptr_conv;
23896         this_ptr_conv.inner = untag_ptr(this_ptr);
23897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23899         this_ptr_conv.is_owned = false;
23900         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
23901         return ret_conv;
23902 }
23903
23904 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
23905         LDKChannelConfig this_ptr_conv;
23906         this_ptr_conv.inner = untag_ptr(this_ptr);
23907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23909         this_ptr_conv.is_owned = false;
23910         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
23911 }
23912
23913 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) {
23914         LDKChannelConfig this_ptr_conv;
23915         this_ptr_conv.inner = untag_ptr(this_ptr);
23916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23918         this_ptr_conv.is_owned = false;
23919         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
23920         return ret_conv;
23921 }
23922
23923 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) {
23924         LDKChannelConfig this_ptr_conv;
23925         this_ptr_conv.inner = untag_ptr(this_ptr);
23926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23928         this_ptr_conv.is_owned = false;
23929         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
23930 }
23931
23932 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) {
23933         LDKChannelConfig this_ptr_conv;
23934         this_ptr_conv.inner = untag_ptr(this_ptr);
23935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23937         this_ptr_conv.is_owned = false;
23938         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
23939         return ret_conv;
23940 }
23941
23942 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) {
23943         LDKChannelConfig this_ptr_conv;
23944         this_ptr_conv.inner = untag_ptr(this_ptr);
23945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23947         this_ptr_conv.is_owned = false;
23948         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
23949 }
23950
23951 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) {
23952         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);
23953         uint64_t ret_ref = 0;
23954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23956         return ret_ref;
23957 }
23958
23959 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
23960         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
23961         uint64_t ret_ref = 0;
23962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23964         return ret_ref;
23965 }
23966 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
23967         LDKChannelConfig arg_conv;
23968         arg_conv.inner = untag_ptr(arg);
23969         arg_conv.is_owned = ptr_is_owned(arg);
23970         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23971         arg_conv.is_owned = false;
23972         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
23973         return ret_conv;
23974 }
23975
23976 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
23977         LDKChannelConfig orig_conv;
23978         orig_conv.inner = untag_ptr(orig);
23979         orig_conv.is_owned = ptr_is_owned(orig);
23980         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23981         orig_conv.is_owned = false;
23982         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
23983         uint64_t ret_ref = 0;
23984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23986         return ret_ref;
23987 }
23988
23989 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
23990         LDKChannelConfig a_conv;
23991         a_conv.inner = untag_ptr(a);
23992         a_conv.is_owned = ptr_is_owned(a);
23993         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23994         a_conv.is_owned = false;
23995         LDKChannelConfig b_conv;
23996         b_conv.inner = untag_ptr(b);
23997         b_conv.is_owned = ptr_is_owned(b);
23998         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23999         b_conv.is_owned = false;
24000         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
24001         return ret_conv;
24002 }
24003
24004 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
24005         LDKChannelConfig ret_var = ChannelConfig_default();
24006         uint64_t ret_ref = 0;
24007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24009         return ret_ref;
24010 }
24011
24012 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
24013         LDKChannelConfig obj_conv;
24014         obj_conv.inner = untag_ptr(obj);
24015         obj_conv.is_owned = ptr_is_owned(obj);
24016         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24017         obj_conv.is_owned = false;
24018         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
24019         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24020         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24021         CVec_u8Z_free(ret_var);
24022         return ret_arr;
24023 }
24024
24025 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
24026         LDKu8slice ser_ref;
24027         ser_ref.datalen = ser->arr_len;
24028         ser_ref.data = ser->elems;
24029         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
24030         *ret_conv = ChannelConfig_read(ser_ref);
24031         FREE(ser);
24032         return tag_ptr(ret_conv, true);
24033 }
24034
24035 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
24036         LDKUserConfig this_obj_conv;
24037         this_obj_conv.inner = untag_ptr(this_obj);
24038         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24040         UserConfig_free(this_obj_conv);
24041 }
24042
24043 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
24044         LDKUserConfig this_ptr_conv;
24045         this_ptr_conv.inner = untag_ptr(this_ptr);
24046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24048         this_ptr_conv.is_owned = false;
24049         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
24050         uint64_t ret_ref = 0;
24051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24053         return ret_ref;
24054 }
24055
24056 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
24057         LDKUserConfig this_ptr_conv;
24058         this_ptr_conv.inner = untag_ptr(this_ptr);
24059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24061         this_ptr_conv.is_owned = false;
24062         LDKChannelHandshakeConfig val_conv;
24063         val_conv.inner = untag_ptr(val);
24064         val_conv.is_owned = ptr_is_owned(val);
24065         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24066         val_conv = ChannelHandshakeConfig_clone(&val_conv);
24067         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
24068 }
24069
24070 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
24071         LDKUserConfig this_ptr_conv;
24072         this_ptr_conv.inner = untag_ptr(this_ptr);
24073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24075         this_ptr_conv.is_owned = false;
24076         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
24077         uint64_t ret_ref = 0;
24078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24080         return ret_ref;
24081 }
24082
24083 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
24084         LDKUserConfig this_ptr_conv;
24085         this_ptr_conv.inner = untag_ptr(this_ptr);
24086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24088         this_ptr_conv.is_owned = false;
24089         LDKChannelHandshakeLimits val_conv;
24090         val_conv.inner = untag_ptr(val);
24091         val_conv.is_owned = ptr_is_owned(val);
24092         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24093         val_conv = ChannelHandshakeLimits_clone(&val_conv);
24094         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
24095 }
24096
24097 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
24098         LDKUserConfig this_ptr_conv;
24099         this_ptr_conv.inner = untag_ptr(this_ptr);
24100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24102         this_ptr_conv.is_owned = false;
24103         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
24104         uint64_t ret_ref = 0;
24105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24107         return ret_ref;
24108 }
24109
24110 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
24111         LDKUserConfig this_ptr_conv;
24112         this_ptr_conv.inner = untag_ptr(this_ptr);
24113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24115         this_ptr_conv.is_owned = false;
24116         LDKChannelConfig val_conv;
24117         val_conv.inner = untag_ptr(val);
24118         val_conv.is_owned = ptr_is_owned(val);
24119         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24120         val_conv = ChannelConfig_clone(&val_conv);
24121         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
24122 }
24123
24124 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
24125         LDKUserConfig this_ptr_conv;
24126         this_ptr_conv.inner = untag_ptr(this_ptr);
24127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24129         this_ptr_conv.is_owned = false;
24130         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
24131         return ret_conv;
24132 }
24133
24134 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) {
24135         LDKUserConfig this_ptr_conv;
24136         this_ptr_conv.inner = untag_ptr(this_ptr);
24137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24139         this_ptr_conv.is_owned = false;
24140         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
24141 }
24142
24143 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
24144         LDKUserConfig this_ptr_conv;
24145         this_ptr_conv.inner = untag_ptr(this_ptr);
24146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24148         this_ptr_conv.is_owned = false;
24149         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
24150         return ret_conv;
24151 }
24152
24153 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
24154         LDKUserConfig this_ptr_conv;
24155         this_ptr_conv.inner = untag_ptr(this_ptr);
24156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24158         this_ptr_conv.is_owned = false;
24159         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
24160 }
24161
24162 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
24163         LDKUserConfig this_ptr_conv;
24164         this_ptr_conv.inner = untag_ptr(this_ptr);
24165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24167         this_ptr_conv.is_owned = false;
24168         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
24169         return ret_conv;
24170 }
24171
24172 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
24173         LDKUserConfig this_ptr_conv;
24174         this_ptr_conv.inner = untag_ptr(this_ptr);
24175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24177         this_ptr_conv.is_owned = false;
24178         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
24179 }
24180
24181 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
24182         LDKUserConfig this_ptr_conv;
24183         this_ptr_conv.inner = untag_ptr(this_ptr);
24184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24186         this_ptr_conv.is_owned = false;
24187         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
24188         return ret_conv;
24189 }
24190
24191 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
24192         LDKUserConfig this_ptr_conv;
24193         this_ptr_conv.inner = untag_ptr(this_ptr);
24194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24196         this_ptr_conv.is_owned = false;
24197         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
24198 }
24199
24200 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) {
24201         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
24202         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
24203         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
24204         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
24205         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
24206         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
24207         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
24208         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
24209         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
24210         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
24211         LDKChannelConfig channel_config_arg_conv;
24212         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
24213         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
24214         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
24215         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
24216         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);
24217         uint64_t ret_ref = 0;
24218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24220         return ret_ref;
24221 }
24222
24223 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
24224         LDKUserConfig ret_var = UserConfig_clone(arg);
24225         uint64_t ret_ref = 0;
24226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24228         return ret_ref;
24229 }
24230 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
24231         LDKUserConfig arg_conv;
24232         arg_conv.inner = untag_ptr(arg);
24233         arg_conv.is_owned = ptr_is_owned(arg);
24234         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24235         arg_conv.is_owned = false;
24236         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
24237         return ret_conv;
24238 }
24239
24240 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
24241         LDKUserConfig orig_conv;
24242         orig_conv.inner = untag_ptr(orig);
24243         orig_conv.is_owned = ptr_is_owned(orig);
24244         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24245         orig_conv.is_owned = false;
24246         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
24247         uint64_t ret_ref = 0;
24248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24250         return ret_ref;
24251 }
24252
24253 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
24254         LDKUserConfig ret_var = UserConfig_default();
24255         uint64_t ret_ref = 0;
24256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24258         return ret_ref;
24259 }
24260
24261 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
24262         LDKBestBlock this_obj_conv;
24263         this_obj_conv.inner = untag_ptr(this_obj);
24264         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24266         BestBlock_free(this_obj_conv);
24267 }
24268
24269 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
24270         LDKBestBlock ret_var = BestBlock_clone(arg);
24271         uint64_t ret_ref = 0;
24272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24274         return ret_ref;
24275 }
24276 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
24277         LDKBestBlock arg_conv;
24278         arg_conv.inner = untag_ptr(arg);
24279         arg_conv.is_owned = ptr_is_owned(arg);
24280         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24281         arg_conv.is_owned = false;
24282         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
24283         return ret_conv;
24284 }
24285
24286 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
24287         LDKBestBlock orig_conv;
24288         orig_conv.inner = untag_ptr(orig);
24289         orig_conv.is_owned = ptr_is_owned(orig);
24290         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24291         orig_conv.is_owned = false;
24292         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
24293         uint64_t ret_ref = 0;
24294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24296         return ret_ref;
24297 }
24298
24299 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
24300         LDKBestBlock a_conv;
24301         a_conv.inner = untag_ptr(a);
24302         a_conv.is_owned = ptr_is_owned(a);
24303         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24304         a_conv.is_owned = false;
24305         LDKBestBlock b_conv;
24306         b_conv.inner = untag_ptr(b);
24307         b_conv.is_owned = ptr_is_owned(b);
24308         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24309         b_conv.is_owned = false;
24310         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
24311         return ret_conv;
24312 }
24313
24314 uint64_t  __attribute__((export_name("TS_BestBlock_from_network"))) TS_BestBlock_from_network(uint32_t network) {
24315         LDKNetwork network_conv = LDKNetwork_from_js(network);
24316         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
24317         uint64_t ret_ref = 0;
24318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24320         return ret_ref;
24321 }
24322
24323 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
24324         LDKThirtyTwoBytes block_hash_ref;
24325         CHECK(block_hash->arr_len == 32);
24326         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
24327         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
24328         uint64_t ret_ref = 0;
24329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24331         return ret_ref;
24332 }
24333
24334 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
24335         LDKBestBlock this_arg_conv;
24336         this_arg_conv.inner = untag_ptr(this_arg);
24337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24339         this_arg_conv.is_owned = false;
24340         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24341         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
24342         return ret_arr;
24343 }
24344
24345 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
24346         LDKBestBlock this_arg_conv;
24347         this_arg_conv.inner = untag_ptr(this_arg);
24348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24350         this_arg_conv.is_owned = false;
24351         int32_t ret_conv = BestBlock_height(&this_arg_conv);
24352         return ret_conv;
24353 }
24354
24355 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
24356         if (!ptr_is_owned(this_ptr)) return;
24357         void* this_ptr_ptr = untag_ptr(this_ptr);
24358         CHECK_ACCESS(this_ptr_ptr);
24359         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
24360         FREE(untag_ptr(this_ptr));
24361         Listen_free(this_ptr_conv);
24362 }
24363
24364 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
24365         if (!ptr_is_owned(this_ptr)) return;
24366         void* this_ptr_ptr = untag_ptr(this_ptr);
24367         CHECK_ACCESS(this_ptr_ptr);
24368         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
24369         FREE(untag_ptr(this_ptr));
24370         Confirm_free(this_ptr_conv);
24371 }
24372
24373 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
24374         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
24375         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
24376         return ret_conv;
24377 }
24378
24379 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
24380         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
24381         return ret_conv;
24382 }
24383
24384 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
24385         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
24386         return ret_conv;
24387 }
24388
24389 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_permanent_failure"))) TS_ChannelMonitorUpdateStatus_permanent_failure() {
24390         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_permanent_failure());
24391         return ret_conv;
24392 }
24393
24394 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
24395         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
24396         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
24397         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
24398         return ret_conv;
24399 }
24400
24401 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
24402         if (!ptr_is_owned(this_ptr)) return;
24403         void* this_ptr_ptr = untag_ptr(this_ptr);
24404         CHECK_ACCESS(this_ptr_ptr);
24405         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
24406         FREE(untag_ptr(this_ptr));
24407         Watch_free(this_ptr_conv);
24408 }
24409
24410 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
24411         if (!ptr_is_owned(this_ptr)) return;
24412         void* this_ptr_ptr = untag_ptr(this_ptr);
24413         CHECK_ACCESS(this_ptr_ptr);
24414         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
24415         FREE(untag_ptr(this_ptr));
24416         Filter_free(this_ptr_conv);
24417 }
24418
24419 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
24420         LDKWatchedOutput this_obj_conv;
24421         this_obj_conv.inner = untag_ptr(this_obj);
24422         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24424         WatchedOutput_free(this_obj_conv);
24425 }
24426
24427 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
24428         LDKWatchedOutput this_ptr_conv;
24429         this_ptr_conv.inner = untag_ptr(this_ptr);
24430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24432         this_ptr_conv.is_owned = false;
24433         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24434         memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
24435         return ret_arr;
24436 }
24437
24438 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, int8_tArray val) {
24439         LDKWatchedOutput this_ptr_conv;
24440         this_ptr_conv.inner = untag_ptr(this_ptr);
24441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24443         this_ptr_conv.is_owned = false;
24444         LDKThirtyTwoBytes val_ref;
24445         CHECK(val->arr_len == 32);
24446         memcpy(val_ref.data, val->elems, 32); FREE(val);
24447         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
24448 }
24449
24450 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
24451         LDKWatchedOutput this_ptr_conv;
24452         this_ptr_conv.inner = untag_ptr(this_ptr);
24453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24455         this_ptr_conv.is_owned = false;
24456         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
24457         uint64_t ret_ref = 0;
24458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24460         return ret_ref;
24461 }
24462
24463 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
24464         LDKWatchedOutput this_ptr_conv;
24465         this_ptr_conv.inner = untag_ptr(this_ptr);
24466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24468         this_ptr_conv.is_owned = false;
24469         LDKOutPoint val_conv;
24470         val_conv.inner = untag_ptr(val);
24471         val_conv.is_owned = ptr_is_owned(val);
24472         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24473         val_conv = OutPoint_clone(&val_conv);
24474         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
24475 }
24476
24477 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
24478         LDKWatchedOutput this_ptr_conv;
24479         this_ptr_conv.inner = untag_ptr(this_ptr);
24480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24482         this_ptr_conv.is_owned = false;
24483         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
24484         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24485         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24486         return ret_arr;
24487 }
24488
24489 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
24490         LDKWatchedOutput this_ptr_conv;
24491         this_ptr_conv.inner = untag_ptr(this_ptr);
24492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24494         this_ptr_conv.is_owned = false;
24495         LDKCVec_u8Z val_ref;
24496         val_ref.datalen = val->arr_len;
24497         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
24498         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
24499         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
24500 }
24501
24502 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) {
24503         LDKThirtyTwoBytes block_hash_arg_ref;
24504         CHECK(block_hash_arg->arr_len == 32);
24505         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
24506         LDKOutPoint outpoint_arg_conv;
24507         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
24508         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
24509         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
24510         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
24511         LDKCVec_u8Z script_pubkey_arg_ref;
24512         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
24513         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
24514         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
24515         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
24516         uint64_t ret_ref = 0;
24517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24519         return ret_ref;
24520 }
24521
24522 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
24523         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
24524         uint64_t ret_ref = 0;
24525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24527         return ret_ref;
24528 }
24529 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
24530         LDKWatchedOutput arg_conv;
24531         arg_conv.inner = untag_ptr(arg);
24532         arg_conv.is_owned = ptr_is_owned(arg);
24533         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24534         arg_conv.is_owned = false;
24535         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
24536         return ret_conv;
24537 }
24538
24539 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
24540         LDKWatchedOutput orig_conv;
24541         orig_conv.inner = untag_ptr(orig);
24542         orig_conv.is_owned = ptr_is_owned(orig);
24543         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24544         orig_conv.is_owned = false;
24545         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
24546         uint64_t ret_ref = 0;
24547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24549         return ret_ref;
24550 }
24551
24552 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
24553         LDKWatchedOutput a_conv;
24554         a_conv.inner = untag_ptr(a);
24555         a_conv.is_owned = ptr_is_owned(a);
24556         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24557         a_conv.is_owned = false;
24558         LDKWatchedOutput b_conv;
24559         b_conv.inner = untag_ptr(b);
24560         b_conv.is_owned = ptr_is_owned(b);
24561         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24562         b_conv.is_owned = false;
24563         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
24564         return ret_conv;
24565 }
24566
24567 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
24568         LDKWatchedOutput o_conv;
24569         o_conv.inner = untag_ptr(o);
24570         o_conv.is_owned = ptr_is_owned(o);
24571         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24572         o_conv.is_owned = false;
24573         int64_t ret_conv = WatchedOutput_hash(&o_conv);
24574         return ret_conv;
24575 }
24576
24577 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
24578         if (!ptr_is_owned(this_ptr)) return;
24579         void* this_ptr_ptr = untag_ptr(this_ptr);
24580         CHECK_ACCESS(this_ptr_ptr);
24581         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
24582         FREE(untag_ptr(this_ptr));
24583         BroadcasterInterface_free(this_ptr_conv);
24584 }
24585
24586 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
24587         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
24588         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
24589         return ret_conv;
24590 }
24591
24592 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
24593         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
24594         return ret_conv;
24595 }
24596
24597 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
24598         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
24599         return ret_conv;
24600 }
24601
24602 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
24603         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
24604         return ret_conv;
24605 }
24606
24607 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
24608         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
24609         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
24610         return ret_conv;
24611 }
24612
24613 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
24614         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
24615         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
24616         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
24617         return ret_conv;
24618 }
24619
24620 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
24621         if (!ptr_is_owned(this_ptr)) return;
24622         void* this_ptr_ptr = untag_ptr(this_ptr);
24623         CHECK_ACCESS(this_ptr_ptr);
24624         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
24625         FREE(untag_ptr(this_ptr));
24626         FeeEstimator_free(this_ptr_conv);
24627 }
24628
24629 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
24630         LDKMonitorUpdateId this_obj_conv;
24631         this_obj_conv.inner = untag_ptr(this_obj);
24632         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24634         MonitorUpdateId_free(this_obj_conv);
24635 }
24636
24637 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
24638         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
24639         uint64_t ret_ref = 0;
24640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24642         return ret_ref;
24643 }
24644 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
24645         LDKMonitorUpdateId arg_conv;
24646         arg_conv.inner = untag_ptr(arg);
24647         arg_conv.is_owned = ptr_is_owned(arg);
24648         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24649         arg_conv.is_owned = false;
24650         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
24651         return ret_conv;
24652 }
24653
24654 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
24655         LDKMonitorUpdateId orig_conv;
24656         orig_conv.inner = untag_ptr(orig);
24657         orig_conv.is_owned = ptr_is_owned(orig);
24658         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24659         orig_conv.is_owned = false;
24660         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
24661         uint64_t ret_ref = 0;
24662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24664         return ret_ref;
24665 }
24666
24667 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
24668         LDKMonitorUpdateId o_conv;
24669         o_conv.inner = untag_ptr(o);
24670         o_conv.is_owned = ptr_is_owned(o);
24671         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24672         o_conv.is_owned = false;
24673         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
24674         return ret_conv;
24675 }
24676
24677 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
24678         LDKMonitorUpdateId a_conv;
24679         a_conv.inner = untag_ptr(a);
24680         a_conv.is_owned = ptr_is_owned(a);
24681         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24682         a_conv.is_owned = false;
24683         LDKMonitorUpdateId b_conv;
24684         b_conv.inner = untag_ptr(b);
24685         b_conv.is_owned = ptr_is_owned(b);
24686         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24687         b_conv.is_owned = false;
24688         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
24689         return ret_conv;
24690 }
24691
24692 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
24693         if (!ptr_is_owned(this_ptr)) return;
24694         void* this_ptr_ptr = untag_ptr(this_ptr);
24695         CHECK_ACCESS(this_ptr_ptr);
24696         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
24697         FREE(untag_ptr(this_ptr));
24698         Persist_free(this_ptr_conv);
24699 }
24700
24701 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
24702         LDKLockedChannelMonitor this_obj_conv;
24703         this_obj_conv.inner = untag_ptr(this_obj);
24704         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24706         LockedChannelMonitor_free(this_obj_conv);
24707 }
24708
24709 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
24710         LDKChainMonitor this_obj_conv;
24711         this_obj_conv.inner = untag_ptr(this_obj);
24712         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24714         ChainMonitor_free(this_obj_conv);
24715 }
24716
24717 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) {
24718         void* chain_source_ptr = untag_ptr(chain_source);
24719         CHECK_ACCESS(chain_source_ptr);
24720         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
24721         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
24722         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
24723                 // Manually implement clone for Java trait instances
24724                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
24725                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24726                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
24727                 }
24728         }
24729         void* broadcaster_ptr = untag_ptr(broadcaster);
24730         CHECK_ACCESS(broadcaster_ptr);
24731         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24732         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24733                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24734                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24735         }
24736         void* logger_ptr = untag_ptr(logger);
24737         CHECK_ACCESS(logger_ptr);
24738         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24739         if (logger_conv.free == LDKLogger_JCalls_free) {
24740                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24741                 LDKLogger_JCalls_cloned(&logger_conv);
24742         }
24743         void* feeest_ptr = untag_ptr(feeest);
24744         CHECK_ACCESS(feeest_ptr);
24745         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
24746         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
24747                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24748                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
24749         }
24750         void* persister_ptr = untag_ptr(persister);
24751         CHECK_ACCESS(persister_ptr);
24752         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
24753         if (persister_conv.free == LDKPersist_JCalls_free) {
24754                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24755                 LDKPersist_JCalls_cloned(&persister_conv);
24756         }
24757         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
24758         uint64_t ret_ref = 0;
24759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24761         return ret_ref;
24762 }
24763
24764 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
24765         LDKChainMonitor this_arg_conv;
24766         this_arg_conv.inner = untag_ptr(this_arg);
24767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24769         this_arg_conv.is_owned = false;
24770         LDKCVec_ChannelDetailsZ ignored_channels_constr;
24771         ignored_channels_constr.datalen = ignored_channels->arr_len;
24772         if (ignored_channels_constr.datalen > 0)
24773                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
24774         else
24775                 ignored_channels_constr.data = NULL;
24776         uint64_t* ignored_channels_vals = ignored_channels->elems;
24777         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
24778                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
24779                 LDKChannelDetails ignored_channels_conv_16_conv;
24780                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
24781                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
24782                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
24783                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
24784                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
24785         }
24786         FREE(ignored_channels);
24787         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
24788         uint64_tArray ret_arr = NULL;
24789         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24790         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24791         for (size_t j = 0; j < ret_var.datalen; j++) {
24792                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24793                 *ret_conv_9_copy = ret_var.data[j];
24794                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
24795                 ret_arr_ptr[j] = ret_conv_9_ref;
24796         }
24797         
24798         FREE(ret_var.data);
24799         return ret_arr;
24800 }
24801
24802 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
24803         LDKChainMonitor this_arg_conv;
24804         this_arg_conv.inner = untag_ptr(this_arg);
24805         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24807         this_arg_conv.is_owned = false;
24808         LDKOutPoint funding_txo_conv;
24809         funding_txo_conv.inner = untag_ptr(funding_txo);
24810         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
24811         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
24812         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
24813         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
24814         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
24815         return tag_ptr(ret_conv, true);
24816 }
24817
24818 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
24819         LDKChainMonitor this_arg_conv;
24820         this_arg_conv.inner = untag_ptr(this_arg);
24821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24823         this_arg_conv.is_owned = false;
24824         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
24825         uint64_tArray ret_arr = NULL;
24826         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24827         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24828         for (size_t k = 0; k < ret_var.datalen; k++) {
24829                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
24830                 uint64_t ret_conv_10_ref = 0;
24831                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
24832                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
24833                 ret_arr_ptr[k] = ret_conv_10_ref;
24834         }
24835         
24836         FREE(ret_var.data);
24837         return ret_arr;
24838 }
24839
24840 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
24841         LDKChainMonitor this_arg_conv;
24842         this_arg_conv.inner = untag_ptr(this_arg);
24843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24845         this_arg_conv.is_owned = false;
24846         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
24847         uint64_tArray ret_arr = NULL;
24848         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24849         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24850         for (size_t p = 0; p < ret_var.datalen; p++) {
24851                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
24852                 *ret_conv_41_conv = ret_var.data[p];
24853                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
24854         }
24855         
24856         FREE(ret_var.data);
24857         return ret_arr;
24858 }
24859
24860 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) {
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         LDKOutPoint funding_txo_conv;
24867         funding_txo_conv.inner = untag_ptr(funding_txo);
24868         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
24869         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
24870         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
24871         LDKMonitorUpdateId completed_update_id_conv;
24872         completed_update_id_conv.inner = untag_ptr(completed_update_id);
24873         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
24874         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
24875         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
24876         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24877         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
24878         return tag_ptr(ret_conv, true);
24879 }
24880
24881 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_update_future"))) TS_ChainMonitor_get_update_future(uint64_t this_arg) {
24882         LDKChainMonitor this_arg_conv;
24883         this_arg_conv.inner = untag_ptr(this_arg);
24884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24886         this_arg_conv.is_owned = false;
24887         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
24888         uint64_t ret_ref = 0;
24889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24891         return ret_ref;
24892 }
24893
24894 void  __attribute__((export_name("TS_ChainMonitor_rebroadcast_pending_claims"))) TS_ChainMonitor_rebroadcast_pending_claims(uint64_t this_arg) {
24895         LDKChainMonitor this_arg_conv;
24896         this_arg_conv.inner = untag_ptr(this_arg);
24897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24899         this_arg_conv.is_owned = false;
24900         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
24901 }
24902
24903 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
24904         LDKChainMonitor this_arg_conv;
24905         this_arg_conv.inner = untag_ptr(this_arg);
24906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24908         this_arg_conv.is_owned = false;
24909         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
24910         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
24911         return tag_ptr(ret_ret, true);
24912 }
24913
24914 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(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         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
24921         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
24922         return tag_ptr(ret_ret, true);
24923 }
24924
24925 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
24926         LDKChainMonitor this_arg_conv;
24927         this_arg_conv.inner = untag_ptr(this_arg);
24928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24930         this_arg_conv.is_owned = false;
24931         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
24932         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
24933         return tag_ptr(ret_ret, true);
24934 }
24935
24936 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
24937         LDKChainMonitor this_arg_conv;
24938         this_arg_conv.inner = untag_ptr(this_arg);
24939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24941         this_arg_conv.is_owned = false;
24942         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
24943         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
24944         return tag_ptr(ret_ret, true);
24945 }
24946
24947 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
24948         LDKChannelMonitorUpdate this_obj_conv;
24949         this_obj_conv.inner = untag_ptr(this_obj);
24950         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24952         ChannelMonitorUpdate_free(this_obj_conv);
24953 }
24954
24955 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
24956         LDKChannelMonitorUpdate this_ptr_conv;
24957         this_ptr_conv.inner = untag_ptr(this_ptr);
24958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24960         this_ptr_conv.is_owned = false;
24961         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
24962         return ret_conv;
24963 }
24964
24965 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
24966         LDKChannelMonitorUpdate this_ptr_conv;
24967         this_ptr_conv.inner = untag_ptr(this_ptr);
24968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24970         this_ptr_conv.is_owned = false;
24971         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
24972 }
24973
24974 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
24975         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
24976         uint64_t ret_ref = 0;
24977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24979         return ret_ref;
24980 }
24981 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
24982         LDKChannelMonitorUpdate arg_conv;
24983         arg_conv.inner = untag_ptr(arg);
24984         arg_conv.is_owned = ptr_is_owned(arg);
24985         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24986         arg_conv.is_owned = false;
24987         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
24988         return ret_conv;
24989 }
24990
24991 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
24992         LDKChannelMonitorUpdate orig_conv;
24993         orig_conv.inner = untag_ptr(orig);
24994         orig_conv.is_owned = ptr_is_owned(orig);
24995         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24996         orig_conv.is_owned = false;
24997         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
24998         uint64_t ret_ref = 0;
24999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25001         return ret_ref;
25002 }
25003
25004 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdate_eq"))) TS_ChannelMonitorUpdate_eq(uint64_t a, uint64_t b) {
25005         LDKChannelMonitorUpdate a_conv;
25006         a_conv.inner = untag_ptr(a);
25007         a_conv.is_owned = ptr_is_owned(a);
25008         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25009         a_conv.is_owned = false;
25010         LDKChannelMonitorUpdate b_conv;
25011         b_conv.inner = untag_ptr(b);
25012         b_conv.is_owned = ptr_is_owned(b);
25013         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25014         b_conv.is_owned = false;
25015         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
25016         return ret_conv;
25017 }
25018
25019 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
25020         LDKChannelMonitorUpdate obj_conv;
25021         obj_conv.inner = untag_ptr(obj);
25022         obj_conv.is_owned = ptr_is_owned(obj);
25023         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25024         obj_conv.is_owned = false;
25025         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
25026         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25027         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25028         CVec_u8Z_free(ret_var);
25029         return ret_arr;
25030 }
25031
25032 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
25033         LDKu8slice ser_ref;
25034         ser_ref.datalen = ser->arr_len;
25035         ser_ref.data = ser->elems;
25036         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25037         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
25038         FREE(ser);
25039         return tag_ptr(ret_conv, true);
25040 }
25041
25042 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
25043         if (!ptr_is_owned(this_ptr)) return;
25044         void* this_ptr_ptr = untag_ptr(this_ptr);
25045         CHECK_ACCESS(this_ptr_ptr);
25046         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
25047         FREE(untag_ptr(this_ptr));
25048         MonitorEvent_free(this_ptr_conv);
25049 }
25050
25051 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
25052         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25053         *ret_copy = MonitorEvent_clone(arg);
25054         uint64_t ret_ref = tag_ptr(ret_copy, true);
25055         return ret_ref;
25056 }
25057 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
25058         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
25059         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
25060         return ret_conv;
25061 }
25062
25063 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
25064         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
25065         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25066         *ret_copy = MonitorEvent_clone(orig_conv);
25067         uint64_t ret_ref = tag_ptr(ret_copy, true);
25068         return ret_ref;
25069 }
25070
25071 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
25072         LDKHTLCUpdate a_conv;
25073         a_conv.inner = untag_ptr(a);
25074         a_conv.is_owned = ptr_is_owned(a);
25075         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25076         a_conv = HTLCUpdate_clone(&a_conv);
25077         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25078         *ret_copy = MonitorEvent_htlcevent(a_conv);
25079         uint64_t ret_ref = tag_ptr(ret_copy, true);
25080         return ret_ref;
25081 }
25082
25083 uint64_t  __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint64_t a) {
25084         LDKOutPoint a_conv;
25085         a_conv.inner = untag_ptr(a);
25086         a_conv.is_owned = ptr_is_owned(a);
25087         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25088         a_conv = OutPoint_clone(&a_conv);
25089         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25090         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
25091         uint64_t ret_ref = tag_ptr(ret_copy, true);
25092         return ret_ref;
25093 }
25094
25095 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, int64_t monitor_update_id) {
25096         LDKOutPoint funding_txo_conv;
25097         funding_txo_conv.inner = untag_ptr(funding_txo);
25098         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
25099         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25100         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25101         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25102         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
25103         uint64_t ret_ref = tag_ptr(ret_copy, true);
25104         return ret_ref;
25105 }
25106
25107 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint64_t a) {
25108         LDKOutPoint a_conv;
25109         a_conv.inner = untag_ptr(a);
25110         a_conv.is_owned = ptr_is_owned(a);
25111         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25112         a_conv = OutPoint_clone(&a_conv);
25113         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25114         *ret_copy = MonitorEvent_update_failed(a_conv);
25115         uint64_t ret_ref = tag_ptr(ret_copy, true);
25116         return ret_ref;
25117 }
25118
25119 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
25120         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
25121         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
25122         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
25123         return ret_conv;
25124 }
25125
25126 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
25127         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
25128         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
25129         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25130         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25131         CVec_u8Z_free(ret_var);
25132         return ret_arr;
25133 }
25134
25135 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
25136         LDKu8slice ser_ref;
25137         ser_ref.datalen = ser->arr_len;
25138         ser_ref.data = ser->elems;
25139         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25140         *ret_conv = MonitorEvent_read(ser_ref);
25141         FREE(ser);
25142         return tag_ptr(ret_conv, true);
25143 }
25144
25145 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
25146         LDKHTLCUpdate this_obj_conv;
25147         this_obj_conv.inner = untag_ptr(this_obj);
25148         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25150         HTLCUpdate_free(this_obj_conv);
25151 }
25152
25153 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
25154         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
25155         uint64_t ret_ref = 0;
25156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25158         return ret_ref;
25159 }
25160 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
25161         LDKHTLCUpdate arg_conv;
25162         arg_conv.inner = untag_ptr(arg);
25163         arg_conv.is_owned = ptr_is_owned(arg);
25164         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25165         arg_conv.is_owned = false;
25166         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
25167         return ret_conv;
25168 }
25169
25170 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
25171         LDKHTLCUpdate orig_conv;
25172         orig_conv.inner = untag_ptr(orig);
25173         orig_conv.is_owned = ptr_is_owned(orig);
25174         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25175         orig_conv.is_owned = false;
25176         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
25177         uint64_t ret_ref = 0;
25178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25180         return ret_ref;
25181 }
25182
25183 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
25184         LDKHTLCUpdate a_conv;
25185         a_conv.inner = untag_ptr(a);
25186         a_conv.is_owned = ptr_is_owned(a);
25187         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25188         a_conv.is_owned = false;
25189         LDKHTLCUpdate b_conv;
25190         b_conv.inner = untag_ptr(b);
25191         b_conv.is_owned = ptr_is_owned(b);
25192         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25193         b_conv.is_owned = false;
25194         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
25195         return ret_conv;
25196 }
25197
25198 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
25199         LDKHTLCUpdate obj_conv;
25200         obj_conv.inner = untag_ptr(obj);
25201         obj_conv.is_owned = ptr_is_owned(obj);
25202         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25203         obj_conv.is_owned = false;
25204         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
25205         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25206         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25207         CVec_u8Z_free(ret_var);
25208         return ret_arr;
25209 }
25210
25211 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
25212         LDKu8slice ser_ref;
25213         ser_ref.datalen = ser->arr_len;
25214         ser_ref.data = ser->elems;
25215         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25216         *ret_conv = HTLCUpdate_read(ser_ref);
25217         FREE(ser);
25218         return tag_ptr(ret_conv, true);
25219 }
25220
25221 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
25222         if (!ptr_is_owned(this_ptr)) return;
25223         void* this_ptr_ptr = untag_ptr(this_ptr);
25224         CHECK_ACCESS(this_ptr_ptr);
25225         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
25226         FREE(untag_ptr(this_ptr));
25227         Balance_free(this_ptr_conv);
25228 }
25229
25230 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
25231         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25232         *ret_copy = Balance_clone(arg);
25233         uint64_t ret_ref = tag_ptr(ret_copy, true);
25234         return ret_ref;
25235 }
25236 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
25237         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
25238         int64_t ret_conv = Balance_clone_ptr(arg_conv);
25239         return ret_conv;
25240 }
25241
25242 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
25243         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
25244         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25245         *ret_copy = Balance_clone(orig_conv);
25246         uint64_t ret_ref = tag_ptr(ret_copy, true);
25247         return ret_ref;
25248 }
25249
25250 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
25251         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25252         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
25253         uint64_t ret_ref = tag_ptr(ret_copy, true);
25254         return ret_ref;
25255 }
25256
25257 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
25258         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25259         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
25260         uint64_t ret_ref = tag_ptr(ret_copy, true);
25261         return ret_ref;
25262 }
25263
25264 uint64_t  __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
25265         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25266         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
25267         uint64_t ret_ref = tag_ptr(ret_copy, true);
25268         return ret_ref;
25269 }
25270
25271 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) {
25272         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25273         *ret_copy = Balance_maybe_timeout_claimable_htlc(claimable_amount_satoshis, claimable_height);
25274         uint64_t ret_ref = tag_ptr(ret_copy, true);
25275         return ret_ref;
25276 }
25277
25278 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) {
25279         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25280         *ret_copy = Balance_maybe_preimage_claimable_htlc(claimable_amount_satoshis, expiry_height);
25281         uint64_t ret_ref = tag_ptr(ret_copy, true);
25282         return ret_ref;
25283 }
25284
25285 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t claimable_amount_satoshis) {
25286         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25287         *ret_copy = Balance_counterparty_revoked_output_claimable(claimable_amount_satoshis);
25288         uint64_t ret_ref = tag_ptr(ret_copy, true);
25289         return ret_ref;
25290 }
25291
25292 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
25293         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
25294         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
25295         jboolean ret_conv = Balance_eq(a_conv, b_conv);
25296         return ret_conv;
25297 }
25298
25299 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
25300         LDKChannelMonitor this_obj_conv;
25301         this_obj_conv.inner = untag_ptr(this_obj);
25302         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25304         ChannelMonitor_free(this_obj_conv);
25305 }
25306
25307 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
25308         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
25309         uint64_t ret_ref = 0;
25310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25312         return ret_ref;
25313 }
25314 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
25315         LDKChannelMonitor arg_conv;
25316         arg_conv.inner = untag_ptr(arg);
25317         arg_conv.is_owned = ptr_is_owned(arg);
25318         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25319         arg_conv.is_owned = false;
25320         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
25321         return ret_conv;
25322 }
25323
25324 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
25325         LDKChannelMonitor orig_conv;
25326         orig_conv.inner = untag_ptr(orig);
25327         orig_conv.is_owned = ptr_is_owned(orig);
25328         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25329         orig_conv.is_owned = false;
25330         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
25331         uint64_t ret_ref = 0;
25332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25334         return ret_ref;
25335 }
25336
25337 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
25338         LDKChannelMonitor obj_conv;
25339         obj_conv.inner = untag_ptr(obj);
25340         obj_conv.is_owned = ptr_is_owned(obj);
25341         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25342         obj_conv.is_owned = false;
25343         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
25344         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25345         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25346         CVec_u8Z_free(ret_var);
25347         return ret_arr;
25348 }
25349
25350 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) {
25351         LDKChannelMonitor this_arg_conv;
25352         this_arg_conv.inner = untag_ptr(this_arg);
25353         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25355         this_arg_conv.is_owned = false;
25356         LDKChannelMonitorUpdate updates_conv;
25357         updates_conv.inner = untag_ptr(updates);
25358         updates_conv.is_owned = ptr_is_owned(updates);
25359         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
25360         updates_conv.is_owned = false;
25361         void* broadcaster_ptr = untag_ptr(broadcaster);
25362         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
25363         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
25364         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25365         CHECK_ACCESS(fee_estimator_ptr);
25366         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25367         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25368                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25369                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25370         }
25371         void* logger_ptr = untag_ptr(logger);
25372         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
25373         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25374         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25375         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
25376         return tag_ptr(ret_conv, true);
25377 }
25378
25379 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
25380         LDKChannelMonitor this_arg_conv;
25381         this_arg_conv.inner = untag_ptr(this_arg);
25382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25384         this_arg_conv.is_owned = false;
25385         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
25386         return ret_conv;
25387 }
25388
25389 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
25390         LDKChannelMonitor this_arg_conv;
25391         this_arg_conv.inner = untag_ptr(this_arg);
25392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25394         this_arg_conv.is_owned = false;
25395         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
25396         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
25397         return tag_ptr(ret_conv, true);
25398 }
25399
25400 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
25401         LDKChannelMonitor this_arg_conv;
25402         this_arg_conv.inner = untag_ptr(this_arg);
25403         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25405         this_arg_conv.is_owned = false;
25406         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
25407         uint64_tArray ret_arr = NULL;
25408         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25409         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25410         for (size_t o = 0; o < ret_var.datalen; o++) {
25411                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
25412                 *ret_conv_40_conv = ret_var.data[o];
25413                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
25414         }
25415         
25416         FREE(ret_var.data);
25417         return ret_arr;
25418 }
25419
25420 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
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         void* filter_ptr = untag_ptr(filter);
25427         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
25428         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
25429         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
25430 }
25431
25432 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) {
25433         LDKChannelMonitor this_arg_conv;
25434         this_arg_conv.inner = untag_ptr(this_arg);
25435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25437         this_arg_conv.is_owned = false;
25438         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
25439         uint64_tArray ret_arr = NULL;
25440         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25441         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25442         for (size_t o = 0; o < ret_var.datalen; o++) {
25443                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25444                 *ret_conv_14_copy = ret_var.data[o];
25445                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
25446                 ret_arr_ptr[o] = ret_conv_14_ref;
25447         }
25448         
25449         FREE(ret_var.data);
25450         return ret_arr;
25451 }
25452
25453 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint64_t this_arg) {
25454         LDKChannelMonitor this_arg_conv;
25455         this_arg_conv.inner = untag_ptr(this_arg);
25456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25458         this_arg_conv.is_owned = false;
25459         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
25460         uint64_tArray ret_arr = NULL;
25461         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25462         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25463         for (size_t h = 0; h < ret_var.datalen; h++) {
25464                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25465                 *ret_conv_7_copy = ret_var.data[h];
25466                 uint64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
25467                 ret_arr_ptr[h] = ret_conv_7_ref;
25468         }
25469         
25470         FREE(ret_var.data);
25471         return ret_arr;
25472 }
25473
25474 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
25475         LDKChannelMonitor this_arg_conv;
25476         this_arg_conv.inner = untag_ptr(this_arg);
25477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25479         this_arg_conv.is_owned = false;
25480         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25481         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
25482         return ret_arr;
25483 }
25484
25485 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) {
25486         LDKChannelMonitor this_arg_conv;
25487         this_arg_conv.inner = untag_ptr(this_arg);
25488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25490         this_arg_conv.is_owned = false;
25491         void* logger_ptr = untag_ptr(logger);
25492         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
25493         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25494         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
25495         ptrArray ret_arr = NULL;
25496         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
25497         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
25498         for (size_t m = 0; m < ret_var.datalen; m++) {
25499                 LDKTransaction ret_conv_12_var = ret_var.data[m];
25500                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
25501                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
25502                 Transaction_free(ret_conv_12_var);
25503                 ret_arr_ptr[m] = ret_conv_12_arr;
25504         }
25505         
25506         FREE(ret_var.data);
25507         return ret_arr;
25508 }
25509
25510 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) {
25511         LDKChannelMonitor this_arg_conv;
25512         this_arg_conv.inner = untag_ptr(this_arg);
25513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25515         this_arg_conv.is_owned = false;
25516         uint8_t header_arr[80];
25517         CHECK(header->arr_len == 80);
25518         memcpy(header_arr, header->elems, 80); FREE(header);
25519         uint8_t (*header_ref)[80] = &header_arr;
25520         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25521         txdata_constr.datalen = txdata->arr_len;
25522         if (txdata_constr.datalen > 0)
25523                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25524         else
25525                 txdata_constr.data = NULL;
25526         uint64_t* txdata_vals = txdata->elems;
25527         for (size_t c = 0; c < txdata_constr.datalen; c++) {
25528                 uint64_t txdata_conv_28 = txdata_vals[c];
25529                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
25530                 CHECK_ACCESS(txdata_conv_28_ptr);
25531                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25532                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
25533                 txdata_constr.data[c] = txdata_conv_28_conv;
25534         }
25535         FREE(txdata);
25536         void* broadcaster_ptr = untag_ptr(broadcaster);
25537         CHECK_ACCESS(broadcaster_ptr);
25538         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25539         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25540                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25541                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25542         }
25543         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25544         CHECK_ACCESS(fee_estimator_ptr);
25545         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25546         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25547                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25548                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25549         }
25550         void* logger_ptr = untag_ptr(logger);
25551         CHECK_ACCESS(logger_ptr);
25552         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25553         if (logger_conv.free == LDKLogger_JCalls_free) {
25554                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25555                 LDKLogger_JCalls_cloned(&logger_conv);
25556         }
25557         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);
25558         uint64_tArray ret_arr = NULL;
25559         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25560         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25561         for (size_t n = 0; n < ret_var.datalen; n++) {
25562                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25563                 *ret_conv_39_conv = ret_var.data[n];
25564                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25565         }
25566         
25567         FREE(ret_var.data);
25568         return ret_arr;
25569 }
25570
25571 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) {
25572         LDKChannelMonitor this_arg_conv;
25573         this_arg_conv.inner = untag_ptr(this_arg);
25574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25576         this_arg_conv.is_owned = false;
25577         uint8_t header_arr[80];
25578         CHECK(header->arr_len == 80);
25579         memcpy(header_arr, header->elems, 80); FREE(header);
25580         uint8_t (*header_ref)[80] = &header_arr;
25581         void* broadcaster_ptr = untag_ptr(broadcaster);
25582         CHECK_ACCESS(broadcaster_ptr);
25583         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25584         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25585                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25586                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25587         }
25588         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25589         CHECK_ACCESS(fee_estimator_ptr);
25590         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25591         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25592                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25593                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25594         }
25595         void* logger_ptr = untag_ptr(logger);
25596         CHECK_ACCESS(logger_ptr);
25597         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25598         if (logger_conv.free == LDKLogger_JCalls_free) {
25599                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25600                 LDKLogger_JCalls_cloned(&logger_conv);
25601         }
25602         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25603 }
25604
25605 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) {
25606         LDKChannelMonitor this_arg_conv;
25607         this_arg_conv.inner = untag_ptr(this_arg);
25608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25610         this_arg_conv.is_owned = false;
25611         uint8_t header_arr[80];
25612         CHECK(header->arr_len == 80);
25613         memcpy(header_arr, header->elems, 80); FREE(header);
25614         uint8_t (*header_ref)[80] = &header_arr;
25615         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25616         txdata_constr.datalen = txdata->arr_len;
25617         if (txdata_constr.datalen > 0)
25618                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25619         else
25620                 txdata_constr.data = NULL;
25621         uint64_t* txdata_vals = txdata->elems;
25622         for (size_t c = 0; c < txdata_constr.datalen; c++) {
25623                 uint64_t txdata_conv_28 = txdata_vals[c];
25624                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
25625                 CHECK_ACCESS(txdata_conv_28_ptr);
25626                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25627                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
25628                 txdata_constr.data[c] = txdata_conv_28_conv;
25629         }
25630         FREE(txdata);
25631         void* broadcaster_ptr = untag_ptr(broadcaster);
25632         CHECK_ACCESS(broadcaster_ptr);
25633         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25634         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25635                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25636                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25637         }
25638         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25639         CHECK_ACCESS(fee_estimator_ptr);
25640         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25641         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25642                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25643                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25644         }
25645         void* logger_ptr = untag_ptr(logger);
25646         CHECK_ACCESS(logger_ptr);
25647         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25648         if (logger_conv.free == LDKLogger_JCalls_free) {
25649                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25650                 LDKLogger_JCalls_cloned(&logger_conv);
25651         }
25652         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);
25653         uint64_tArray ret_arr = NULL;
25654         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25655         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25656         for (size_t n = 0; n < ret_var.datalen; n++) {
25657                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25658                 *ret_conv_39_conv = ret_var.data[n];
25659                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25660         }
25661         
25662         FREE(ret_var.data);
25663         return ret_arr;
25664 }
25665
25666 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) {
25667         LDKChannelMonitor this_arg_conv;
25668         this_arg_conv.inner = untag_ptr(this_arg);
25669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25671         this_arg_conv.is_owned = false;
25672         uint8_t txid_arr[32];
25673         CHECK(txid->arr_len == 32);
25674         memcpy(txid_arr, txid->elems, 32); FREE(txid);
25675         uint8_t (*txid_ref)[32] = &txid_arr;
25676         void* broadcaster_ptr = untag_ptr(broadcaster);
25677         CHECK_ACCESS(broadcaster_ptr);
25678         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25679         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25680                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25681                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25682         }
25683         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25684         CHECK_ACCESS(fee_estimator_ptr);
25685         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25686         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25687                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25688                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25689         }
25690         void* logger_ptr = untag_ptr(logger);
25691         CHECK_ACCESS(logger_ptr);
25692         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25693         if (logger_conv.free == LDKLogger_JCalls_free) {
25694                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25695                 LDKLogger_JCalls_cloned(&logger_conv);
25696         }
25697         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
25698 }
25699
25700 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) {
25701         LDKChannelMonitor this_arg_conv;
25702         this_arg_conv.inner = untag_ptr(this_arg);
25703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25705         this_arg_conv.is_owned = false;
25706         uint8_t header_arr[80];
25707         CHECK(header->arr_len == 80);
25708         memcpy(header_arr, header->elems, 80); FREE(header);
25709         uint8_t (*header_ref)[80] = &header_arr;
25710         void* broadcaster_ptr = untag_ptr(broadcaster);
25711         CHECK_ACCESS(broadcaster_ptr);
25712         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25713         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25714                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25715                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25716         }
25717         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25718         CHECK_ACCESS(fee_estimator_ptr);
25719         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25720         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25721                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25722                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25723         }
25724         void* logger_ptr = untag_ptr(logger);
25725         CHECK_ACCESS(logger_ptr);
25726         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25727         if (logger_conv.free == LDKLogger_JCalls_free) {
25728                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25729                 LDKLogger_JCalls_cloned(&logger_conv);
25730         }
25731         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25732         uint64_tArray ret_arr = NULL;
25733         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25734         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25735         for (size_t n = 0; n < ret_var.datalen; n++) {
25736                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25737                 *ret_conv_39_conv = ret_var.data[n];
25738                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25739         }
25740         
25741         FREE(ret_var.data);
25742         return ret_arr;
25743 }
25744
25745 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
25746         LDKChannelMonitor this_arg_conv;
25747         this_arg_conv.inner = untag_ptr(this_arg);
25748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25750         this_arg_conv.is_owned = false;
25751         LDKCVec_C2Tuple_TxidBlockHashZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_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 z = 0; z < ret_var.datalen; z++) {
25756                 LDKC2Tuple_TxidBlockHashZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
25757                 *ret_conv_25_conv = ret_var.data[z];
25758                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
25759         }
25760         
25761         FREE(ret_var.data);
25762         return ret_arr;
25763 }
25764
25765 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(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         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
25772         uint64_t ret_ref = 0;
25773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25775         return ret_ref;
25776 }
25777
25778 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) {
25779         LDKChannelMonitor this_arg_conv;
25780         this_arg_conv.inner = untag_ptr(this_arg);
25781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25783         this_arg_conv.is_owned = false;
25784         void* broadcaster_ptr = untag_ptr(broadcaster);
25785         CHECK_ACCESS(broadcaster_ptr);
25786         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25787         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25788                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25789                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25790         }
25791         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25792         CHECK_ACCESS(fee_estimator_ptr);
25793         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25794         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25795                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25796                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25797         }
25798         void* logger_ptr = untag_ptr(logger);
25799         CHECK_ACCESS(logger_ptr);
25800         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25801         if (logger_conv.free == LDKLogger_JCalls_free) {
25802                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25803                 LDKLogger_JCalls_cloned(&logger_conv);
25804         }
25805         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
25806 }
25807
25808 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
25809         LDKChannelMonitor this_arg_conv;
25810         this_arg_conv.inner = untag_ptr(this_arg);
25811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25813         this_arg_conv.is_owned = false;
25814         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
25815         uint64_tArray ret_arr = NULL;
25816         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25817         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25818         for (size_t j = 0; j < ret_var.datalen; j++) {
25819                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25820                 *ret_conv_9_copy = ret_var.data[j];
25821                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
25822                 ret_arr_ptr[j] = ret_conv_9_ref;
25823         }
25824         
25825         FREE(ret_var.data);
25826         return ret_arr;
25827 }
25828
25829 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b) {
25830         LDKu8slice ser_ref;
25831         ser_ref.datalen = ser->arr_len;
25832         ser_ref.data = ser->elems;
25833         void* arg_a_ptr = untag_ptr(arg_a);
25834         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
25835         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
25836         void* arg_b_ptr = untag_ptr(arg_b);
25837         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
25838         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
25839         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
25840         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
25841         FREE(ser);
25842         return tag_ptr(ret_conv, true);
25843 }
25844
25845 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
25846         LDKOutPoint this_obj_conv;
25847         this_obj_conv.inner = untag_ptr(this_obj);
25848         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25850         OutPoint_free(this_obj_conv);
25851 }
25852
25853 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
25854         LDKOutPoint this_ptr_conv;
25855         this_ptr_conv.inner = untag_ptr(this_ptr);
25856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25858         this_ptr_conv.is_owned = false;
25859         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25860         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
25861         return ret_arr;
25862 }
25863
25864 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
25865         LDKOutPoint this_ptr_conv;
25866         this_ptr_conv.inner = untag_ptr(this_ptr);
25867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25869         this_ptr_conv.is_owned = false;
25870         LDKThirtyTwoBytes val_ref;
25871         CHECK(val->arr_len == 32);
25872         memcpy(val_ref.data, val->elems, 32); FREE(val);
25873         OutPoint_set_txid(&this_ptr_conv, val_ref);
25874 }
25875
25876 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
25877         LDKOutPoint this_ptr_conv;
25878         this_ptr_conv.inner = untag_ptr(this_ptr);
25879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25881         this_ptr_conv.is_owned = false;
25882         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
25883         return ret_conv;
25884 }
25885
25886 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
25887         LDKOutPoint this_ptr_conv;
25888         this_ptr_conv.inner = untag_ptr(this_ptr);
25889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25891         this_ptr_conv.is_owned = false;
25892         OutPoint_set_index(&this_ptr_conv, val);
25893 }
25894
25895 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
25896         LDKThirtyTwoBytes txid_arg_ref;
25897         CHECK(txid_arg->arr_len == 32);
25898         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
25899         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
25900         uint64_t ret_ref = 0;
25901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25903         return ret_ref;
25904 }
25905
25906 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
25907         LDKOutPoint ret_var = OutPoint_clone(arg);
25908         uint64_t ret_ref = 0;
25909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25911         return ret_ref;
25912 }
25913 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
25914         LDKOutPoint arg_conv;
25915         arg_conv.inner = untag_ptr(arg);
25916         arg_conv.is_owned = ptr_is_owned(arg);
25917         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25918         arg_conv.is_owned = false;
25919         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
25920         return ret_conv;
25921 }
25922
25923 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
25924         LDKOutPoint orig_conv;
25925         orig_conv.inner = untag_ptr(orig);
25926         orig_conv.is_owned = ptr_is_owned(orig);
25927         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25928         orig_conv.is_owned = false;
25929         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
25930         uint64_t ret_ref = 0;
25931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25933         return ret_ref;
25934 }
25935
25936 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
25937         LDKOutPoint a_conv;
25938         a_conv.inner = untag_ptr(a);
25939         a_conv.is_owned = ptr_is_owned(a);
25940         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25941         a_conv.is_owned = false;
25942         LDKOutPoint b_conv;
25943         b_conv.inner = untag_ptr(b);
25944         b_conv.is_owned = ptr_is_owned(b);
25945         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25946         b_conv.is_owned = false;
25947         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
25948         return ret_conv;
25949 }
25950
25951 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
25952         LDKOutPoint o_conv;
25953         o_conv.inner = untag_ptr(o);
25954         o_conv.is_owned = ptr_is_owned(o);
25955         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25956         o_conv.is_owned = false;
25957         int64_t ret_conv = OutPoint_hash(&o_conv);
25958         return ret_conv;
25959 }
25960
25961 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
25962         LDKOutPoint this_arg_conv;
25963         this_arg_conv.inner = untag_ptr(this_arg);
25964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25966         this_arg_conv.is_owned = false;
25967         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25968         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
25969         return ret_arr;
25970 }
25971
25972 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
25973         LDKOutPoint obj_conv;
25974         obj_conv.inner = untag_ptr(obj);
25975         obj_conv.is_owned = ptr_is_owned(obj);
25976         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25977         obj_conv.is_owned = false;
25978         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
25979         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25980         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25981         CVec_u8Z_free(ret_var);
25982         return ret_arr;
25983 }
25984
25985 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
25986         LDKu8slice ser_ref;
25987         ser_ref.datalen = ser->arr_len;
25988         ser_ref.data = ser->elems;
25989         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
25990         *ret_conv = OutPoint_read(ser_ref);
25991         FREE(ser);
25992         return tag_ptr(ret_conv, true);
25993 }
25994
25995 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
25996         LDKDelayedPaymentOutputDescriptor this_obj_conv;
25997         this_obj_conv.inner = untag_ptr(this_obj);
25998         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26000         DelayedPaymentOutputDescriptor_free(this_obj_conv);
26001 }
26002
26003 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
26004         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26005         this_ptr_conv.inner = untag_ptr(this_ptr);
26006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26008         this_ptr_conv.is_owned = false;
26009         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26010         uint64_t ret_ref = 0;
26011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26013         return ret_ref;
26014 }
26015
26016 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
26017         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26018         this_ptr_conv.inner = untag_ptr(this_ptr);
26019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26021         this_ptr_conv.is_owned = false;
26022         LDKOutPoint val_conv;
26023         val_conv.inner = untag_ptr(val);
26024         val_conv.is_owned = ptr_is_owned(val);
26025         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26026         val_conv = OutPoint_clone(&val_conv);
26027         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26028 }
26029
26030 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
26031         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26032         this_ptr_conv.inner = untag_ptr(this_ptr);
26033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26035         this_ptr_conv.is_owned = false;
26036         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26037         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
26038         return ret_arr;
26039 }
26040
26041 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
26042         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26043         this_ptr_conv.inner = untag_ptr(this_ptr);
26044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26046         this_ptr_conv.is_owned = false;
26047         LDKPublicKey val_ref;
26048         CHECK(val->arr_len == 33);
26049         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26050         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
26051 }
26052
26053 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
26054         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26055         this_ptr_conv.inner = untag_ptr(this_ptr);
26056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26058         this_ptr_conv.is_owned = false;
26059         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
26060         return ret_conv;
26061 }
26062
26063 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
26064         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26065         this_ptr_conv.inner = untag_ptr(this_ptr);
26066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26068         this_ptr_conv.is_owned = false;
26069         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
26070 }
26071
26072 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
26073         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26074         this_ptr_conv.inner = untag_ptr(this_ptr);
26075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26077         this_ptr_conv.is_owned = false;
26078         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
26079         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
26080         return tag_ptr(ret_ref, true);
26081 }
26082
26083 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_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         void* val_ptr = untag_ptr(val);
26090         CHECK_ACCESS(val_ptr);
26091         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26092         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
26093         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26094 }
26095
26096 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
26097         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26098         this_ptr_conv.inner = untag_ptr(this_ptr);
26099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26101         this_ptr_conv.is_owned = false;
26102         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26103         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
26104         return ret_arr;
26105 }
26106
26107 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
26108         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26109         this_ptr_conv.inner = untag_ptr(this_ptr);
26110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26112         this_ptr_conv.is_owned = false;
26113         LDKPublicKey val_ref;
26114         CHECK(val->arr_len == 33);
26115         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26116         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
26117 }
26118
26119 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
26120         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26121         this_ptr_conv.inner = untag_ptr(this_ptr);
26122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26124         this_ptr_conv.is_owned = false;
26125         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26126         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
26127         return ret_arr;
26128 }
26129
26130 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
26131         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26132         this_ptr_conv.inner = untag_ptr(this_ptr);
26133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26135         this_ptr_conv.is_owned = false;
26136         LDKThirtyTwoBytes val_ref;
26137         CHECK(val->arr_len == 32);
26138         memcpy(val_ref.data, val->elems, 32); FREE(val);
26139         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26140 }
26141
26142 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
26143         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26144         this_ptr_conv.inner = untag_ptr(this_ptr);
26145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26147         this_ptr_conv.is_owned = false;
26148         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26149         return ret_conv;
26150 }
26151
26152 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
26153         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26154         this_ptr_conv.inner = untag_ptr(this_ptr);
26155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26157         this_ptr_conv.is_owned = false;
26158         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26159 }
26160
26161 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) {
26162         LDKOutPoint outpoint_arg_conv;
26163         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
26164         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
26165         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26166         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26167         LDKPublicKey per_commitment_point_arg_ref;
26168         CHECK(per_commitment_point_arg->arr_len == 33);
26169         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
26170         void* output_arg_ptr = untag_ptr(output_arg);
26171         CHECK_ACCESS(output_arg_ptr);
26172         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26173         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
26174         LDKPublicKey revocation_pubkey_arg_ref;
26175         CHECK(revocation_pubkey_arg->arr_len == 33);
26176         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
26177         LDKThirtyTwoBytes channel_keys_id_arg_ref;
26178         CHECK(channel_keys_id_arg->arr_len == 32);
26179         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
26180         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);
26181         uint64_t ret_ref = 0;
26182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26184         return ret_ref;
26185 }
26186
26187 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
26188         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
26189         uint64_t ret_ref = 0;
26190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26192         return ret_ref;
26193 }
26194 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
26195         LDKDelayedPaymentOutputDescriptor arg_conv;
26196         arg_conv.inner = untag_ptr(arg);
26197         arg_conv.is_owned = ptr_is_owned(arg);
26198         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26199         arg_conv.is_owned = false;
26200         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
26201         return ret_conv;
26202 }
26203
26204 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
26205         LDKDelayedPaymentOutputDescriptor orig_conv;
26206         orig_conv.inner = untag_ptr(orig);
26207         orig_conv.is_owned = ptr_is_owned(orig);
26208         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26209         orig_conv.is_owned = false;
26210         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
26211         uint64_t ret_ref = 0;
26212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26214         return ret_ref;
26215 }
26216
26217 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
26218         LDKDelayedPaymentOutputDescriptor a_conv;
26219         a_conv.inner = untag_ptr(a);
26220         a_conv.is_owned = ptr_is_owned(a);
26221         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26222         a_conv.is_owned = false;
26223         LDKDelayedPaymentOutputDescriptor b_conv;
26224         b_conv.inner = untag_ptr(b);
26225         b_conv.is_owned = ptr_is_owned(b);
26226         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26227         b_conv.is_owned = false;
26228         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
26229         return ret_conv;
26230 }
26231
26232 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
26233         LDKDelayedPaymentOutputDescriptor obj_conv;
26234         obj_conv.inner = untag_ptr(obj);
26235         obj_conv.is_owned = ptr_is_owned(obj);
26236         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26237         obj_conv.is_owned = false;
26238         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
26239         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26240         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26241         CVec_u8Z_free(ret_var);
26242         return ret_arr;
26243 }
26244
26245 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
26246         LDKu8slice ser_ref;
26247         ser_ref.datalen = ser->arr_len;
26248         ser_ref.data = ser->elems;
26249         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
26250         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
26251         FREE(ser);
26252         return tag_ptr(ret_conv, true);
26253 }
26254
26255 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
26256         LDKStaticPaymentOutputDescriptor this_obj_conv;
26257         this_obj_conv.inner = untag_ptr(this_obj);
26258         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26260         StaticPaymentOutputDescriptor_free(this_obj_conv);
26261 }
26262
26263 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
26264         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26265         this_ptr_conv.inner = untag_ptr(this_ptr);
26266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26268         this_ptr_conv.is_owned = false;
26269         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26270         uint64_t ret_ref = 0;
26271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26273         return ret_ref;
26274 }
26275
26276 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
26277         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26278         this_ptr_conv.inner = untag_ptr(this_ptr);
26279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26281         this_ptr_conv.is_owned = false;
26282         LDKOutPoint val_conv;
26283         val_conv.inner = untag_ptr(val);
26284         val_conv.is_owned = ptr_is_owned(val);
26285         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26286         val_conv = OutPoint_clone(&val_conv);
26287         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26288 }
26289
26290 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
26291         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26292         this_ptr_conv.inner = untag_ptr(this_ptr);
26293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26295         this_ptr_conv.is_owned = false;
26296         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
26297         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
26298         return tag_ptr(ret_ref, true);
26299 }
26300
26301 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
26302         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26303         this_ptr_conv.inner = untag_ptr(this_ptr);
26304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26306         this_ptr_conv.is_owned = false;
26307         void* val_ptr = untag_ptr(val);
26308         CHECK_ACCESS(val_ptr);
26309         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26310         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
26311         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26312 }
26313
26314 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
26315         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26316         this_ptr_conv.inner = untag_ptr(this_ptr);
26317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26319         this_ptr_conv.is_owned = false;
26320         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26321         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
26322         return ret_arr;
26323 }
26324
26325 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
26326         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26327         this_ptr_conv.inner = untag_ptr(this_ptr);
26328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26330         this_ptr_conv.is_owned = false;
26331         LDKThirtyTwoBytes val_ref;
26332         CHECK(val->arr_len == 32);
26333         memcpy(val_ref.data, val->elems, 32); FREE(val);
26334         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26335 }
26336
26337 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
26338         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26339         this_ptr_conv.inner = untag_ptr(this_ptr);
26340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26342         this_ptr_conv.is_owned = false;
26343         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26344         return ret_conv;
26345 }
26346
26347 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
26348         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26349         this_ptr_conv.inner = untag_ptr(this_ptr);
26350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26352         this_ptr_conv.is_owned = false;
26353         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26354 }
26355
26356 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) {
26357         LDKOutPoint outpoint_arg_conv;
26358         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
26359         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
26360         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26361         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26362         void* output_arg_ptr = untag_ptr(output_arg);
26363         CHECK_ACCESS(output_arg_ptr);
26364         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26365         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
26366         LDKThirtyTwoBytes channel_keys_id_arg_ref;
26367         CHECK(channel_keys_id_arg->arr_len == 32);
26368         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
26369         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
26370         uint64_t ret_ref = 0;
26371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26373         return ret_ref;
26374 }
26375
26376 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
26377         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
26378         uint64_t ret_ref = 0;
26379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26381         return ret_ref;
26382 }
26383 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
26384         LDKStaticPaymentOutputDescriptor arg_conv;
26385         arg_conv.inner = untag_ptr(arg);
26386         arg_conv.is_owned = ptr_is_owned(arg);
26387         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26388         arg_conv.is_owned = false;
26389         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
26390         return ret_conv;
26391 }
26392
26393 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
26394         LDKStaticPaymentOutputDescriptor orig_conv;
26395         orig_conv.inner = untag_ptr(orig);
26396         orig_conv.is_owned = ptr_is_owned(orig);
26397         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26398         orig_conv.is_owned = false;
26399         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
26400         uint64_t ret_ref = 0;
26401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26403         return ret_ref;
26404 }
26405
26406 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
26407         LDKStaticPaymentOutputDescriptor a_conv;
26408         a_conv.inner = untag_ptr(a);
26409         a_conv.is_owned = ptr_is_owned(a);
26410         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26411         a_conv.is_owned = false;
26412         LDKStaticPaymentOutputDescriptor b_conv;
26413         b_conv.inner = untag_ptr(b);
26414         b_conv.is_owned = ptr_is_owned(b);
26415         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26416         b_conv.is_owned = false;
26417         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
26418         return ret_conv;
26419 }
26420
26421 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
26422         LDKStaticPaymentOutputDescriptor obj_conv;
26423         obj_conv.inner = untag_ptr(obj);
26424         obj_conv.is_owned = ptr_is_owned(obj);
26425         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26426         obj_conv.is_owned = false;
26427         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
26428         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26429         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26430         CVec_u8Z_free(ret_var);
26431         return ret_arr;
26432 }
26433
26434 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
26435         LDKu8slice ser_ref;
26436         ser_ref.datalen = ser->arr_len;
26437         ser_ref.data = ser->elems;
26438         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
26439         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
26440         FREE(ser);
26441         return tag_ptr(ret_conv, true);
26442 }
26443
26444 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
26445         if (!ptr_is_owned(this_ptr)) return;
26446         void* this_ptr_ptr = untag_ptr(this_ptr);
26447         CHECK_ACCESS(this_ptr_ptr);
26448         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
26449         FREE(untag_ptr(this_ptr));
26450         SpendableOutputDescriptor_free(this_ptr_conv);
26451 }
26452
26453 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
26454         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26455         *ret_copy = SpendableOutputDescriptor_clone(arg);
26456         uint64_t ret_ref = tag_ptr(ret_copy, true);
26457         return ret_ref;
26458 }
26459 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
26460         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
26461         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
26462         return ret_conv;
26463 }
26464
26465 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
26466         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
26467         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26468         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
26469         uint64_t ret_ref = tag_ptr(ret_copy, true);
26470         return ret_ref;
26471 }
26472
26473 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
26474         LDKOutPoint outpoint_conv;
26475         outpoint_conv.inner = untag_ptr(outpoint);
26476         outpoint_conv.is_owned = ptr_is_owned(outpoint);
26477         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
26478         outpoint_conv = OutPoint_clone(&outpoint_conv);
26479         void* output_ptr = untag_ptr(output);
26480         CHECK_ACCESS(output_ptr);
26481         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
26482         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
26483         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26484         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
26485         uint64_t ret_ref = tag_ptr(ret_copy, true);
26486         return ret_ref;
26487 }
26488
26489 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
26490         LDKDelayedPaymentOutputDescriptor a_conv;
26491         a_conv.inner = untag_ptr(a);
26492         a_conv.is_owned = ptr_is_owned(a);
26493         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26494         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
26495         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26496         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
26497         uint64_t ret_ref = tag_ptr(ret_copy, true);
26498         return ret_ref;
26499 }
26500
26501 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
26502         LDKStaticPaymentOutputDescriptor a_conv;
26503         a_conv.inner = untag_ptr(a);
26504         a_conv.is_owned = ptr_is_owned(a);
26505         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26506         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
26507         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26508         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
26509         uint64_t ret_ref = tag_ptr(ret_copy, true);
26510         return ret_ref;
26511 }
26512
26513 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
26514         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
26515         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
26516         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
26517         return ret_conv;
26518 }
26519
26520 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
26521         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
26522         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
26523         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26524         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26525         CVec_u8Z_free(ret_var);
26526         return ret_arr;
26527 }
26528
26529 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
26530         LDKu8slice ser_ref;
26531         ser_ref.datalen = ser->arr_len;
26532         ser_ref.data = ser->elems;
26533         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
26534         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
26535         FREE(ser);
26536         return tag_ptr(ret_conv, true);
26537 }
26538
26539 void  __attribute__((export_name("TS_ChannelSigner_free"))) TS_ChannelSigner_free(uint64_t this_ptr) {
26540         if (!ptr_is_owned(this_ptr)) return;
26541         void* this_ptr_ptr = untag_ptr(this_ptr);
26542         CHECK_ACCESS(this_ptr_ptr);
26543         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
26544         FREE(untag_ptr(this_ptr));
26545         ChannelSigner_free(this_ptr_conv);
26546 }
26547
26548 void  __attribute__((export_name("TS_EcdsaChannelSigner_free"))) TS_EcdsaChannelSigner_free(uint64_t this_ptr) {
26549         if (!ptr_is_owned(this_ptr)) return;
26550         void* this_ptr_ptr = untag_ptr(this_ptr);
26551         CHECK_ACCESS(this_ptr_ptr);
26552         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
26553         FREE(untag_ptr(this_ptr));
26554         EcdsaChannelSigner_free(this_ptr_conv);
26555 }
26556
26557 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
26558         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
26559         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
26560         return tag_ptr(ret_ret, true);
26561 }
26562 int64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone_ptr"))) TS_WriteableEcdsaChannelSigner_clone_ptr(uint64_t arg) {
26563         void* arg_ptr = untag_ptr(arg);
26564         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
26565         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
26566         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
26567         return ret_conv;
26568 }
26569
26570 uint64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone"))) TS_WriteableEcdsaChannelSigner_clone(uint64_t orig) {
26571         void* orig_ptr = untag_ptr(orig);
26572         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
26573         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
26574         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
26575         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
26576         return tag_ptr(ret_ret, true);
26577 }
26578
26579 void  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_free"))) TS_WriteableEcdsaChannelSigner_free(uint64_t this_ptr) {
26580         if (!ptr_is_owned(this_ptr)) return;
26581         void* this_ptr_ptr = untag_ptr(this_ptr);
26582         CHECK_ACCESS(this_ptr_ptr);
26583         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
26584         FREE(untag_ptr(this_ptr));
26585         WriteableEcdsaChannelSigner_free(this_ptr_conv);
26586 }
26587
26588 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
26589         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
26590         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
26591         return ret_conv;
26592 }
26593
26594 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
26595         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
26596         return ret_conv;
26597 }
26598
26599 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
26600         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
26601         return ret_conv;
26602 }
26603
26604 void  __attribute__((export_name("TS_EntropySource_free"))) TS_EntropySource_free(uint64_t this_ptr) {
26605         if (!ptr_is_owned(this_ptr)) return;
26606         void* this_ptr_ptr = untag_ptr(this_ptr);
26607         CHECK_ACCESS(this_ptr_ptr);
26608         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
26609         FREE(untag_ptr(this_ptr));
26610         EntropySource_free(this_ptr_conv);
26611 }
26612
26613 void  __attribute__((export_name("TS_NodeSigner_free"))) TS_NodeSigner_free(uint64_t this_ptr) {
26614         if (!ptr_is_owned(this_ptr)) return;
26615         void* this_ptr_ptr = untag_ptr(this_ptr);
26616         CHECK_ACCESS(this_ptr_ptr);
26617         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
26618         FREE(untag_ptr(this_ptr));
26619         NodeSigner_free(this_ptr_conv);
26620 }
26621
26622 void  __attribute__((export_name("TS_SignerProvider_free"))) TS_SignerProvider_free(uint64_t this_ptr) {
26623         if (!ptr_is_owned(this_ptr)) return;
26624         void* this_ptr_ptr = untag_ptr(this_ptr);
26625         CHECK_ACCESS(this_ptr_ptr);
26626         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
26627         FREE(untag_ptr(this_ptr));
26628         SignerProvider_free(this_ptr_conv);
26629 }
26630
26631 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
26632         LDKInMemorySigner this_obj_conv;
26633         this_obj_conv.inner = untag_ptr(this_obj);
26634         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26636         InMemorySigner_free(this_obj_conv);
26637 }
26638
26639 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
26640         LDKInMemorySigner this_ptr_conv;
26641         this_ptr_conv.inner = untag_ptr(this_ptr);
26642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26644         this_ptr_conv.is_owned = false;
26645         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26646         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
26647         return ret_arr;
26648 }
26649
26650 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
26651         LDKInMemorySigner this_ptr_conv;
26652         this_ptr_conv.inner = untag_ptr(this_ptr);
26653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26655         this_ptr_conv.is_owned = false;
26656         LDKSecretKey val_ref;
26657         CHECK(val->arr_len == 32);
26658         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26659         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
26660 }
26661
26662 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
26663         LDKInMemorySigner this_ptr_conv;
26664         this_ptr_conv.inner = untag_ptr(this_ptr);
26665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26667         this_ptr_conv.is_owned = false;
26668         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26669         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
26670         return ret_arr;
26671 }
26672
26673 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
26674         LDKInMemorySigner this_ptr_conv;
26675         this_ptr_conv.inner = untag_ptr(this_ptr);
26676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26678         this_ptr_conv.is_owned = false;
26679         LDKSecretKey val_ref;
26680         CHECK(val->arr_len == 32);
26681         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26682         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
26683 }
26684
26685 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
26686         LDKInMemorySigner this_ptr_conv;
26687         this_ptr_conv.inner = untag_ptr(this_ptr);
26688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26690         this_ptr_conv.is_owned = false;
26691         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26692         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
26693         return ret_arr;
26694 }
26695
26696 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
26697         LDKInMemorySigner this_ptr_conv;
26698         this_ptr_conv.inner = untag_ptr(this_ptr);
26699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26701         this_ptr_conv.is_owned = false;
26702         LDKSecretKey val_ref;
26703         CHECK(val->arr_len == 32);
26704         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26705         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
26706 }
26707
26708 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
26709         LDKInMemorySigner this_ptr_conv;
26710         this_ptr_conv.inner = untag_ptr(this_ptr);
26711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26713         this_ptr_conv.is_owned = false;
26714         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26715         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
26716         return ret_arr;
26717 }
26718
26719 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) {
26720         LDKInMemorySigner this_ptr_conv;
26721         this_ptr_conv.inner = untag_ptr(this_ptr);
26722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26724         this_ptr_conv.is_owned = false;
26725         LDKSecretKey val_ref;
26726         CHECK(val->arr_len == 32);
26727         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26728         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
26729 }
26730
26731 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
26732         LDKInMemorySigner this_ptr_conv;
26733         this_ptr_conv.inner = untag_ptr(this_ptr);
26734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26736         this_ptr_conv.is_owned = false;
26737         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26738         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
26739         return ret_arr;
26740 }
26741
26742 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
26743         LDKInMemorySigner this_ptr_conv;
26744         this_ptr_conv.inner = untag_ptr(this_ptr);
26745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26747         this_ptr_conv.is_owned = false;
26748         LDKSecretKey val_ref;
26749         CHECK(val->arr_len == 32);
26750         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26751         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
26752 }
26753
26754 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
26755         LDKInMemorySigner this_ptr_conv;
26756         this_ptr_conv.inner = untag_ptr(this_ptr);
26757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26759         this_ptr_conv.is_owned = false;
26760         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26761         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
26762         return ret_arr;
26763 }
26764
26765 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
26766         LDKInMemorySigner this_ptr_conv;
26767         this_ptr_conv.inner = untag_ptr(this_ptr);
26768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26770         this_ptr_conv.is_owned = false;
26771         LDKThirtyTwoBytes val_ref;
26772         CHECK(val->arr_len == 32);
26773         memcpy(val_ref.data, val->elems, 32); FREE(val);
26774         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
26775 }
26776
26777 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
26778         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
26779         uint64_t ret_ref = 0;
26780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26782         return ret_ref;
26783 }
26784 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
26785         LDKInMemorySigner arg_conv;
26786         arg_conv.inner = untag_ptr(arg);
26787         arg_conv.is_owned = ptr_is_owned(arg);
26788         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26789         arg_conv.is_owned = false;
26790         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
26791         return ret_conv;
26792 }
26793
26794 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
26795         LDKInMemorySigner orig_conv;
26796         orig_conv.inner = untag_ptr(orig);
26797         orig_conv.is_owned = ptr_is_owned(orig);
26798         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26799         orig_conv.is_owned = false;
26800         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
26801         uint64_t ret_ref = 0;
26802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26804         return ret_ref;
26805 }
26806
26807 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) {
26808         LDKSecretKey funding_key_ref;
26809         CHECK(funding_key->arr_len == 32);
26810         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
26811         LDKSecretKey revocation_base_key_ref;
26812         CHECK(revocation_base_key->arr_len == 32);
26813         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
26814         LDKSecretKey payment_key_ref;
26815         CHECK(payment_key->arr_len == 32);
26816         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
26817         LDKSecretKey delayed_payment_base_key_ref;
26818         CHECK(delayed_payment_base_key->arr_len == 32);
26819         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
26820         LDKSecretKey htlc_base_key_ref;
26821         CHECK(htlc_base_key->arr_len == 32);
26822         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
26823         LDKThirtyTwoBytes commitment_seed_ref;
26824         CHECK(commitment_seed->arr_len == 32);
26825         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
26826         LDKThirtyTwoBytes channel_keys_id_ref;
26827         CHECK(channel_keys_id->arr_len == 32);
26828         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
26829         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
26830         CHECK(rand_bytes_unique_start->arr_len == 32);
26831         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
26832         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);
26833         uint64_t ret_ref = 0;
26834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26836         return ret_ref;
26837 }
26838
26839 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
26840         LDKInMemorySigner this_arg_conv;
26841         this_arg_conv.inner = untag_ptr(this_arg);
26842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26844         this_arg_conv.is_owned = false;
26845         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
26846         uint64_t ret_ref = 0;
26847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26849         return ret_ref;
26850 }
26851
26852 int16_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
26853         LDKInMemorySigner this_arg_conv;
26854         this_arg_conv.inner = untag_ptr(this_arg);
26855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26857         this_arg_conv.is_owned = false;
26858         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
26859         return ret_conv;
26860 }
26861
26862 int16_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
26863         LDKInMemorySigner this_arg_conv;
26864         this_arg_conv.inner = untag_ptr(this_arg);
26865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26867         this_arg_conv.is_owned = false;
26868         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
26869         return ret_conv;
26870 }
26871
26872 jboolean  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(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         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
26879         return ret_conv;
26880 }
26881
26882 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(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         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
26889         uint64_t ret_ref = 0;
26890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26892         return ret_ref;
26893 }
26894
26895 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
26896         LDKInMemorySigner this_arg_conv;
26897         this_arg_conv.inner = untag_ptr(this_arg);
26898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26900         this_arg_conv.is_owned = false;
26901         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
26902         uint64_t ret_ref = 0;
26903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26905         return ret_ref;
26906 }
26907
26908 jboolean  __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint64_t this_arg) {
26909         LDKInMemorySigner this_arg_conv;
26910         this_arg_conv.inner = untag_ptr(this_arg);
26911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26913         this_arg_conv.is_owned = false;
26914         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
26915         return ret_conv;
26916 }
26917
26918 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) {
26919         LDKInMemorySigner this_arg_conv;
26920         this_arg_conv.inner = untag_ptr(this_arg);
26921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26923         this_arg_conv.is_owned = false;
26924         LDKTransaction spend_tx_ref;
26925         spend_tx_ref.datalen = spend_tx->arr_len;
26926         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
26927         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
26928         spend_tx_ref.data_is_owned = true;
26929         LDKStaticPaymentOutputDescriptor descriptor_conv;
26930         descriptor_conv.inner = untag_ptr(descriptor);
26931         descriptor_conv.is_owned = ptr_is_owned(descriptor);
26932         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
26933         descriptor_conv.is_owned = false;
26934         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
26935         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
26936         return tag_ptr(ret_conv, true);
26937 }
26938
26939 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) {
26940         LDKInMemorySigner this_arg_conv;
26941         this_arg_conv.inner = untag_ptr(this_arg);
26942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26944         this_arg_conv.is_owned = false;
26945         LDKTransaction spend_tx_ref;
26946         spend_tx_ref.datalen = spend_tx->arr_len;
26947         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
26948         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
26949         spend_tx_ref.data_is_owned = true;
26950         LDKDelayedPaymentOutputDescriptor descriptor_conv;
26951         descriptor_conv.inner = untag_ptr(descriptor);
26952         descriptor_conv.is_owned = ptr_is_owned(descriptor);
26953         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
26954         descriptor_conv.is_owned = false;
26955         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
26956         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
26957         return tag_ptr(ret_conv, true);
26958 }
26959
26960 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EntropySource"))) TS_InMemorySigner_as_EntropySource(uint64_t this_arg) {
26961         LDKInMemorySigner this_arg_conv;
26962         this_arg_conv.inner = untag_ptr(this_arg);
26963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26965         this_arg_conv.is_owned = false;
26966         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
26967         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
26968         return tag_ptr(ret_ret, true);
26969 }
26970
26971 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_ChannelSigner"))) TS_InMemorySigner_as_ChannelSigner(uint64_t this_arg) {
26972         LDKInMemorySigner this_arg_conv;
26973         this_arg_conv.inner = untag_ptr(this_arg);
26974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26976         this_arg_conv.is_owned = false;
26977         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
26978         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
26979         return tag_ptr(ret_ret, true);
26980 }
26981
26982 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EcdsaChannelSigner"))) TS_InMemorySigner_as_EcdsaChannelSigner(uint64_t this_arg) {
26983         LDKInMemorySigner this_arg_conv;
26984         this_arg_conv.inner = untag_ptr(this_arg);
26985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26987         this_arg_conv.is_owned = false;
26988         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
26989         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
26990         return tag_ptr(ret_ret, true);
26991 }
26992
26993 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_WriteableEcdsaChannelSigner"))) TS_InMemorySigner_as_WriteableEcdsaChannelSigner(uint64_t this_arg) {
26994         LDKInMemorySigner this_arg_conv;
26995         this_arg_conv.inner = untag_ptr(this_arg);
26996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26998         this_arg_conv.is_owned = false;
26999         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
27000         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
27001         return tag_ptr(ret_ret, true);
27002 }
27003
27004 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
27005         LDKInMemorySigner obj_conv;
27006         obj_conv.inner = untag_ptr(obj);
27007         obj_conv.is_owned = ptr_is_owned(obj);
27008         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27009         obj_conv.is_owned = false;
27010         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
27011         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27012         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27013         CVec_u8Z_free(ret_var);
27014         return ret_arr;
27015 }
27016
27017 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, uint64_t arg) {
27018         LDKu8slice ser_ref;
27019         ser_ref.datalen = ser->arr_len;
27020         ser_ref.data = ser->elems;
27021         void* arg_ptr = untag_ptr(arg);
27022         CHECK_ACCESS(arg_ptr);
27023         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
27024         if (arg_conv.free == LDKEntropySource_JCalls_free) {
27025                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27026                 LDKEntropySource_JCalls_cloned(&arg_conv);
27027         }
27028         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
27029         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
27030         FREE(ser);
27031         return tag_ptr(ret_conv, true);
27032 }
27033
27034 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
27035         LDKKeysManager this_obj_conv;
27036         this_obj_conv.inner = untag_ptr(this_obj);
27037         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27039         KeysManager_free(this_obj_conv);
27040 }
27041
27042 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
27043         uint8_t seed_arr[32];
27044         CHECK(seed->arr_len == 32);
27045         memcpy(seed_arr, seed->elems, 32); FREE(seed);
27046         uint8_t (*seed_ref)[32] = &seed_arr;
27047         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
27048         uint64_t ret_ref = 0;
27049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27051         return ret_ref;
27052 }
27053
27054 int8_tArray  __attribute__((export_name("TS_KeysManager_get_node_secret_key"))) TS_KeysManager_get_node_secret_key(uint64_t this_arg) {
27055         LDKKeysManager this_arg_conv;
27056         this_arg_conv.inner = untag_ptr(this_arg);
27057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27059         this_arg_conv.is_owned = false;
27060         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27061         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
27062         return ret_arr;
27063 }
27064
27065 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) {
27066         LDKKeysManager this_arg_conv;
27067         this_arg_conv.inner = untag_ptr(this_arg);
27068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27070         this_arg_conv.is_owned = false;
27071         uint8_t params_arr[32];
27072         CHECK(params->arr_len == 32);
27073         memcpy(params_arr, params->elems, 32); FREE(params);
27074         uint8_t (*params_ref)[32] = &params_arr;
27075         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27076         uint64_t ret_ref = 0;
27077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27079         return ret_ref;
27080 }
27081
27082 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) {
27083         LDKKeysManager this_arg_conv;
27084         this_arg_conv.inner = untag_ptr(this_arg);
27085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27087         this_arg_conv.is_owned = false;
27088         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27089         descriptors_constr.datalen = descriptors->arr_len;
27090         if (descriptors_constr.datalen > 0)
27091                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27092         else
27093                 descriptors_constr.data = NULL;
27094         uint64_t* descriptors_vals = descriptors->elems;
27095         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27096                 uint64_t descriptors_conv_27 = descriptors_vals[b];
27097                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
27098                 CHECK_ACCESS(descriptors_conv_27_ptr);
27099                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27100                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
27101                 descriptors_constr.data[b] = descriptors_conv_27_conv;
27102         }
27103         FREE(descriptors);
27104         LDKCVec_TxOutZ outputs_constr;
27105         outputs_constr.datalen = outputs->arr_len;
27106         if (outputs_constr.datalen > 0)
27107                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27108         else
27109                 outputs_constr.data = NULL;
27110         uint64_t* outputs_vals = outputs->elems;
27111         for (size_t h = 0; h < outputs_constr.datalen; h++) {
27112                 uint64_t outputs_conv_7 = outputs_vals[h];
27113                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
27114                 CHECK_ACCESS(outputs_conv_7_ptr);
27115                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27116                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
27117                 outputs_constr.data[h] = outputs_conv_7_conv;
27118         }
27119         FREE(outputs);
27120         LDKCVec_u8Z change_destination_script_ref;
27121         change_destination_script_ref.datalen = change_destination_script->arr_len;
27122         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27123         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
27124         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27125         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27126         return tag_ptr(ret_conv, true);
27127 }
27128
27129 uint64_t  __attribute__((export_name("TS_KeysManager_as_EntropySource"))) TS_KeysManager_as_EntropySource(uint64_t this_arg) {
27130         LDKKeysManager this_arg_conv;
27131         this_arg_conv.inner = untag_ptr(this_arg);
27132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27134         this_arg_conv.is_owned = false;
27135         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
27136         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
27137         return tag_ptr(ret_ret, true);
27138 }
27139
27140 uint64_t  __attribute__((export_name("TS_KeysManager_as_NodeSigner"))) TS_KeysManager_as_NodeSigner(uint64_t this_arg) {
27141         LDKKeysManager this_arg_conv;
27142         this_arg_conv.inner = untag_ptr(this_arg);
27143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27145         this_arg_conv.is_owned = false;
27146         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
27147         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
27148         return tag_ptr(ret_ret, true);
27149 }
27150
27151 uint64_t  __attribute__((export_name("TS_KeysManager_as_SignerProvider"))) TS_KeysManager_as_SignerProvider(uint64_t this_arg) {
27152         LDKKeysManager this_arg_conv;
27153         this_arg_conv.inner = untag_ptr(this_arg);
27154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27156         this_arg_conv.is_owned = false;
27157         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
27158         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
27159         return tag_ptr(ret_ret, true);
27160 }
27161
27162 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
27163         LDKPhantomKeysManager this_obj_conv;
27164         this_obj_conv.inner = untag_ptr(this_obj);
27165         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27167         PhantomKeysManager_free(this_obj_conv);
27168 }
27169
27170 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_EntropySource"))) TS_PhantomKeysManager_as_EntropySource(uint64_t this_arg) {
27171         LDKPhantomKeysManager this_arg_conv;
27172         this_arg_conv.inner = untag_ptr(this_arg);
27173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27175         this_arg_conv.is_owned = false;
27176         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
27177         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
27178         return tag_ptr(ret_ret, true);
27179 }
27180
27181 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_NodeSigner"))) TS_PhantomKeysManager_as_NodeSigner(uint64_t this_arg) {
27182         LDKPhantomKeysManager this_arg_conv;
27183         this_arg_conv.inner = untag_ptr(this_arg);
27184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27186         this_arg_conv.is_owned = false;
27187         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
27188         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
27189         return tag_ptr(ret_ret, true);
27190 }
27191
27192 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_SignerProvider"))) TS_PhantomKeysManager_as_SignerProvider(uint64_t this_arg) {
27193         LDKPhantomKeysManager this_arg_conv;
27194         this_arg_conv.inner = untag_ptr(this_arg);
27195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27197         this_arg_conv.is_owned = false;
27198         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
27199         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
27200         return tag_ptr(ret_ret, true);
27201 }
27202
27203 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) {
27204         uint8_t seed_arr[32];
27205         CHECK(seed->arr_len == 32);
27206         memcpy(seed_arr, seed->elems, 32); FREE(seed);
27207         uint8_t (*seed_ref)[32] = &seed_arr;
27208         uint8_t cross_node_seed_arr[32];
27209         CHECK(cross_node_seed->arr_len == 32);
27210         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
27211         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
27212         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
27213         uint64_t ret_ref = 0;
27214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27216         return ret_ref;
27217 }
27218
27219 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) {
27220         LDKPhantomKeysManager this_arg_conv;
27221         this_arg_conv.inner = untag_ptr(this_arg);
27222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27224         this_arg_conv.is_owned = false;
27225         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27226         descriptors_constr.datalen = descriptors->arr_len;
27227         if (descriptors_constr.datalen > 0)
27228                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27229         else
27230                 descriptors_constr.data = NULL;
27231         uint64_t* descriptors_vals = descriptors->elems;
27232         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27233                 uint64_t descriptors_conv_27 = descriptors_vals[b];
27234                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
27235                 CHECK_ACCESS(descriptors_conv_27_ptr);
27236                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27237                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
27238                 descriptors_constr.data[b] = descriptors_conv_27_conv;
27239         }
27240         FREE(descriptors);
27241         LDKCVec_TxOutZ outputs_constr;
27242         outputs_constr.datalen = outputs->arr_len;
27243         if (outputs_constr.datalen > 0)
27244                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27245         else
27246                 outputs_constr.data = NULL;
27247         uint64_t* outputs_vals = outputs->elems;
27248         for (size_t h = 0; h < outputs_constr.datalen; h++) {
27249                 uint64_t outputs_conv_7 = outputs_vals[h];
27250                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
27251                 CHECK_ACCESS(outputs_conv_7_ptr);
27252                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27253                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
27254                 outputs_constr.data[h] = outputs_conv_7_conv;
27255         }
27256         FREE(outputs);
27257         LDKCVec_u8Z change_destination_script_ref;
27258         change_destination_script_ref.datalen = change_destination_script->arr_len;
27259         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27260         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
27261         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27262         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27263         return tag_ptr(ret_conv, true);
27264 }
27265
27266 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) {
27267         LDKPhantomKeysManager this_arg_conv;
27268         this_arg_conv.inner = untag_ptr(this_arg);
27269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27271         this_arg_conv.is_owned = false;
27272         uint8_t params_arr[32];
27273         CHECK(params->arr_len == 32);
27274         memcpy(params_arr, params->elems, 32); FREE(params);
27275         uint8_t (*params_ref)[32] = &params_arr;
27276         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27277         uint64_t ret_ref = 0;
27278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27280         return ret_ref;
27281 }
27282
27283 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_node_secret_key"))) TS_PhantomKeysManager_get_node_secret_key(uint64_t this_arg) {
27284         LDKPhantomKeysManager this_arg_conv;
27285         this_arg_conv.inner = untag_ptr(this_arg);
27286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27288         this_arg_conv.is_owned = false;
27289         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27290         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
27291         return ret_arr;
27292 }
27293
27294 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_phantom_node_secret_key"))) TS_PhantomKeysManager_get_phantom_node_secret_key(uint64_t this_arg) {
27295         LDKPhantomKeysManager this_arg_conv;
27296         this_arg_conv.inner = untag_ptr(this_arg);
27297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27299         this_arg_conv.is_owned = false;
27300         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27301         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
27302         return ret_arr;
27303 }
27304
27305 uint32_t  __attribute__((export_name("TS_FailureCode_clone"))) TS_FailureCode_clone(uint64_t orig) {
27306         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
27307         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_clone(orig_conv));
27308         return ret_conv;
27309 }
27310
27311 uint32_t  __attribute__((export_name("TS_FailureCode_temporary_node_failure"))) TS_FailureCode_temporary_node_failure() {
27312         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_temporary_node_failure());
27313         return ret_conv;
27314 }
27315
27316 uint32_t  __attribute__((export_name("TS_FailureCode_required_node_feature_missing"))) TS_FailureCode_required_node_feature_missing() {
27317         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_required_node_feature_missing());
27318         return ret_conv;
27319 }
27320
27321 uint32_t  __attribute__((export_name("TS_FailureCode_incorrect_or_unknown_payment_details"))) TS_FailureCode_incorrect_or_unknown_payment_details() {
27322         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_incorrect_or_unknown_payment_details());
27323         return ret_conv;
27324 }
27325
27326 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
27327         LDKChannelManager this_obj_conv;
27328         this_obj_conv.inner = untag_ptr(this_obj);
27329         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27331         ChannelManager_free(this_obj_conv);
27332 }
27333
27334 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
27335         LDKChainParameters this_obj_conv;
27336         this_obj_conv.inner = untag_ptr(this_obj);
27337         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27339         ChainParameters_free(this_obj_conv);
27340 }
27341
27342 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
27343         LDKChainParameters this_ptr_conv;
27344         this_ptr_conv.inner = untag_ptr(this_ptr);
27345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27347         this_ptr_conv.is_owned = false;
27348         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
27349         return ret_conv;
27350 }
27351
27352 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
27353         LDKChainParameters this_ptr_conv;
27354         this_ptr_conv.inner = untag_ptr(this_ptr);
27355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27357         this_ptr_conv.is_owned = false;
27358         LDKNetwork val_conv = LDKNetwork_from_js(val);
27359         ChainParameters_set_network(&this_ptr_conv, val_conv);
27360 }
27361
27362 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(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         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
27369         uint64_t ret_ref = 0;
27370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27372         return ret_ref;
27373 }
27374
27375 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
27376         LDKChainParameters this_ptr_conv;
27377         this_ptr_conv.inner = untag_ptr(this_ptr);
27378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27380         this_ptr_conv.is_owned = false;
27381         LDKBestBlock val_conv;
27382         val_conv.inner = untag_ptr(val);
27383         val_conv.is_owned = ptr_is_owned(val);
27384         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27385         val_conv = BestBlock_clone(&val_conv);
27386         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
27387 }
27388
27389 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
27390         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
27391         LDKBestBlock best_block_arg_conv;
27392         best_block_arg_conv.inner = untag_ptr(best_block_arg);
27393         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
27394         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
27395         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
27396         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
27397         uint64_t ret_ref = 0;
27398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27400         return ret_ref;
27401 }
27402
27403 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
27404         LDKChainParameters ret_var = ChainParameters_clone(arg);
27405         uint64_t ret_ref = 0;
27406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27408         return ret_ref;
27409 }
27410 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
27411         LDKChainParameters arg_conv;
27412         arg_conv.inner = untag_ptr(arg);
27413         arg_conv.is_owned = ptr_is_owned(arg);
27414         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27415         arg_conv.is_owned = false;
27416         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
27417         return ret_conv;
27418 }
27419
27420 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
27421         LDKChainParameters orig_conv;
27422         orig_conv.inner = untag_ptr(orig);
27423         orig_conv.is_owned = ptr_is_owned(orig);
27424         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27425         orig_conv.is_owned = false;
27426         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
27427         uint64_t ret_ref = 0;
27428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27430         return ret_ref;
27431 }
27432
27433 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
27434         LDKCounterpartyForwardingInfo this_obj_conv;
27435         this_obj_conv.inner = untag_ptr(this_obj);
27436         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27438         CounterpartyForwardingInfo_free(this_obj_conv);
27439 }
27440
27441 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
27442         LDKCounterpartyForwardingInfo this_ptr_conv;
27443         this_ptr_conv.inner = untag_ptr(this_ptr);
27444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27446         this_ptr_conv.is_owned = false;
27447         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
27448         return ret_conv;
27449 }
27450
27451 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
27452         LDKCounterpartyForwardingInfo this_ptr_conv;
27453         this_ptr_conv.inner = untag_ptr(this_ptr);
27454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27456         this_ptr_conv.is_owned = false;
27457         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
27458 }
27459
27460 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
27461         LDKCounterpartyForwardingInfo this_ptr_conv;
27462         this_ptr_conv.inner = untag_ptr(this_ptr);
27463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27465         this_ptr_conv.is_owned = false;
27466         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
27467         return ret_conv;
27468 }
27469
27470 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
27471         LDKCounterpartyForwardingInfo this_ptr_conv;
27472         this_ptr_conv.inner = untag_ptr(this_ptr);
27473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27475         this_ptr_conv.is_owned = false;
27476         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
27477 }
27478
27479 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
27480         LDKCounterpartyForwardingInfo this_ptr_conv;
27481         this_ptr_conv.inner = untag_ptr(this_ptr);
27482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27484         this_ptr_conv.is_owned = false;
27485         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
27486         return ret_conv;
27487 }
27488
27489 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
27490         LDKCounterpartyForwardingInfo this_ptr_conv;
27491         this_ptr_conv.inner = untag_ptr(this_ptr);
27492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27494         this_ptr_conv.is_owned = false;
27495         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
27496 }
27497
27498 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) {
27499         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
27500         uint64_t ret_ref = 0;
27501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27503         return ret_ref;
27504 }
27505
27506 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
27507         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
27508         uint64_t ret_ref = 0;
27509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27511         return ret_ref;
27512 }
27513 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
27514         LDKCounterpartyForwardingInfo arg_conv;
27515         arg_conv.inner = untag_ptr(arg);
27516         arg_conv.is_owned = ptr_is_owned(arg);
27517         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27518         arg_conv.is_owned = false;
27519         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
27520         return ret_conv;
27521 }
27522
27523 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
27524         LDKCounterpartyForwardingInfo orig_conv;
27525         orig_conv.inner = untag_ptr(orig);
27526         orig_conv.is_owned = ptr_is_owned(orig);
27527         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27528         orig_conv.is_owned = false;
27529         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
27530         uint64_t ret_ref = 0;
27531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27533         return ret_ref;
27534 }
27535
27536 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
27537         LDKChannelCounterparty this_obj_conv;
27538         this_obj_conv.inner = untag_ptr(this_obj);
27539         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27541         ChannelCounterparty_free(this_obj_conv);
27542 }
27543
27544 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
27545         LDKChannelCounterparty this_ptr_conv;
27546         this_ptr_conv.inner = untag_ptr(this_ptr);
27547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27549         this_ptr_conv.is_owned = false;
27550         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27551         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
27552         return ret_arr;
27553 }
27554
27555 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
27556         LDKChannelCounterparty this_ptr_conv;
27557         this_ptr_conv.inner = untag_ptr(this_ptr);
27558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27560         this_ptr_conv.is_owned = false;
27561         LDKPublicKey val_ref;
27562         CHECK(val->arr_len == 33);
27563         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27564         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
27565 }
27566
27567 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
27568         LDKChannelCounterparty this_ptr_conv;
27569         this_ptr_conv.inner = untag_ptr(this_ptr);
27570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27572         this_ptr_conv.is_owned = false;
27573         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
27574         uint64_t ret_ref = 0;
27575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27577         return ret_ref;
27578 }
27579
27580 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
27581         LDKChannelCounterparty this_ptr_conv;
27582         this_ptr_conv.inner = untag_ptr(this_ptr);
27583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27585         this_ptr_conv.is_owned = false;
27586         LDKInitFeatures val_conv;
27587         val_conv.inner = untag_ptr(val);
27588         val_conv.is_owned = ptr_is_owned(val);
27589         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27590         val_conv = InitFeatures_clone(&val_conv);
27591         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
27592 }
27593
27594 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
27595         LDKChannelCounterparty this_ptr_conv;
27596         this_ptr_conv.inner = untag_ptr(this_ptr);
27597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27599         this_ptr_conv.is_owned = false;
27600         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
27601         return ret_conv;
27602 }
27603
27604 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
27605         LDKChannelCounterparty this_ptr_conv;
27606         this_ptr_conv.inner = untag_ptr(this_ptr);
27607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27609         this_ptr_conv.is_owned = false;
27610         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
27611 }
27612
27613 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
27614         LDKChannelCounterparty this_ptr_conv;
27615         this_ptr_conv.inner = untag_ptr(this_ptr);
27616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27618         this_ptr_conv.is_owned = false;
27619         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
27620         uint64_t ret_ref = 0;
27621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27623         return ret_ref;
27624 }
27625
27626 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
27627         LDKChannelCounterparty this_ptr_conv;
27628         this_ptr_conv.inner = untag_ptr(this_ptr);
27629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27631         this_ptr_conv.is_owned = false;
27632         LDKCounterpartyForwardingInfo val_conv;
27633         val_conv.inner = untag_ptr(val);
27634         val_conv.is_owned = ptr_is_owned(val);
27635         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27636         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
27637         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
27638 }
27639
27640 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
27641         LDKChannelCounterparty this_ptr_conv;
27642         this_ptr_conv.inner = untag_ptr(this_ptr);
27643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27645         this_ptr_conv.is_owned = false;
27646         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27647         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
27648         uint64_t ret_ref = tag_ptr(ret_copy, true);
27649         return ret_ref;
27650 }
27651
27652 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) {
27653         LDKChannelCounterparty this_ptr_conv;
27654         this_ptr_conv.inner = untag_ptr(this_ptr);
27655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27657         this_ptr_conv.is_owned = false;
27658         void* val_ptr = untag_ptr(val);
27659         CHECK_ACCESS(val_ptr);
27660         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27661         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27662         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
27663 }
27664
27665 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
27666         LDKChannelCounterparty this_ptr_conv;
27667         this_ptr_conv.inner = untag_ptr(this_ptr);
27668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27670         this_ptr_conv.is_owned = false;
27671         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27672         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
27673         uint64_t ret_ref = tag_ptr(ret_copy, true);
27674         return ret_ref;
27675 }
27676
27677 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) {
27678         LDKChannelCounterparty this_ptr_conv;
27679         this_ptr_conv.inner = untag_ptr(this_ptr);
27680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27682         this_ptr_conv.is_owned = false;
27683         void* val_ptr = untag_ptr(val);
27684         CHECK_ACCESS(val_ptr);
27685         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27686         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27687         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
27688 }
27689
27690 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) {
27691         LDKPublicKey node_id_arg_ref;
27692         CHECK(node_id_arg->arr_len == 33);
27693         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
27694         LDKInitFeatures features_arg_conv;
27695         features_arg_conv.inner = untag_ptr(features_arg);
27696         features_arg_conv.is_owned = ptr_is_owned(features_arg);
27697         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
27698         features_arg_conv = InitFeatures_clone(&features_arg_conv);
27699         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
27700         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
27701         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
27702         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
27703         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
27704         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
27705         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
27706         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
27707         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
27708         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
27709         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
27710         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
27711         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
27712         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);
27713         uint64_t ret_ref = 0;
27714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27716         return ret_ref;
27717 }
27718
27719 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
27720         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
27721         uint64_t ret_ref = 0;
27722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27724         return ret_ref;
27725 }
27726 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
27727         LDKChannelCounterparty arg_conv;
27728         arg_conv.inner = untag_ptr(arg);
27729         arg_conv.is_owned = ptr_is_owned(arg);
27730         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27731         arg_conv.is_owned = false;
27732         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
27733         return ret_conv;
27734 }
27735
27736 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
27737         LDKChannelCounterparty orig_conv;
27738         orig_conv.inner = untag_ptr(orig);
27739         orig_conv.is_owned = ptr_is_owned(orig);
27740         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27741         orig_conv.is_owned = false;
27742         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
27743         uint64_t ret_ref = 0;
27744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27746         return ret_ref;
27747 }
27748
27749 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
27750         LDKChannelDetails this_obj_conv;
27751         this_obj_conv.inner = untag_ptr(this_obj);
27752         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27754         ChannelDetails_free(this_obj_conv);
27755 }
27756
27757 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
27758         LDKChannelDetails this_ptr_conv;
27759         this_ptr_conv.inner = untag_ptr(this_ptr);
27760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27762         this_ptr_conv.is_owned = false;
27763         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27764         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
27765         return ret_arr;
27766 }
27767
27768 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
27769         LDKChannelDetails this_ptr_conv;
27770         this_ptr_conv.inner = untag_ptr(this_ptr);
27771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27773         this_ptr_conv.is_owned = false;
27774         LDKThirtyTwoBytes val_ref;
27775         CHECK(val->arr_len == 32);
27776         memcpy(val_ref.data, val->elems, 32); FREE(val);
27777         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
27778 }
27779
27780 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
27781         LDKChannelDetails this_ptr_conv;
27782         this_ptr_conv.inner = untag_ptr(this_ptr);
27783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27785         this_ptr_conv.is_owned = false;
27786         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
27787         uint64_t ret_ref = 0;
27788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27790         return ret_ref;
27791 }
27792
27793 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
27794         LDKChannelDetails this_ptr_conv;
27795         this_ptr_conv.inner = untag_ptr(this_ptr);
27796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27798         this_ptr_conv.is_owned = false;
27799         LDKChannelCounterparty val_conv;
27800         val_conv.inner = untag_ptr(val);
27801         val_conv.is_owned = ptr_is_owned(val);
27802         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27803         val_conv = ChannelCounterparty_clone(&val_conv);
27804         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
27805 }
27806
27807 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
27808         LDKChannelDetails this_ptr_conv;
27809         this_ptr_conv.inner = untag_ptr(this_ptr);
27810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27812         this_ptr_conv.is_owned = false;
27813         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
27814         uint64_t ret_ref = 0;
27815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27817         return ret_ref;
27818 }
27819
27820 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
27821         LDKChannelDetails this_ptr_conv;
27822         this_ptr_conv.inner = untag_ptr(this_ptr);
27823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27825         this_ptr_conv.is_owned = false;
27826         LDKOutPoint val_conv;
27827         val_conv.inner = untag_ptr(val);
27828         val_conv.is_owned = ptr_is_owned(val);
27829         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27830         val_conv = OutPoint_clone(&val_conv);
27831         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
27832 }
27833
27834 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
27835         LDKChannelDetails this_ptr_conv;
27836         this_ptr_conv.inner = untag_ptr(this_ptr);
27837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27839         this_ptr_conv.is_owned = false;
27840         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
27841         uint64_t ret_ref = 0;
27842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27844         return ret_ref;
27845 }
27846
27847 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
27848         LDKChannelDetails this_ptr_conv;
27849         this_ptr_conv.inner = untag_ptr(this_ptr);
27850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27852         this_ptr_conv.is_owned = false;
27853         LDKChannelTypeFeatures val_conv;
27854         val_conv.inner = untag_ptr(val);
27855         val_conv.is_owned = ptr_is_owned(val);
27856         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27857         val_conv = ChannelTypeFeatures_clone(&val_conv);
27858         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
27859 }
27860
27861 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
27862         LDKChannelDetails this_ptr_conv;
27863         this_ptr_conv.inner = untag_ptr(this_ptr);
27864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27866         this_ptr_conv.is_owned = false;
27867         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27868         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
27869         uint64_t ret_ref = tag_ptr(ret_copy, true);
27870         return ret_ref;
27871 }
27872
27873 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
27874         LDKChannelDetails this_ptr_conv;
27875         this_ptr_conv.inner = untag_ptr(this_ptr);
27876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27878         this_ptr_conv.is_owned = false;
27879         void* val_ptr = untag_ptr(val);
27880         CHECK_ACCESS(val_ptr);
27881         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27882         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27883         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
27884 }
27885
27886 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
27887         LDKChannelDetails this_ptr_conv;
27888         this_ptr_conv.inner = untag_ptr(this_ptr);
27889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27891         this_ptr_conv.is_owned = false;
27892         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27893         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
27894         uint64_t ret_ref = tag_ptr(ret_copy, true);
27895         return ret_ref;
27896 }
27897
27898 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
27899         LDKChannelDetails this_ptr_conv;
27900         this_ptr_conv.inner = untag_ptr(this_ptr);
27901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27903         this_ptr_conv.is_owned = false;
27904         void* val_ptr = untag_ptr(val);
27905         CHECK_ACCESS(val_ptr);
27906         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27907         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27908         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
27909 }
27910
27911 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
27912         LDKChannelDetails this_ptr_conv;
27913         this_ptr_conv.inner = untag_ptr(this_ptr);
27914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27916         this_ptr_conv.is_owned = false;
27917         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27918         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
27919         uint64_t ret_ref = tag_ptr(ret_copy, true);
27920         return ret_ref;
27921 }
27922
27923 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
27924         LDKChannelDetails this_ptr_conv;
27925         this_ptr_conv.inner = untag_ptr(this_ptr);
27926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27928         this_ptr_conv.is_owned = false;
27929         void* val_ptr = untag_ptr(val);
27930         CHECK_ACCESS(val_ptr);
27931         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27932         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27933         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
27934 }
27935
27936 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
27937         LDKChannelDetails this_ptr_conv;
27938         this_ptr_conv.inner = untag_ptr(this_ptr);
27939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27941         this_ptr_conv.is_owned = false;
27942         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
27943         return ret_conv;
27944 }
27945
27946 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
27947         LDKChannelDetails this_ptr_conv;
27948         this_ptr_conv.inner = untag_ptr(this_ptr);
27949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27951         this_ptr_conv.is_owned = false;
27952         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
27953 }
27954
27955 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
27956         LDKChannelDetails this_ptr_conv;
27957         this_ptr_conv.inner = untag_ptr(this_ptr);
27958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27960         this_ptr_conv.is_owned = false;
27961         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27962         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
27963         uint64_t ret_ref = tag_ptr(ret_copy, true);
27964         return ret_ref;
27965 }
27966
27967 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
27968         LDKChannelDetails this_ptr_conv;
27969         this_ptr_conv.inner = untag_ptr(this_ptr);
27970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27972         this_ptr_conv.is_owned = false;
27973         void* val_ptr = untag_ptr(val);
27974         CHECK_ACCESS(val_ptr);
27975         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27976         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27977         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
27978 }
27979
27980 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
27981         LDKChannelDetails this_ptr_conv;
27982         this_ptr_conv.inner = untag_ptr(this_ptr);
27983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27985         this_ptr_conv.is_owned = false;
27986         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
27987         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
27988         return ret_arr;
27989 }
27990
27991 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
27992         LDKChannelDetails this_ptr_conv;
27993         this_ptr_conv.inner = untag_ptr(this_ptr);
27994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27996         this_ptr_conv.is_owned = false;
27997         LDKU128 val_ref;
27998         CHECK(val->arr_len == 16);
27999         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
28000         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
28001 }
28002
28003 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) {
28004         LDKChannelDetails this_ptr_conv;
28005         this_ptr_conv.inner = untag_ptr(this_ptr);
28006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28008         this_ptr_conv.is_owned = false;
28009         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28010         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
28011         uint64_t ret_ref = tag_ptr(ret_copy, true);
28012         return ret_ref;
28013 }
28014
28015 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) {
28016         LDKChannelDetails this_ptr_conv;
28017         this_ptr_conv.inner = untag_ptr(this_ptr);
28018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28020         this_ptr_conv.is_owned = false;
28021         void* val_ptr = untag_ptr(val);
28022         CHECK_ACCESS(val_ptr);
28023         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28024         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28025         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
28026 }
28027
28028 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
28029         LDKChannelDetails this_ptr_conv;
28030         this_ptr_conv.inner = untag_ptr(this_ptr);
28031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28033         this_ptr_conv.is_owned = false;
28034         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
28035         return ret_conv;
28036 }
28037
28038 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
28039         LDKChannelDetails this_ptr_conv;
28040         this_ptr_conv.inner = untag_ptr(this_ptr);
28041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28043         this_ptr_conv.is_owned = false;
28044         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
28045 }
28046
28047 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
28048         LDKChannelDetails this_ptr_conv;
28049         this_ptr_conv.inner = untag_ptr(this_ptr);
28050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28052         this_ptr_conv.is_owned = false;
28053         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
28054         return ret_conv;
28055 }
28056
28057 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
28058         LDKChannelDetails this_ptr_conv;
28059         this_ptr_conv.inner = untag_ptr(this_ptr);
28060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28062         this_ptr_conv.is_owned = false;
28063         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
28064 }
28065
28066 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) {
28067         LDKChannelDetails this_ptr_conv;
28068         this_ptr_conv.inner = untag_ptr(this_ptr);
28069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28071         this_ptr_conv.is_owned = false;
28072         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
28073         return ret_conv;
28074 }
28075
28076 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) {
28077         LDKChannelDetails this_ptr_conv;
28078         this_ptr_conv.inner = untag_ptr(this_ptr);
28079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28081         this_ptr_conv.is_owned = false;
28082         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
28083 }
28084
28085 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
28086         LDKChannelDetails this_ptr_conv;
28087         this_ptr_conv.inner = untag_ptr(this_ptr);
28088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28090         this_ptr_conv.is_owned = false;
28091         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
28092         return ret_conv;
28093 }
28094
28095 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
28096         LDKChannelDetails this_ptr_conv;
28097         this_ptr_conv.inner = untag_ptr(this_ptr);
28098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28100         this_ptr_conv.is_owned = false;
28101         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
28102 }
28103
28104 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
28105         LDKChannelDetails this_ptr_conv;
28106         this_ptr_conv.inner = untag_ptr(this_ptr);
28107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28109         this_ptr_conv.is_owned = false;
28110         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28111         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
28112         uint64_t ret_ref = tag_ptr(ret_copy, true);
28113         return ret_ref;
28114 }
28115
28116 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
28117         LDKChannelDetails this_ptr_conv;
28118         this_ptr_conv.inner = untag_ptr(this_ptr);
28119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28121         this_ptr_conv.is_owned = false;
28122         void* val_ptr = untag_ptr(val);
28123         CHECK_ACCESS(val_ptr);
28124         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28125         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28126         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
28127 }
28128
28129 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
28130         LDKChannelDetails this_ptr_conv;
28131         this_ptr_conv.inner = untag_ptr(this_ptr);
28132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28134         this_ptr_conv.is_owned = false;
28135         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28136         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
28137         uint64_t ret_ref = tag_ptr(ret_copy, true);
28138         return ret_ref;
28139 }
28140
28141 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
28142         LDKChannelDetails this_ptr_conv;
28143         this_ptr_conv.inner = untag_ptr(this_ptr);
28144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28146         this_ptr_conv.is_owned = false;
28147         void* val_ptr = untag_ptr(val);
28148         CHECK_ACCESS(val_ptr);
28149         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28150         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28151         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
28152 }
28153
28154 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
28155         LDKChannelDetails this_ptr_conv;
28156         this_ptr_conv.inner = untag_ptr(this_ptr);
28157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28159         this_ptr_conv.is_owned = false;
28160         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
28161         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
28162         uint64_t ret_ref = tag_ptr(ret_copy, true);
28163         return ret_ref;
28164 }
28165
28166 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) {
28167         LDKChannelDetails this_ptr_conv;
28168         this_ptr_conv.inner = untag_ptr(this_ptr);
28169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28171         this_ptr_conv.is_owned = false;
28172         void* val_ptr = untag_ptr(val);
28173         CHECK_ACCESS(val_ptr);
28174         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
28175         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
28176         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
28177 }
28178
28179 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
28180         LDKChannelDetails this_ptr_conv;
28181         this_ptr_conv.inner = untag_ptr(this_ptr);
28182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28184         this_ptr_conv.is_owned = false;
28185         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
28186         return ret_conv;
28187 }
28188
28189 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
28190         LDKChannelDetails this_ptr_conv;
28191         this_ptr_conv.inner = untag_ptr(this_ptr);
28192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28194         this_ptr_conv.is_owned = false;
28195         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
28196 }
28197
28198 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
28199         LDKChannelDetails this_ptr_conv;
28200         this_ptr_conv.inner = untag_ptr(this_ptr);
28201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28203         this_ptr_conv.is_owned = false;
28204         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
28205         return ret_conv;
28206 }
28207
28208 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
28209         LDKChannelDetails this_ptr_conv;
28210         this_ptr_conv.inner = untag_ptr(this_ptr);
28211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28213         this_ptr_conv.is_owned = false;
28214         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
28215 }
28216
28217 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
28218         LDKChannelDetails this_ptr_conv;
28219         this_ptr_conv.inner = untag_ptr(this_ptr);
28220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28222         this_ptr_conv.is_owned = false;
28223         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
28224         return ret_conv;
28225 }
28226
28227 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
28228         LDKChannelDetails this_ptr_conv;
28229         this_ptr_conv.inner = untag_ptr(this_ptr);
28230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28232         this_ptr_conv.is_owned = false;
28233         ChannelDetails_set_is_usable(&this_ptr_conv, val);
28234 }
28235
28236 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
28237         LDKChannelDetails this_ptr_conv;
28238         this_ptr_conv.inner = untag_ptr(this_ptr);
28239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28241         this_ptr_conv.is_owned = false;
28242         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
28243         return ret_conv;
28244 }
28245
28246 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
28247         LDKChannelDetails this_ptr_conv;
28248         this_ptr_conv.inner = untag_ptr(this_ptr);
28249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28251         this_ptr_conv.is_owned = false;
28252         ChannelDetails_set_is_public(&this_ptr_conv, val);
28253 }
28254
28255 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
28256         LDKChannelDetails this_ptr_conv;
28257         this_ptr_conv.inner = untag_ptr(this_ptr);
28258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28260         this_ptr_conv.is_owned = false;
28261         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28262         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
28263         uint64_t ret_ref = tag_ptr(ret_copy, true);
28264         return ret_ref;
28265 }
28266
28267 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) {
28268         LDKChannelDetails this_ptr_conv;
28269         this_ptr_conv.inner = untag_ptr(this_ptr);
28270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28272         this_ptr_conv.is_owned = false;
28273         void* val_ptr = untag_ptr(val);
28274         CHECK_ACCESS(val_ptr);
28275         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28276         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28277         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
28278 }
28279
28280 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
28281         LDKChannelDetails this_ptr_conv;
28282         this_ptr_conv.inner = untag_ptr(this_ptr);
28283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28285         this_ptr_conv.is_owned = false;
28286         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28287         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
28288         uint64_t ret_ref = tag_ptr(ret_copy, true);
28289         return ret_ref;
28290 }
28291
28292 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_htlc_maximum_msat"))) TS_ChannelDetails_set_inbound_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
28293         LDKChannelDetails this_ptr_conv;
28294         this_ptr_conv.inner = untag_ptr(this_ptr);
28295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28297         this_ptr_conv.is_owned = false;
28298         void* val_ptr = untag_ptr(val);
28299         CHECK_ACCESS(val_ptr);
28300         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28301         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28302         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
28303 }
28304
28305 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
28306         LDKChannelDetails this_ptr_conv;
28307         this_ptr_conv.inner = untag_ptr(this_ptr);
28308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28310         this_ptr_conv.is_owned = false;
28311         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
28312         uint64_t ret_ref = 0;
28313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28315         return ret_ref;
28316 }
28317
28318 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
28319         LDKChannelDetails this_ptr_conv;
28320         this_ptr_conv.inner = untag_ptr(this_ptr);
28321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28323         this_ptr_conv.is_owned = false;
28324         LDKChannelConfig val_conv;
28325         val_conv.inner = untag_ptr(val);
28326         val_conv.is_owned = ptr_is_owned(val);
28327         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28328         val_conv = ChannelConfig_clone(&val_conv);
28329         ChannelDetails_set_config(&this_ptr_conv, val_conv);
28330 }
28331
28332 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) {
28333         LDKThirtyTwoBytes channel_id_arg_ref;
28334         CHECK(channel_id_arg->arr_len == 32);
28335         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28336         LDKChannelCounterparty counterparty_arg_conv;
28337         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
28338         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
28339         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
28340         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
28341         LDKOutPoint funding_txo_arg_conv;
28342         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
28343         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
28344         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
28345         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
28346         LDKChannelTypeFeatures channel_type_arg_conv;
28347         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
28348         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
28349         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
28350         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
28351         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
28352         CHECK_ACCESS(short_channel_id_arg_ptr);
28353         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
28354         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
28355         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
28356         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
28357         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
28358         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
28359         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
28360         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
28361         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
28362         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
28363         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
28364         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
28365         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
28366         LDKU128 user_channel_id_arg_ref;
28367         CHECK(user_channel_id_arg->arr_len == 16);
28368         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
28369         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
28370         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
28371         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
28372         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
28373         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
28374         CHECK_ACCESS(confirmations_required_arg_ptr);
28375         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
28376         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
28377         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
28378         CHECK_ACCESS(confirmations_arg_ptr);
28379         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
28380         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
28381         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
28382         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
28383         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
28384         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
28385         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
28386         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
28387         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
28388         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
28389         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
28390         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
28391         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
28392         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
28393         LDKChannelConfig config_arg_conv;
28394         config_arg_conv.inner = untag_ptr(config_arg);
28395         config_arg_conv.is_owned = ptr_is_owned(config_arg);
28396         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
28397         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
28398         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);
28399         uint64_t ret_ref = 0;
28400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28402         return ret_ref;
28403 }
28404
28405 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
28406         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
28407         uint64_t ret_ref = 0;
28408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28410         return ret_ref;
28411 }
28412 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
28413         LDKChannelDetails arg_conv;
28414         arg_conv.inner = untag_ptr(arg);
28415         arg_conv.is_owned = ptr_is_owned(arg);
28416         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28417         arg_conv.is_owned = false;
28418         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
28419         return ret_conv;
28420 }
28421
28422 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
28423         LDKChannelDetails orig_conv;
28424         orig_conv.inner = untag_ptr(orig);
28425         orig_conv.is_owned = ptr_is_owned(orig);
28426         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28427         orig_conv.is_owned = false;
28428         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
28429         uint64_t ret_ref = 0;
28430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28432         return ret_ref;
28433 }
28434
28435 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
28436         LDKChannelDetails this_arg_conv;
28437         this_arg_conv.inner = untag_ptr(this_arg);
28438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28440         this_arg_conv.is_owned = false;
28441         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28442         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
28443         uint64_t ret_ref = tag_ptr(ret_copy, true);
28444         return ret_ref;
28445 }
28446
28447 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
28448         LDKChannelDetails this_arg_conv;
28449         this_arg_conv.inner = untag_ptr(this_arg);
28450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28452         this_arg_conv.is_owned = false;
28453         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28454         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
28455         uint64_t ret_ref = tag_ptr(ret_copy, true);
28456         return ret_ref;
28457 }
28458
28459 void  __attribute__((export_name("TS_RecentPaymentDetails_free"))) TS_RecentPaymentDetails_free(uint64_t this_ptr) {
28460         if (!ptr_is_owned(this_ptr)) return;
28461         void* this_ptr_ptr = untag_ptr(this_ptr);
28462         CHECK_ACCESS(this_ptr_ptr);
28463         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
28464         FREE(untag_ptr(this_ptr));
28465         RecentPaymentDetails_free(this_ptr_conv);
28466 }
28467
28468 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
28469         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28470         *ret_copy = RecentPaymentDetails_clone(arg);
28471         uint64_t ret_ref = tag_ptr(ret_copy, true);
28472         return ret_ref;
28473 }
28474 int64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone_ptr"))) TS_RecentPaymentDetails_clone_ptr(uint64_t arg) {
28475         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
28476         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
28477         return ret_conv;
28478 }
28479
28480 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone"))) TS_RecentPaymentDetails_clone(uint64_t orig) {
28481         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
28482         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28483         *ret_copy = RecentPaymentDetails_clone(orig_conv);
28484         uint64_t ret_ref = tag_ptr(ret_copy, true);
28485         return ret_ref;
28486 }
28487
28488 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_pending"))) TS_RecentPaymentDetails_pending(int8_tArray payment_hash, int64_t total_msat) {
28489         LDKThirtyTwoBytes payment_hash_ref;
28490         CHECK(payment_hash->arr_len == 32);
28491         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28492         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28493         *ret_copy = RecentPaymentDetails_pending(payment_hash_ref, total_msat);
28494         uint64_t ret_ref = tag_ptr(ret_copy, true);
28495         return ret_ref;
28496 }
28497
28498 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_fulfilled"))) TS_RecentPaymentDetails_fulfilled(int8_tArray payment_hash) {
28499         LDKThirtyTwoBytes payment_hash_ref;
28500         CHECK(payment_hash->arr_len == 32);
28501         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28502         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28503         *ret_copy = RecentPaymentDetails_fulfilled(payment_hash_ref);
28504         uint64_t ret_ref = tag_ptr(ret_copy, true);
28505         return ret_ref;
28506 }
28507
28508 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_abandoned"))) TS_RecentPaymentDetails_abandoned(int8_tArray payment_hash) {
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_abandoned(payment_hash_ref);
28514         uint64_t ret_ref = tag_ptr(ret_copy, true);
28515         return ret_ref;
28516 }
28517
28518 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
28519         LDKPhantomRouteHints this_obj_conv;
28520         this_obj_conv.inner = untag_ptr(this_obj);
28521         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28523         PhantomRouteHints_free(this_obj_conv);
28524 }
28525
28526 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
28527         LDKPhantomRouteHints this_ptr_conv;
28528         this_ptr_conv.inner = untag_ptr(this_ptr);
28529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28531         this_ptr_conv.is_owned = false;
28532         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
28533         uint64_tArray ret_arr = NULL;
28534         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28535         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28536         for (size_t q = 0; q < ret_var.datalen; q++) {
28537                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28538                 uint64_t ret_conv_16_ref = 0;
28539                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28540                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28541                 ret_arr_ptr[q] = ret_conv_16_ref;
28542         }
28543         
28544         FREE(ret_var.data);
28545         return ret_arr;
28546 }
28547
28548 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
28549         LDKPhantomRouteHints this_ptr_conv;
28550         this_ptr_conv.inner = untag_ptr(this_ptr);
28551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28553         this_ptr_conv.is_owned = false;
28554         LDKCVec_ChannelDetailsZ val_constr;
28555         val_constr.datalen = val->arr_len;
28556         if (val_constr.datalen > 0)
28557                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28558         else
28559                 val_constr.data = NULL;
28560         uint64_t* val_vals = val->elems;
28561         for (size_t q = 0; q < val_constr.datalen; q++) {
28562                 uint64_t val_conv_16 = val_vals[q];
28563                 LDKChannelDetails val_conv_16_conv;
28564                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
28565                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
28566                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
28567                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
28568                 val_constr.data[q] = val_conv_16_conv;
28569         }
28570         FREE(val);
28571         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
28572 }
28573
28574 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
28575         LDKPhantomRouteHints this_ptr_conv;
28576         this_ptr_conv.inner = untag_ptr(this_ptr);
28577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28579         this_ptr_conv.is_owned = false;
28580         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
28581         return ret_conv;
28582 }
28583
28584 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
28585         LDKPhantomRouteHints this_ptr_conv;
28586         this_ptr_conv.inner = untag_ptr(this_ptr);
28587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28589         this_ptr_conv.is_owned = false;
28590         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
28591 }
28592
28593 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
28594         LDKPhantomRouteHints this_ptr_conv;
28595         this_ptr_conv.inner = untag_ptr(this_ptr);
28596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28598         this_ptr_conv.is_owned = false;
28599         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28600         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
28601         return ret_arr;
28602 }
28603
28604 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray 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         LDKPublicKey val_ref;
28611         CHECK(val->arr_len == 33);
28612         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28613         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
28614 }
28615
28616 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) {
28617         LDKCVec_ChannelDetailsZ channels_arg_constr;
28618         channels_arg_constr.datalen = channels_arg->arr_len;
28619         if (channels_arg_constr.datalen > 0)
28620                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28621         else
28622                 channels_arg_constr.data = NULL;
28623         uint64_t* channels_arg_vals = channels_arg->elems;
28624         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
28625                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
28626                 LDKChannelDetails channels_arg_conv_16_conv;
28627                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
28628                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
28629                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
28630                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
28631                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
28632         }
28633         FREE(channels_arg);
28634         LDKPublicKey real_node_pubkey_arg_ref;
28635         CHECK(real_node_pubkey_arg->arr_len == 33);
28636         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
28637         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
28638         uint64_t ret_ref = 0;
28639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28641         return ret_ref;
28642 }
28643
28644 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
28645         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
28646         uint64_t ret_ref = 0;
28647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28649         return ret_ref;
28650 }
28651 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
28652         LDKPhantomRouteHints arg_conv;
28653         arg_conv.inner = untag_ptr(arg);
28654         arg_conv.is_owned = ptr_is_owned(arg);
28655         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28656         arg_conv.is_owned = false;
28657         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
28658         return ret_conv;
28659 }
28660
28661 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
28662         LDKPhantomRouteHints orig_conv;
28663         orig_conv.inner = untag_ptr(orig);
28664         orig_conv.is_owned = ptr_is_owned(orig);
28665         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28666         orig_conv.is_owned = false;
28667         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
28668         uint64_t ret_ref = 0;
28669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28671         return ret_ref;
28672 }
28673
28674 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) {
28675         void* fee_est_ptr = untag_ptr(fee_est);
28676         CHECK_ACCESS(fee_est_ptr);
28677         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
28678         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
28679                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28680                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
28681         }
28682         void* chain_monitor_ptr = untag_ptr(chain_monitor);
28683         CHECK_ACCESS(chain_monitor_ptr);
28684         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
28685         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
28686                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28687                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
28688         }
28689         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
28690         CHECK_ACCESS(tx_broadcaster_ptr);
28691         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
28692         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28693                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28694                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
28695         }
28696         void* router_ptr = untag_ptr(router);
28697         CHECK_ACCESS(router_ptr);
28698         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
28699         if (router_conv.free == LDKRouter_JCalls_free) {
28700                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28701                 LDKRouter_JCalls_cloned(&router_conv);
28702         }
28703         void* logger_ptr = untag_ptr(logger);
28704         CHECK_ACCESS(logger_ptr);
28705         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28706         if (logger_conv.free == LDKLogger_JCalls_free) {
28707                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28708                 LDKLogger_JCalls_cloned(&logger_conv);
28709         }
28710         void* entropy_source_ptr = untag_ptr(entropy_source);
28711         CHECK_ACCESS(entropy_source_ptr);
28712         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
28713         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
28714                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28715                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
28716         }
28717         void* node_signer_ptr = untag_ptr(node_signer);
28718         CHECK_ACCESS(node_signer_ptr);
28719         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
28720         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
28721                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28722                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
28723         }
28724         void* signer_provider_ptr = untag_ptr(signer_provider);
28725         CHECK_ACCESS(signer_provider_ptr);
28726         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
28727         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
28728                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28729                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
28730         }
28731         LDKUserConfig config_conv;
28732         config_conv.inner = untag_ptr(config);
28733         config_conv.is_owned = ptr_is_owned(config);
28734         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
28735         config_conv = UserConfig_clone(&config_conv);
28736         LDKChainParameters params_conv;
28737         params_conv.inner = untag_ptr(params);
28738         params_conv.is_owned = ptr_is_owned(params);
28739         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
28740         params_conv = ChainParameters_clone(&params_conv);
28741         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);
28742         uint64_t ret_ref = 0;
28743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28745         return ret_ref;
28746 }
28747
28748 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
28749         LDKChannelManager this_arg_conv;
28750         this_arg_conv.inner = untag_ptr(this_arg);
28751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28753         this_arg_conv.is_owned = false;
28754         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
28755         uint64_t ret_ref = 0;
28756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28758         return ret_ref;
28759 }
28760
28761 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) {
28762         LDKChannelManager this_arg_conv;
28763         this_arg_conv.inner = untag_ptr(this_arg);
28764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28766         this_arg_conv.is_owned = false;
28767         LDKPublicKey their_network_key_ref;
28768         CHECK(their_network_key->arr_len == 33);
28769         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
28770         LDKU128 user_channel_id_ref;
28771         CHECK(user_channel_id->arr_len == 16);
28772         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
28773         LDKUserConfig override_config_conv;
28774         override_config_conv.inner = untag_ptr(override_config);
28775         override_config_conv.is_owned = ptr_is_owned(override_config);
28776         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
28777         override_config_conv = UserConfig_clone(&override_config_conv);
28778         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
28779         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
28780         return tag_ptr(ret_conv, true);
28781 }
28782
28783 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
28784         LDKChannelManager this_arg_conv;
28785         this_arg_conv.inner = untag_ptr(this_arg);
28786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28788         this_arg_conv.is_owned = false;
28789         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
28790         uint64_tArray ret_arr = NULL;
28791         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28792         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28793         for (size_t q = 0; q < ret_var.datalen; q++) {
28794                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28795                 uint64_t ret_conv_16_ref = 0;
28796                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28797                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28798                 ret_arr_ptr[q] = ret_conv_16_ref;
28799         }
28800         
28801         FREE(ret_var.data);
28802         return ret_arr;
28803 }
28804
28805 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
28806         LDKChannelManager this_arg_conv;
28807         this_arg_conv.inner = untag_ptr(this_arg);
28808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28810         this_arg_conv.is_owned = false;
28811         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
28812         uint64_tArray ret_arr = NULL;
28813         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28814         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28815         for (size_t q = 0; q < ret_var.datalen; q++) {
28816                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28817                 uint64_t ret_conv_16_ref = 0;
28818                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28819                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28820                 ret_arr_ptr[q] = ret_conv_16_ref;
28821         }
28822         
28823         FREE(ret_var.data);
28824         return ret_arr;
28825 }
28826
28827 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) {
28828         LDKChannelManager this_arg_conv;
28829         this_arg_conv.inner = untag_ptr(this_arg);
28830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28832         this_arg_conv.is_owned = false;
28833         LDKPublicKey counterparty_node_id_ref;
28834         CHECK(counterparty_node_id->arr_len == 33);
28835         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28836         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
28837         uint64_tArray ret_arr = NULL;
28838         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28839         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28840         for (size_t q = 0; q < ret_var.datalen; q++) {
28841                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28842                 uint64_t ret_conv_16_ref = 0;
28843                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28844                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28845                 ret_arr_ptr[q] = ret_conv_16_ref;
28846         }
28847         
28848         FREE(ret_var.data);
28849         return ret_arr;
28850 }
28851
28852 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_recent_payments"))) TS_ChannelManager_list_recent_payments(uint64_t this_arg) {
28853         LDKChannelManager this_arg_conv;
28854         this_arg_conv.inner = untag_ptr(this_arg);
28855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28857         this_arg_conv.is_owned = false;
28858         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
28859         uint64_tArray ret_arr = NULL;
28860         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28861         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28862         for (size_t w = 0; w < ret_var.datalen; w++) {
28863                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
28864                 *ret_conv_22_copy = ret_var.data[w];
28865                 uint64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
28866                 ret_arr_ptr[w] = ret_conv_22_ref;
28867         }
28868         
28869         FREE(ret_var.data);
28870         return ret_arr;
28871 }
28872
28873 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) {
28874         LDKChannelManager this_arg_conv;
28875         this_arg_conv.inner = untag_ptr(this_arg);
28876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28878         this_arg_conv.is_owned = false;
28879         uint8_t channel_id_arr[32];
28880         CHECK(channel_id->arr_len == 32);
28881         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28882         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
28883         LDKPublicKey counterparty_node_id_ref;
28884         CHECK(counterparty_node_id->arr_len == 33);
28885         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28886         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28887         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28888         return tag_ptr(ret_conv, true);
28889 }
28890
28891 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) {
28892         LDKChannelManager this_arg_conv;
28893         this_arg_conv.inner = untag_ptr(this_arg);
28894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28896         this_arg_conv.is_owned = false;
28897         uint8_t channel_id_arr[32];
28898         CHECK(channel_id->arr_len == 32);
28899         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28900         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
28901         LDKPublicKey counterparty_node_id_ref;
28902         CHECK(counterparty_node_id->arr_len == 33);
28903         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28904         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28905         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
28906         return tag_ptr(ret_conv, true);
28907 }
28908
28909 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) {
28910         LDKChannelManager this_arg_conv;
28911         this_arg_conv.inner = untag_ptr(this_arg);
28912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28914         this_arg_conv.is_owned = false;
28915         uint8_t channel_id_arr[32];
28916         CHECK(channel_id->arr_len == 32);
28917         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28918         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
28919         LDKPublicKey counterparty_node_id_ref;
28920         CHECK(counterparty_node_id->arr_len == 33);
28921         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28922         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28923         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28924         return tag_ptr(ret_conv, true);
28925 }
28926
28927 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) {
28928         LDKChannelManager this_arg_conv;
28929         this_arg_conv.inner = untag_ptr(this_arg);
28930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28932         this_arg_conv.is_owned = false;
28933         uint8_t channel_id_arr[32];
28934         CHECK(channel_id->arr_len == 32);
28935         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28936         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
28937         LDKPublicKey counterparty_node_id_ref;
28938         CHECK(counterparty_node_id->arr_len == 33);
28939         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28940         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28941         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28942         return tag_ptr(ret_conv, true);
28943 }
28944
28945 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) {
28946         LDKChannelManager this_arg_conv;
28947         this_arg_conv.inner = untag_ptr(this_arg);
28948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28950         this_arg_conv.is_owned = false;
28951         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
28952 }
28953
28954 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) {
28955         LDKChannelManager this_arg_conv;
28956         this_arg_conv.inner = untag_ptr(this_arg);
28957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28959         this_arg_conv.is_owned = false;
28960         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
28961 }
28962
28963 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) {
28964         LDKChannelManager this_arg_conv;
28965         this_arg_conv.inner = untag_ptr(this_arg);
28966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28968         this_arg_conv.is_owned = false;
28969         LDKRoute route_conv;
28970         route_conv.inner = untag_ptr(route);
28971         route_conv.is_owned = ptr_is_owned(route);
28972         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
28973         route_conv.is_owned = false;
28974         LDKThirtyTwoBytes payment_hash_ref;
28975         CHECK(payment_hash->arr_len == 32);
28976         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28977         LDKRecipientOnionFields recipient_onion_conv;
28978         recipient_onion_conv.inner = untag_ptr(recipient_onion);
28979         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
28980         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
28981         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
28982         LDKThirtyTwoBytes payment_id_ref;
28983         CHECK(payment_id->arr_len == 32);
28984         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
28985         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
28986         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
28987         return tag_ptr(ret_conv, true);
28988 }
28989
28990 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) {
28991         LDKChannelManager this_arg_conv;
28992         this_arg_conv.inner = untag_ptr(this_arg);
28993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28995         this_arg_conv.is_owned = false;
28996         LDKThirtyTwoBytes payment_hash_ref;
28997         CHECK(payment_hash->arr_len == 32);
28998         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28999         LDKRecipientOnionFields recipient_onion_conv;
29000         recipient_onion_conv.inner = untag_ptr(recipient_onion);
29001         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
29002         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
29003         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
29004         LDKThirtyTwoBytes payment_id_ref;
29005         CHECK(payment_id->arr_len == 32);
29006         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29007         LDKRouteParameters route_params_conv;
29008         route_params_conv.inner = untag_ptr(route_params);
29009         route_params_conv.is_owned = ptr_is_owned(route_params);
29010         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
29011         route_params_conv = RouteParameters_clone(&route_params_conv);
29012         void* retry_strategy_ptr = untag_ptr(retry_strategy);
29013         CHECK_ACCESS(retry_strategy_ptr);
29014         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
29015         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
29016         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
29017         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
29018         return tag_ptr(ret_conv, true);
29019 }
29020
29021 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
29022         LDKChannelManager this_arg_conv;
29023         this_arg_conv.inner = untag_ptr(this_arg);
29024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29026         this_arg_conv.is_owned = false;
29027         LDKThirtyTwoBytes payment_id_ref;
29028         CHECK(payment_id->arr_len == 32);
29029         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29030         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
29031 }
29032
29033 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) {
29034         LDKChannelManager this_arg_conv;
29035         this_arg_conv.inner = untag_ptr(this_arg);
29036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29038         this_arg_conv.is_owned = false;
29039         LDKRoute route_conv;
29040         route_conv.inner = untag_ptr(route);
29041         route_conv.is_owned = ptr_is_owned(route);
29042         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29043         route_conv.is_owned = false;
29044         LDKThirtyTwoBytes payment_preimage_ref;
29045         CHECK(payment_preimage->arr_len == 32);
29046         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
29047         LDKRecipientOnionFields recipient_onion_conv;
29048         recipient_onion_conv.inner = untag_ptr(recipient_onion);
29049         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
29050         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
29051         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
29052         LDKThirtyTwoBytes payment_id_ref;
29053         CHECK(payment_id->arr_len == 32);
29054         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29055         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
29056         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref, recipient_onion_conv, payment_id_ref);
29057         return tag_ptr(ret_conv, true);
29058 }
29059
29060 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) {
29061         LDKChannelManager this_arg_conv;
29062         this_arg_conv.inner = untag_ptr(this_arg);
29063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29065         this_arg_conv.is_owned = false;
29066         LDKThirtyTwoBytes payment_preimage_ref;
29067         CHECK(payment_preimage->arr_len == 32);
29068         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
29069         LDKRecipientOnionFields recipient_onion_conv;
29070         recipient_onion_conv.inner = untag_ptr(recipient_onion);
29071         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
29072         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
29073         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
29074         LDKThirtyTwoBytes payment_id_ref;
29075         CHECK(payment_id->arr_len == 32);
29076         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
29077         LDKRouteParameters route_params_conv;
29078         route_params_conv.inner = untag_ptr(route_params);
29079         route_params_conv.is_owned = ptr_is_owned(route_params);
29080         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
29081         route_params_conv = RouteParameters_clone(&route_params_conv);
29082         void* retry_strategy_ptr = untag_ptr(retry_strategy);
29083         CHECK_ACCESS(retry_strategy_ptr);
29084         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
29085         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
29086         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
29087         *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);
29088         return tag_ptr(ret_conv, true);
29089 }
29090
29091 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_t path) {
29092         LDKChannelManager this_arg_conv;
29093         this_arg_conv.inner = untag_ptr(this_arg);
29094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29096         this_arg_conv.is_owned = false;
29097         LDKPath path_conv;
29098         path_conv.inner = untag_ptr(path);
29099         path_conv.is_owned = ptr_is_owned(path);
29100         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
29101         path_conv = Path_clone(&path_conv);
29102         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
29103         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
29104         return tag_ptr(ret_conv, true);
29105 }
29106
29107 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) {
29108         LDKChannelManager this_arg_conv;
29109         this_arg_conv.inner = untag_ptr(this_arg);
29110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29112         this_arg_conv.is_owned = false;
29113         uint8_t temporary_channel_id_arr[32];
29114         CHECK(temporary_channel_id->arr_len == 32);
29115         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
29116         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29117         LDKPublicKey counterparty_node_id_ref;
29118         CHECK(counterparty_node_id->arr_len == 33);
29119         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29120         LDKTransaction funding_transaction_ref;
29121         funding_transaction_ref.datalen = funding_transaction->arr_len;
29122         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
29123         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
29124         funding_transaction_ref.data_is_owned = true;
29125         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29126         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
29127         return tag_ptr(ret_conv, true);
29128 }
29129
29130 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) {
29131         LDKChannelManager this_arg_conv;
29132         this_arg_conv.inner = untag_ptr(this_arg);
29133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29135         this_arg_conv.is_owned = false;
29136         LDKPublicKey counterparty_node_id_ref;
29137         CHECK(counterparty_node_id->arr_len == 33);
29138         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29139         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
29140         channel_ids_constr.datalen = channel_ids->arr_len;
29141         if (channel_ids_constr.datalen > 0)
29142                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
29143         else
29144                 channel_ids_constr.data = NULL;
29145         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
29146         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
29147                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
29148                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
29149                 CHECK(channel_ids_conv_12->arr_len == 32);
29150                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
29151                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
29152         }
29153         FREE(channel_ids);
29154         LDKChannelConfig config_conv;
29155         config_conv.inner = untag_ptr(config);
29156         config_conv.is_owned = ptr_is_owned(config);
29157         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
29158         config_conv.is_owned = false;
29159         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29160         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
29161         return tag_ptr(ret_conv, true);
29162 }
29163
29164 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) {
29165         LDKChannelManager this_arg_conv;
29166         this_arg_conv.inner = untag_ptr(this_arg);
29167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29169         this_arg_conv.is_owned = false;
29170         LDKThirtyTwoBytes intercept_id_ref;
29171         CHECK(intercept_id->arr_len == 32);
29172         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
29173         uint8_t next_hop_channel_id_arr[32];
29174         CHECK(next_hop_channel_id->arr_len == 32);
29175         memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id);
29176         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
29177         LDKPublicKey next_node_id_ref;
29178         CHECK(next_node_id->arr_len == 33);
29179         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
29180         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29181         *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);
29182         return tag_ptr(ret_conv, true);
29183 }
29184
29185 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
29186         LDKChannelManager this_arg_conv;
29187         this_arg_conv.inner = untag_ptr(this_arg);
29188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29190         this_arg_conv.is_owned = false;
29191         LDKThirtyTwoBytes intercept_id_ref;
29192         CHECK(intercept_id->arr_len == 32);
29193         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
29194         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29195         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
29196         return tag_ptr(ret_conv, true);
29197 }
29198
29199 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
29200         LDKChannelManager this_arg_conv;
29201         this_arg_conv.inner = untag_ptr(this_arg);
29202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29204         this_arg_conv.is_owned = false;
29205         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
29206 }
29207
29208 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
29209         LDKChannelManager this_arg_conv;
29210         this_arg_conv.inner = untag_ptr(this_arg);
29211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29213         this_arg_conv.is_owned = false;
29214         ChannelManager_timer_tick_occurred(&this_arg_conv);
29215 }
29216
29217 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
29218         LDKChannelManager this_arg_conv;
29219         this_arg_conv.inner = untag_ptr(this_arg);
29220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29222         this_arg_conv.is_owned = false;
29223         uint8_t payment_hash_arr[32];
29224         CHECK(payment_hash->arr_len == 32);
29225         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
29226         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
29227         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
29228 }
29229
29230 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) {
29231         LDKChannelManager this_arg_conv;
29232         this_arg_conv.inner = untag_ptr(this_arg);
29233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29235         this_arg_conv.is_owned = false;
29236         uint8_t payment_hash_arr[32];
29237         CHECK(payment_hash->arr_len == 32);
29238         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
29239         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
29240         LDKFailureCode failure_code_conv = LDKFailureCode_from_js(failure_code);
29241         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
29242 }
29243
29244 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
29245         LDKChannelManager this_arg_conv;
29246         this_arg_conv.inner = untag_ptr(this_arg);
29247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29249         this_arg_conv.is_owned = false;
29250         LDKThirtyTwoBytes payment_preimage_ref;
29251         CHECK(payment_preimage->arr_len == 32);
29252         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
29253         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
29254 }
29255
29256 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
29257         LDKChannelManager this_arg_conv;
29258         this_arg_conv.inner = untag_ptr(this_arg);
29259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29261         this_arg_conv.is_owned = false;
29262         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29263         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
29264         return ret_arr;
29265 }
29266
29267 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) {
29268         LDKChannelManager this_arg_conv;
29269         this_arg_conv.inner = untag_ptr(this_arg);
29270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29272         this_arg_conv.is_owned = false;
29273         uint8_t temporary_channel_id_arr[32];
29274         CHECK(temporary_channel_id->arr_len == 32);
29275         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
29276         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29277         LDKPublicKey counterparty_node_id_ref;
29278         CHECK(counterparty_node_id->arr_len == 33);
29279         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29280         LDKU128 user_channel_id_ref;
29281         CHECK(user_channel_id->arr_len == 16);
29282         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
29283         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29284         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
29285         return tag_ptr(ret_conv, true);
29286 }
29287
29288 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) {
29289         LDKChannelManager this_arg_conv;
29290         this_arg_conv.inner = untag_ptr(this_arg);
29291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29293         this_arg_conv.is_owned = false;
29294         uint8_t temporary_channel_id_arr[32];
29295         CHECK(temporary_channel_id->arr_len == 32);
29296         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
29297         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29298         LDKPublicKey counterparty_node_id_ref;
29299         CHECK(counterparty_node_id->arr_len == 33);
29300         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
29301         LDKU128 user_channel_id_ref;
29302         CHECK(user_channel_id->arr_len == 16);
29303         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
29304         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29305         *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);
29306         return tag_ptr(ret_conv, true);
29307 }
29308
29309 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) {
29310         LDKChannelManager this_arg_conv;
29311         this_arg_conv.inner = untag_ptr(this_arg);
29312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29314         this_arg_conv.is_owned = false;
29315         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29316         CHECK_ACCESS(min_value_msat_ptr);
29317         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29318         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29319         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
29320         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
29321         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
29322         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
29323         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
29324         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
29325         return tag_ptr(ret_conv, true);
29326 }
29327
29328 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) {
29329         LDKChannelManager this_arg_conv;
29330         this_arg_conv.inner = untag_ptr(this_arg);
29331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29333         this_arg_conv.is_owned = false;
29334         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29335         CHECK_ACCESS(min_value_msat_ptr);
29336         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29337         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29338         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
29339         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
29340         return tag_ptr(ret_conv, true);
29341 }
29342
29343 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) {
29344         LDKChannelManager this_arg_conv;
29345         this_arg_conv.inner = untag_ptr(this_arg);
29346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29348         this_arg_conv.is_owned = false;
29349         LDKThirtyTwoBytes payment_hash_ref;
29350         CHECK(payment_hash->arr_len == 32);
29351         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29352         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29353         CHECK_ACCESS(min_value_msat_ptr);
29354         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29355         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29356         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
29357         CHECK_ACCESS(min_final_cltv_expiry_ptr);
29358         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
29359         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
29360         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
29361         *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);
29362         return tag_ptr(ret_conv, true);
29363 }
29364
29365 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) {
29366         LDKChannelManager this_arg_conv;
29367         this_arg_conv.inner = untag_ptr(this_arg);
29368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29370         this_arg_conv.is_owned = false;
29371         LDKThirtyTwoBytes payment_hash_ref;
29372         CHECK(payment_hash->arr_len == 32);
29373         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29374         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29375         CHECK_ACCESS(min_value_msat_ptr);
29376         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29377         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29378         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
29379         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
29380         return tag_ptr(ret_conv, true);
29381 }
29382
29383 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) {
29384         LDKChannelManager this_arg_conv;
29385         this_arg_conv.inner = untag_ptr(this_arg);
29386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29388         this_arg_conv.is_owned = false;
29389         LDKThirtyTwoBytes payment_hash_ref;
29390         CHECK(payment_hash->arr_len == 32);
29391         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29392         LDKThirtyTwoBytes payment_secret_ref;
29393         CHECK(payment_secret->arr_len == 32);
29394         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
29395         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
29396         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
29397         return tag_ptr(ret_conv, true);
29398 }
29399
29400 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
29401         LDKChannelManager this_arg_conv;
29402         this_arg_conv.inner = untag_ptr(this_arg);
29403         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29405         this_arg_conv.is_owned = false;
29406         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
29407         return ret_conv;
29408 }
29409
29410 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
29411         LDKChannelManager this_arg_conv;
29412         this_arg_conv.inner = untag_ptr(this_arg);
29413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29415         this_arg_conv.is_owned = false;
29416         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
29417         uint64_t ret_ref = 0;
29418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29420         return ret_ref;
29421 }
29422
29423 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
29424         LDKChannelManager this_arg_conv;
29425         this_arg_conv.inner = untag_ptr(this_arg);
29426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29428         this_arg_conv.is_owned = false;
29429         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
29430         return ret_conv;
29431 }
29432
29433 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
29434         LDKChannelManager this_arg_conv;
29435         this_arg_conv.inner = untag_ptr(this_arg);
29436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29438         this_arg_conv.is_owned = false;
29439         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
29440         uint64_t ret_ref = 0;
29441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29443         return ret_ref;
29444 }
29445
29446 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
29447         LDKChannelManager this_arg_conv;
29448         this_arg_conv.inner = untag_ptr(this_arg);
29449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29451         this_arg_conv.is_owned = false;
29452         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
29453         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
29454         return tag_ptr(ret_ret, true);
29455 }
29456
29457 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
29458         LDKChannelManager this_arg_conv;
29459         this_arg_conv.inner = untag_ptr(this_arg);
29460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29462         this_arg_conv.is_owned = false;
29463         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
29464         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
29465         return tag_ptr(ret_ret, true);
29466 }
29467
29468 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
29469         LDKChannelManager this_arg_conv;
29470         this_arg_conv.inner = untag_ptr(this_arg);
29471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29473         this_arg_conv.is_owned = false;
29474         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
29475         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
29476         return tag_ptr(ret_ret, true);
29477 }
29478
29479 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
29480         LDKChannelManager this_arg_conv;
29481         this_arg_conv.inner = untag_ptr(this_arg);
29482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29484         this_arg_conv.is_owned = false;
29485         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
29486         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
29487         return tag_ptr(ret_ret, true);
29488 }
29489
29490 uint64_t  __attribute__((export_name("TS_ChannelManager_get_persistable_update_future"))) TS_ChannelManager_get_persistable_update_future(uint64_t this_arg) {
29491         LDKChannelManager this_arg_conv;
29492         this_arg_conv.inner = untag_ptr(this_arg);
29493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29495         this_arg_conv.is_owned = false;
29496         LDKFuture ret_var = ChannelManager_get_persistable_update_future(&this_arg_conv);
29497         uint64_t ret_ref = 0;
29498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29500         return ret_ref;
29501 }
29502
29503 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
29504         LDKChannelManager this_arg_conv;
29505         this_arg_conv.inner = untag_ptr(this_arg);
29506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29508         this_arg_conv.is_owned = false;
29509         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
29510         uint64_t ret_ref = 0;
29511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29513         return ret_ref;
29514 }
29515
29516 uint64_t  __attribute__((export_name("TS_ChannelManager_node_features"))) TS_ChannelManager_node_features(uint64_t this_arg) {
29517         LDKChannelManager this_arg_conv;
29518         this_arg_conv.inner = untag_ptr(this_arg);
29519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29521         this_arg_conv.is_owned = false;
29522         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
29523         uint64_t ret_ref = 0;
29524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29526         return ret_ref;
29527 }
29528
29529 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_features"))) TS_ChannelManager_channel_features(uint64_t this_arg) {
29530         LDKChannelManager this_arg_conv;
29531         this_arg_conv.inner = untag_ptr(this_arg);
29532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29534         this_arg_conv.is_owned = false;
29535         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
29536         uint64_t ret_ref = 0;
29537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29539         return ret_ref;
29540 }
29541
29542 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_type_features"))) TS_ChannelManager_channel_type_features(uint64_t this_arg) {
29543         LDKChannelManager this_arg_conv;
29544         this_arg_conv.inner = untag_ptr(this_arg);
29545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29547         this_arg_conv.is_owned = false;
29548         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
29549         uint64_t ret_ref = 0;
29550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29552         return ret_ref;
29553 }
29554
29555 uint64_t  __attribute__((export_name("TS_ChannelManager_init_features"))) TS_ChannelManager_init_features(uint64_t this_arg) {
29556         LDKChannelManager this_arg_conv;
29557         this_arg_conv.inner = untag_ptr(this_arg);
29558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29560         this_arg_conv.is_owned = false;
29561         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
29562         uint64_t ret_ref = 0;
29563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29565         return ret_ref;
29566 }
29567
29568 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
29569         LDKChannelManager this_arg_conv;
29570         this_arg_conv.inner = untag_ptr(this_arg);
29571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29573         this_arg_conv.is_owned = false;
29574         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
29575         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
29576         return tag_ptr(ret_ret, true);
29577 }
29578
29579 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features(uint64_t _config) {
29580         LDKUserConfig _config_conv;
29581         _config_conv.inner = untag_ptr(_config);
29582         _config_conv.is_owned = ptr_is_owned(_config);
29583         CHECK_INNER_FIELD_ACCESS_OR_NULL(_config_conv);
29584         _config_conv.is_owned = false;
29585         LDKInitFeatures ret_var = provided_init_features(&_config_conv);
29586         uint64_t ret_ref = 0;
29587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29589         return ret_ref;
29590 }
29591
29592 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
29593         LDKCounterpartyForwardingInfo obj_conv;
29594         obj_conv.inner = untag_ptr(obj);
29595         obj_conv.is_owned = ptr_is_owned(obj);
29596         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29597         obj_conv.is_owned = false;
29598         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
29599         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29600         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29601         CVec_u8Z_free(ret_var);
29602         return ret_arr;
29603 }
29604
29605 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
29606         LDKu8slice ser_ref;
29607         ser_ref.datalen = ser->arr_len;
29608         ser_ref.data = ser->elems;
29609         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
29610         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
29611         FREE(ser);
29612         return tag_ptr(ret_conv, true);
29613 }
29614
29615 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
29616         LDKChannelCounterparty obj_conv;
29617         obj_conv.inner = untag_ptr(obj);
29618         obj_conv.is_owned = ptr_is_owned(obj);
29619         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29620         obj_conv.is_owned = false;
29621         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
29622         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29623         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29624         CVec_u8Z_free(ret_var);
29625         return ret_arr;
29626 }
29627
29628 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
29629         LDKu8slice ser_ref;
29630         ser_ref.datalen = ser->arr_len;
29631         ser_ref.data = ser->elems;
29632         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
29633         *ret_conv = ChannelCounterparty_read(ser_ref);
29634         FREE(ser);
29635         return tag_ptr(ret_conv, true);
29636 }
29637
29638 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
29639         LDKChannelDetails obj_conv;
29640         obj_conv.inner = untag_ptr(obj);
29641         obj_conv.is_owned = ptr_is_owned(obj);
29642         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29643         obj_conv.is_owned = false;
29644         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
29645         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29646         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29647         CVec_u8Z_free(ret_var);
29648         return ret_arr;
29649 }
29650
29651 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
29652         LDKu8slice ser_ref;
29653         ser_ref.datalen = ser->arr_len;
29654         ser_ref.data = ser->elems;
29655         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
29656         *ret_conv = ChannelDetails_read(ser_ref);
29657         FREE(ser);
29658         return tag_ptr(ret_conv, true);
29659 }
29660
29661 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
29662         LDKPhantomRouteHints obj_conv;
29663         obj_conv.inner = untag_ptr(obj);
29664         obj_conv.is_owned = ptr_is_owned(obj);
29665         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29666         obj_conv.is_owned = false;
29667         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
29668         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29669         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29670         CVec_u8Z_free(ret_var);
29671         return ret_arr;
29672 }
29673
29674 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
29675         LDKu8slice ser_ref;
29676         ser_ref.datalen = ser->arr_len;
29677         ser_ref.data = ser->elems;
29678         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
29679         *ret_conv = PhantomRouteHints_read(ser_ref);
29680         FREE(ser);
29681         return tag_ptr(ret_conv, true);
29682 }
29683
29684 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
29685         LDKChannelManager obj_conv;
29686         obj_conv.inner = untag_ptr(obj);
29687         obj_conv.is_owned = ptr_is_owned(obj);
29688         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29689         obj_conv.is_owned = false;
29690         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
29691         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29692         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29693         CVec_u8Z_free(ret_var);
29694         return ret_arr;
29695 }
29696
29697 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
29698         LDKChannelManagerReadArgs this_obj_conv;
29699         this_obj_conv.inner = untag_ptr(this_obj);
29700         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29702         ChannelManagerReadArgs_free(this_obj_conv);
29703 }
29704
29705 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_entropy_source"))) TS_ChannelManagerReadArgs_get_entropy_source(uint64_t this_ptr) {
29706         LDKChannelManagerReadArgs this_ptr_conv;
29707         this_ptr_conv.inner = untag_ptr(this_ptr);
29708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29710         this_ptr_conv.is_owned = false;
29711         // WARNING: This object doesn't live past this scope, needs clone!
29712         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
29713         return ret_ret;
29714 }
29715
29716 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_entropy_source"))) TS_ChannelManagerReadArgs_set_entropy_source(uint64_t this_ptr, uint64_t val) {
29717         LDKChannelManagerReadArgs this_ptr_conv;
29718         this_ptr_conv.inner = untag_ptr(this_ptr);
29719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29721         this_ptr_conv.is_owned = false;
29722         void* val_ptr = untag_ptr(val);
29723         CHECK_ACCESS(val_ptr);
29724         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
29725         if (val_conv.free == LDKEntropySource_JCalls_free) {
29726                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29727                 LDKEntropySource_JCalls_cloned(&val_conv);
29728         }
29729         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
29730 }
29731
29732 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_node_signer"))) TS_ChannelManagerReadArgs_get_node_signer(uint64_t this_ptr) {
29733         LDKChannelManagerReadArgs this_ptr_conv;
29734         this_ptr_conv.inner = untag_ptr(this_ptr);
29735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29737         this_ptr_conv.is_owned = false;
29738         // WARNING: This object doesn't live past this scope, needs clone!
29739         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
29740         return ret_ret;
29741 }
29742
29743 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_node_signer"))) TS_ChannelManagerReadArgs_set_node_signer(uint64_t this_ptr, uint64_t val) {
29744         LDKChannelManagerReadArgs this_ptr_conv;
29745         this_ptr_conv.inner = untag_ptr(this_ptr);
29746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29748         this_ptr_conv.is_owned = false;
29749         void* val_ptr = untag_ptr(val);
29750         CHECK_ACCESS(val_ptr);
29751         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
29752         if (val_conv.free == LDKNodeSigner_JCalls_free) {
29753                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29754                 LDKNodeSigner_JCalls_cloned(&val_conv);
29755         }
29756         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
29757 }
29758
29759 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_signer_provider"))) TS_ChannelManagerReadArgs_get_signer_provider(uint64_t this_ptr) {
29760         LDKChannelManagerReadArgs this_ptr_conv;
29761         this_ptr_conv.inner = untag_ptr(this_ptr);
29762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29764         this_ptr_conv.is_owned = false;
29765         // WARNING: This object doesn't live past this scope, needs clone!
29766         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
29767         return ret_ret;
29768 }
29769
29770 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_signer_provider"))) TS_ChannelManagerReadArgs_set_signer_provider(uint64_t this_ptr, uint64_t val) {
29771         LDKChannelManagerReadArgs this_ptr_conv;
29772         this_ptr_conv.inner = untag_ptr(this_ptr);
29773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29775         this_ptr_conv.is_owned = false;
29776         void* val_ptr = untag_ptr(val);
29777         CHECK_ACCESS(val_ptr);
29778         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
29779         if (val_conv.free == LDKSignerProvider_JCalls_free) {
29780                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29781                 LDKSignerProvider_JCalls_cloned(&val_conv);
29782         }
29783         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
29784 }
29785
29786 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
29787         LDKChannelManagerReadArgs this_ptr_conv;
29788         this_ptr_conv.inner = untag_ptr(this_ptr);
29789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29791         this_ptr_conv.is_owned = false;
29792         // WARNING: This object doesn't live past this scope, needs clone!
29793         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
29794         return ret_ret;
29795 }
29796
29797 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
29798         LDKChannelManagerReadArgs this_ptr_conv;
29799         this_ptr_conv.inner = untag_ptr(this_ptr);
29800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29802         this_ptr_conv.is_owned = false;
29803         void* val_ptr = untag_ptr(val);
29804         CHECK_ACCESS(val_ptr);
29805         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
29806         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
29807                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29808                 LDKFeeEstimator_JCalls_cloned(&val_conv);
29809         }
29810         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
29811 }
29812
29813 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
29814         LDKChannelManagerReadArgs this_ptr_conv;
29815         this_ptr_conv.inner = untag_ptr(this_ptr);
29816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29818         this_ptr_conv.is_owned = false;
29819         // WARNING: This object doesn't live past this scope, needs clone!
29820         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
29821         return ret_ret;
29822 }
29823
29824 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
29825         LDKChannelManagerReadArgs this_ptr_conv;
29826         this_ptr_conv.inner = untag_ptr(this_ptr);
29827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29829         this_ptr_conv.is_owned = false;
29830         void* val_ptr = untag_ptr(val);
29831         CHECK_ACCESS(val_ptr);
29832         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
29833         if (val_conv.free == LDKWatch_JCalls_free) {
29834                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29835                 LDKWatch_JCalls_cloned(&val_conv);
29836         }
29837         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
29838 }
29839
29840 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
29841         LDKChannelManagerReadArgs this_ptr_conv;
29842         this_ptr_conv.inner = untag_ptr(this_ptr);
29843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29845         this_ptr_conv.is_owned = false;
29846         // WARNING: This object doesn't live past this scope, needs clone!
29847         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
29848         return ret_ret;
29849 }
29850
29851 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
29852         LDKChannelManagerReadArgs this_ptr_conv;
29853         this_ptr_conv.inner = untag_ptr(this_ptr);
29854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29856         this_ptr_conv.is_owned = false;
29857         void* val_ptr = untag_ptr(val);
29858         CHECK_ACCESS(val_ptr);
29859         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
29860         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
29861                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29862                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
29863         }
29864         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
29865 }
29866
29867 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_router"))) TS_ChannelManagerReadArgs_get_router(uint64_t this_ptr) {
29868         LDKChannelManagerReadArgs this_ptr_conv;
29869         this_ptr_conv.inner = untag_ptr(this_ptr);
29870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29872         this_ptr_conv.is_owned = false;
29873         // WARNING: This object doesn't live past this scope, needs clone!
29874         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
29875         return ret_ret;
29876 }
29877
29878 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_router"))) TS_ChannelManagerReadArgs_set_router(uint64_t this_ptr, uint64_t val) {
29879         LDKChannelManagerReadArgs this_ptr_conv;
29880         this_ptr_conv.inner = untag_ptr(this_ptr);
29881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29883         this_ptr_conv.is_owned = false;
29884         void* val_ptr = untag_ptr(val);
29885         CHECK_ACCESS(val_ptr);
29886         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
29887         if (val_conv.free == LDKRouter_JCalls_free) {
29888                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29889                 LDKRouter_JCalls_cloned(&val_conv);
29890         }
29891         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
29892 }
29893
29894 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
29895         LDKChannelManagerReadArgs this_ptr_conv;
29896         this_ptr_conv.inner = untag_ptr(this_ptr);
29897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29899         this_ptr_conv.is_owned = false;
29900         // WARNING: This object doesn't live past this scope, needs clone!
29901         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
29902         return ret_ret;
29903 }
29904
29905 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
29906         LDKChannelManagerReadArgs this_ptr_conv;
29907         this_ptr_conv.inner = untag_ptr(this_ptr);
29908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29910         this_ptr_conv.is_owned = false;
29911         void* val_ptr = untag_ptr(val);
29912         CHECK_ACCESS(val_ptr);
29913         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
29914         if (val_conv.free == LDKLogger_JCalls_free) {
29915                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29916                 LDKLogger_JCalls_cloned(&val_conv);
29917         }
29918         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
29919 }
29920
29921 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
29922         LDKChannelManagerReadArgs this_ptr_conv;
29923         this_ptr_conv.inner = untag_ptr(this_ptr);
29924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29926         this_ptr_conv.is_owned = false;
29927         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
29928         uint64_t ret_ref = 0;
29929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29931         return ret_ref;
29932 }
29933
29934 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
29935         LDKChannelManagerReadArgs this_ptr_conv;
29936         this_ptr_conv.inner = untag_ptr(this_ptr);
29937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29939         this_ptr_conv.is_owned = false;
29940         LDKUserConfig val_conv;
29941         val_conv.inner = untag_ptr(val);
29942         val_conv.is_owned = ptr_is_owned(val);
29943         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29944         val_conv = UserConfig_clone(&val_conv);
29945         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
29946 }
29947
29948 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) {
29949         void* entropy_source_ptr = untag_ptr(entropy_source);
29950         CHECK_ACCESS(entropy_source_ptr);
29951         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
29952         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
29953                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29954                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
29955         }
29956         void* node_signer_ptr = untag_ptr(node_signer);
29957         CHECK_ACCESS(node_signer_ptr);
29958         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
29959         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
29960                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29961                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
29962         }
29963         void* signer_provider_ptr = untag_ptr(signer_provider);
29964         CHECK_ACCESS(signer_provider_ptr);
29965         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
29966         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
29967                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29968                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
29969         }
29970         void* fee_estimator_ptr = untag_ptr(fee_estimator);
29971         CHECK_ACCESS(fee_estimator_ptr);
29972         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
29973         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
29974                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29975                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
29976         }
29977         void* chain_monitor_ptr = untag_ptr(chain_monitor);
29978         CHECK_ACCESS(chain_monitor_ptr);
29979         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
29980         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
29981                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29982                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
29983         }
29984         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
29985         CHECK_ACCESS(tx_broadcaster_ptr);
29986         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
29987         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
29988                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29989                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
29990         }
29991         void* router_ptr = untag_ptr(router);
29992         CHECK_ACCESS(router_ptr);
29993         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
29994         if (router_conv.free == LDKRouter_JCalls_free) {
29995                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29996                 LDKRouter_JCalls_cloned(&router_conv);
29997         }
29998         void* logger_ptr = untag_ptr(logger);
29999         CHECK_ACCESS(logger_ptr);
30000         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30001         if (logger_conv.free == LDKLogger_JCalls_free) {
30002                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30003                 LDKLogger_JCalls_cloned(&logger_conv);
30004         }
30005         LDKUserConfig default_config_conv;
30006         default_config_conv.inner = untag_ptr(default_config);
30007         default_config_conv.is_owned = ptr_is_owned(default_config);
30008         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
30009         default_config_conv = UserConfig_clone(&default_config_conv);
30010         LDKCVec_ChannelMonitorZ channel_monitors_constr;
30011         channel_monitors_constr.datalen = channel_monitors->arr_len;
30012         if (channel_monitors_constr.datalen > 0)
30013                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
30014         else
30015                 channel_monitors_constr.data = NULL;
30016         uint64_t* channel_monitors_vals = channel_monitors->elems;
30017         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
30018                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
30019                 LDKChannelMonitor channel_monitors_conv_16_conv;
30020                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
30021                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
30022                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
30023                 channel_monitors_conv_16_conv.is_owned = false;
30024                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
30025         }
30026         FREE(channel_monitors);
30027         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);
30028         uint64_t ret_ref = 0;
30029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30031         return ret_ref;
30032 }
30033
30034 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
30035         LDKu8slice ser_ref;
30036         ser_ref.datalen = ser->arr_len;
30037         ser_ref.data = ser->elems;
30038         LDKChannelManagerReadArgs arg_conv;
30039         arg_conv.inner = untag_ptr(arg);
30040         arg_conv.is_owned = ptr_is_owned(arg);
30041         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30042         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
30043         
30044         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
30045         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
30046         FREE(ser);
30047         return tag_ptr(ret_conv, true);
30048 }
30049
30050 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
30051         LDKExpandedKey this_obj_conv;
30052         this_obj_conv.inner = untag_ptr(this_obj);
30053         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30055         ExpandedKey_free(this_obj_conv);
30056 }
30057
30058 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
30059         uint8_t key_material_arr[32];
30060         CHECK(key_material->arr_len == 32);
30061         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
30062         uint8_t (*key_material_ref)[32] = &key_material_arr;
30063         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
30064         uint64_t ret_ref = 0;
30065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30067         return ret_ref;
30068 }
30069
30070 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) {
30071         LDKExpandedKey keys_conv;
30072         keys_conv.inner = untag_ptr(keys);
30073         keys_conv.is_owned = ptr_is_owned(keys);
30074         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30075         keys_conv.is_owned = false;
30076         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30077         CHECK_ACCESS(min_value_msat_ptr);
30078         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30079         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30080         void* entropy_source_ptr = untag_ptr(entropy_source);
30081         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
30082         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
30083         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
30084         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
30085         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
30086         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
30087         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
30088         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
30089         return tag_ptr(ret_conv, true);
30090 }
30091
30092 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) {
30093         LDKExpandedKey keys_conv;
30094         keys_conv.inner = untag_ptr(keys);
30095         keys_conv.is_owned = ptr_is_owned(keys);
30096         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30097         keys_conv.is_owned = false;
30098         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30099         CHECK_ACCESS(min_value_msat_ptr);
30100         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30101         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30102         LDKThirtyTwoBytes payment_hash_ref;
30103         CHECK(payment_hash->arr_len == 32);
30104         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
30105         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
30106         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
30107         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
30108         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
30109         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
30110         *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);
30111         return tag_ptr(ret_conv, true);
30112 }
30113
30114 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
30115         if (!ptr_is_owned(this_ptr)) return;
30116         void* this_ptr_ptr = untag_ptr(this_ptr);
30117         CHECK_ACCESS(this_ptr_ptr);
30118         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
30119         FREE(untag_ptr(this_ptr));
30120         DecodeError_free(this_ptr_conv);
30121 }
30122
30123 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
30124         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30125         *ret_copy = DecodeError_clone(arg);
30126         uint64_t ret_ref = tag_ptr(ret_copy, true);
30127         return ret_ref;
30128 }
30129 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
30130         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
30131         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
30132         return ret_conv;
30133 }
30134
30135 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
30136         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
30137         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30138         *ret_copy = DecodeError_clone(orig_conv);
30139         uint64_t ret_ref = tag_ptr(ret_copy, true);
30140         return ret_ref;
30141 }
30142
30143 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
30144         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30145         *ret_copy = DecodeError_unknown_version();
30146         uint64_t ret_ref = tag_ptr(ret_copy, true);
30147         return ret_ref;
30148 }
30149
30150 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
30151         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30152         *ret_copy = DecodeError_unknown_required_feature();
30153         uint64_t ret_ref = tag_ptr(ret_copy, true);
30154         return ret_ref;
30155 }
30156
30157 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
30158         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30159         *ret_copy = DecodeError_invalid_value();
30160         uint64_t ret_ref = tag_ptr(ret_copy, true);
30161         return ret_ref;
30162 }
30163
30164 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
30165         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30166         *ret_copy = DecodeError_short_read();
30167         uint64_t ret_ref = tag_ptr(ret_copy, true);
30168         return ret_ref;
30169 }
30170
30171 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
30172         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30173         *ret_copy = DecodeError_bad_length_descriptor();
30174         uint64_t ret_ref = tag_ptr(ret_copy, true);
30175         return ret_ref;
30176 }
30177
30178 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
30179         LDKIOError a_conv = LDKIOError_from_js(a);
30180         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30181         *ret_copy = DecodeError_io(a_conv);
30182         uint64_t ret_ref = tag_ptr(ret_copy, true);
30183         return ret_ref;
30184 }
30185
30186 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
30187         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
30188         *ret_copy = DecodeError_unsupported_compression();
30189         uint64_t ret_ref = tag_ptr(ret_copy, true);
30190         return ret_ref;
30191 }
30192
30193 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
30194         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
30195         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
30196         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
30197         return ret_conv;
30198 }
30199
30200 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
30201         LDKInit this_obj_conv;
30202         this_obj_conv.inner = untag_ptr(this_obj);
30203         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30205         Init_free(this_obj_conv);
30206 }
30207
30208 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
30209         LDKInit this_ptr_conv;
30210         this_ptr_conv.inner = untag_ptr(this_ptr);
30211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30213         this_ptr_conv.is_owned = false;
30214         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
30215         uint64_t ret_ref = 0;
30216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30218         return ret_ref;
30219 }
30220
30221 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
30222         LDKInit this_ptr_conv;
30223         this_ptr_conv.inner = untag_ptr(this_ptr);
30224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30226         this_ptr_conv.is_owned = false;
30227         LDKInitFeatures val_conv;
30228         val_conv.inner = untag_ptr(val);
30229         val_conv.is_owned = ptr_is_owned(val);
30230         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30231         val_conv = InitFeatures_clone(&val_conv);
30232         Init_set_features(&this_ptr_conv, val_conv);
30233 }
30234
30235 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
30236         LDKInit this_ptr_conv;
30237         this_ptr_conv.inner = untag_ptr(this_ptr);
30238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30240         this_ptr_conv.is_owned = false;
30241         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
30242         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
30243         uint64_t ret_ref = tag_ptr(ret_copy, true);
30244         return ret_ref;
30245 }
30246
30247 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
30248         LDKInit this_ptr_conv;
30249         this_ptr_conv.inner = untag_ptr(this_ptr);
30250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30252         this_ptr_conv.is_owned = false;
30253         void* val_ptr = untag_ptr(val);
30254         CHECK_ACCESS(val_ptr);
30255         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
30256         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
30257         Init_set_remote_network_address(&this_ptr_conv, val_conv);
30258 }
30259
30260 uint64_t  __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint64_t features_arg, uint64_t remote_network_address_arg) {
30261         LDKInitFeatures features_arg_conv;
30262         features_arg_conv.inner = untag_ptr(features_arg);
30263         features_arg_conv.is_owned = ptr_is_owned(features_arg);
30264         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
30265         features_arg_conv = InitFeatures_clone(&features_arg_conv);
30266         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
30267         CHECK_ACCESS(remote_network_address_arg_ptr);
30268         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
30269         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
30270         uint64_t ret_ref = 0;
30271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30273         return ret_ref;
30274 }
30275
30276 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
30277         LDKInit ret_var = Init_clone(arg);
30278         uint64_t ret_ref = 0;
30279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30281         return ret_ref;
30282 }
30283 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
30284         LDKInit arg_conv;
30285         arg_conv.inner = untag_ptr(arg);
30286         arg_conv.is_owned = ptr_is_owned(arg);
30287         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30288         arg_conv.is_owned = false;
30289         int64_t ret_conv = Init_clone_ptr(&arg_conv);
30290         return ret_conv;
30291 }
30292
30293 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
30294         LDKInit orig_conv;
30295         orig_conv.inner = untag_ptr(orig);
30296         orig_conv.is_owned = ptr_is_owned(orig);
30297         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30298         orig_conv.is_owned = false;
30299         LDKInit ret_var = Init_clone(&orig_conv);
30300         uint64_t ret_ref = 0;
30301         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30302         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30303         return ret_ref;
30304 }
30305
30306 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
30307         LDKInit a_conv;
30308         a_conv.inner = untag_ptr(a);
30309         a_conv.is_owned = ptr_is_owned(a);
30310         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30311         a_conv.is_owned = false;
30312         LDKInit b_conv;
30313         b_conv.inner = untag_ptr(b);
30314         b_conv.is_owned = ptr_is_owned(b);
30315         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30316         b_conv.is_owned = false;
30317         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
30318         return ret_conv;
30319 }
30320
30321 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
30322         LDKErrorMessage this_obj_conv;
30323         this_obj_conv.inner = untag_ptr(this_obj);
30324         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30326         ErrorMessage_free(this_obj_conv);
30327 }
30328
30329 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
30330         LDKErrorMessage this_ptr_conv;
30331         this_ptr_conv.inner = untag_ptr(this_ptr);
30332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30334         this_ptr_conv.is_owned = false;
30335         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30336         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
30337         return ret_arr;
30338 }
30339
30340 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30341         LDKErrorMessage this_ptr_conv;
30342         this_ptr_conv.inner = untag_ptr(this_ptr);
30343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30345         this_ptr_conv.is_owned = false;
30346         LDKThirtyTwoBytes val_ref;
30347         CHECK(val->arr_len == 32);
30348         memcpy(val_ref.data, val->elems, 32); FREE(val);
30349         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
30350 }
30351
30352 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
30353         LDKErrorMessage this_ptr_conv;
30354         this_ptr_conv.inner = untag_ptr(this_ptr);
30355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30357         this_ptr_conv.is_owned = false;
30358         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
30359         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30360         Str_free(ret_str);
30361         return ret_conv;
30362 }
30363
30364 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
30365         LDKErrorMessage this_ptr_conv;
30366         this_ptr_conv.inner = untag_ptr(this_ptr);
30367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30369         this_ptr_conv.is_owned = false;
30370         LDKStr val_conv = str_ref_to_owned_c(val);
30371         ErrorMessage_set_data(&this_ptr_conv, val_conv);
30372 }
30373
30374 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
30375         LDKThirtyTwoBytes channel_id_arg_ref;
30376         CHECK(channel_id_arg->arr_len == 32);
30377         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30378         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
30379         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
30380         uint64_t ret_ref = 0;
30381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30383         return ret_ref;
30384 }
30385
30386 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
30387         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
30388         uint64_t ret_ref = 0;
30389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30391         return ret_ref;
30392 }
30393 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
30394         LDKErrorMessage arg_conv;
30395         arg_conv.inner = untag_ptr(arg);
30396         arg_conv.is_owned = ptr_is_owned(arg);
30397         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30398         arg_conv.is_owned = false;
30399         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
30400         return ret_conv;
30401 }
30402
30403 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
30404         LDKErrorMessage orig_conv;
30405         orig_conv.inner = untag_ptr(orig);
30406         orig_conv.is_owned = ptr_is_owned(orig);
30407         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30408         orig_conv.is_owned = false;
30409         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
30410         uint64_t ret_ref = 0;
30411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30413         return ret_ref;
30414 }
30415
30416 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
30417         LDKErrorMessage a_conv;
30418         a_conv.inner = untag_ptr(a);
30419         a_conv.is_owned = ptr_is_owned(a);
30420         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30421         a_conv.is_owned = false;
30422         LDKErrorMessage b_conv;
30423         b_conv.inner = untag_ptr(b);
30424         b_conv.is_owned = ptr_is_owned(b);
30425         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30426         b_conv.is_owned = false;
30427         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
30428         return ret_conv;
30429 }
30430
30431 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
30432         LDKWarningMessage this_obj_conv;
30433         this_obj_conv.inner = untag_ptr(this_obj);
30434         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30436         WarningMessage_free(this_obj_conv);
30437 }
30438
30439 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
30440         LDKWarningMessage this_ptr_conv;
30441         this_ptr_conv.inner = untag_ptr(this_ptr);
30442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30444         this_ptr_conv.is_owned = false;
30445         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30446         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
30447         return ret_arr;
30448 }
30449
30450 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30451         LDKWarningMessage this_ptr_conv;
30452         this_ptr_conv.inner = untag_ptr(this_ptr);
30453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30455         this_ptr_conv.is_owned = false;
30456         LDKThirtyTwoBytes val_ref;
30457         CHECK(val->arr_len == 32);
30458         memcpy(val_ref.data, val->elems, 32); FREE(val);
30459         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
30460 }
30461
30462 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
30463         LDKWarningMessage this_ptr_conv;
30464         this_ptr_conv.inner = untag_ptr(this_ptr);
30465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30467         this_ptr_conv.is_owned = false;
30468         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
30469         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30470         Str_free(ret_str);
30471         return ret_conv;
30472 }
30473
30474 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
30475         LDKWarningMessage this_ptr_conv;
30476         this_ptr_conv.inner = untag_ptr(this_ptr);
30477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30479         this_ptr_conv.is_owned = false;
30480         LDKStr val_conv = str_ref_to_owned_c(val);
30481         WarningMessage_set_data(&this_ptr_conv, val_conv);
30482 }
30483
30484 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
30485         LDKThirtyTwoBytes channel_id_arg_ref;
30486         CHECK(channel_id_arg->arr_len == 32);
30487         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30488         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
30489         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
30490         uint64_t ret_ref = 0;
30491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30493         return ret_ref;
30494 }
30495
30496 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
30497         LDKWarningMessage ret_var = WarningMessage_clone(arg);
30498         uint64_t ret_ref = 0;
30499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30501         return ret_ref;
30502 }
30503 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
30504         LDKWarningMessage arg_conv;
30505         arg_conv.inner = untag_ptr(arg);
30506         arg_conv.is_owned = ptr_is_owned(arg);
30507         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30508         arg_conv.is_owned = false;
30509         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
30510         return ret_conv;
30511 }
30512
30513 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
30514         LDKWarningMessage orig_conv;
30515         orig_conv.inner = untag_ptr(orig);
30516         orig_conv.is_owned = ptr_is_owned(orig);
30517         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30518         orig_conv.is_owned = false;
30519         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
30520         uint64_t ret_ref = 0;
30521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30523         return ret_ref;
30524 }
30525
30526 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
30527         LDKWarningMessage a_conv;
30528         a_conv.inner = untag_ptr(a);
30529         a_conv.is_owned = ptr_is_owned(a);
30530         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30531         a_conv.is_owned = false;
30532         LDKWarningMessage b_conv;
30533         b_conv.inner = untag_ptr(b);
30534         b_conv.is_owned = ptr_is_owned(b);
30535         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30536         b_conv.is_owned = false;
30537         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
30538         return ret_conv;
30539 }
30540
30541 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
30542         LDKPing this_obj_conv;
30543         this_obj_conv.inner = untag_ptr(this_obj);
30544         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30546         Ping_free(this_obj_conv);
30547 }
30548
30549 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
30550         LDKPing this_ptr_conv;
30551         this_ptr_conv.inner = untag_ptr(this_ptr);
30552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30554         this_ptr_conv.is_owned = false;
30555         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
30556         return ret_conv;
30557 }
30558
30559 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
30560         LDKPing this_ptr_conv;
30561         this_ptr_conv.inner = untag_ptr(this_ptr);
30562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30564         this_ptr_conv.is_owned = false;
30565         Ping_set_ponglen(&this_ptr_conv, val);
30566 }
30567
30568 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
30569         LDKPing this_ptr_conv;
30570         this_ptr_conv.inner = untag_ptr(this_ptr);
30571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30573         this_ptr_conv.is_owned = false;
30574         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
30575         return ret_conv;
30576 }
30577
30578 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
30579         LDKPing this_ptr_conv;
30580         this_ptr_conv.inner = untag_ptr(this_ptr);
30581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30583         this_ptr_conv.is_owned = false;
30584         Ping_set_byteslen(&this_ptr_conv, val);
30585 }
30586
30587 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
30588         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
30589         uint64_t ret_ref = 0;
30590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30592         return ret_ref;
30593 }
30594
30595 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
30596         LDKPing ret_var = Ping_clone(arg);
30597         uint64_t ret_ref = 0;
30598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30600         return ret_ref;
30601 }
30602 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
30603         LDKPing arg_conv;
30604         arg_conv.inner = untag_ptr(arg);
30605         arg_conv.is_owned = ptr_is_owned(arg);
30606         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30607         arg_conv.is_owned = false;
30608         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
30609         return ret_conv;
30610 }
30611
30612 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
30613         LDKPing orig_conv;
30614         orig_conv.inner = untag_ptr(orig);
30615         orig_conv.is_owned = ptr_is_owned(orig);
30616         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30617         orig_conv.is_owned = false;
30618         LDKPing ret_var = Ping_clone(&orig_conv);
30619         uint64_t ret_ref = 0;
30620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30622         return ret_ref;
30623 }
30624
30625 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
30626         LDKPing a_conv;
30627         a_conv.inner = untag_ptr(a);
30628         a_conv.is_owned = ptr_is_owned(a);
30629         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30630         a_conv.is_owned = false;
30631         LDKPing b_conv;
30632         b_conv.inner = untag_ptr(b);
30633         b_conv.is_owned = ptr_is_owned(b);
30634         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30635         b_conv.is_owned = false;
30636         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
30637         return ret_conv;
30638 }
30639
30640 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
30641         LDKPong this_obj_conv;
30642         this_obj_conv.inner = untag_ptr(this_obj);
30643         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30645         Pong_free(this_obj_conv);
30646 }
30647
30648 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
30649         LDKPong this_ptr_conv;
30650         this_ptr_conv.inner = untag_ptr(this_ptr);
30651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30653         this_ptr_conv.is_owned = false;
30654         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
30655         return ret_conv;
30656 }
30657
30658 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
30659         LDKPong this_ptr_conv;
30660         this_ptr_conv.inner = untag_ptr(this_ptr);
30661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30663         this_ptr_conv.is_owned = false;
30664         Pong_set_byteslen(&this_ptr_conv, val);
30665 }
30666
30667 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
30668         LDKPong ret_var = Pong_new(byteslen_arg);
30669         uint64_t ret_ref = 0;
30670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30672         return ret_ref;
30673 }
30674
30675 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
30676         LDKPong ret_var = Pong_clone(arg);
30677         uint64_t ret_ref = 0;
30678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30680         return ret_ref;
30681 }
30682 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
30683         LDKPong arg_conv;
30684         arg_conv.inner = untag_ptr(arg);
30685         arg_conv.is_owned = ptr_is_owned(arg);
30686         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30687         arg_conv.is_owned = false;
30688         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
30689         return ret_conv;
30690 }
30691
30692 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
30693         LDKPong orig_conv;
30694         orig_conv.inner = untag_ptr(orig);
30695         orig_conv.is_owned = ptr_is_owned(orig);
30696         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30697         orig_conv.is_owned = false;
30698         LDKPong ret_var = Pong_clone(&orig_conv);
30699         uint64_t ret_ref = 0;
30700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30702         return ret_ref;
30703 }
30704
30705 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
30706         LDKPong a_conv;
30707         a_conv.inner = untag_ptr(a);
30708         a_conv.is_owned = ptr_is_owned(a);
30709         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30710         a_conv.is_owned = false;
30711         LDKPong b_conv;
30712         b_conv.inner = untag_ptr(b);
30713         b_conv.is_owned = ptr_is_owned(b);
30714         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30715         b_conv.is_owned = false;
30716         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
30717         return ret_conv;
30718 }
30719
30720 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
30721         LDKOpenChannel this_obj_conv;
30722         this_obj_conv.inner = untag_ptr(this_obj);
30723         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30725         OpenChannel_free(this_obj_conv);
30726 }
30727
30728 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
30729         LDKOpenChannel this_ptr_conv;
30730         this_ptr_conv.inner = untag_ptr(this_ptr);
30731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30733         this_ptr_conv.is_owned = false;
30734         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30735         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
30736         return ret_arr;
30737 }
30738
30739 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
30740         LDKOpenChannel this_ptr_conv;
30741         this_ptr_conv.inner = untag_ptr(this_ptr);
30742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30744         this_ptr_conv.is_owned = false;
30745         LDKThirtyTwoBytes val_ref;
30746         CHECK(val->arr_len == 32);
30747         memcpy(val_ref.data, val->elems, 32); FREE(val);
30748         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
30749 }
30750
30751 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
30752         LDKOpenChannel this_ptr_conv;
30753         this_ptr_conv.inner = untag_ptr(this_ptr);
30754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30756         this_ptr_conv.is_owned = false;
30757         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30758         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
30759         return ret_arr;
30760 }
30761
30762 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
30763         LDKOpenChannel this_ptr_conv;
30764         this_ptr_conv.inner = untag_ptr(this_ptr);
30765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30767         this_ptr_conv.is_owned = false;
30768         LDKThirtyTwoBytes val_ref;
30769         CHECK(val->arr_len == 32);
30770         memcpy(val_ref.data, val->elems, 32); FREE(val);
30771         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
30772 }
30773
30774 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
30775         LDKOpenChannel this_ptr_conv;
30776         this_ptr_conv.inner = untag_ptr(this_ptr);
30777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30779         this_ptr_conv.is_owned = false;
30780         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
30781         return ret_conv;
30782 }
30783
30784 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
30785         LDKOpenChannel this_ptr_conv;
30786         this_ptr_conv.inner = untag_ptr(this_ptr);
30787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30789         this_ptr_conv.is_owned = false;
30790         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
30791 }
30792
30793 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
30794         LDKOpenChannel this_ptr_conv;
30795         this_ptr_conv.inner = untag_ptr(this_ptr);
30796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30798         this_ptr_conv.is_owned = false;
30799         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
30800         return ret_conv;
30801 }
30802
30803 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
30804         LDKOpenChannel this_ptr_conv;
30805         this_ptr_conv.inner = untag_ptr(this_ptr);
30806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30808         this_ptr_conv.is_owned = false;
30809         OpenChannel_set_push_msat(&this_ptr_conv, val);
30810 }
30811
30812 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
30813         LDKOpenChannel this_ptr_conv;
30814         this_ptr_conv.inner = untag_ptr(this_ptr);
30815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30817         this_ptr_conv.is_owned = false;
30818         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
30819         return ret_conv;
30820 }
30821
30822 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
30823         LDKOpenChannel this_ptr_conv;
30824         this_ptr_conv.inner = untag_ptr(this_ptr);
30825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30827         this_ptr_conv.is_owned = false;
30828         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
30829 }
30830
30831 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) {
30832         LDKOpenChannel this_ptr_conv;
30833         this_ptr_conv.inner = untag_ptr(this_ptr);
30834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30836         this_ptr_conv.is_owned = false;
30837         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
30838         return ret_conv;
30839 }
30840
30841 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) {
30842         LDKOpenChannel this_ptr_conv;
30843         this_ptr_conv.inner = untag_ptr(this_ptr);
30844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30846         this_ptr_conv.is_owned = false;
30847         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30848 }
30849
30850 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
30851         LDKOpenChannel this_ptr_conv;
30852         this_ptr_conv.inner = untag_ptr(this_ptr);
30853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30855         this_ptr_conv.is_owned = false;
30856         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
30857         return ret_conv;
30858 }
30859
30860 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
30861         LDKOpenChannel this_ptr_conv;
30862         this_ptr_conv.inner = untag_ptr(this_ptr);
30863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30865         this_ptr_conv.is_owned = false;
30866         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
30867 }
30868
30869 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
30870         LDKOpenChannel this_ptr_conv;
30871         this_ptr_conv.inner = untag_ptr(this_ptr);
30872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30874         this_ptr_conv.is_owned = false;
30875         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
30876         return ret_conv;
30877 }
30878
30879 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
30880         LDKOpenChannel this_ptr_conv;
30881         this_ptr_conv.inner = untag_ptr(this_ptr);
30882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30884         this_ptr_conv.is_owned = false;
30885         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
30886 }
30887
30888 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
30889         LDKOpenChannel this_ptr_conv;
30890         this_ptr_conv.inner = untag_ptr(this_ptr);
30891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30893         this_ptr_conv.is_owned = false;
30894         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
30895         return ret_conv;
30896 }
30897
30898 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
30899         LDKOpenChannel this_ptr_conv;
30900         this_ptr_conv.inner = untag_ptr(this_ptr);
30901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30903         this_ptr_conv.is_owned = false;
30904         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
30905 }
30906
30907 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
30908         LDKOpenChannel this_ptr_conv;
30909         this_ptr_conv.inner = untag_ptr(this_ptr);
30910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30912         this_ptr_conv.is_owned = false;
30913         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
30914         return ret_conv;
30915 }
30916
30917 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
30918         LDKOpenChannel this_ptr_conv;
30919         this_ptr_conv.inner = untag_ptr(this_ptr);
30920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30922         this_ptr_conv.is_owned = false;
30923         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
30924 }
30925
30926 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
30927         LDKOpenChannel this_ptr_conv;
30928         this_ptr_conv.inner = untag_ptr(this_ptr);
30929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30931         this_ptr_conv.is_owned = false;
30932         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
30933         return ret_conv;
30934 }
30935
30936 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
30937         LDKOpenChannel this_ptr_conv;
30938         this_ptr_conv.inner = untag_ptr(this_ptr);
30939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30941         this_ptr_conv.is_owned = false;
30942         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
30943 }
30944
30945 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
30946         LDKOpenChannel this_ptr_conv;
30947         this_ptr_conv.inner = untag_ptr(this_ptr);
30948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30950         this_ptr_conv.is_owned = false;
30951         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30952         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
30953         return ret_arr;
30954 }
30955
30956 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray 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         LDKPublicKey val_ref;
30963         CHECK(val->arr_len == 33);
30964         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30965         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
30966 }
30967
30968 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
30969         LDKOpenChannel this_ptr_conv;
30970         this_ptr_conv.inner = untag_ptr(this_ptr);
30971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30973         this_ptr_conv.is_owned = false;
30974         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30975         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
30976         return ret_arr;
30977 }
30978
30979 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
30980         LDKOpenChannel this_ptr_conv;
30981         this_ptr_conv.inner = untag_ptr(this_ptr);
30982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30984         this_ptr_conv.is_owned = false;
30985         LDKPublicKey val_ref;
30986         CHECK(val->arr_len == 33);
30987         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30988         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
30989 }
30990
30991 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
30992         LDKOpenChannel this_ptr_conv;
30993         this_ptr_conv.inner = untag_ptr(this_ptr);
30994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30996         this_ptr_conv.is_owned = false;
30997         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30998         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
30999         return ret_arr;
31000 }
31001
31002 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
31003         LDKOpenChannel this_ptr_conv;
31004         this_ptr_conv.inner = untag_ptr(this_ptr);
31005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31007         this_ptr_conv.is_owned = false;
31008         LDKPublicKey val_ref;
31009         CHECK(val->arr_len == 33);
31010         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31011         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
31012 }
31013
31014 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
31015         LDKOpenChannel this_ptr_conv;
31016         this_ptr_conv.inner = untag_ptr(this_ptr);
31017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31019         this_ptr_conv.is_owned = false;
31020         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31021         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
31022         return ret_arr;
31023 }
31024
31025 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
31026         LDKOpenChannel this_ptr_conv;
31027         this_ptr_conv.inner = untag_ptr(this_ptr);
31028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31030         this_ptr_conv.is_owned = false;
31031         LDKPublicKey val_ref;
31032         CHECK(val->arr_len == 33);
31033         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31034         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31035 }
31036
31037 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
31038         LDKOpenChannel this_ptr_conv;
31039         this_ptr_conv.inner = untag_ptr(this_ptr);
31040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31042         this_ptr_conv.is_owned = false;
31043         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31044         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
31045         return ret_arr;
31046 }
31047
31048 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
31049         LDKOpenChannel this_ptr_conv;
31050         this_ptr_conv.inner = untag_ptr(this_ptr);
31051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31053         this_ptr_conv.is_owned = false;
31054         LDKPublicKey val_ref;
31055         CHECK(val->arr_len == 33);
31056         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31057         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31058 }
31059
31060 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
31061         LDKOpenChannel this_ptr_conv;
31062         this_ptr_conv.inner = untag_ptr(this_ptr);
31063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31065         this_ptr_conv.is_owned = false;
31066         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31067         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31068         return ret_arr;
31069 }
31070
31071 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) {
31072         LDKOpenChannel this_ptr_conv;
31073         this_ptr_conv.inner = untag_ptr(this_ptr);
31074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31076         this_ptr_conv.is_owned = false;
31077         LDKPublicKey val_ref;
31078         CHECK(val->arr_len == 33);
31079         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31080         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31081 }
31082
31083 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
31084         LDKOpenChannel this_ptr_conv;
31085         this_ptr_conv.inner = untag_ptr(this_ptr);
31086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31088         this_ptr_conv.is_owned = false;
31089         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
31090         return ret_conv;
31091 }
31092
31093 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
31094         LDKOpenChannel this_ptr_conv;
31095         this_ptr_conv.inner = untag_ptr(this_ptr);
31096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31098         this_ptr_conv.is_owned = false;
31099         OpenChannel_set_channel_flags(&this_ptr_conv, val);
31100 }
31101
31102 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
31103         LDKOpenChannel this_ptr_conv;
31104         this_ptr_conv.inner = untag_ptr(this_ptr);
31105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31107         this_ptr_conv.is_owned = false;
31108         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
31109         uint64_t ret_ref = 0;
31110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31112         return ret_ref;
31113 }
31114
31115 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
31116         LDKOpenChannel this_ptr_conv;
31117         this_ptr_conv.inner = untag_ptr(this_ptr);
31118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31120         this_ptr_conv.is_owned = false;
31121         LDKChannelTypeFeatures val_conv;
31122         val_conv.inner = untag_ptr(val);
31123         val_conv.is_owned = ptr_is_owned(val);
31124         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31125         val_conv = ChannelTypeFeatures_clone(&val_conv);
31126         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
31127 }
31128
31129 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
31130         LDKOpenChannel ret_var = OpenChannel_clone(arg);
31131         uint64_t ret_ref = 0;
31132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31134         return ret_ref;
31135 }
31136 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
31137         LDKOpenChannel arg_conv;
31138         arg_conv.inner = untag_ptr(arg);
31139         arg_conv.is_owned = ptr_is_owned(arg);
31140         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31141         arg_conv.is_owned = false;
31142         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
31143         return ret_conv;
31144 }
31145
31146 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
31147         LDKOpenChannel orig_conv;
31148         orig_conv.inner = untag_ptr(orig);
31149         orig_conv.is_owned = ptr_is_owned(orig);
31150         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31151         orig_conv.is_owned = false;
31152         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
31153         uint64_t ret_ref = 0;
31154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31156         return ret_ref;
31157 }
31158
31159 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
31160         LDKOpenChannel a_conv;
31161         a_conv.inner = untag_ptr(a);
31162         a_conv.is_owned = ptr_is_owned(a);
31163         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31164         a_conv.is_owned = false;
31165         LDKOpenChannel b_conv;
31166         b_conv.inner = untag_ptr(b);
31167         b_conv.is_owned = ptr_is_owned(b);
31168         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31169         b_conv.is_owned = false;
31170         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
31171         return ret_conv;
31172 }
31173
31174 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
31175         LDKAcceptChannel this_obj_conv;
31176         this_obj_conv.inner = untag_ptr(this_obj);
31177         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31179         AcceptChannel_free(this_obj_conv);
31180 }
31181
31182 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
31183         LDKAcceptChannel this_ptr_conv;
31184         this_ptr_conv.inner = untag_ptr(this_ptr);
31185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31187         this_ptr_conv.is_owned = false;
31188         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31189         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
31190         return ret_arr;
31191 }
31192
31193 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
31194         LDKAcceptChannel this_ptr_conv;
31195         this_ptr_conv.inner = untag_ptr(this_ptr);
31196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31198         this_ptr_conv.is_owned = false;
31199         LDKThirtyTwoBytes val_ref;
31200         CHECK(val->arr_len == 32);
31201         memcpy(val_ref.data, val->elems, 32); FREE(val);
31202         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
31203 }
31204
31205 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
31206         LDKAcceptChannel this_ptr_conv;
31207         this_ptr_conv.inner = untag_ptr(this_ptr);
31208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31210         this_ptr_conv.is_owned = false;
31211         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
31212         return ret_conv;
31213 }
31214
31215 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
31216         LDKAcceptChannel this_ptr_conv;
31217         this_ptr_conv.inner = untag_ptr(this_ptr);
31218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31220         this_ptr_conv.is_owned = false;
31221         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
31222 }
31223
31224 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) {
31225         LDKAcceptChannel this_ptr_conv;
31226         this_ptr_conv.inner = untag_ptr(this_ptr);
31227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31229         this_ptr_conv.is_owned = false;
31230         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
31231         return ret_conv;
31232 }
31233
31234 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) {
31235         LDKAcceptChannel this_ptr_conv;
31236         this_ptr_conv.inner = untag_ptr(this_ptr);
31237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31239         this_ptr_conv.is_owned = false;
31240         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
31241 }
31242
31243 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
31244         LDKAcceptChannel this_ptr_conv;
31245         this_ptr_conv.inner = untag_ptr(this_ptr);
31246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31248         this_ptr_conv.is_owned = false;
31249         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
31250         return ret_conv;
31251 }
31252
31253 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
31254         LDKAcceptChannel this_ptr_conv;
31255         this_ptr_conv.inner = untag_ptr(this_ptr);
31256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31258         this_ptr_conv.is_owned = false;
31259         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
31260 }
31261
31262 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
31263         LDKAcceptChannel this_ptr_conv;
31264         this_ptr_conv.inner = untag_ptr(this_ptr);
31265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31267         this_ptr_conv.is_owned = false;
31268         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
31269         return ret_conv;
31270 }
31271
31272 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
31273         LDKAcceptChannel this_ptr_conv;
31274         this_ptr_conv.inner = untag_ptr(this_ptr);
31275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31277         this_ptr_conv.is_owned = false;
31278         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
31279 }
31280
31281 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
31282         LDKAcceptChannel this_ptr_conv;
31283         this_ptr_conv.inner = untag_ptr(this_ptr);
31284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31286         this_ptr_conv.is_owned = false;
31287         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
31288         return ret_conv;
31289 }
31290
31291 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
31292         LDKAcceptChannel this_ptr_conv;
31293         this_ptr_conv.inner = untag_ptr(this_ptr);
31294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31296         this_ptr_conv.is_owned = false;
31297         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
31298 }
31299
31300 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
31301         LDKAcceptChannel this_ptr_conv;
31302         this_ptr_conv.inner = untag_ptr(this_ptr);
31303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31305         this_ptr_conv.is_owned = false;
31306         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
31307         return ret_conv;
31308 }
31309
31310 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
31311         LDKAcceptChannel this_ptr_conv;
31312         this_ptr_conv.inner = untag_ptr(this_ptr);
31313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31315         this_ptr_conv.is_owned = false;
31316         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
31317 }
31318
31319 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
31320         LDKAcceptChannel this_ptr_conv;
31321         this_ptr_conv.inner = untag_ptr(this_ptr);
31322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31324         this_ptr_conv.is_owned = false;
31325         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
31326         return ret_conv;
31327 }
31328
31329 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
31330         LDKAcceptChannel this_ptr_conv;
31331         this_ptr_conv.inner = untag_ptr(this_ptr);
31332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31334         this_ptr_conv.is_owned = false;
31335         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
31336 }
31337
31338 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
31339         LDKAcceptChannel this_ptr_conv;
31340         this_ptr_conv.inner = untag_ptr(this_ptr);
31341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31343         this_ptr_conv.is_owned = false;
31344         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31345         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
31346         return ret_arr;
31347 }
31348
31349 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray 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         LDKPublicKey val_ref;
31356         CHECK(val->arr_len == 33);
31357         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31358         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
31359 }
31360
31361 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
31362         LDKAcceptChannel this_ptr_conv;
31363         this_ptr_conv.inner = untag_ptr(this_ptr);
31364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31366         this_ptr_conv.is_owned = false;
31367         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31368         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
31369         return ret_arr;
31370 }
31371
31372 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
31373         LDKAcceptChannel this_ptr_conv;
31374         this_ptr_conv.inner = untag_ptr(this_ptr);
31375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31377         this_ptr_conv.is_owned = false;
31378         LDKPublicKey val_ref;
31379         CHECK(val->arr_len == 33);
31380         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31381         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31382 }
31383
31384 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
31385         LDKAcceptChannel this_ptr_conv;
31386         this_ptr_conv.inner = untag_ptr(this_ptr);
31387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31389         this_ptr_conv.is_owned = false;
31390         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31391         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
31392         return ret_arr;
31393 }
31394
31395 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
31396         LDKAcceptChannel this_ptr_conv;
31397         this_ptr_conv.inner = untag_ptr(this_ptr);
31398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31400         this_ptr_conv.is_owned = false;
31401         LDKPublicKey val_ref;
31402         CHECK(val->arr_len == 33);
31403         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31404         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
31405 }
31406
31407 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
31408         LDKAcceptChannel this_ptr_conv;
31409         this_ptr_conv.inner = untag_ptr(this_ptr);
31410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31412         this_ptr_conv.is_owned = false;
31413         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31414         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
31415         return ret_arr;
31416 }
31417
31418 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
31419         LDKAcceptChannel this_ptr_conv;
31420         this_ptr_conv.inner = untag_ptr(this_ptr);
31421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31423         this_ptr_conv.is_owned = false;
31424         LDKPublicKey val_ref;
31425         CHECK(val->arr_len == 33);
31426         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31427         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31428 }
31429
31430 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
31431         LDKAcceptChannel this_ptr_conv;
31432         this_ptr_conv.inner = untag_ptr(this_ptr);
31433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31435         this_ptr_conv.is_owned = false;
31436         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31437         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
31438         return ret_arr;
31439 }
31440
31441 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
31442         LDKAcceptChannel this_ptr_conv;
31443         this_ptr_conv.inner = untag_ptr(this_ptr);
31444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31446         this_ptr_conv.is_owned = false;
31447         LDKPublicKey val_ref;
31448         CHECK(val->arr_len == 33);
31449         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31450         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31451 }
31452
31453 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
31454         LDKAcceptChannel this_ptr_conv;
31455         this_ptr_conv.inner = untag_ptr(this_ptr);
31456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31458         this_ptr_conv.is_owned = false;
31459         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31460         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31461         return ret_arr;
31462 }
31463
31464 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) {
31465         LDKAcceptChannel this_ptr_conv;
31466         this_ptr_conv.inner = untag_ptr(this_ptr);
31467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31469         this_ptr_conv.is_owned = false;
31470         LDKPublicKey val_ref;
31471         CHECK(val->arr_len == 33);
31472         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31473         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31474 }
31475
31476 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
31477         LDKAcceptChannel this_ptr_conv;
31478         this_ptr_conv.inner = untag_ptr(this_ptr);
31479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31481         this_ptr_conv.is_owned = false;
31482         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
31483         uint64_t ret_ref = 0;
31484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31486         return ret_ref;
31487 }
31488
31489 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
31490         LDKAcceptChannel this_ptr_conv;
31491         this_ptr_conv.inner = untag_ptr(this_ptr);
31492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31494         this_ptr_conv.is_owned = false;
31495         LDKChannelTypeFeatures val_conv;
31496         val_conv.inner = untag_ptr(val);
31497         val_conv.is_owned = ptr_is_owned(val);
31498         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31499         val_conv = ChannelTypeFeatures_clone(&val_conv);
31500         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
31501 }
31502
31503 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
31504         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
31505         uint64_t ret_ref = 0;
31506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31508         return ret_ref;
31509 }
31510 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
31511         LDKAcceptChannel arg_conv;
31512         arg_conv.inner = untag_ptr(arg);
31513         arg_conv.is_owned = ptr_is_owned(arg);
31514         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31515         arg_conv.is_owned = false;
31516         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
31517         return ret_conv;
31518 }
31519
31520 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
31521         LDKAcceptChannel orig_conv;
31522         orig_conv.inner = untag_ptr(orig);
31523         orig_conv.is_owned = ptr_is_owned(orig);
31524         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31525         orig_conv.is_owned = false;
31526         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
31527         uint64_t ret_ref = 0;
31528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31530         return ret_ref;
31531 }
31532
31533 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
31534         LDKAcceptChannel a_conv;
31535         a_conv.inner = untag_ptr(a);
31536         a_conv.is_owned = ptr_is_owned(a);
31537         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31538         a_conv.is_owned = false;
31539         LDKAcceptChannel b_conv;
31540         b_conv.inner = untag_ptr(b);
31541         b_conv.is_owned = ptr_is_owned(b);
31542         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31543         b_conv.is_owned = false;
31544         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
31545         return ret_conv;
31546 }
31547
31548 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
31549         LDKFundingCreated this_obj_conv;
31550         this_obj_conv.inner = untag_ptr(this_obj);
31551         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31553         FundingCreated_free(this_obj_conv);
31554 }
31555
31556 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
31557         LDKFundingCreated this_ptr_conv;
31558         this_ptr_conv.inner = untag_ptr(this_ptr);
31559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31561         this_ptr_conv.is_owned = false;
31562         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31563         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
31564         return ret_arr;
31565 }
31566
31567 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
31568         LDKFundingCreated this_ptr_conv;
31569         this_ptr_conv.inner = untag_ptr(this_ptr);
31570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31572         this_ptr_conv.is_owned = false;
31573         LDKThirtyTwoBytes val_ref;
31574         CHECK(val->arr_len == 32);
31575         memcpy(val_ref.data, val->elems, 32); FREE(val);
31576         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
31577 }
31578
31579 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
31580         LDKFundingCreated this_ptr_conv;
31581         this_ptr_conv.inner = untag_ptr(this_ptr);
31582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31584         this_ptr_conv.is_owned = false;
31585         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31586         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
31587         return ret_arr;
31588 }
31589
31590 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
31591         LDKFundingCreated this_ptr_conv;
31592         this_ptr_conv.inner = untag_ptr(this_ptr);
31593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31595         this_ptr_conv.is_owned = false;
31596         LDKThirtyTwoBytes val_ref;
31597         CHECK(val->arr_len == 32);
31598         memcpy(val_ref.data, val->elems, 32); FREE(val);
31599         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
31600 }
31601
31602 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
31603         LDKFundingCreated this_ptr_conv;
31604         this_ptr_conv.inner = untag_ptr(this_ptr);
31605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31607         this_ptr_conv.is_owned = false;
31608         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
31609         return ret_conv;
31610 }
31611
31612 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
31613         LDKFundingCreated this_ptr_conv;
31614         this_ptr_conv.inner = untag_ptr(this_ptr);
31615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31617         this_ptr_conv.is_owned = false;
31618         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
31619 }
31620
31621 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
31622         LDKFundingCreated this_ptr_conv;
31623         this_ptr_conv.inner = untag_ptr(this_ptr);
31624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31626         this_ptr_conv.is_owned = false;
31627         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31628         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
31629         return ret_arr;
31630 }
31631
31632 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray 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         LDKSignature val_ref;
31639         CHECK(val->arr_len == 64);
31640         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31641         FundingCreated_set_signature(&this_ptr_conv, val_ref);
31642 }
31643
31644 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) {
31645         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
31646         CHECK(temporary_channel_id_arg->arr_len == 32);
31647         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
31648         LDKThirtyTwoBytes funding_txid_arg_ref;
31649         CHECK(funding_txid_arg->arr_len == 32);
31650         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
31651         LDKSignature signature_arg_ref;
31652         CHECK(signature_arg->arr_len == 64);
31653         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31654         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
31655         uint64_t ret_ref = 0;
31656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31658         return ret_ref;
31659 }
31660
31661 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
31662         LDKFundingCreated ret_var = FundingCreated_clone(arg);
31663         uint64_t ret_ref = 0;
31664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31666         return ret_ref;
31667 }
31668 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
31669         LDKFundingCreated arg_conv;
31670         arg_conv.inner = untag_ptr(arg);
31671         arg_conv.is_owned = ptr_is_owned(arg);
31672         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31673         arg_conv.is_owned = false;
31674         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
31675         return ret_conv;
31676 }
31677
31678 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
31679         LDKFundingCreated orig_conv;
31680         orig_conv.inner = untag_ptr(orig);
31681         orig_conv.is_owned = ptr_is_owned(orig);
31682         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31683         orig_conv.is_owned = false;
31684         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
31685         uint64_t ret_ref = 0;
31686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31688         return ret_ref;
31689 }
31690
31691 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
31692         LDKFundingCreated a_conv;
31693         a_conv.inner = untag_ptr(a);
31694         a_conv.is_owned = ptr_is_owned(a);
31695         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31696         a_conv.is_owned = false;
31697         LDKFundingCreated b_conv;
31698         b_conv.inner = untag_ptr(b);
31699         b_conv.is_owned = ptr_is_owned(b);
31700         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31701         b_conv.is_owned = false;
31702         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
31703         return ret_conv;
31704 }
31705
31706 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
31707         LDKFundingSigned this_obj_conv;
31708         this_obj_conv.inner = untag_ptr(this_obj);
31709         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31711         FundingSigned_free(this_obj_conv);
31712 }
31713
31714 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
31715         LDKFundingSigned this_ptr_conv;
31716         this_ptr_conv.inner = untag_ptr(this_ptr);
31717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31719         this_ptr_conv.is_owned = false;
31720         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31721         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
31722         return ret_arr;
31723 }
31724
31725 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31726         LDKFundingSigned this_ptr_conv;
31727         this_ptr_conv.inner = untag_ptr(this_ptr);
31728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31730         this_ptr_conv.is_owned = false;
31731         LDKThirtyTwoBytes val_ref;
31732         CHECK(val->arr_len == 32);
31733         memcpy(val_ref.data, val->elems, 32); FREE(val);
31734         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
31735 }
31736
31737 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
31738         LDKFundingSigned this_ptr_conv;
31739         this_ptr_conv.inner = untag_ptr(this_ptr);
31740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31742         this_ptr_conv.is_owned = false;
31743         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31744         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
31745         return ret_arr;
31746 }
31747
31748 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
31749         LDKFundingSigned this_ptr_conv;
31750         this_ptr_conv.inner = untag_ptr(this_ptr);
31751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31753         this_ptr_conv.is_owned = false;
31754         LDKSignature val_ref;
31755         CHECK(val->arr_len == 64);
31756         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31757         FundingSigned_set_signature(&this_ptr_conv, val_ref);
31758 }
31759
31760 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
31761         LDKThirtyTwoBytes channel_id_arg_ref;
31762         CHECK(channel_id_arg->arr_len == 32);
31763         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31764         LDKSignature signature_arg_ref;
31765         CHECK(signature_arg->arr_len == 64);
31766         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31767         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
31768         uint64_t ret_ref = 0;
31769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31771         return ret_ref;
31772 }
31773
31774 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
31775         LDKFundingSigned ret_var = FundingSigned_clone(arg);
31776         uint64_t ret_ref = 0;
31777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31779         return ret_ref;
31780 }
31781 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
31782         LDKFundingSigned arg_conv;
31783         arg_conv.inner = untag_ptr(arg);
31784         arg_conv.is_owned = ptr_is_owned(arg);
31785         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31786         arg_conv.is_owned = false;
31787         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
31788         return ret_conv;
31789 }
31790
31791 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
31792         LDKFundingSigned orig_conv;
31793         orig_conv.inner = untag_ptr(orig);
31794         orig_conv.is_owned = ptr_is_owned(orig);
31795         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31796         orig_conv.is_owned = false;
31797         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
31798         uint64_t ret_ref = 0;
31799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31801         return ret_ref;
31802 }
31803
31804 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
31805         LDKFundingSigned a_conv;
31806         a_conv.inner = untag_ptr(a);
31807         a_conv.is_owned = ptr_is_owned(a);
31808         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31809         a_conv.is_owned = false;
31810         LDKFundingSigned b_conv;
31811         b_conv.inner = untag_ptr(b);
31812         b_conv.is_owned = ptr_is_owned(b);
31813         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31814         b_conv.is_owned = false;
31815         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
31816         return ret_conv;
31817 }
31818
31819 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
31820         LDKChannelReady this_obj_conv;
31821         this_obj_conv.inner = untag_ptr(this_obj);
31822         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31824         ChannelReady_free(this_obj_conv);
31825 }
31826
31827 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
31828         LDKChannelReady this_ptr_conv;
31829         this_ptr_conv.inner = untag_ptr(this_ptr);
31830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31832         this_ptr_conv.is_owned = false;
31833         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31834         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
31835         return ret_arr;
31836 }
31837
31838 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31839         LDKChannelReady this_ptr_conv;
31840         this_ptr_conv.inner = untag_ptr(this_ptr);
31841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31843         this_ptr_conv.is_owned = false;
31844         LDKThirtyTwoBytes val_ref;
31845         CHECK(val->arr_len == 32);
31846         memcpy(val_ref.data, val->elems, 32); FREE(val);
31847         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
31848 }
31849
31850 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
31851         LDKChannelReady this_ptr_conv;
31852         this_ptr_conv.inner = untag_ptr(this_ptr);
31853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31855         this_ptr_conv.is_owned = false;
31856         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31857         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31858         return ret_arr;
31859 }
31860
31861 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) {
31862         LDKChannelReady this_ptr_conv;
31863         this_ptr_conv.inner = untag_ptr(this_ptr);
31864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31866         this_ptr_conv.is_owned = false;
31867         LDKPublicKey val_ref;
31868         CHECK(val->arr_len == 33);
31869         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31870         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
31871 }
31872
31873 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
31874         LDKChannelReady this_ptr_conv;
31875         this_ptr_conv.inner = untag_ptr(this_ptr);
31876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31878         this_ptr_conv.is_owned = false;
31879         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31880         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
31881         uint64_t ret_ref = tag_ptr(ret_copy, true);
31882         return ret_ref;
31883 }
31884
31885 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) {
31886         LDKChannelReady this_ptr_conv;
31887         this_ptr_conv.inner = untag_ptr(this_ptr);
31888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31890         this_ptr_conv.is_owned = false;
31891         void* val_ptr = untag_ptr(val);
31892         CHECK_ACCESS(val_ptr);
31893         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31894         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31895         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
31896 }
31897
31898 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) {
31899         LDKThirtyTwoBytes channel_id_arg_ref;
31900         CHECK(channel_id_arg->arr_len == 32);
31901         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31902         LDKPublicKey next_per_commitment_point_arg_ref;
31903         CHECK(next_per_commitment_point_arg->arr_len == 33);
31904         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
31905         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
31906         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
31907         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
31908         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
31909         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
31910         uint64_t ret_ref = 0;
31911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31913         return ret_ref;
31914 }
31915
31916 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
31917         LDKChannelReady ret_var = ChannelReady_clone(arg);
31918         uint64_t ret_ref = 0;
31919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31921         return ret_ref;
31922 }
31923 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
31924         LDKChannelReady arg_conv;
31925         arg_conv.inner = untag_ptr(arg);
31926         arg_conv.is_owned = ptr_is_owned(arg);
31927         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31928         arg_conv.is_owned = false;
31929         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
31930         return ret_conv;
31931 }
31932
31933 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
31934         LDKChannelReady orig_conv;
31935         orig_conv.inner = untag_ptr(orig);
31936         orig_conv.is_owned = ptr_is_owned(orig);
31937         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31938         orig_conv.is_owned = false;
31939         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
31940         uint64_t ret_ref = 0;
31941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31943         return ret_ref;
31944 }
31945
31946 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
31947         LDKChannelReady a_conv;
31948         a_conv.inner = untag_ptr(a);
31949         a_conv.is_owned = ptr_is_owned(a);
31950         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31951         a_conv.is_owned = false;
31952         LDKChannelReady b_conv;
31953         b_conv.inner = untag_ptr(b);
31954         b_conv.is_owned = ptr_is_owned(b);
31955         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31956         b_conv.is_owned = false;
31957         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
31958         return ret_conv;
31959 }
31960
31961 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
31962         LDKShutdown this_obj_conv;
31963         this_obj_conv.inner = untag_ptr(this_obj);
31964         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31966         Shutdown_free(this_obj_conv);
31967 }
31968
31969 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
31970         LDKShutdown this_ptr_conv;
31971         this_ptr_conv.inner = untag_ptr(this_ptr);
31972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31974         this_ptr_conv.is_owned = false;
31975         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31976         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
31977         return ret_arr;
31978 }
31979
31980 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31981         LDKShutdown this_ptr_conv;
31982         this_ptr_conv.inner = untag_ptr(this_ptr);
31983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31985         this_ptr_conv.is_owned = false;
31986         LDKThirtyTwoBytes val_ref;
31987         CHECK(val->arr_len == 32);
31988         memcpy(val_ref.data, val->elems, 32); FREE(val);
31989         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
31990 }
31991
31992 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
31993         LDKShutdown this_ptr_conv;
31994         this_ptr_conv.inner = untag_ptr(this_ptr);
31995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31997         this_ptr_conv.is_owned = false;
31998         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
31999         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32000         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32001         return ret_arr;
32002 }
32003
32004 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
32005         LDKShutdown this_ptr_conv;
32006         this_ptr_conv.inner = untag_ptr(this_ptr);
32007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32009         this_ptr_conv.is_owned = false;
32010         LDKCVec_u8Z val_ref;
32011         val_ref.datalen = val->arr_len;
32012         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
32013         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
32014         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
32015 }
32016
32017 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
32018         LDKThirtyTwoBytes channel_id_arg_ref;
32019         CHECK(channel_id_arg->arr_len == 32);
32020         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32021         LDKCVec_u8Z scriptpubkey_arg_ref;
32022         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
32023         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
32024         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
32025         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
32026         uint64_t ret_ref = 0;
32027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32029         return ret_ref;
32030 }
32031
32032 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
32033         LDKShutdown ret_var = Shutdown_clone(arg);
32034         uint64_t ret_ref = 0;
32035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32037         return ret_ref;
32038 }
32039 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
32040         LDKShutdown arg_conv;
32041         arg_conv.inner = untag_ptr(arg);
32042         arg_conv.is_owned = ptr_is_owned(arg);
32043         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32044         arg_conv.is_owned = false;
32045         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
32046         return ret_conv;
32047 }
32048
32049 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
32050         LDKShutdown orig_conv;
32051         orig_conv.inner = untag_ptr(orig);
32052         orig_conv.is_owned = ptr_is_owned(orig);
32053         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32054         orig_conv.is_owned = false;
32055         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
32056         uint64_t ret_ref = 0;
32057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32059         return ret_ref;
32060 }
32061
32062 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
32063         LDKShutdown a_conv;
32064         a_conv.inner = untag_ptr(a);
32065         a_conv.is_owned = ptr_is_owned(a);
32066         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32067         a_conv.is_owned = false;
32068         LDKShutdown b_conv;
32069         b_conv.inner = untag_ptr(b);
32070         b_conv.is_owned = ptr_is_owned(b);
32071         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32072         b_conv.is_owned = false;
32073         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
32074         return ret_conv;
32075 }
32076
32077 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
32078         LDKClosingSignedFeeRange this_obj_conv;
32079         this_obj_conv.inner = untag_ptr(this_obj);
32080         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32082         ClosingSignedFeeRange_free(this_obj_conv);
32083 }
32084
32085 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
32086         LDKClosingSignedFeeRange this_ptr_conv;
32087         this_ptr_conv.inner = untag_ptr(this_ptr);
32088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32090         this_ptr_conv.is_owned = false;
32091         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
32092         return ret_conv;
32093 }
32094
32095 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
32096         LDKClosingSignedFeeRange this_ptr_conv;
32097         this_ptr_conv.inner = untag_ptr(this_ptr);
32098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32100         this_ptr_conv.is_owned = false;
32101         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
32102 }
32103
32104 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
32105         LDKClosingSignedFeeRange this_ptr_conv;
32106         this_ptr_conv.inner = untag_ptr(this_ptr);
32107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32109         this_ptr_conv.is_owned = false;
32110         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
32111         return ret_conv;
32112 }
32113
32114 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
32115         LDKClosingSignedFeeRange this_ptr_conv;
32116         this_ptr_conv.inner = untag_ptr(this_ptr);
32117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32119         this_ptr_conv.is_owned = false;
32120         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
32121 }
32122
32123 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
32124         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
32125         uint64_t ret_ref = 0;
32126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32128         return ret_ref;
32129 }
32130
32131 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
32132         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
32133         uint64_t ret_ref = 0;
32134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32136         return ret_ref;
32137 }
32138 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
32139         LDKClosingSignedFeeRange arg_conv;
32140         arg_conv.inner = untag_ptr(arg);
32141         arg_conv.is_owned = ptr_is_owned(arg);
32142         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32143         arg_conv.is_owned = false;
32144         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
32145         return ret_conv;
32146 }
32147
32148 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
32149         LDKClosingSignedFeeRange orig_conv;
32150         orig_conv.inner = untag_ptr(orig);
32151         orig_conv.is_owned = ptr_is_owned(orig);
32152         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32153         orig_conv.is_owned = false;
32154         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
32155         uint64_t ret_ref = 0;
32156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32158         return ret_ref;
32159 }
32160
32161 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
32162         LDKClosingSignedFeeRange a_conv;
32163         a_conv.inner = untag_ptr(a);
32164         a_conv.is_owned = ptr_is_owned(a);
32165         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32166         a_conv.is_owned = false;
32167         LDKClosingSignedFeeRange b_conv;
32168         b_conv.inner = untag_ptr(b);
32169         b_conv.is_owned = ptr_is_owned(b);
32170         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32171         b_conv.is_owned = false;
32172         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
32173         return ret_conv;
32174 }
32175
32176 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
32177         LDKClosingSigned this_obj_conv;
32178         this_obj_conv.inner = untag_ptr(this_obj);
32179         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32181         ClosingSigned_free(this_obj_conv);
32182 }
32183
32184 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
32185         LDKClosingSigned this_ptr_conv;
32186         this_ptr_conv.inner = untag_ptr(this_ptr);
32187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32189         this_ptr_conv.is_owned = false;
32190         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32191         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
32192         return ret_arr;
32193 }
32194
32195 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32196         LDKClosingSigned this_ptr_conv;
32197         this_ptr_conv.inner = untag_ptr(this_ptr);
32198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32200         this_ptr_conv.is_owned = false;
32201         LDKThirtyTwoBytes val_ref;
32202         CHECK(val->arr_len == 32);
32203         memcpy(val_ref.data, val->elems, 32); FREE(val);
32204         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
32205 }
32206
32207 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
32208         LDKClosingSigned this_ptr_conv;
32209         this_ptr_conv.inner = untag_ptr(this_ptr);
32210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32212         this_ptr_conv.is_owned = false;
32213         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
32214         return ret_conv;
32215 }
32216
32217 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
32218         LDKClosingSigned this_ptr_conv;
32219         this_ptr_conv.inner = untag_ptr(this_ptr);
32220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32222         this_ptr_conv.is_owned = false;
32223         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
32224 }
32225
32226 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
32227         LDKClosingSigned this_ptr_conv;
32228         this_ptr_conv.inner = untag_ptr(this_ptr);
32229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32231         this_ptr_conv.is_owned = false;
32232         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32233         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
32234         return ret_arr;
32235 }
32236
32237 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray 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         LDKSignature val_ref;
32244         CHECK(val->arr_len == 64);
32245         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32246         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
32247 }
32248
32249 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
32250         LDKClosingSigned this_ptr_conv;
32251         this_ptr_conv.inner = untag_ptr(this_ptr);
32252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32254         this_ptr_conv.is_owned = false;
32255         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
32256         uint64_t ret_ref = 0;
32257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32259         return ret_ref;
32260 }
32261
32262 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
32263         LDKClosingSigned this_ptr_conv;
32264         this_ptr_conv.inner = untag_ptr(this_ptr);
32265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32267         this_ptr_conv.is_owned = false;
32268         LDKClosingSignedFeeRange val_conv;
32269         val_conv.inner = untag_ptr(val);
32270         val_conv.is_owned = ptr_is_owned(val);
32271         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32272         val_conv = ClosingSignedFeeRange_clone(&val_conv);
32273         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
32274 }
32275
32276 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) {
32277         LDKThirtyTwoBytes channel_id_arg_ref;
32278         CHECK(channel_id_arg->arr_len == 32);
32279         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32280         LDKSignature signature_arg_ref;
32281         CHECK(signature_arg->arr_len == 64);
32282         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
32283         LDKClosingSignedFeeRange fee_range_arg_conv;
32284         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
32285         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
32286         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
32287         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
32288         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
32289         uint64_t ret_ref = 0;
32290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32292         return ret_ref;
32293 }
32294
32295 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
32296         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
32297         uint64_t ret_ref = 0;
32298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32300         return ret_ref;
32301 }
32302 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
32303         LDKClosingSigned arg_conv;
32304         arg_conv.inner = untag_ptr(arg);
32305         arg_conv.is_owned = ptr_is_owned(arg);
32306         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32307         arg_conv.is_owned = false;
32308         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
32309         return ret_conv;
32310 }
32311
32312 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
32313         LDKClosingSigned orig_conv;
32314         orig_conv.inner = untag_ptr(orig);
32315         orig_conv.is_owned = ptr_is_owned(orig);
32316         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32317         orig_conv.is_owned = false;
32318         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
32319         uint64_t ret_ref = 0;
32320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32322         return ret_ref;
32323 }
32324
32325 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
32326         LDKClosingSigned a_conv;
32327         a_conv.inner = untag_ptr(a);
32328         a_conv.is_owned = ptr_is_owned(a);
32329         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32330         a_conv.is_owned = false;
32331         LDKClosingSigned b_conv;
32332         b_conv.inner = untag_ptr(b);
32333         b_conv.is_owned = ptr_is_owned(b);
32334         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32335         b_conv.is_owned = false;
32336         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
32337         return ret_conv;
32338 }
32339
32340 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
32341         LDKUpdateAddHTLC this_obj_conv;
32342         this_obj_conv.inner = untag_ptr(this_obj);
32343         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32345         UpdateAddHTLC_free(this_obj_conv);
32346 }
32347
32348 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
32349         LDKUpdateAddHTLC this_ptr_conv;
32350         this_ptr_conv.inner = untag_ptr(this_ptr);
32351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32353         this_ptr_conv.is_owned = false;
32354         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32355         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
32356         return ret_arr;
32357 }
32358
32359 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32360         LDKUpdateAddHTLC this_ptr_conv;
32361         this_ptr_conv.inner = untag_ptr(this_ptr);
32362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32364         this_ptr_conv.is_owned = false;
32365         LDKThirtyTwoBytes val_ref;
32366         CHECK(val->arr_len == 32);
32367         memcpy(val_ref.data, val->elems, 32); FREE(val);
32368         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
32369 }
32370
32371 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
32372         LDKUpdateAddHTLC this_ptr_conv;
32373         this_ptr_conv.inner = untag_ptr(this_ptr);
32374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32376         this_ptr_conv.is_owned = false;
32377         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
32378         return ret_conv;
32379 }
32380
32381 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32382         LDKUpdateAddHTLC this_ptr_conv;
32383         this_ptr_conv.inner = untag_ptr(this_ptr);
32384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32386         this_ptr_conv.is_owned = false;
32387         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
32388 }
32389
32390 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
32391         LDKUpdateAddHTLC this_ptr_conv;
32392         this_ptr_conv.inner = untag_ptr(this_ptr);
32393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32395         this_ptr_conv.is_owned = false;
32396         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
32397         return ret_conv;
32398 }
32399
32400 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
32401         LDKUpdateAddHTLC this_ptr_conv;
32402         this_ptr_conv.inner = untag_ptr(this_ptr);
32403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32405         this_ptr_conv.is_owned = false;
32406         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
32407 }
32408
32409 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
32410         LDKUpdateAddHTLC this_ptr_conv;
32411         this_ptr_conv.inner = untag_ptr(this_ptr);
32412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32414         this_ptr_conv.is_owned = false;
32415         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32416         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
32417         return ret_arr;
32418 }
32419
32420 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray 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         LDKThirtyTwoBytes val_ref;
32427         CHECK(val->arr_len == 32);
32428         memcpy(val_ref.data, val->elems, 32); FREE(val);
32429         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
32430 }
32431
32432 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
32433         LDKUpdateAddHTLC this_ptr_conv;
32434         this_ptr_conv.inner = untag_ptr(this_ptr);
32435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32437         this_ptr_conv.is_owned = false;
32438         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
32439         return ret_conv;
32440 }
32441
32442 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
32443         LDKUpdateAddHTLC this_ptr_conv;
32444         this_ptr_conv.inner = untag_ptr(this_ptr);
32445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32447         this_ptr_conv.is_owned = false;
32448         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
32449 }
32450
32451 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
32452         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
32453         uint64_t ret_ref = 0;
32454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32456         return ret_ref;
32457 }
32458 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
32459         LDKUpdateAddHTLC arg_conv;
32460         arg_conv.inner = untag_ptr(arg);
32461         arg_conv.is_owned = ptr_is_owned(arg);
32462         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32463         arg_conv.is_owned = false;
32464         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
32465         return ret_conv;
32466 }
32467
32468 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
32469         LDKUpdateAddHTLC orig_conv;
32470         orig_conv.inner = untag_ptr(orig);
32471         orig_conv.is_owned = ptr_is_owned(orig);
32472         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32473         orig_conv.is_owned = false;
32474         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
32475         uint64_t ret_ref = 0;
32476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32478         return ret_ref;
32479 }
32480
32481 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
32482         LDKUpdateAddHTLC a_conv;
32483         a_conv.inner = untag_ptr(a);
32484         a_conv.is_owned = ptr_is_owned(a);
32485         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32486         a_conv.is_owned = false;
32487         LDKUpdateAddHTLC b_conv;
32488         b_conv.inner = untag_ptr(b);
32489         b_conv.is_owned = ptr_is_owned(b);
32490         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32491         b_conv.is_owned = false;
32492         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
32493         return ret_conv;
32494 }
32495
32496 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
32497         LDKOnionMessage this_obj_conv;
32498         this_obj_conv.inner = untag_ptr(this_obj);
32499         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32501         OnionMessage_free(this_obj_conv);
32502 }
32503
32504 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
32505         LDKOnionMessage this_ptr_conv;
32506         this_ptr_conv.inner = untag_ptr(this_ptr);
32507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32509         this_ptr_conv.is_owned = false;
32510         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32511         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
32512         return ret_arr;
32513 }
32514
32515 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
32516         LDKOnionMessage this_ptr_conv;
32517         this_ptr_conv.inner = untag_ptr(this_ptr);
32518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32520         this_ptr_conv.is_owned = false;
32521         LDKPublicKey val_ref;
32522         CHECK(val->arr_len == 33);
32523         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32524         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
32525 }
32526
32527 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
32528         LDKOnionMessage ret_var = OnionMessage_clone(arg);
32529         uint64_t ret_ref = 0;
32530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32532         return ret_ref;
32533 }
32534 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
32535         LDKOnionMessage arg_conv;
32536         arg_conv.inner = untag_ptr(arg);
32537         arg_conv.is_owned = ptr_is_owned(arg);
32538         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32539         arg_conv.is_owned = false;
32540         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
32541         return ret_conv;
32542 }
32543
32544 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
32545         LDKOnionMessage orig_conv;
32546         orig_conv.inner = untag_ptr(orig);
32547         orig_conv.is_owned = ptr_is_owned(orig);
32548         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32549         orig_conv.is_owned = false;
32550         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
32551         uint64_t ret_ref = 0;
32552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32554         return ret_ref;
32555 }
32556
32557 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
32558         LDKOnionMessage a_conv;
32559         a_conv.inner = untag_ptr(a);
32560         a_conv.is_owned = ptr_is_owned(a);
32561         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32562         a_conv.is_owned = false;
32563         LDKOnionMessage b_conv;
32564         b_conv.inner = untag_ptr(b);
32565         b_conv.is_owned = ptr_is_owned(b);
32566         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32567         b_conv.is_owned = false;
32568         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
32569         return ret_conv;
32570 }
32571
32572 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
32573         LDKUpdateFulfillHTLC this_obj_conv;
32574         this_obj_conv.inner = untag_ptr(this_obj);
32575         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32577         UpdateFulfillHTLC_free(this_obj_conv);
32578 }
32579
32580 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
32581         LDKUpdateFulfillHTLC this_ptr_conv;
32582         this_ptr_conv.inner = untag_ptr(this_ptr);
32583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32585         this_ptr_conv.is_owned = false;
32586         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32587         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
32588         return ret_arr;
32589 }
32590
32591 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32592         LDKUpdateFulfillHTLC this_ptr_conv;
32593         this_ptr_conv.inner = untag_ptr(this_ptr);
32594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32596         this_ptr_conv.is_owned = false;
32597         LDKThirtyTwoBytes val_ref;
32598         CHECK(val->arr_len == 32);
32599         memcpy(val_ref.data, val->elems, 32); FREE(val);
32600         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
32601 }
32602
32603 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
32604         LDKUpdateFulfillHTLC this_ptr_conv;
32605         this_ptr_conv.inner = untag_ptr(this_ptr);
32606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32608         this_ptr_conv.is_owned = false;
32609         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
32610         return ret_conv;
32611 }
32612
32613 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32614         LDKUpdateFulfillHTLC this_ptr_conv;
32615         this_ptr_conv.inner = untag_ptr(this_ptr);
32616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32618         this_ptr_conv.is_owned = false;
32619         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
32620 }
32621
32622 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
32623         LDKUpdateFulfillHTLC this_ptr_conv;
32624         this_ptr_conv.inner = untag_ptr(this_ptr);
32625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32627         this_ptr_conv.is_owned = false;
32628         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32629         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
32630         return ret_arr;
32631 }
32632
32633 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray 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         LDKThirtyTwoBytes val_ref;
32640         CHECK(val->arr_len == 32);
32641         memcpy(val_ref.data, val->elems, 32); FREE(val);
32642         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
32643 }
32644
32645 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) {
32646         LDKThirtyTwoBytes channel_id_arg_ref;
32647         CHECK(channel_id_arg->arr_len == 32);
32648         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32649         LDKThirtyTwoBytes payment_preimage_arg_ref;
32650         CHECK(payment_preimage_arg->arr_len == 32);
32651         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
32652         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
32653         uint64_t ret_ref = 0;
32654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32656         return ret_ref;
32657 }
32658
32659 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
32660         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
32661         uint64_t ret_ref = 0;
32662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32664         return ret_ref;
32665 }
32666 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
32667         LDKUpdateFulfillHTLC arg_conv;
32668         arg_conv.inner = untag_ptr(arg);
32669         arg_conv.is_owned = ptr_is_owned(arg);
32670         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32671         arg_conv.is_owned = false;
32672         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
32673         return ret_conv;
32674 }
32675
32676 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
32677         LDKUpdateFulfillHTLC orig_conv;
32678         orig_conv.inner = untag_ptr(orig);
32679         orig_conv.is_owned = ptr_is_owned(orig);
32680         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32681         orig_conv.is_owned = false;
32682         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
32683         uint64_t ret_ref = 0;
32684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32686         return ret_ref;
32687 }
32688
32689 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
32690         LDKUpdateFulfillHTLC a_conv;
32691         a_conv.inner = untag_ptr(a);
32692         a_conv.is_owned = ptr_is_owned(a);
32693         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32694         a_conv.is_owned = false;
32695         LDKUpdateFulfillHTLC b_conv;
32696         b_conv.inner = untag_ptr(b);
32697         b_conv.is_owned = ptr_is_owned(b);
32698         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32699         b_conv.is_owned = false;
32700         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
32701         return ret_conv;
32702 }
32703
32704 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
32705         LDKUpdateFailHTLC this_obj_conv;
32706         this_obj_conv.inner = untag_ptr(this_obj);
32707         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32709         UpdateFailHTLC_free(this_obj_conv);
32710 }
32711
32712 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
32713         LDKUpdateFailHTLC this_ptr_conv;
32714         this_ptr_conv.inner = untag_ptr(this_ptr);
32715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32717         this_ptr_conv.is_owned = false;
32718         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32719         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
32720         return ret_arr;
32721 }
32722
32723 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32724         LDKUpdateFailHTLC this_ptr_conv;
32725         this_ptr_conv.inner = untag_ptr(this_ptr);
32726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32728         this_ptr_conv.is_owned = false;
32729         LDKThirtyTwoBytes val_ref;
32730         CHECK(val->arr_len == 32);
32731         memcpy(val_ref.data, val->elems, 32); FREE(val);
32732         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
32733 }
32734
32735 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
32736         LDKUpdateFailHTLC this_ptr_conv;
32737         this_ptr_conv.inner = untag_ptr(this_ptr);
32738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32740         this_ptr_conv.is_owned = false;
32741         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
32742         return ret_conv;
32743 }
32744
32745 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32746         LDKUpdateFailHTLC this_ptr_conv;
32747         this_ptr_conv.inner = untag_ptr(this_ptr);
32748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32750         this_ptr_conv.is_owned = false;
32751         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
32752 }
32753
32754 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
32755         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
32756         uint64_t ret_ref = 0;
32757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32759         return ret_ref;
32760 }
32761 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
32762         LDKUpdateFailHTLC arg_conv;
32763         arg_conv.inner = untag_ptr(arg);
32764         arg_conv.is_owned = ptr_is_owned(arg);
32765         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32766         arg_conv.is_owned = false;
32767         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
32768         return ret_conv;
32769 }
32770
32771 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
32772         LDKUpdateFailHTLC orig_conv;
32773         orig_conv.inner = untag_ptr(orig);
32774         orig_conv.is_owned = ptr_is_owned(orig);
32775         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32776         orig_conv.is_owned = false;
32777         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
32778         uint64_t ret_ref = 0;
32779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32781         return ret_ref;
32782 }
32783
32784 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
32785         LDKUpdateFailHTLC a_conv;
32786         a_conv.inner = untag_ptr(a);
32787         a_conv.is_owned = ptr_is_owned(a);
32788         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32789         a_conv.is_owned = false;
32790         LDKUpdateFailHTLC b_conv;
32791         b_conv.inner = untag_ptr(b);
32792         b_conv.is_owned = ptr_is_owned(b);
32793         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32794         b_conv.is_owned = false;
32795         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
32796         return ret_conv;
32797 }
32798
32799 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
32800         LDKUpdateFailMalformedHTLC this_obj_conv;
32801         this_obj_conv.inner = untag_ptr(this_obj);
32802         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32804         UpdateFailMalformedHTLC_free(this_obj_conv);
32805 }
32806
32807 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
32808         LDKUpdateFailMalformedHTLC this_ptr_conv;
32809         this_ptr_conv.inner = untag_ptr(this_ptr);
32810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32812         this_ptr_conv.is_owned = false;
32813         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32814         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
32815         return ret_arr;
32816 }
32817
32818 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32819         LDKUpdateFailMalformedHTLC this_ptr_conv;
32820         this_ptr_conv.inner = untag_ptr(this_ptr);
32821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32823         this_ptr_conv.is_owned = false;
32824         LDKThirtyTwoBytes val_ref;
32825         CHECK(val->arr_len == 32);
32826         memcpy(val_ref.data, val->elems, 32); FREE(val);
32827         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
32828 }
32829
32830 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
32831         LDKUpdateFailMalformedHTLC this_ptr_conv;
32832         this_ptr_conv.inner = untag_ptr(this_ptr);
32833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32835         this_ptr_conv.is_owned = false;
32836         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
32837         return ret_conv;
32838 }
32839
32840 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32841         LDKUpdateFailMalformedHTLC this_ptr_conv;
32842         this_ptr_conv.inner = untag_ptr(this_ptr);
32843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32845         this_ptr_conv.is_owned = false;
32846         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
32847 }
32848
32849 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
32850         LDKUpdateFailMalformedHTLC this_ptr_conv;
32851         this_ptr_conv.inner = untag_ptr(this_ptr);
32852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32854         this_ptr_conv.is_owned = false;
32855         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
32856         return ret_conv;
32857 }
32858
32859 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
32860         LDKUpdateFailMalformedHTLC this_ptr_conv;
32861         this_ptr_conv.inner = untag_ptr(this_ptr);
32862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32864         this_ptr_conv.is_owned = false;
32865         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
32866 }
32867
32868 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
32869         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
32870         uint64_t ret_ref = 0;
32871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32873         return ret_ref;
32874 }
32875 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
32876         LDKUpdateFailMalformedHTLC arg_conv;
32877         arg_conv.inner = untag_ptr(arg);
32878         arg_conv.is_owned = ptr_is_owned(arg);
32879         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32880         arg_conv.is_owned = false;
32881         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
32882         return ret_conv;
32883 }
32884
32885 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
32886         LDKUpdateFailMalformedHTLC orig_conv;
32887         orig_conv.inner = untag_ptr(orig);
32888         orig_conv.is_owned = ptr_is_owned(orig);
32889         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32890         orig_conv.is_owned = false;
32891         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
32892         uint64_t ret_ref = 0;
32893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32895         return ret_ref;
32896 }
32897
32898 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
32899         LDKUpdateFailMalformedHTLC a_conv;
32900         a_conv.inner = untag_ptr(a);
32901         a_conv.is_owned = ptr_is_owned(a);
32902         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32903         a_conv.is_owned = false;
32904         LDKUpdateFailMalformedHTLC b_conv;
32905         b_conv.inner = untag_ptr(b);
32906         b_conv.is_owned = ptr_is_owned(b);
32907         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32908         b_conv.is_owned = false;
32909         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
32910         return ret_conv;
32911 }
32912
32913 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
32914         LDKCommitmentSigned this_obj_conv;
32915         this_obj_conv.inner = untag_ptr(this_obj);
32916         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32918         CommitmentSigned_free(this_obj_conv);
32919 }
32920
32921 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
32922         LDKCommitmentSigned this_ptr_conv;
32923         this_ptr_conv.inner = untag_ptr(this_ptr);
32924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32926         this_ptr_conv.is_owned = false;
32927         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32928         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
32929         return ret_arr;
32930 }
32931
32932 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32933         LDKCommitmentSigned this_ptr_conv;
32934         this_ptr_conv.inner = untag_ptr(this_ptr);
32935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32937         this_ptr_conv.is_owned = false;
32938         LDKThirtyTwoBytes val_ref;
32939         CHECK(val->arr_len == 32);
32940         memcpy(val_ref.data, val->elems, 32); FREE(val);
32941         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
32942 }
32943
32944 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
32945         LDKCommitmentSigned this_ptr_conv;
32946         this_ptr_conv.inner = untag_ptr(this_ptr);
32947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32949         this_ptr_conv.is_owned = false;
32950         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32951         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
32952         return ret_arr;
32953 }
32954
32955 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
32956         LDKCommitmentSigned this_ptr_conv;
32957         this_ptr_conv.inner = untag_ptr(this_ptr);
32958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32960         this_ptr_conv.is_owned = false;
32961         LDKSignature val_ref;
32962         CHECK(val->arr_len == 64);
32963         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32964         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
32965 }
32966
32967 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
32968         LDKCommitmentSigned this_ptr_conv;
32969         this_ptr_conv.inner = untag_ptr(this_ptr);
32970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32972         this_ptr_conv.is_owned = false;
32973         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
32974         ptrArray ret_arr = NULL;
32975         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
32976         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
32977         for (size_t m = 0; m < ret_var.datalen; m++) {
32978                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
32979                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
32980                 ret_arr_ptr[m] = ret_conv_12_arr;
32981         }
32982         
32983         FREE(ret_var.data);
32984         return ret_arr;
32985 }
32986
32987 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
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 val_constr;
32994         val_constr.datalen = val->arr_len;
32995         if (val_constr.datalen > 0)
32996                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
32997         else
32998                 val_constr.data = NULL;
32999         int8_tArray* val_vals = (void*) val->elems;
33000         for (size_t m = 0; m < val_constr.datalen; m++) {
33001                 int8_tArray val_conv_12 = val_vals[m];
33002                 LDKSignature val_conv_12_ref;
33003                 CHECK(val_conv_12->arr_len == 64);
33004                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
33005                 val_constr.data[m] = val_conv_12_ref;
33006         }
33007         FREE(val);
33008         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
33009 }
33010
33011 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
33012         LDKThirtyTwoBytes channel_id_arg_ref;
33013         CHECK(channel_id_arg->arr_len == 32);
33014         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33015         LDKSignature signature_arg_ref;
33016         CHECK(signature_arg->arr_len == 64);
33017         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
33018         LDKCVec_SignatureZ htlc_signatures_arg_constr;
33019         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
33020         if (htlc_signatures_arg_constr.datalen > 0)
33021                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33022         else
33023                 htlc_signatures_arg_constr.data = NULL;
33024         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
33025         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
33026                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
33027                 LDKSignature htlc_signatures_arg_conv_12_ref;
33028                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
33029                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
33030                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
33031         }
33032         FREE(htlc_signatures_arg);
33033         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
33034         uint64_t ret_ref = 0;
33035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33037         return ret_ref;
33038 }
33039
33040 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
33041         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
33042         uint64_t ret_ref = 0;
33043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33045         return ret_ref;
33046 }
33047 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
33048         LDKCommitmentSigned arg_conv;
33049         arg_conv.inner = untag_ptr(arg);
33050         arg_conv.is_owned = ptr_is_owned(arg);
33051         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33052         arg_conv.is_owned = false;
33053         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
33054         return ret_conv;
33055 }
33056
33057 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
33058         LDKCommitmentSigned orig_conv;
33059         orig_conv.inner = untag_ptr(orig);
33060         orig_conv.is_owned = ptr_is_owned(orig);
33061         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33062         orig_conv.is_owned = false;
33063         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
33064         uint64_t ret_ref = 0;
33065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33067         return ret_ref;
33068 }
33069
33070 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
33071         LDKCommitmentSigned a_conv;
33072         a_conv.inner = untag_ptr(a);
33073         a_conv.is_owned = ptr_is_owned(a);
33074         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33075         a_conv.is_owned = false;
33076         LDKCommitmentSigned b_conv;
33077         b_conv.inner = untag_ptr(b);
33078         b_conv.is_owned = ptr_is_owned(b);
33079         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33080         b_conv.is_owned = false;
33081         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
33082         return ret_conv;
33083 }
33084
33085 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
33086         LDKRevokeAndACK this_obj_conv;
33087         this_obj_conv.inner = untag_ptr(this_obj);
33088         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33090         RevokeAndACK_free(this_obj_conv);
33091 }
33092
33093 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
33094         LDKRevokeAndACK this_ptr_conv;
33095         this_ptr_conv.inner = untag_ptr(this_ptr);
33096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33098         this_ptr_conv.is_owned = false;
33099         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33100         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
33101         return ret_arr;
33102 }
33103
33104 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33105         LDKRevokeAndACK this_ptr_conv;
33106         this_ptr_conv.inner = untag_ptr(this_ptr);
33107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33109         this_ptr_conv.is_owned = false;
33110         LDKThirtyTwoBytes val_ref;
33111         CHECK(val->arr_len == 32);
33112         memcpy(val_ref.data, val->elems, 32); FREE(val);
33113         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
33114 }
33115
33116 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
33117         LDKRevokeAndACK this_ptr_conv;
33118         this_ptr_conv.inner = untag_ptr(this_ptr);
33119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33121         this_ptr_conv.is_owned = false;
33122         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33123         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
33124         return ret_arr;
33125 }
33126
33127 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
33128         LDKRevokeAndACK this_ptr_conv;
33129         this_ptr_conv.inner = untag_ptr(this_ptr);
33130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33132         this_ptr_conv.is_owned = false;
33133         LDKThirtyTwoBytes val_ref;
33134         CHECK(val->arr_len == 32);
33135         memcpy(val_ref.data, val->elems, 32); FREE(val);
33136         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
33137 }
33138
33139 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
33140         LDKRevokeAndACK this_ptr_conv;
33141         this_ptr_conv.inner = untag_ptr(this_ptr);
33142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33144         this_ptr_conv.is_owned = false;
33145         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33146         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
33147         return ret_arr;
33148 }
33149
33150 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) {
33151         LDKRevokeAndACK this_ptr_conv;
33152         this_ptr_conv.inner = untag_ptr(this_ptr);
33153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33155         this_ptr_conv.is_owned = false;
33156         LDKPublicKey val_ref;
33157         CHECK(val->arr_len == 33);
33158         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33159         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
33160 }
33161
33162 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) {
33163         LDKThirtyTwoBytes channel_id_arg_ref;
33164         CHECK(channel_id_arg->arr_len == 32);
33165         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33166         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
33167         CHECK(per_commitment_secret_arg->arr_len == 32);
33168         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
33169         LDKPublicKey next_per_commitment_point_arg_ref;
33170         CHECK(next_per_commitment_point_arg->arr_len == 33);
33171         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
33172         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
33173         uint64_t ret_ref = 0;
33174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33176         return ret_ref;
33177 }
33178
33179 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
33180         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
33181         uint64_t ret_ref = 0;
33182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33184         return ret_ref;
33185 }
33186 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
33187         LDKRevokeAndACK arg_conv;
33188         arg_conv.inner = untag_ptr(arg);
33189         arg_conv.is_owned = ptr_is_owned(arg);
33190         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33191         arg_conv.is_owned = false;
33192         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
33193         return ret_conv;
33194 }
33195
33196 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
33197         LDKRevokeAndACK orig_conv;
33198         orig_conv.inner = untag_ptr(orig);
33199         orig_conv.is_owned = ptr_is_owned(orig);
33200         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33201         orig_conv.is_owned = false;
33202         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
33203         uint64_t ret_ref = 0;
33204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33206         return ret_ref;
33207 }
33208
33209 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
33210         LDKRevokeAndACK a_conv;
33211         a_conv.inner = untag_ptr(a);
33212         a_conv.is_owned = ptr_is_owned(a);
33213         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33214         a_conv.is_owned = false;
33215         LDKRevokeAndACK b_conv;
33216         b_conv.inner = untag_ptr(b);
33217         b_conv.is_owned = ptr_is_owned(b);
33218         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33219         b_conv.is_owned = false;
33220         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
33221         return ret_conv;
33222 }
33223
33224 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
33225         LDKUpdateFee this_obj_conv;
33226         this_obj_conv.inner = untag_ptr(this_obj);
33227         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33229         UpdateFee_free(this_obj_conv);
33230 }
33231
33232 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
33233         LDKUpdateFee this_ptr_conv;
33234         this_ptr_conv.inner = untag_ptr(this_ptr);
33235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33237         this_ptr_conv.is_owned = false;
33238         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33239         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
33240         return ret_arr;
33241 }
33242
33243 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33244         LDKUpdateFee this_ptr_conv;
33245         this_ptr_conv.inner = untag_ptr(this_ptr);
33246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33248         this_ptr_conv.is_owned = false;
33249         LDKThirtyTwoBytes val_ref;
33250         CHECK(val->arr_len == 32);
33251         memcpy(val_ref.data, val->elems, 32); FREE(val);
33252         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
33253 }
33254
33255 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
33256         LDKUpdateFee this_ptr_conv;
33257         this_ptr_conv.inner = untag_ptr(this_ptr);
33258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33260         this_ptr_conv.is_owned = false;
33261         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
33262         return ret_conv;
33263 }
33264
33265 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
33266         LDKUpdateFee this_ptr_conv;
33267         this_ptr_conv.inner = untag_ptr(this_ptr);
33268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33270         this_ptr_conv.is_owned = false;
33271         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
33272 }
33273
33274 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
33275         LDKThirtyTwoBytes channel_id_arg_ref;
33276         CHECK(channel_id_arg->arr_len == 32);
33277         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33278         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
33279         uint64_t ret_ref = 0;
33280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33282         return ret_ref;
33283 }
33284
33285 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
33286         LDKUpdateFee ret_var = UpdateFee_clone(arg);
33287         uint64_t ret_ref = 0;
33288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33290         return ret_ref;
33291 }
33292 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
33293         LDKUpdateFee arg_conv;
33294         arg_conv.inner = untag_ptr(arg);
33295         arg_conv.is_owned = ptr_is_owned(arg);
33296         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33297         arg_conv.is_owned = false;
33298         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
33299         return ret_conv;
33300 }
33301
33302 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
33303         LDKUpdateFee orig_conv;
33304         orig_conv.inner = untag_ptr(orig);
33305         orig_conv.is_owned = ptr_is_owned(orig);
33306         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33307         orig_conv.is_owned = false;
33308         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
33309         uint64_t ret_ref = 0;
33310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33312         return ret_ref;
33313 }
33314
33315 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
33316         LDKUpdateFee a_conv;
33317         a_conv.inner = untag_ptr(a);
33318         a_conv.is_owned = ptr_is_owned(a);
33319         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33320         a_conv.is_owned = false;
33321         LDKUpdateFee b_conv;
33322         b_conv.inner = untag_ptr(b);
33323         b_conv.is_owned = ptr_is_owned(b);
33324         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33325         b_conv.is_owned = false;
33326         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
33327         return ret_conv;
33328 }
33329
33330 void  __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint64_t this_obj) {
33331         LDKDataLossProtect this_obj_conv;
33332         this_obj_conv.inner = untag_ptr(this_obj);
33333         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33335         DataLossProtect_free(this_obj_conv);
33336 }
33337
33338 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) {
33339         LDKDataLossProtect this_ptr_conv;
33340         this_ptr_conv.inner = untag_ptr(this_ptr);
33341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33343         this_ptr_conv.is_owned = false;
33344         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33345         memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
33346         return ret_arr;
33347 }
33348
33349 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) {
33350         LDKDataLossProtect this_ptr_conv;
33351         this_ptr_conv.inner = untag_ptr(this_ptr);
33352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33354         this_ptr_conv.is_owned = false;
33355         LDKThirtyTwoBytes val_ref;
33356         CHECK(val->arr_len == 32);
33357         memcpy(val_ref.data, val->elems, 32); FREE(val);
33358         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
33359 }
33360
33361 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) {
33362         LDKDataLossProtect this_ptr_conv;
33363         this_ptr_conv.inner = untag_ptr(this_ptr);
33364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33366         this_ptr_conv.is_owned = false;
33367         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33368         memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
33369         return ret_arr;
33370 }
33371
33372 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) {
33373         LDKDataLossProtect this_ptr_conv;
33374         this_ptr_conv.inner = untag_ptr(this_ptr);
33375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33377         this_ptr_conv.is_owned = false;
33378         LDKPublicKey val_ref;
33379         CHECK(val->arr_len == 33);
33380         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33381         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
33382 }
33383
33384 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) {
33385         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
33386         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
33387         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
33388         LDKPublicKey my_current_per_commitment_point_arg_ref;
33389         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
33390         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);
33391         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
33392         uint64_t ret_ref = 0;
33393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33395         return ret_ref;
33396 }
33397
33398 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
33399         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
33400         uint64_t ret_ref = 0;
33401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33403         return ret_ref;
33404 }
33405 int64_t  __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint64_t arg) {
33406         LDKDataLossProtect arg_conv;
33407         arg_conv.inner = untag_ptr(arg);
33408         arg_conv.is_owned = ptr_is_owned(arg);
33409         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33410         arg_conv.is_owned = false;
33411         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
33412         return ret_conv;
33413 }
33414
33415 uint64_t  __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint64_t orig) {
33416         LDKDataLossProtect orig_conv;
33417         orig_conv.inner = untag_ptr(orig);
33418         orig_conv.is_owned = ptr_is_owned(orig);
33419         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33420         orig_conv.is_owned = false;
33421         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
33422         uint64_t ret_ref = 0;
33423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33425         return ret_ref;
33426 }
33427
33428 jboolean  __attribute__((export_name("TS_DataLossProtect_eq"))) TS_DataLossProtect_eq(uint64_t a, uint64_t b) {
33429         LDKDataLossProtect a_conv;
33430         a_conv.inner = untag_ptr(a);
33431         a_conv.is_owned = ptr_is_owned(a);
33432         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33433         a_conv.is_owned = false;
33434         LDKDataLossProtect b_conv;
33435         b_conv.inner = untag_ptr(b);
33436         b_conv.is_owned = ptr_is_owned(b);
33437         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33438         b_conv.is_owned = false;
33439         jboolean ret_conv = DataLossProtect_eq(&a_conv, &b_conv);
33440         return ret_conv;
33441 }
33442
33443 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
33444         LDKChannelReestablish this_obj_conv;
33445         this_obj_conv.inner = untag_ptr(this_obj);
33446         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33448         ChannelReestablish_free(this_obj_conv);
33449 }
33450
33451 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
33452         LDKChannelReestablish this_ptr_conv;
33453         this_ptr_conv.inner = untag_ptr(this_ptr);
33454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33456         this_ptr_conv.is_owned = false;
33457         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33458         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
33459         return ret_arr;
33460 }
33461
33462 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33463         LDKChannelReestablish this_ptr_conv;
33464         this_ptr_conv.inner = untag_ptr(this_ptr);
33465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33467         this_ptr_conv.is_owned = false;
33468         LDKThirtyTwoBytes val_ref;
33469         CHECK(val->arr_len == 32);
33470         memcpy(val_ref.data, val->elems, 32); FREE(val);
33471         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
33472 }
33473
33474 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
33475         LDKChannelReestablish this_ptr_conv;
33476         this_ptr_conv.inner = untag_ptr(this_ptr);
33477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33479         this_ptr_conv.is_owned = false;
33480         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
33481         return ret_conv;
33482 }
33483
33484 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) {
33485         LDKChannelReestablish this_ptr_conv;
33486         this_ptr_conv.inner = untag_ptr(this_ptr);
33487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33489         this_ptr_conv.is_owned = false;
33490         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
33491 }
33492
33493 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
33494         LDKChannelReestablish this_ptr_conv;
33495         this_ptr_conv.inner = untag_ptr(this_ptr);
33496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33498         this_ptr_conv.is_owned = false;
33499         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
33500         return ret_conv;
33501 }
33502
33503 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) {
33504         LDKChannelReestablish this_ptr_conv;
33505         this_ptr_conv.inner = untag_ptr(this_ptr);
33506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33508         this_ptr_conv.is_owned = false;
33509         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
33510 }
33511
33512 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
33513         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
33514         uint64_t ret_ref = 0;
33515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33517         return ret_ref;
33518 }
33519 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
33520         LDKChannelReestablish arg_conv;
33521         arg_conv.inner = untag_ptr(arg);
33522         arg_conv.is_owned = ptr_is_owned(arg);
33523         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33524         arg_conv.is_owned = false;
33525         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
33526         return ret_conv;
33527 }
33528
33529 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
33530         LDKChannelReestablish orig_conv;
33531         orig_conv.inner = untag_ptr(orig);
33532         orig_conv.is_owned = ptr_is_owned(orig);
33533         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33534         orig_conv.is_owned = false;
33535         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
33536         uint64_t ret_ref = 0;
33537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33539         return ret_ref;
33540 }
33541
33542 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
33543         LDKChannelReestablish a_conv;
33544         a_conv.inner = untag_ptr(a);
33545         a_conv.is_owned = ptr_is_owned(a);
33546         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33547         a_conv.is_owned = false;
33548         LDKChannelReestablish b_conv;
33549         b_conv.inner = untag_ptr(b);
33550         b_conv.is_owned = ptr_is_owned(b);
33551         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33552         b_conv.is_owned = false;
33553         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
33554         return ret_conv;
33555 }
33556
33557 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
33558         LDKAnnouncementSignatures this_obj_conv;
33559         this_obj_conv.inner = untag_ptr(this_obj);
33560         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33562         AnnouncementSignatures_free(this_obj_conv);
33563 }
33564
33565 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
33566         LDKAnnouncementSignatures this_ptr_conv;
33567         this_ptr_conv.inner = untag_ptr(this_ptr);
33568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33570         this_ptr_conv.is_owned = false;
33571         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33572         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
33573         return ret_arr;
33574 }
33575
33576 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33577         LDKAnnouncementSignatures this_ptr_conv;
33578         this_ptr_conv.inner = untag_ptr(this_ptr);
33579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33581         this_ptr_conv.is_owned = false;
33582         LDKThirtyTwoBytes val_ref;
33583         CHECK(val->arr_len == 32);
33584         memcpy(val_ref.data, val->elems, 32); FREE(val);
33585         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
33586 }
33587
33588 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
33589         LDKAnnouncementSignatures this_ptr_conv;
33590         this_ptr_conv.inner = untag_ptr(this_ptr);
33591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33593         this_ptr_conv.is_owned = false;
33594         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
33595         return ret_conv;
33596 }
33597
33598 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
33599         LDKAnnouncementSignatures this_ptr_conv;
33600         this_ptr_conv.inner = untag_ptr(this_ptr);
33601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33603         this_ptr_conv.is_owned = false;
33604         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
33605 }
33606
33607 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
33608         LDKAnnouncementSignatures this_ptr_conv;
33609         this_ptr_conv.inner = untag_ptr(this_ptr);
33610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33612         this_ptr_conv.is_owned = false;
33613         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33614         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
33615         return ret_arr;
33616 }
33617
33618 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray 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         LDKSignature val_ref;
33625         CHECK(val->arr_len == 64);
33626         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33627         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
33628 }
33629
33630 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
33631         LDKAnnouncementSignatures this_ptr_conv;
33632         this_ptr_conv.inner = untag_ptr(this_ptr);
33633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33635         this_ptr_conv.is_owned = false;
33636         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33637         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
33638         return ret_arr;
33639 }
33640
33641 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
33642         LDKAnnouncementSignatures this_ptr_conv;
33643         this_ptr_conv.inner = untag_ptr(this_ptr);
33644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33646         this_ptr_conv.is_owned = false;
33647         LDKSignature val_ref;
33648         CHECK(val->arr_len == 64);
33649         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33650         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
33651 }
33652
33653 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) {
33654         LDKThirtyTwoBytes channel_id_arg_ref;
33655         CHECK(channel_id_arg->arr_len == 32);
33656         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33657         LDKSignature node_signature_arg_ref;
33658         CHECK(node_signature_arg->arr_len == 64);
33659         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
33660         LDKSignature bitcoin_signature_arg_ref;
33661         CHECK(bitcoin_signature_arg->arr_len == 64);
33662         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
33663         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
33664         uint64_t ret_ref = 0;
33665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33667         return ret_ref;
33668 }
33669
33670 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
33671         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
33672         uint64_t ret_ref = 0;
33673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33675         return ret_ref;
33676 }
33677 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
33678         LDKAnnouncementSignatures arg_conv;
33679         arg_conv.inner = untag_ptr(arg);
33680         arg_conv.is_owned = ptr_is_owned(arg);
33681         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33682         arg_conv.is_owned = false;
33683         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
33684         return ret_conv;
33685 }
33686
33687 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
33688         LDKAnnouncementSignatures orig_conv;
33689         orig_conv.inner = untag_ptr(orig);
33690         orig_conv.is_owned = ptr_is_owned(orig);
33691         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33692         orig_conv.is_owned = false;
33693         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
33694         uint64_t ret_ref = 0;
33695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33697         return ret_ref;
33698 }
33699
33700 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
33701         LDKAnnouncementSignatures a_conv;
33702         a_conv.inner = untag_ptr(a);
33703         a_conv.is_owned = ptr_is_owned(a);
33704         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33705         a_conv.is_owned = false;
33706         LDKAnnouncementSignatures b_conv;
33707         b_conv.inner = untag_ptr(b);
33708         b_conv.is_owned = ptr_is_owned(b);
33709         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33710         b_conv.is_owned = false;
33711         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
33712         return ret_conv;
33713 }
33714
33715 void  __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint64_t this_ptr) {
33716         if (!ptr_is_owned(this_ptr)) return;
33717         void* this_ptr_ptr = untag_ptr(this_ptr);
33718         CHECK_ACCESS(this_ptr_ptr);
33719         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
33720         FREE(untag_ptr(this_ptr));
33721         NetAddress_free(this_ptr_conv);
33722 }
33723
33724 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
33725         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33726         *ret_copy = NetAddress_clone(arg);
33727         uint64_t ret_ref = tag_ptr(ret_copy, true);
33728         return ret_ref;
33729 }
33730 int64_t  __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint64_t arg) {
33731         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
33732         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
33733         return ret_conv;
33734 }
33735
33736 uint64_t  __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint64_t orig) {
33737         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
33738         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33739         *ret_copy = NetAddress_clone(orig_conv);
33740         uint64_t ret_ref = tag_ptr(ret_copy, true);
33741         return ret_ref;
33742 }
33743
33744 uint64_t  __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
33745         LDKFourBytes addr_ref;
33746         CHECK(addr->arr_len == 4);
33747         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
33748         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33749         *ret_copy = NetAddress_ipv4(addr_ref, port);
33750         uint64_t ret_ref = tag_ptr(ret_copy, true);
33751         return ret_ref;
33752 }
33753
33754 uint64_t  __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
33755         LDKSixteenBytes addr_ref;
33756         CHECK(addr->arr_len == 16);
33757         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
33758         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33759         *ret_copy = NetAddress_ipv6(addr_ref, port);
33760         uint64_t ret_ref = tag_ptr(ret_copy, true);
33761         return ret_ref;
33762 }
33763
33764 uint64_t  __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
33765         LDKTwelveBytes a_ref;
33766         CHECK(a->arr_len == 12);
33767         memcpy(a_ref.data, a->elems, 12); FREE(a);
33768         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33769         *ret_copy = NetAddress_onion_v2(a_ref);
33770         uint64_t ret_ref = tag_ptr(ret_copy, true);
33771         return ret_ref;
33772 }
33773
33774 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) {
33775         LDKThirtyTwoBytes ed25519_pubkey_ref;
33776         CHECK(ed25519_pubkey->arr_len == 32);
33777         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
33778         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33779         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, 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_hostname"))) TS_NetAddress_hostname(uint64_t hostname, int16_t port) {
33785         LDKHostname hostname_conv;
33786         hostname_conv.inner = untag_ptr(hostname);
33787         hostname_conv.is_owned = ptr_is_owned(hostname);
33788         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
33789         hostname_conv = Hostname_clone(&hostname_conv);
33790         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33791         *ret_copy = NetAddress_hostname(hostname_conv, port);
33792         uint64_t ret_ref = tag_ptr(ret_copy, true);
33793         return ret_ref;
33794 }
33795
33796 jboolean  __attribute__((export_name("TS_NetAddress_eq"))) TS_NetAddress_eq(uint64_t a, uint64_t b) {
33797         LDKNetAddress* a_conv = (LDKNetAddress*)untag_ptr(a);
33798         LDKNetAddress* b_conv = (LDKNetAddress*)untag_ptr(b);
33799         jboolean ret_conv = NetAddress_eq(a_conv, b_conv);
33800         return ret_conv;
33801 }
33802
33803 int8_tArray  __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint64_t obj) {
33804         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
33805         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
33806         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33807         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33808         CVec_u8Z_free(ret_var);
33809         return ret_arr;
33810 }
33811
33812 uint64_t  __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
33813         LDKu8slice ser_ref;
33814         ser_ref.datalen = ser->arr_len;
33815         ser_ref.data = ser->elems;
33816         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
33817         *ret_conv = NetAddress_read(ser_ref);
33818         FREE(ser);
33819         return tag_ptr(ret_conv, true);
33820 }
33821
33822 void  __attribute__((export_name("TS_UnsignedGossipMessage_free"))) TS_UnsignedGossipMessage_free(uint64_t this_ptr) {
33823         if (!ptr_is_owned(this_ptr)) return;
33824         void* this_ptr_ptr = untag_ptr(this_ptr);
33825         CHECK_ACCESS(this_ptr_ptr);
33826         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
33827         FREE(untag_ptr(this_ptr));
33828         UnsignedGossipMessage_free(this_ptr_conv);
33829 }
33830
33831 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
33832         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33833         *ret_copy = UnsignedGossipMessage_clone(arg);
33834         uint64_t ret_ref = tag_ptr(ret_copy, true);
33835         return ret_ref;
33836 }
33837 int64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone_ptr"))) TS_UnsignedGossipMessage_clone_ptr(uint64_t arg) {
33838         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
33839         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
33840         return ret_conv;
33841 }
33842
33843 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone"))) TS_UnsignedGossipMessage_clone(uint64_t orig) {
33844         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
33845         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33846         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
33847         uint64_t ret_ref = tag_ptr(ret_copy, true);
33848         return ret_ref;
33849 }
33850
33851 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_announcement"))) TS_UnsignedGossipMessage_channel_announcement(uint64_t a) {
33852         LDKUnsignedChannelAnnouncement a_conv;
33853         a_conv.inner = untag_ptr(a);
33854         a_conv.is_owned = ptr_is_owned(a);
33855         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33856         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
33857         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33858         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
33859         uint64_t ret_ref = tag_ptr(ret_copy, true);
33860         return ret_ref;
33861 }
33862
33863 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_update"))) TS_UnsignedGossipMessage_channel_update(uint64_t a) {
33864         LDKUnsignedChannelUpdate a_conv;
33865         a_conv.inner = untag_ptr(a);
33866         a_conv.is_owned = ptr_is_owned(a);
33867         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33868         a_conv = UnsignedChannelUpdate_clone(&a_conv);
33869         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33870         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
33871         uint64_t ret_ref = tag_ptr(ret_copy, true);
33872         return ret_ref;
33873 }
33874
33875 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_node_announcement"))) TS_UnsignedGossipMessage_node_announcement(uint64_t a) {
33876         LDKUnsignedNodeAnnouncement a_conv;
33877         a_conv.inner = untag_ptr(a);
33878         a_conv.is_owned = ptr_is_owned(a);
33879         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33880         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
33881         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
33882         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
33883         uint64_t ret_ref = tag_ptr(ret_copy, true);
33884         return ret_ref;
33885 }
33886
33887 int8_tArray  __attribute__((export_name("TS_UnsignedGossipMessage_write"))) TS_UnsignedGossipMessage_write(uint64_t obj) {
33888         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
33889         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
33890         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33891         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33892         CVec_u8Z_free(ret_var);
33893         return ret_arr;
33894 }
33895
33896 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
33897         LDKUnsignedNodeAnnouncement this_obj_conv;
33898         this_obj_conv.inner = untag_ptr(this_obj);
33899         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33901         UnsignedNodeAnnouncement_free(this_obj_conv);
33902 }
33903
33904 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
33905         LDKUnsignedNodeAnnouncement this_ptr_conv;
33906         this_ptr_conv.inner = untag_ptr(this_ptr);
33907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33909         this_ptr_conv.is_owned = false;
33910         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
33911         uint64_t ret_ref = 0;
33912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33914         return ret_ref;
33915 }
33916
33917 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
33918         LDKUnsignedNodeAnnouncement this_ptr_conv;
33919         this_ptr_conv.inner = untag_ptr(this_ptr);
33920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33922         this_ptr_conv.is_owned = false;
33923         LDKNodeFeatures val_conv;
33924         val_conv.inner = untag_ptr(val);
33925         val_conv.is_owned = ptr_is_owned(val);
33926         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33927         val_conv = NodeFeatures_clone(&val_conv);
33928         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
33929 }
33930
33931 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
33932         LDKUnsignedNodeAnnouncement this_ptr_conv;
33933         this_ptr_conv.inner = untag_ptr(this_ptr);
33934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33936         this_ptr_conv.is_owned = false;
33937         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
33938         return ret_conv;
33939 }
33940
33941 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
33942         LDKUnsignedNodeAnnouncement this_ptr_conv;
33943         this_ptr_conv.inner = untag_ptr(this_ptr);
33944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33946         this_ptr_conv.is_owned = false;
33947         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
33948 }
33949
33950 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
33951         LDKUnsignedNodeAnnouncement this_ptr_conv;
33952         this_ptr_conv.inner = untag_ptr(this_ptr);
33953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33955         this_ptr_conv.is_owned = false;
33956         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
33957         uint64_t ret_ref = 0;
33958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33960         return ret_ref;
33961 }
33962
33963 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, uint64_t val) {
33964         LDKUnsignedNodeAnnouncement this_ptr_conv;
33965         this_ptr_conv.inner = untag_ptr(this_ptr);
33966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33968         this_ptr_conv.is_owned = false;
33969         LDKNodeId val_conv;
33970         val_conv.inner = untag_ptr(val);
33971         val_conv.is_owned = ptr_is_owned(val);
33972         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33973         val_conv = NodeId_clone(&val_conv);
33974         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
33975 }
33976
33977 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
33978         LDKUnsignedNodeAnnouncement this_ptr_conv;
33979         this_ptr_conv.inner = untag_ptr(this_ptr);
33980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33982         this_ptr_conv.is_owned = false;
33983         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
33984         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
33985         return ret_arr;
33986 }
33987
33988 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
33989         LDKUnsignedNodeAnnouncement this_ptr_conv;
33990         this_ptr_conv.inner = untag_ptr(this_ptr);
33991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33993         this_ptr_conv.is_owned = false;
33994         LDKThreeBytes val_ref;
33995         CHECK(val->arr_len == 3);
33996         memcpy(val_ref.data, val->elems, 3); FREE(val);
33997         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
33998 }
33999
34000 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
34001         LDKUnsignedNodeAnnouncement this_ptr_conv;
34002         this_ptr_conv.inner = untag_ptr(this_ptr);
34003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34005         this_ptr_conv.is_owned = false;
34006         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
34007         uint64_t ret_ref = 0;
34008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34010         return ret_ref;
34011 }
34012
34013 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, uint64_t val) {
34014         LDKUnsignedNodeAnnouncement this_ptr_conv;
34015         this_ptr_conv.inner = untag_ptr(this_ptr);
34016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34018         this_ptr_conv.is_owned = false;
34019         LDKNodeAlias val_conv;
34020         val_conv.inner = untag_ptr(val);
34021         val_conv.is_owned = ptr_is_owned(val);
34022         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34023         val_conv = NodeAlias_clone(&val_conv);
34024         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
34025 }
34026
34027 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
34028         LDKUnsignedNodeAnnouncement this_ptr_conv;
34029         this_ptr_conv.inner = untag_ptr(this_ptr);
34030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34032         this_ptr_conv.is_owned = false;
34033         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
34034         uint64_tArray ret_arr = NULL;
34035         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34036         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34037         for (size_t m = 0; m < ret_var.datalen; m++) {
34038                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
34039                 *ret_conv_12_copy = ret_var.data[m];
34040                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
34041                 ret_arr_ptr[m] = ret_conv_12_ref;
34042         }
34043         
34044         FREE(ret_var.data);
34045         return ret_arr;
34046 }
34047
34048 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
34049         LDKUnsignedNodeAnnouncement this_ptr_conv;
34050         this_ptr_conv.inner = untag_ptr(this_ptr);
34051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34053         this_ptr_conv.is_owned = false;
34054         LDKCVec_NetAddressZ val_constr;
34055         val_constr.datalen = val->arr_len;
34056         if (val_constr.datalen > 0)
34057                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
34058         else
34059                 val_constr.data = NULL;
34060         uint64_t* val_vals = val->elems;
34061         for (size_t m = 0; m < val_constr.datalen; m++) {
34062                 uint64_t val_conv_12 = val_vals[m];
34063                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
34064                 CHECK_ACCESS(val_conv_12_ptr);
34065                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
34066                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
34067                 val_constr.data[m] = val_conv_12_conv;
34068         }
34069         FREE(val);
34070         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
34071 }
34072
34073 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
34074         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
34075         uint64_t ret_ref = 0;
34076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34078         return ret_ref;
34079 }
34080 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
34081         LDKUnsignedNodeAnnouncement arg_conv;
34082         arg_conv.inner = untag_ptr(arg);
34083         arg_conv.is_owned = ptr_is_owned(arg);
34084         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34085         arg_conv.is_owned = false;
34086         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
34087         return ret_conv;
34088 }
34089
34090 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
34091         LDKUnsignedNodeAnnouncement orig_conv;
34092         orig_conv.inner = untag_ptr(orig);
34093         orig_conv.is_owned = ptr_is_owned(orig);
34094         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34095         orig_conv.is_owned = false;
34096         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
34097         uint64_t ret_ref = 0;
34098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34100         return ret_ref;
34101 }
34102
34103 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
34104         LDKUnsignedNodeAnnouncement a_conv;
34105         a_conv.inner = untag_ptr(a);
34106         a_conv.is_owned = ptr_is_owned(a);
34107         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34108         a_conv.is_owned = false;
34109         LDKUnsignedNodeAnnouncement b_conv;
34110         b_conv.inner = untag_ptr(b);
34111         b_conv.is_owned = ptr_is_owned(b);
34112         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34113         b_conv.is_owned = false;
34114         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
34115         return ret_conv;
34116 }
34117
34118 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
34119         LDKNodeAnnouncement this_obj_conv;
34120         this_obj_conv.inner = untag_ptr(this_obj);
34121         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34123         NodeAnnouncement_free(this_obj_conv);
34124 }
34125
34126 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
34127         LDKNodeAnnouncement this_ptr_conv;
34128         this_ptr_conv.inner = untag_ptr(this_ptr);
34129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34131         this_ptr_conv.is_owned = false;
34132         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34133         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
34134         return ret_arr;
34135 }
34136
34137 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
34138         LDKNodeAnnouncement this_ptr_conv;
34139         this_ptr_conv.inner = untag_ptr(this_ptr);
34140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34142         this_ptr_conv.is_owned = false;
34143         LDKSignature val_ref;
34144         CHECK(val->arr_len == 64);
34145         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34146         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
34147 }
34148
34149 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
34150         LDKNodeAnnouncement this_ptr_conv;
34151         this_ptr_conv.inner = untag_ptr(this_ptr);
34152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34154         this_ptr_conv.is_owned = false;
34155         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
34156         uint64_t ret_ref = 0;
34157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34159         return ret_ref;
34160 }
34161
34162 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
34163         LDKNodeAnnouncement this_ptr_conv;
34164         this_ptr_conv.inner = untag_ptr(this_ptr);
34165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34167         this_ptr_conv.is_owned = false;
34168         LDKUnsignedNodeAnnouncement val_conv;
34169         val_conv.inner = untag_ptr(val);
34170         val_conv.is_owned = ptr_is_owned(val);
34171         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34172         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
34173         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
34174 }
34175
34176 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
34177         LDKSignature signature_arg_ref;
34178         CHECK(signature_arg->arr_len == 64);
34179         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
34180         LDKUnsignedNodeAnnouncement contents_arg_conv;
34181         contents_arg_conv.inner = untag_ptr(contents_arg);
34182         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34183         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34184         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
34185         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
34186         uint64_t ret_ref = 0;
34187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34189         return ret_ref;
34190 }
34191
34192 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
34193         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
34194         uint64_t ret_ref = 0;
34195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34197         return ret_ref;
34198 }
34199 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
34200         LDKNodeAnnouncement arg_conv;
34201         arg_conv.inner = untag_ptr(arg);
34202         arg_conv.is_owned = ptr_is_owned(arg);
34203         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34204         arg_conv.is_owned = false;
34205         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
34206         return ret_conv;
34207 }
34208
34209 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
34210         LDKNodeAnnouncement orig_conv;
34211         orig_conv.inner = untag_ptr(orig);
34212         orig_conv.is_owned = ptr_is_owned(orig);
34213         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34214         orig_conv.is_owned = false;
34215         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
34216         uint64_t ret_ref = 0;
34217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34219         return ret_ref;
34220 }
34221
34222 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
34223         LDKNodeAnnouncement a_conv;
34224         a_conv.inner = untag_ptr(a);
34225         a_conv.is_owned = ptr_is_owned(a);
34226         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34227         a_conv.is_owned = false;
34228         LDKNodeAnnouncement b_conv;
34229         b_conv.inner = untag_ptr(b);
34230         b_conv.is_owned = ptr_is_owned(b);
34231         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34232         b_conv.is_owned = false;
34233         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
34234         return ret_conv;
34235 }
34236
34237 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
34238         LDKUnsignedChannelAnnouncement this_obj_conv;
34239         this_obj_conv.inner = untag_ptr(this_obj);
34240         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34242         UnsignedChannelAnnouncement_free(this_obj_conv);
34243 }
34244
34245 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
34246         LDKUnsignedChannelAnnouncement this_ptr_conv;
34247         this_ptr_conv.inner = untag_ptr(this_ptr);
34248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34250         this_ptr_conv.is_owned = false;
34251         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
34252         uint64_t ret_ref = 0;
34253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34255         return ret_ref;
34256 }
34257
34258 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
34259         LDKUnsignedChannelAnnouncement this_ptr_conv;
34260         this_ptr_conv.inner = untag_ptr(this_ptr);
34261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34263         this_ptr_conv.is_owned = false;
34264         LDKChannelFeatures val_conv;
34265         val_conv.inner = untag_ptr(val);
34266         val_conv.is_owned = ptr_is_owned(val);
34267         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34268         val_conv = ChannelFeatures_clone(&val_conv);
34269         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
34270 }
34271
34272 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
34273         LDKUnsignedChannelAnnouncement this_ptr_conv;
34274         this_ptr_conv.inner = untag_ptr(this_ptr);
34275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34277         this_ptr_conv.is_owned = false;
34278         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34279         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
34280         return ret_arr;
34281 }
34282
34283 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34284         LDKUnsignedChannelAnnouncement this_ptr_conv;
34285         this_ptr_conv.inner = untag_ptr(this_ptr);
34286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34288         this_ptr_conv.is_owned = false;
34289         LDKThirtyTwoBytes val_ref;
34290         CHECK(val->arr_len == 32);
34291         memcpy(val_ref.data, val->elems, 32); FREE(val);
34292         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
34293 }
34294
34295 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
34296         LDKUnsignedChannelAnnouncement this_ptr_conv;
34297         this_ptr_conv.inner = untag_ptr(this_ptr);
34298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34300         this_ptr_conv.is_owned = false;
34301         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
34302         return ret_conv;
34303 }
34304
34305 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
34306         LDKUnsignedChannelAnnouncement this_ptr_conv;
34307         this_ptr_conv.inner = untag_ptr(this_ptr);
34308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34310         this_ptr_conv.is_owned = false;
34311         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
34312 }
34313
34314 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
34315         LDKUnsignedChannelAnnouncement this_ptr_conv;
34316         this_ptr_conv.inner = untag_ptr(this_ptr);
34317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34319         this_ptr_conv.is_owned = false;
34320         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
34321         uint64_t ret_ref = 0;
34322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34324         return ret_ref;
34325 }
34326
34327 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, uint64_t val) {
34328         LDKUnsignedChannelAnnouncement this_ptr_conv;
34329         this_ptr_conv.inner = untag_ptr(this_ptr);
34330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34332         this_ptr_conv.is_owned = false;
34333         LDKNodeId val_conv;
34334         val_conv.inner = untag_ptr(val);
34335         val_conv.is_owned = ptr_is_owned(val);
34336         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34337         val_conv = NodeId_clone(&val_conv);
34338         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
34339 }
34340
34341 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
34342         LDKUnsignedChannelAnnouncement this_ptr_conv;
34343         this_ptr_conv.inner = untag_ptr(this_ptr);
34344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34346         this_ptr_conv.is_owned = false;
34347         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
34348         uint64_t ret_ref = 0;
34349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34351         return ret_ref;
34352 }
34353
34354 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, uint64_t val) {
34355         LDKUnsignedChannelAnnouncement this_ptr_conv;
34356         this_ptr_conv.inner = untag_ptr(this_ptr);
34357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34359         this_ptr_conv.is_owned = false;
34360         LDKNodeId val_conv;
34361         val_conv.inner = untag_ptr(val);
34362         val_conv.is_owned = ptr_is_owned(val);
34363         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34364         val_conv = NodeId_clone(&val_conv);
34365         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
34366 }
34367
34368 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
34369         LDKUnsignedChannelAnnouncement this_ptr_conv;
34370         this_ptr_conv.inner = untag_ptr(this_ptr);
34371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34373         this_ptr_conv.is_owned = false;
34374         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
34375         uint64_t ret_ref = 0;
34376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34378         return ret_ref;
34379 }
34380
34381 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, uint64_t val) {
34382         LDKUnsignedChannelAnnouncement this_ptr_conv;
34383         this_ptr_conv.inner = untag_ptr(this_ptr);
34384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34386         this_ptr_conv.is_owned = false;
34387         LDKNodeId val_conv;
34388         val_conv.inner = untag_ptr(val);
34389         val_conv.is_owned = ptr_is_owned(val);
34390         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34391         val_conv = NodeId_clone(&val_conv);
34392         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
34393 }
34394
34395 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
34396         LDKUnsignedChannelAnnouncement this_ptr_conv;
34397         this_ptr_conv.inner = untag_ptr(this_ptr);
34398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34400         this_ptr_conv.is_owned = false;
34401         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
34402         uint64_t ret_ref = 0;
34403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34405         return ret_ref;
34406 }
34407
34408 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, uint64_t val) {
34409         LDKUnsignedChannelAnnouncement this_ptr_conv;
34410         this_ptr_conv.inner = untag_ptr(this_ptr);
34411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34413         this_ptr_conv.is_owned = false;
34414         LDKNodeId val_conv;
34415         val_conv.inner = untag_ptr(val);
34416         val_conv.is_owned = ptr_is_owned(val);
34417         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34418         val_conv = NodeId_clone(&val_conv);
34419         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
34420 }
34421
34422 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
34423         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
34424         uint64_t ret_ref = 0;
34425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34427         return ret_ref;
34428 }
34429 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
34430         LDKUnsignedChannelAnnouncement arg_conv;
34431         arg_conv.inner = untag_ptr(arg);
34432         arg_conv.is_owned = ptr_is_owned(arg);
34433         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34434         arg_conv.is_owned = false;
34435         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
34436         return ret_conv;
34437 }
34438
34439 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
34440         LDKUnsignedChannelAnnouncement orig_conv;
34441         orig_conv.inner = untag_ptr(orig);
34442         orig_conv.is_owned = ptr_is_owned(orig);
34443         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34444         orig_conv.is_owned = false;
34445         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
34446         uint64_t ret_ref = 0;
34447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34449         return ret_ref;
34450 }
34451
34452 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
34453         LDKUnsignedChannelAnnouncement a_conv;
34454         a_conv.inner = untag_ptr(a);
34455         a_conv.is_owned = ptr_is_owned(a);
34456         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34457         a_conv.is_owned = false;
34458         LDKUnsignedChannelAnnouncement b_conv;
34459         b_conv.inner = untag_ptr(b);
34460         b_conv.is_owned = ptr_is_owned(b);
34461         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34462         b_conv.is_owned = false;
34463         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
34464         return ret_conv;
34465 }
34466
34467 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
34468         LDKChannelAnnouncement this_obj_conv;
34469         this_obj_conv.inner = untag_ptr(this_obj);
34470         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34472         ChannelAnnouncement_free(this_obj_conv);
34473 }
34474
34475 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
34476         LDKChannelAnnouncement this_ptr_conv;
34477         this_ptr_conv.inner = untag_ptr(this_ptr);
34478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34480         this_ptr_conv.is_owned = false;
34481         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34482         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
34483         return ret_arr;
34484 }
34485
34486 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
34487         LDKChannelAnnouncement this_ptr_conv;
34488         this_ptr_conv.inner = untag_ptr(this_ptr);
34489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34491         this_ptr_conv.is_owned = false;
34492         LDKSignature val_ref;
34493         CHECK(val->arr_len == 64);
34494         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34495         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
34496 }
34497
34498 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
34499         LDKChannelAnnouncement this_ptr_conv;
34500         this_ptr_conv.inner = untag_ptr(this_ptr);
34501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34503         this_ptr_conv.is_owned = false;
34504         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34505         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
34506         return ret_arr;
34507 }
34508
34509 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
34510         LDKChannelAnnouncement this_ptr_conv;
34511         this_ptr_conv.inner = untag_ptr(this_ptr);
34512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34514         this_ptr_conv.is_owned = false;
34515         LDKSignature val_ref;
34516         CHECK(val->arr_len == 64);
34517         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34518         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
34519 }
34520
34521 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
34522         LDKChannelAnnouncement this_ptr_conv;
34523         this_ptr_conv.inner = untag_ptr(this_ptr);
34524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34526         this_ptr_conv.is_owned = false;
34527         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34528         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
34529         return ret_arr;
34530 }
34531
34532 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
34533         LDKChannelAnnouncement this_ptr_conv;
34534         this_ptr_conv.inner = untag_ptr(this_ptr);
34535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34537         this_ptr_conv.is_owned = false;
34538         LDKSignature val_ref;
34539         CHECK(val->arr_len == 64);
34540         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34541         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
34542 }
34543
34544 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
34545         LDKChannelAnnouncement this_ptr_conv;
34546         this_ptr_conv.inner = untag_ptr(this_ptr);
34547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34549         this_ptr_conv.is_owned = false;
34550         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34551         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
34552         return ret_arr;
34553 }
34554
34555 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
34556         LDKChannelAnnouncement this_ptr_conv;
34557         this_ptr_conv.inner = untag_ptr(this_ptr);
34558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34560         this_ptr_conv.is_owned = false;
34561         LDKSignature val_ref;
34562         CHECK(val->arr_len == 64);
34563         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34564         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
34565 }
34566
34567 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
34568         LDKChannelAnnouncement this_ptr_conv;
34569         this_ptr_conv.inner = untag_ptr(this_ptr);
34570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34572         this_ptr_conv.is_owned = false;
34573         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
34574         uint64_t ret_ref = 0;
34575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34577         return ret_ref;
34578 }
34579
34580 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
34581         LDKChannelAnnouncement this_ptr_conv;
34582         this_ptr_conv.inner = untag_ptr(this_ptr);
34583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34585         this_ptr_conv.is_owned = false;
34586         LDKUnsignedChannelAnnouncement val_conv;
34587         val_conv.inner = untag_ptr(val);
34588         val_conv.is_owned = ptr_is_owned(val);
34589         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34590         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
34591         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
34592 }
34593
34594 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) {
34595         LDKSignature node_signature_1_arg_ref;
34596         CHECK(node_signature_1_arg->arr_len == 64);
34597         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
34598         LDKSignature node_signature_2_arg_ref;
34599         CHECK(node_signature_2_arg->arr_len == 64);
34600         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
34601         LDKSignature bitcoin_signature_1_arg_ref;
34602         CHECK(bitcoin_signature_1_arg->arr_len == 64);
34603         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
34604         LDKSignature bitcoin_signature_2_arg_ref;
34605         CHECK(bitcoin_signature_2_arg->arr_len == 64);
34606         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
34607         LDKUnsignedChannelAnnouncement contents_arg_conv;
34608         contents_arg_conv.inner = untag_ptr(contents_arg);
34609         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34610         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34611         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
34612         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);
34613         uint64_t ret_ref = 0;
34614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34616         return ret_ref;
34617 }
34618
34619 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
34620         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
34621         uint64_t ret_ref = 0;
34622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34624         return ret_ref;
34625 }
34626 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
34627         LDKChannelAnnouncement arg_conv;
34628         arg_conv.inner = untag_ptr(arg);
34629         arg_conv.is_owned = ptr_is_owned(arg);
34630         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34631         arg_conv.is_owned = false;
34632         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
34633         return ret_conv;
34634 }
34635
34636 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
34637         LDKChannelAnnouncement orig_conv;
34638         orig_conv.inner = untag_ptr(orig);
34639         orig_conv.is_owned = ptr_is_owned(orig);
34640         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34641         orig_conv.is_owned = false;
34642         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
34643         uint64_t ret_ref = 0;
34644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34646         return ret_ref;
34647 }
34648
34649 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
34650         LDKChannelAnnouncement a_conv;
34651         a_conv.inner = untag_ptr(a);
34652         a_conv.is_owned = ptr_is_owned(a);
34653         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34654         a_conv.is_owned = false;
34655         LDKChannelAnnouncement b_conv;
34656         b_conv.inner = untag_ptr(b);
34657         b_conv.is_owned = ptr_is_owned(b);
34658         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34659         b_conv.is_owned = false;
34660         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
34661         return ret_conv;
34662 }
34663
34664 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
34665         LDKUnsignedChannelUpdate this_obj_conv;
34666         this_obj_conv.inner = untag_ptr(this_obj);
34667         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34669         UnsignedChannelUpdate_free(this_obj_conv);
34670 }
34671
34672 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
34673         LDKUnsignedChannelUpdate this_ptr_conv;
34674         this_ptr_conv.inner = untag_ptr(this_ptr);
34675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34677         this_ptr_conv.is_owned = false;
34678         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34679         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
34680         return ret_arr;
34681 }
34682
34683 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34684         LDKUnsignedChannelUpdate this_ptr_conv;
34685         this_ptr_conv.inner = untag_ptr(this_ptr);
34686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34688         this_ptr_conv.is_owned = false;
34689         LDKThirtyTwoBytes val_ref;
34690         CHECK(val->arr_len == 32);
34691         memcpy(val_ref.data, val->elems, 32); FREE(val);
34692         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
34693 }
34694
34695 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
34696         LDKUnsignedChannelUpdate this_ptr_conv;
34697         this_ptr_conv.inner = untag_ptr(this_ptr);
34698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34700         this_ptr_conv.is_owned = false;
34701         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
34702         return ret_conv;
34703 }
34704
34705 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
34706         LDKUnsignedChannelUpdate this_ptr_conv;
34707         this_ptr_conv.inner = untag_ptr(this_ptr);
34708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34710         this_ptr_conv.is_owned = false;
34711         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
34712 }
34713
34714 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
34715         LDKUnsignedChannelUpdate this_ptr_conv;
34716         this_ptr_conv.inner = untag_ptr(this_ptr);
34717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34719         this_ptr_conv.is_owned = false;
34720         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
34721         return ret_conv;
34722 }
34723
34724 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
34725         LDKUnsignedChannelUpdate this_ptr_conv;
34726         this_ptr_conv.inner = untag_ptr(this_ptr);
34727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34729         this_ptr_conv.is_owned = false;
34730         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
34731 }
34732
34733 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
34734         LDKUnsignedChannelUpdate this_ptr_conv;
34735         this_ptr_conv.inner = untag_ptr(this_ptr);
34736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34738         this_ptr_conv.is_owned = false;
34739         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
34740         return ret_conv;
34741 }
34742
34743 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
34744         LDKUnsignedChannelUpdate this_ptr_conv;
34745         this_ptr_conv.inner = untag_ptr(this_ptr);
34746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34748         this_ptr_conv.is_owned = false;
34749         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
34750 }
34751
34752 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
34753         LDKUnsignedChannelUpdate this_ptr_conv;
34754         this_ptr_conv.inner = untag_ptr(this_ptr);
34755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34757         this_ptr_conv.is_owned = false;
34758         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
34759         return ret_conv;
34760 }
34761
34762 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
34763         LDKUnsignedChannelUpdate this_ptr_conv;
34764         this_ptr_conv.inner = untag_ptr(this_ptr);
34765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34767         this_ptr_conv.is_owned = false;
34768         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
34769 }
34770
34771 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
34772         LDKUnsignedChannelUpdate this_ptr_conv;
34773         this_ptr_conv.inner = untag_ptr(this_ptr);
34774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34776         this_ptr_conv.is_owned = false;
34777         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
34778         return ret_conv;
34779 }
34780
34781 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
34782         LDKUnsignedChannelUpdate this_ptr_conv;
34783         this_ptr_conv.inner = untag_ptr(this_ptr);
34784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34786         this_ptr_conv.is_owned = false;
34787         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
34788 }
34789
34790 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
34791         LDKUnsignedChannelUpdate this_ptr_conv;
34792         this_ptr_conv.inner = untag_ptr(this_ptr);
34793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34795         this_ptr_conv.is_owned = false;
34796         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
34797         return ret_conv;
34798 }
34799
34800 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
34801         LDKUnsignedChannelUpdate this_ptr_conv;
34802         this_ptr_conv.inner = untag_ptr(this_ptr);
34803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34805         this_ptr_conv.is_owned = false;
34806         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
34807 }
34808
34809 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
34810         LDKUnsignedChannelUpdate this_ptr_conv;
34811         this_ptr_conv.inner = untag_ptr(this_ptr);
34812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34814         this_ptr_conv.is_owned = false;
34815         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
34816         return ret_conv;
34817 }
34818
34819 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
34820         LDKUnsignedChannelUpdate this_ptr_conv;
34821         this_ptr_conv.inner = untag_ptr(this_ptr);
34822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34824         this_ptr_conv.is_owned = false;
34825         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
34826 }
34827
34828 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
34829         LDKUnsignedChannelUpdate this_ptr_conv;
34830         this_ptr_conv.inner = untag_ptr(this_ptr);
34831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34833         this_ptr_conv.is_owned = false;
34834         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
34835         return ret_conv;
34836 }
34837
34838 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
34839         LDKUnsignedChannelUpdate this_ptr_conv;
34840         this_ptr_conv.inner = untag_ptr(this_ptr);
34841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34843         this_ptr_conv.is_owned = false;
34844         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
34845 }
34846
34847 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
34848         LDKUnsignedChannelUpdate this_ptr_conv;
34849         this_ptr_conv.inner = untag_ptr(this_ptr);
34850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34852         this_ptr_conv.is_owned = false;
34853         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
34854         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34855         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34856         CVec_u8Z_free(ret_var);
34857         return ret_arr;
34858 }
34859
34860 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
34861         LDKUnsignedChannelUpdate this_ptr_conv;
34862         this_ptr_conv.inner = untag_ptr(this_ptr);
34863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34865         this_ptr_conv.is_owned = false;
34866         LDKCVec_u8Z val_ref;
34867         val_ref.datalen = val->arr_len;
34868         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
34869         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
34870         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
34871 }
34872
34873 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) {
34874         LDKThirtyTwoBytes chain_hash_arg_ref;
34875         CHECK(chain_hash_arg->arr_len == 32);
34876         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
34877         LDKCVec_u8Z excess_data_arg_ref;
34878         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
34879         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
34880         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
34881         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);
34882         uint64_t ret_ref = 0;
34883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34885         return ret_ref;
34886 }
34887
34888 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
34889         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
34890         uint64_t ret_ref = 0;
34891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34893         return ret_ref;
34894 }
34895 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
34896         LDKUnsignedChannelUpdate arg_conv;
34897         arg_conv.inner = untag_ptr(arg);
34898         arg_conv.is_owned = ptr_is_owned(arg);
34899         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34900         arg_conv.is_owned = false;
34901         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
34902         return ret_conv;
34903 }
34904
34905 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
34906         LDKUnsignedChannelUpdate orig_conv;
34907         orig_conv.inner = untag_ptr(orig);
34908         orig_conv.is_owned = ptr_is_owned(orig);
34909         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34910         orig_conv.is_owned = false;
34911         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
34912         uint64_t ret_ref = 0;
34913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34915         return ret_ref;
34916 }
34917
34918 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
34919         LDKUnsignedChannelUpdate a_conv;
34920         a_conv.inner = untag_ptr(a);
34921         a_conv.is_owned = ptr_is_owned(a);
34922         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34923         a_conv.is_owned = false;
34924         LDKUnsignedChannelUpdate b_conv;
34925         b_conv.inner = untag_ptr(b);
34926         b_conv.is_owned = ptr_is_owned(b);
34927         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34928         b_conv.is_owned = false;
34929         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
34930         return ret_conv;
34931 }
34932
34933 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
34934         LDKChannelUpdate this_obj_conv;
34935         this_obj_conv.inner = untag_ptr(this_obj);
34936         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34938         ChannelUpdate_free(this_obj_conv);
34939 }
34940
34941 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
34942         LDKChannelUpdate this_ptr_conv;
34943         this_ptr_conv.inner = untag_ptr(this_ptr);
34944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34946         this_ptr_conv.is_owned = false;
34947         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34948         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
34949         return ret_arr;
34950 }
34951
34952 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
34953         LDKChannelUpdate this_ptr_conv;
34954         this_ptr_conv.inner = untag_ptr(this_ptr);
34955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34957         this_ptr_conv.is_owned = false;
34958         LDKSignature val_ref;
34959         CHECK(val->arr_len == 64);
34960         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34961         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
34962 }
34963
34964 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
34965         LDKChannelUpdate this_ptr_conv;
34966         this_ptr_conv.inner = untag_ptr(this_ptr);
34967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34969         this_ptr_conv.is_owned = false;
34970         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
34971         uint64_t ret_ref = 0;
34972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34974         return ret_ref;
34975 }
34976
34977 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
34978         LDKChannelUpdate this_ptr_conv;
34979         this_ptr_conv.inner = untag_ptr(this_ptr);
34980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34982         this_ptr_conv.is_owned = false;
34983         LDKUnsignedChannelUpdate val_conv;
34984         val_conv.inner = untag_ptr(val);
34985         val_conv.is_owned = ptr_is_owned(val);
34986         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34987         val_conv = UnsignedChannelUpdate_clone(&val_conv);
34988         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
34989 }
34990
34991 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
34992         LDKSignature signature_arg_ref;
34993         CHECK(signature_arg->arr_len == 64);
34994         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
34995         LDKUnsignedChannelUpdate contents_arg_conv;
34996         contents_arg_conv.inner = untag_ptr(contents_arg);
34997         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34998         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34999         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
35000         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
35001         uint64_t ret_ref = 0;
35002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35004         return ret_ref;
35005 }
35006
35007 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
35008         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
35009         uint64_t ret_ref = 0;
35010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35012         return ret_ref;
35013 }
35014 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
35015         LDKChannelUpdate arg_conv;
35016         arg_conv.inner = untag_ptr(arg);
35017         arg_conv.is_owned = ptr_is_owned(arg);
35018         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35019         arg_conv.is_owned = false;
35020         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
35021         return ret_conv;
35022 }
35023
35024 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
35025         LDKChannelUpdate orig_conv;
35026         orig_conv.inner = untag_ptr(orig);
35027         orig_conv.is_owned = ptr_is_owned(orig);
35028         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35029         orig_conv.is_owned = false;
35030         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
35031         uint64_t ret_ref = 0;
35032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35034         return ret_ref;
35035 }
35036
35037 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
35038         LDKChannelUpdate a_conv;
35039         a_conv.inner = untag_ptr(a);
35040         a_conv.is_owned = ptr_is_owned(a);
35041         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35042         a_conv.is_owned = false;
35043         LDKChannelUpdate b_conv;
35044         b_conv.inner = untag_ptr(b);
35045         b_conv.is_owned = ptr_is_owned(b);
35046         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35047         b_conv.is_owned = false;
35048         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
35049         return ret_conv;
35050 }
35051
35052 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
35053         LDKQueryChannelRange this_obj_conv;
35054         this_obj_conv.inner = untag_ptr(this_obj);
35055         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35057         QueryChannelRange_free(this_obj_conv);
35058 }
35059
35060 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
35061         LDKQueryChannelRange this_ptr_conv;
35062         this_ptr_conv.inner = untag_ptr(this_ptr);
35063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35065         this_ptr_conv.is_owned = false;
35066         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35067         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
35068         return ret_arr;
35069 }
35070
35071 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35072         LDKQueryChannelRange this_ptr_conv;
35073         this_ptr_conv.inner = untag_ptr(this_ptr);
35074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35076         this_ptr_conv.is_owned = false;
35077         LDKThirtyTwoBytes val_ref;
35078         CHECK(val->arr_len == 32);
35079         memcpy(val_ref.data, val->elems, 32); FREE(val);
35080         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
35081 }
35082
35083 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
35084         LDKQueryChannelRange this_ptr_conv;
35085         this_ptr_conv.inner = untag_ptr(this_ptr);
35086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35088         this_ptr_conv.is_owned = false;
35089         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
35090         return ret_conv;
35091 }
35092
35093 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
35094         LDKQueryChannelRange this_ptr_conv;
35095         this_ptr_conv.inner = untag_ptr(this_ptr);
35096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35098         this_ptr_conv.is_owned = false;
35099         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
35100 }
35101
35102 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
35103         LDKQueryChannelRange this_ptr_conv;
35104         this_ptr_conv.inner = untag_ptr(this_ptr);
35105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35107         this_ptr_conv.is_owned = false;
35108         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
35109         return ret_conv;
35110 }
35111
35112 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
35113         LDKQueryChannelRange this_ptr_conv;
35114         this_ptr_conv.inner = untag_ptr(this_ptr);
35115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35117         this_ptr_conv.is_owned = false;
35118         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
35119 }
35120
35121 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) {
35122         LDKThirtyTwoBytes chain_hash_arg_ref;
35123         CHECK(chain_hash_arg->arr_len == 32);
35124         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35125         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
35126         uint64_t ret_ref = 0;
35127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35129         return ret_ref;
35130 }
35131
35132 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
35133         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
35134         uint64_t ret_ref = 0;
35135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35137         return ret_ref;
35138 }
35139 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
35140         LDKQueryChannelRange arg_conv;
35141         arg_conv.inner = untag_ptr(arg);
35142         arg_conv.is_owned = ptr_is_owned(arg);
35143         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35144         arg_conv.is_owned = false;
35145         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
35146         return ret_conv;
35147 }
35148
35149 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
35150         LDKQueryChannelRange orig_conv;
35151         orig_conv.inner = untag_ptr(orig);
35152         orig_conv.is_owned = ptr_is_owned(orig);
35153         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35154         orig_conv.is_owned = false;
35155         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
35156         uint64_t ret_ref = 0;
35157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35159         return ret_ref;
35160 }
35161
35162 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
35163         LDKQueryChannelRange a_conv;
35164         a_conv.inner = untag_ptr(a);
35165         a_conv.is_owned = ptr_is_owned(a);
35166         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35167         a_conv.is_owned = false;
35168         LDKQueryChannelRange b_conv;
35169         b_conv.inner = untag_ptr(b);
35170         b_conv.is_owned = ptr_is_owned(b);
35171         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35172         b_conv.is_owned = false;
35173         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
35174         return ret_conv;
35175 }
35176
35177 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
35178         LDKReplyChannelRange this_obj_conv;
35179         this_obj_conv.inner = untag_ptr(this_obj);
35180         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35182         ReplyChannelRange_free(this_obj_conv);
35183 }
35184
35185 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
35186         LDKReplyChannelRange this_ptr_conv;
35187         this_ptr_conv.inner = untag_ptr(this_ptr);
35188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35190         this_ptr_conv.is_owned = false;
35191         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35192         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
35193         return ret_arr;
35194 }
35195
35196 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35197         LDKReplyChannelRange this_ptr_conv;
35198         this_ptr_conv.inner = untag_ptr(this_ptr);
35199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35201         this_ptr_conv.is_owned = false;
35202         LDKThirtyTwoBytes val_ref;
35203         CHECK(val->arr_len == 32);
35204         memcpy(val_ref.data, val->elems, 32); FREE(val);
35205         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
35206 }
35207
35208 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
35209         LDKReplyChannelRange this_ptr_conv;
35210         this_ptr_conv.inner = untag_ptr(this_ptr);
35211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35213         this_ptr_conv.is_owned = false;
35214         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
35215         return ret_conv;
35216 }
35217
35218 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
35219         LDKReplyChannelRange this_ptr_conv;
35220         this_ptr_conv.inner = untag_ptr(this_ptr);
35221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35223         this_ptr_conv.is_owned = false;
35224         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
35225 }
35226
35227 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
35228         LDKReplyChannelRange this_ptr_conv;
35229         this_ptr_conv.inner = untag_ptr(this_ptr);
35230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35232         this_ptr_conv.is_owned = false;
35233         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
35234         return ret_conv;
35235 }
35236
35237 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
35238         LDKReplyChannelRange this_ptr_conv;
35239         this_ptr_conv.inner = untag_ptr(this_ptr);
35240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35242         this_ptr_conv.is_owned = false;
35243         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
35244 }
35245
35246 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
35247         LDKReplyChannelRange this_ptr_conv;
35248         this_ptr_conv.inner = untag_ptr(this_ptr);
35249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35251         this_ptr_conv.is_owned = false;
35252         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
35253         return ret_conv;
35254 }
35255
35256 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
35257         LDKReplyChannelRange this_ptr_conv;
35258         this_ptr_conv.inner = untag_ptr(this_ptr);
35259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35261         this_ptr_conv.is_owned = false;
35262         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
35263 }
35264
35265 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
35266         LDKReplyChannelRange this_ptr_conv;
35267         this_ptr_conv.inner = untag_ptr(this_ptr);
35268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35270         this_ptr_conv.is_owned = false;
35271         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
35272         int64_tArray ret_arr = NULL;
35273         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35274         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35275         for (size_t i = 0; i < ret_var.datalen; i++) {
35276                 int64_t ret_conv_8_conv = ret_var.data[i];
35277                 ret_arr_ptr[i] = ret_conv_8_conv;
35278         }
35279         
35280         FREE(ret_var.data);
35281         return ret_arr;
35282 }
35283
35284 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
35285         LDKReplyChannelRange this_ptr_conv;
35286         this_ptr_conv.inner = untag_ptr(this_ptr);
35287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35289         this_ptr_conv.is_owned = false;
35290         LDKCVec_u64Z val_constr;
35291         val_constr.datalen = val->arr_len;
35292         if (val_constr.datalen > 0)
35293                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35294         else
35295                 val_constr.data = NULL;
35296         int64_t* val_vals = val->elems;
35297         for (size_t i = 0; i < val_constr.datalen; i++) {
35298                 int64_t val_conv_8 = val_vals[i];
35299                 val_constr.data[i] = val_conv_8;
35300         }
35301         FREE(val);
35302         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
35303 }
35304
35305 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) {
35306         LDKThirtyTwoBytes chain_hash_arg_ref;
35307         CHECK(chain_hash_arg->arr_len == 32);
35308         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35309         LDKCVec_u64Z short_channel_ids_arg_constr;
35310         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
35311         if (short_channel_ids_arg_constr.datalen > 0)
35312                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35313         else
35314                 short_channel_ids_arg_constr.data = NULL;
35315         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
35316         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
35317                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
35318                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
35319         }
35320         FREE(short_channel_ids_arg);
35321         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
35322         uint64_t ret_ref = 0;
35323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35325         return ret_ref;
35326 }
35327
35328 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
35329         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
35330         uint64_t ret_ref = 0;
35331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35333         return ret_ref;
35334 }
35335 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
35336         LDKReplyChannelRange arg_conv;
35337         arg_conv.inner = untag_ptr(arg);
35338         arg_conv.is_owned = ptr_is_owned(arg);
35339         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35340         arg_conv.is_owned = false;
35341         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
35342         return ret_conv;
35343 }
35344
35345 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
35346         LDKReplyChannelRange orig_conv;
35347         orig_conv.inner = untag_ptr(orig);
35348         orig_conv.is_owned = ptr_is_owned(orig);
35349         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35350         orig_conv.is_owned = false;
35351         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
35352         uint64_t ret_ref = 0;
35353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35355         return ret_ref;
35356 }
35357
35358 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
35359         LDKReplyChannelRange a_conv;
35360         a_conv.inner = untag_ptr(a);
35361         a_conv.is_owned = ptr_is_owned(a);
35362         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35363         a_conv.is_owned = false;
35364         LDKReplyChannelRange b_conv;
35365         b_conv.inner = untag_ptr(b);
35366         b_conv.is_owned = ptr_is_owned(b);
35367         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35368         b_conv.is_owned = false;
35369         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
35370         return ret_conv;
35371 }
35372
35373 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
35374         LDKQueryShortChannelIds this_obj_conv;
35375         this_obj_conv.inner = untag_ptr(this_obj);
35376         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35378         QueryShortChannelIds_free(this_obj_conv);
35379 }
35380
35381 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
35382         LDKQueryShortChannelIds this_ptr_conv;
35383         this_ptr_conv.inner = untag_ptr(this_ptr);
35384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35386         this_ptr_conv.is_owned = false;
35387         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35388         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
35389         return ret_arr;
35390 }
35391
35392 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35393         LDKQueryShortChannelIds this_ptr_conv;
35394         this_ptr_conv.inner = untag_ptr(this_ptr);
35395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35397         this_ptr_conv.is_owned = false;
35398         LDKThirtyTwoBytes val_ref;
35399         CHECK(val->arr_len == 32);
35400         memcpy(val_ref.data, val->elems, 32); FREE(val);
35401         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
35402 }
35403
35404 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
35405         LDKQueryShortChannelIds this_ptr_conv;
35406         this_ptr_conv.inner = untag_ptr(this_ptr);
35407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35409         this_ptr_conv.is_owned = false;
35410         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
35411         int64_tArray ret_arr = NULL;
35412         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35413         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35414         for (size_t i = 0; i < ret_var.datalen; i++) {
35415                 int64_t ret_conv_8_conv = ret_var.data[i];
35416                 ret_arr_ptr[i] = ret_conv_8_conv;
35417         }
35418         
35419         FREE(ret_var.data);
35420         return ret_arr;
35421 }
35422
35423 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
35424         LDKQueryShortChannelIds this_ptr_conv;
35425         this_ptr_conv.inner = untag_ptr(this_ptr);
35426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35428         this_ptr_conv.is_owned = false;
35429         LDKCVec_u64Z val_constr;
35430         val_constr.datalen = val->arr_len;
35431         if (val_constr.datalen > 0)
35432                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35433         else
35434                 val_constr.data = NULL;
35435         int64_t* val_vals = val->elems;
35436         for (size_t i = 0; i < val_constr.datalen; i++) {
35437                 int64_t val_conv_8 = val_vals[i];
35438                 val_constr.data[i] = val_conv_8;
35439         }
35440         FREE(val);
35441         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
35442 }
35443
35444 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
35445         LDKThirtyTwoBytes chain_hash_arg_ref;
35446         CHECK(chain_hash_arg->arr_len == 32);
35447         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35448         LDKCVec_u64Z short_channel_ids_arg_constr;
35449         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
35450         if (short_channel_ids_arg_constr.datalen > 0)
35451                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35452         else
35453                 short_channel_ids_arg_constr.data = NULL;
35454         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
35455         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
35456                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
35457                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
35458         }
35459         FREE(short_channel_ids_arg);
35460         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
35461         uint64_t ret_ref = 0;
35462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35464         return ret_ref;
35465 }
35466
35467 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
35468         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
35469         uint64_t ret_ref = 0;
35470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35472         return ret_ref;
35473 }
35474 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
35475         LDKQueryShortChannelIds arg_conv;
35476         arg_conv.inner = untag_ptr(arg);
35477         arg_conv.is_owned = ptr_is_owned(arg);
35478         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35479         arg_conv.is_owned = false;
35480         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
35481         return ret_conv;
35482 }
35483
35484 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
35485         LDKQueryShortChannelIds orig_conv;
35486         orig_conv.inner = untag_ptr(orig);
35487         orig_conv.is_owned = ptr_is_owned(orig);
35488         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35489         orig_conv.is_owned = false;
35490         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
35491         uint64_t ret_ref = 0;
35492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35494         return ret_ref;
35495 }
35496
35497 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
35498         LDKQueryShortChannelIds a_conv;
35499         a_conv.inner = untag_ptr(a);
35500         a_conv.is_owned = ptr_is_owned(a);
35501         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35502         a_conv.is_owned = false;
35503         LDKQueryShortChannelIds b_conv;
35504         b_conv.inner = untag_ptr(b);
35505         b_conv.is_owned = ptr_is_owned(b);
35506         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35507         b_conv.is_owned = false;
35508         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
35509         return ret_conv;
35510 }
35511
35512 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
35513         LDKReplyShortChannelIdsEnd this_obj_conv;
35514         this_obj_conv.inner = untag_ptr(this_obj);
35515         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35517         ReplyShortChannelIdsEnd_free(this_obj_conv);
35518 }
35519
35520 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
35521         LDKReplyShortChannelIdsEnd this_ptr_conv;
35522         this_ptr_conv.inner = untag_ptr(this_ptr);
35523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35525         this_ptr_conv.is_owned = false;
35526         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35527         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
35528         return ret_arr;
35529 }
35530
35531 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35532         LDKReplyShortChannelIdsEnd this_ptr_conv;
35533         this_ptr_conv.inner = untag_ptr(this_ptr);
35534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35536         this_ptr_conv.is_owned = false;
35537         LDKThirtyTwoBytes val_ref;
35538         CHECK(val->arr_len == 32);
35539         memcpy(val_ref.data, val->elems, 32); FREE(val);
35540         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
35541 }
35542
35543 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
35544         LDKReplyShortChannelIdsEnd this_ptr_conv;
35545         this_ptr_conv.inner = untag_ptr(this_ptr);
35546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35548         this_ptr_conv.is_owned = false;
35549         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
35550         return ret_conv;
35551 }
35552
35553 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
35554         LDKReplyShortChannelIdsEnd this_ptr_conv;
35555         this_ptr_conv.inner = untag_ptr(this_ptr);
35556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35558         this_ptr_conv.is_owned = false;
35559         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
35560 }
35561
35562 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
35563         LDKThirtyTwoBytes chain_hash_arg_ref;
35564         CHECK(chain_hash_arg->arr_len == 32);
35565         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35566         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
35567         uint64_t ret_ref = 0;
35568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35570         return ret_ref;
35571 }
35572
35573 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
35574         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
35575         uint64_t ret_ref = 0;
35576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35578         return ret_ref;
35579 }
35580 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
35581         LDKReplyShortChannelIdsEnd arg_conv;
35582         arg_conv.inner = untag_ptr(arg);
35583         arg_conv.is_owned = ptr_is_owned(arg);
35584         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35585         arg_conv.is_owned = false;
35586         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
35587         return ret_conv;
35588 }
35589
35590 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
35591         LDKReplyShortChannelIdsEnd orig_conv;
35592         orig_conv.inner = untag_ptr(orig);
35593         orig_conv.is_owned = ptr_is_owned(orig);
35594         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35595         orig_conv.is_owned = false;
35596         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
35597         uint64_t ret_ref = 0;
35598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35600         return ret_ref;
35601 }
35602
35603 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
35604         LDKReplyShortChannelIdsEnd a_conv;
35605         a_conv.inner = untag_ptr(a);
35606         a_conv.is_owned = ptr_is_owned(a);
35607         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35608         a_conv.is_owned = false;
35609         LDKReplyShortChannelIdsEnd b_conv;
35610         b_conv.inner = untag_ptr(b);
35611         b_conv.is_owned = ptr_is_owned(b);
35612         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35613         b_conv.is_owned = false;
35614         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
35615         return ret_conv;
35616 }
35617
35618 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
35619         LDKGossipTimestampFilter this_obj_conv;
35620         this_obj_conv.inner = untag_ptr(this_obj);
35621         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35623         GossipTimestampFilter_free(this_obj_conv);
35624 }
35625
35626 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
35627         LDKGossipTimestampFilter this_ptr_conv;
35628         this_ptr_conv.inner = untag_ptr(this_ptr);
35629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35631         this_ptr_conv.is_owned = false;
35632         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35633         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
35634         return ret_arr;
35635 }
35636
35637 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35638         LDKGossipTimestampFilter this_ptr_conv;
35639         this_ptr_conv.inner = untag_ptr(this_ptr);
35640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35642         this_ptr_conv.is_owned = false;
35643         LDKThirtyTwoBytes val_ref;
35644         CHECK(val->arr_len == 32);
35645         memcpy(val_ref.data, val->elems, 32); FREE(val);
35646         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
35647 }
35648
35649 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
35650         LDKGossipTimestampFilter this_ptr_conv;
35651         this_ptr_conv.inner = untag_ptr(this_ptr);
35652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35654         this_ptr_conv.is_owned = false;
35655         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
35656         return ret_conv;
35657 }
35658
35659 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
35660         LDKGossipTimestampFilter this_ptr_conv;
35661         this_ptr_conv.inner = untag_ptr(this_ptr);
35662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35664         this_ptr_conv.is_owned = false;
35665         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
35666 }
35667
35668 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
35669         LDKGossipTimestampFilter this_ptr_conv;
35670         this_ptr_conv.inner = untag_ptr(this_ptr);
35671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35673         this_ptr_conv.is_owned = false;
35674         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
35675         return ret_conv;
35676 }
35677
35678 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
35679         LDKGossipTimestampFilter this_ptr_conv;
35680         this_ptr_conv.inner = untag_ptr(this_ptr);
35681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35683         this_ptr_conv.is_owned = false;
35684         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
35685 }
35686
35687 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) {
35688         LDKThirtyTwoBytes chain_hash_arg_ref;
35689         CHECK(chain_hash_arg->arr_len == 32);
35690         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35691         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
35692         uint64_t ret_ref = 0;
35693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35695         return ret_ref;
35696 }
35697
35698 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
35699         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
35700         uint64_t ret_ref = 0;
35701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35703         return ret_ref;
35704 }
35705 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
35706         LDKGossipTimestampFilter arg_conv;
35707         arg_conv.inner = untag_ptr(arg);
35708         arg_conv.is_owned = ptr_is_owned(arg);
35709         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35710         arg_conv.is_owned = false;
35711         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
35712         return ret_conv;
35713 }
35714
35715 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
35716         LDKGossipTimestampFilter orig_conv;
35717         orig_conv.inner = untag_ptr(orig);
35718         orig_conv.is_owned = ptr_is_owned(orig);
35719         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35720         orig_conv.is_owned = false;
35721         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
35722         uint64_t ret_ref = 0;
35723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35725         return ret_ref;
35726 }
35727
35728 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
35729         LDKGossipTimestampFilter a_conv;
35730         a_conv.inner = untag_ptr(a);
35731         a_conv.is_owned = ptr_is_owned(a);
35732         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35733         a_conv.is_owned = false;
35734         LDKGossipTimestampFilter b_conv;
35735         b_conv.inner = untag_ptr(b);
35736         b_conv.is_owned = ptr_is_owned(b);
35737         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35738         b_conv.is_owned = false;
35739         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
35740         return ret_conv;
35741 }
35742
35743 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
35744         if (!ptr_is_owned(this_ptr)) return;
35745         void* this_ptr_ptr = untag_ptr(this_ptr);
35746         CHECK_ACCESS(this_ptr_ptr);
35747         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
35748         FREE(untag_ptr(this_ptr));
35749         ErrorAction_free(this_ptr_conv);
35750 }
35751
35752 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
35753         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35754         *ret_copy = ErrorAction_clone(arg);
35755         uint64_t ret_ref = tag_ptr(ret_copy, true);
35756         return ret_ref;
35757 }
35758 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
35759         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
35760         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
35761         return ret_conv;
35762 }
35763
35764 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
35765         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
35766         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35767         *ret_copy = ErrorAction_clone(orig_conv);
35768         uint64_t ret_ref = tag_ptr(ret_copy, true);
35769         return ret_ref;
35770 }
35771
35772 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
35773         LDKErrorMessage msg_conv;
35774         msg_conv.inner = untag_ptr(msg);
35775         msg_conv.is_owned = ptr_is_owned(msg);
35776         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35777         msg_conv = ErrorMessage_clone(&msg_conv);
35778         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35779         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
35780         uint64_t ret_ref = tag_ptr(ret_copy, true);
35781         return ret_ref;
35782 }
35783
35784 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
35785         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35786         *ret_copy = ErrorAction_ignore_error();
35787         uint64_t ret_ref = tag_ptr(ret_copy, true);
35788         return ret_ref;
35789 }
35790
35791 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
35792         LDKLevel a_conv = LDKLevel_from_js(a);
35793         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35794         *ret_copy = ErrorAction_ignore_and_log(a_conv);
35795         uint64_t ret_ref = tag_ptr(ret_copy, true);
35796         return ret_ref;
35797 }
35798
35799 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
35800         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35801         *ret_copy = ErrorAction_ignore_duplicate_gossip();
35802         uint64_t ret_ref = tag_ptr(ret_copy, true);
35803         return ret_ref;
35804 }
35805
35806 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
35807         LDKErrorMessage msg_conv;
35808         msg_conv.inner = untag_ptr(msg);
35809         msg_conv.is_owned = ptr_is_owned(msg);
35810         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35811         msg_conv = ErrorMessage_clone(&msg_conv);
35812         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35813         *ret_copy = ErrorAction_send_error_message(msg_conv);
35814         uint64_t ret_ref = tag_ptr(ret_copy, true);
35815         return ret_ref;
35816 }
35817
35818 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
35819         LDKWarningMessage msg_conv;
35820         msg_conv.inner = untag_ptr(msg);
35821         msg_conv.is_owned = ptr_is_owned(msg);
35822         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35823         msg_conv = WarningMessage_clone(&msg_conv);
35824         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
35825         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35826         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
35827         uint64_t ret_ref = tag_ptr(ret_copy, true);
35828         return ret_ref;
35829 }
35830
35831 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
35832         LDKLightningError this_obj_conv;
35833         this_obj_conv.inner = untag_ptr(this_obj);
35834         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35836         LightningError_free(this_obj_conv);
35837 }
35838
35839 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
35840         LDKLightningError this_ptr_conv;
35841         this_ptr_conv.inner = untag_ptr(this_ptr);
35842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35844         this_ptr_conv.is_owned = false;
35845         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
35846         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
35847         Str_free(ret_str);
35848         return ret_conv;
35849 }
35850
35851 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
35852         LDKLightningError this_ptr_conv;
35853         this_ptr_conv.inner = untag_ptr(this_ptr);
35854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35856         this_ptr_conv.is_owned = false;
35857         LDKStr val_conv = str_ref_to_owned_c(val);
35858         LightningError_set_err(&this_ptr_conv, val_conv);
35859 }
35860
35861 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
35862         LDKLightningError this_ptr_conv;
35863         this_ptr_conv.inner = untag_ptr(this_ptr);
35864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35866         this_ptr_conv.is_owned = false;
35867         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35868         *ret_copy = LightningError_get_action(&this_ptr_conv);
35869         uint64_t ret_ref = tag_ptr(ret_copy, true);
35870         return ret_ref;
35871 }
35872
35873 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
35874         LDKLightningError this_ptr_conv;
35875         this_ptr_conv.inner = untag_ptr(this_ptr);
35876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35878         this_ptr_conv.is_owned = false;
35879         void* val_ptr = untag_ptr(val);
35880         CHECK_ACCESS(val_ptr);
35881         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
35882         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
35883         LightningError_set_action(&this_ptr_conv, val_conv);
35884 }
35885
35886 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
35887         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
35888         void* action_arg_ptr = untag_ptr(action_arg);
35889         CHECK_ACCESS(action_arg_ptr);
35890         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
35891         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
35892         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
35893         uint64_t ret_ref = 0;
35894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35896         return ret_ref;
35897 }
35898
35899 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
35900         LDKLightningError ret_var = LightningError_clone(arg);
35901         uint64_t ret_ref = 0;
35902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35904         return ret_ref;
35905 }
35906 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
35907         LDKLightningError arg_conv;
35908         arg_conv.inner = untag_ptr(arg);
35909         arg_conv.is_owned = ptr_is_owned(arg);
35910         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35911         arg_conv.is_owned = false;
35912         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
35913         return ret_conv;
35914 }
35915
35916 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
35917         LDKLightningError orig_conv;
35918         orig_conv.inner = untag_ptr(orig);
35919         orig_conv.is_owned = ptr_is_owned(orig);
35920         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35921         orig_conv.is_owned = false;
35922         LDKLightningError ret_var = LightningError_clone(&orig_conv);
35923         uint64_t ret_ref = 0;
35924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35926         return ret_ref;
35927 }
35928
35929 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
35930         LDKCommitmentUpdate this_obj_conv;
35931         this_obj_conv.inner = untag_ptr(this_obj);
35932         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35934         CommitmentUpdate_free(this_obj_conv);
35935 }
35936
35937 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
35938         LDKCommitmentUpdate this_ptr_conv;
35939         this_ptr_conv.inner = untag_ptr(this_ptr);
35940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35942         this_ptr_conv.is_owned = false;
35943         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
35944         uint64_tArray ret_arr = NULL;
35945         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35946         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35947         for (size_t p = 0; p < ret_var.datalen; p++) {
35948                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
35949                 uint64_t ret_conv_15_ref = 0;
35950                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
35951                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
35952                 ret_arr_ptr[p] = ret_conv_15_ref;
35953         }
35954         
35955         FREE(ret_var.data);
35956         return ret_arr;
35957 }
35958
35959 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
35960         LDKCommitmentUpdate this_ptr_conv;
35961         this_ptr_conv.inner = untag_ptr(this_ptr);
35962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35964         this_ptr_conv.is_owned = false;
35965         LDKCVec_UpdateAddHTLCZ val_constr;
35966         val_constr.datalen = val->arr_len;
35967         if (val_constr.datalen > 0)
35968                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
35969         else
35970                 val_constr.data = NULL;
35971         uint64_t* val_vals = val->elems;
35972         for (size_t p = 0; p < val_constr.datalen; p++) {
35973                 uint64_t val_conv_15 = val_vals[p];
35974                 LDKUpdateAddHTLC val_conv_15_conv;
35975                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
35976                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
35977                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
35978                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
35979                 val_constr.data[p] = val_conv_15_conv;
35980         }
35981         FREE(val);
35982         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
35983 }
35984
35985 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
35986         LDKCommitmentUpdate this_ptr_conv;
35987         this_ptr_conv.inner = untag_ptr(this_ptr);
35988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35990         this_ptr_conv.is_owned = false;
35991         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
35992         uint64_tArray ret_arr = NULL;
35993         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35994         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35995         for (size_t t = 0; t < ret_var.datalen; t++) {
35996                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
35997                 uint64_t ret_conv_19_ref = 0;
35998                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
35999                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
36000                 ret_arr_ptr[t] = ret_conv_19_ref;
36001         }
36002         
36003         FREE(ret_var.data);
36004         return ret_arr;
36005 }
36006
36007 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
36008         LDKCommitmentUpdate this_ptr_conv;
36009         this_ptr_conv.inner = untag_ptr(this_ptr);
36010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36012         this_ptr_conv.is_owned = false;
36013         LDKCVec_UpdateFulfillHTLCZ val_constr;
36014         val_constr.datalen = val->arr_len;
36015         if (val_constr.datalen > 0)
36016                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
36017         else
36018                 val_constr.data = NULL;
36019         uint64_t* val_vals = val->elems;
36020         for (size_t t = 0; t < val_constr.datalen; t++) {
36021                 uint64_t val_conv_19 = val_vals[t];
36022                 LDKUpdateFulfillHTLC val_conv_19_conv;
36023                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
36024                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
36025                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
36026                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
36027                 val_constr.data[t] = val_conv_19_conv;
36028         }
36029         FREE(val);
36030         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
36031 }
36032
36033 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
36034         LDKCommitmentUpdate this_ptr_conv;
36035         this_ptr_conv.inner = untag_ptr(this_ptr);
36036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36038         this_ptr_conv.is_owned = false;
36039         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
36040         uint64_tArray ret_arr = NULL;
36041         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36042         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36043         for (size_t q = 0; q < ret_var.datalen; q++) {
36044                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
36045                 uint64_t ret_conv_16_ref = 0;
36046                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
36047                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
36048                 ret_arr_ptr[q] = ret_conv_16_ref;
36049         }
36050         
36051         FREE(ret_var.data);
36052         return ret_arr;
36053 }
36054
36055 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
36056         LDKCommitmentUpdate this_ptr_conv;
36057         this_ptr_conv.inner = untag_ptr(this_ptr);
36058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36060         this_ptr_conv.is_owned = false;
36061         LDKCVec_UpdateFailHTLCZ val_constr;
36062         val_constr.datalen = val->arr_len;
36063         if (val_constr.datalen > 0)
36064                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
36065         else
36066                 val_constr.data = NULL;
36067         uint64_t* val_vals = val->elems;
36068         for (size_t q = 0; q < val_constr.datalen; q++) {
36069                 uint64_t val_conv_16 = val_vals[q];
36070                 LDKUpdateFailHTLC val_conv_16_conv;
36071                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
36072                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
36073                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
36074                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
36075                 val_constr.data[q] = val_conv_16_conv;
36076         }
36077         FREE(val);
36078         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
36079 }
36080
36081 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
36082         LDKCommitmentUpdate this_ptr_conv;
36083         this_ptr_conv.inner = untag_ptr(this_ptr);
36084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36086         this_ptr_conv.is_owned = false;
36087         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
36088         uint64_tArray ret_arr = NULL;
36089         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36090         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36091         for (size_t z = 0; z < ret_var.datalen; z++) {
36092                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
36093                 uint64_t ret_conv_25_ref = 0;
36094                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
36095                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
36096                 ret_arr_ptr[z] = ret_conv_25_ref;
36097         }
36098         
36099         FREE(ret_var.data);
36100         return ret_arr;
36101 }
36102
36103 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) {
36104         LDKCommitmentUpdate this_ptr_conv;
36105         this_ptr_conv.inner = untag_ptr(this_ptr);
36106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36108         this_ptr_conv.is_owned = false;
36109         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
36110         val_constr.datalen = val->arr_len;
36111         if (val_constr.datalen > 0)
36112                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
36113         else
36114                 val_constr.data = NULL;
36115         uint64_t* val_vals = val->elems;
36116         for (size_t z = 0; z < val_constr.datalen; z++) {
36117                 uint64_t val_conv_25 = val_vals[z];
36118                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
36119                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
36120                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
36121                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
36122                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
36123                 val_constr.data[z] = val_conv_25_conv;
36124         }
36125         FREE(val);
36126         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
36127 }
36128
36129 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
36130         LDKCommitmentUpdate this_ptr_conv;
36131         this_ptr_conv.inner = untag_ptr(this_ptr);
36132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36134         this_ptr_conv.is_owned = false;
36135         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
36136         uint64_t ret_ref = 0;
36137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36139         return ret_ref;
36140 }
36141
36142 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
36143         LDKCommitmentUpdate this_ptr_conv;
36144         this_ptr_conv.inner = untag_ptr(this_ptr);
36145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36147         this_ptr_conv.is_owned = false;
36148         LDKUpdateFee val_conv;
36149         val_conv.inner = untag_ptr(val);
36150         val_conv.is_owned = ptr_is_owned(val);
36151         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36152         val_conv = UpdateFee_clone(&val_conv);
36153         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
36154 }
36155
36156 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
36157         LDKCommitmentUpdate this_ptr_conv;
36158         this_ptr_conv.inner = untag_ptr(this_ptr);
36159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36161         this_ptr_conv.is_owned = false;
36162         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
36163         uint64_t ret_ref = 0;
36164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36166         return ret_ref;
36167 }
36168
36169 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
36170         LDKCommitmentUpdate this_ptr_conv;
36171         this_ptr_conv.inner = untag_ptr(this_ptr);
36172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36174         this_ptr_conv.is_owned = false;
36175         LDKCommitmentSigned val_conv;
36176         val_conv.inner = untag_ptr(val);
36177         val_conv.is_owned = ptr_is_owned(val);
36178         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36179         val_conv = CommitmentSigned_clone(&val_conv);
36180         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
36181 }
36182
36183 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) {
36184         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
36185         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
36186         if (update_add_htlcs_arg_constr.datalen > 0)
36187                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
36188         else
36189                 update_add_htlcs_arg_constr.data = NULL;
36190         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
36191         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
36192                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
36193                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
36194                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
36195                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
36196                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
36197                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
36198                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
36199         }
36200         FREE(update_add_htlcs_arg);
36201         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
36202         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
36203         if (update_fulfill_htlcs_arg_constr.datalen > 0)
36204                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
36205         else
36206                 update_fulfill_htlcs_arg_constr.data = NULL;
36207         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
36208         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
36209                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
36210                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
36211                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
36212                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
36213                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
36214                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
36215                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
36216         }
36217         FREE(update_fulfill_htlcs_arg);
36218         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
36219         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
36220         if (update_fail_htlcs_arg_constr.datalen > 0)
36221                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
36222         else
36223                 update_fail_htlcs_arg_constr.data = NULL;
36224         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
36225         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
36226                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
36227                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
36228                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
36229                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
36230                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
36231                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
36232                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
36233         }
36234         FREE(update_fail_htlcs_arg);
36235         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
36236         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
36237         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
36238                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
36239         else
36240                 update_fail_malformed_htlcs_arg_constr.data = NULL;
36241         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
36242         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
36243                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
36244                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
36245                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
36246                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
36247                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
36248                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
36249                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
36250         }
36251         FREE(update_fail_malformed_htlcs_arg);
36252         LDKUpdateFee update_fee_arg_conv;
36253         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
36254         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
36255         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
36256         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
36257         LDKCommitmentSigned commitment_signed_arg_conv;
36258         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
36259         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
36260         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
36261         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
36262         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);
36263         uint64_t ret_ref = 0;
36264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36266         return ret_ref;
36267 }
36268
36269 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
36270         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
36271         uint64_t ret_ref = 0;
36272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36274         return ret_ref;
36275 }
36276 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
36277         LDKCommitmentUpdate arg_conv;
36278         arg_conv.inner = untag_ptr(arg);
36279         arg_conv.is_owned = ptr_is_owned(arg);
36280         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36281         arg_conv.is_owned = false;
36282         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
36283         return ret_conv;
36284 }
36285
36286 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
36287         LDKCommitmentUpdate orig_conv;
36288         orig_conv.inner = untag_ptr(orig);
36289         orig_conv.is_owned = ptr_is_owned(orig);
36290         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36291         orig_conv.is_owned = false;
36292         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
36293         uint64_t ret_ref = 0;
36294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36296         return ret_ref;
36297 }
36298
36299 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
36300         LDKCommitmentUpdate a_conv;
36301         a_conv.inner = untag_ptr(a);
36302         a_conv.is_owned = ptr_is_owned(a);
36303         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36304         a_conv.is_owned = false;
36305         LDKCommitmentUpdate b_conv;
36306         b_conv.inner = untag_ptr(b);
36307         b_conv.is_owned = ptr_is_owned(b);
36308         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36309         b_conv.is_owned = false;
36310         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
36311         return ret_conv;
36312 }
36313
36314 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
36315         if (!ptr_is_owned(this_ptr)) return;
36316         void* this_ptr_ptr = untag_ptr(this_ptr);
36317         CHECK_ACCESS(this_ptr_ptr);
36318         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
36319         FREE(untag_ptr(this_ptr));
36320         ChannelMessageHandler_free(this_ptr_conv);
36321 }
36322
36323 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
36324         if (!ptr_is_owned(this_ptr)) return;
36325         void* this_ptr_ptr = untag_ptr(this_ptr);
36326         CHECK_ACCESS(this_ptr_ptr);
36327         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
36328         FREE(untag_ptr(this_ptr));
36329         RoutingMessageHandler_free(this_ptr_conv);
36330 }
36331
36332 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
36333         if (!ptr_is_owned(this_ptr)) return;
36334         void* this_ptr_ptr = untag_ptr(this_ptr);
36335         CHECK_ACCESS(this_ptr_ptr);
36336         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
36337         FREE(untag_ptr(this_ptr));
36338         OnionMessageHandler_free(this_ptr_conv);
36339 }
36340
36341 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
36342         LDKAcceptChannel obj_conv;
36343         obj_conv.inner = untag_ptr(obj);
36344         obj_conv.is_owned = ptr_is_owned(obj);
36345         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36346         obj_conv.is_owned = false;
36347         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
36348         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36349         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36350         CVec_u8Z_free(ret_var);
36351         return ret_arr;
36352 }
36353
36354 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
36355         LDKu8slice ser_ref;
36356         ser_ref.datalen = ser->arr_len;
36357         ser_ref.data = ser->elems;
36358         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
36359         *ret_conv = AcceptChannel_read(ser_ref);
36360         FREE(ser);
36361         return tag_ptr(ret_conv, true);
36362 }
36363
36364 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
36365         LDKAnnouncementSignatures obj_conv;
36366         obj_conv.inner = untag_ptr(obj);
36367         obj_conv.is_owned = ptr_is_owned(obj);
36368         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36369         obj_conv.is_owned = false;
36370         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
36371         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36372         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36373         CVec_u8Z_free(ret_var);
36374         return ret_arr;
36375 }
36376
36377 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
36378         LDKu8slice ser_ref;
36379         ser_ref.datalen = ser->arr_len;
36380         ser_ref.data = ser->elems;
36381         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
36382         *ret_conv = AnnouncementSignatures_read(ser_ref);
36383         FREE(ser);
36384         return tag_ptr(ret_conv, true);
36385 }
36386
36387 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
36388         LDKChannelReestablish obj_conv;
36389         obj_conv.inner = untag_ptr(obj);
36390         obj_conv.is_owned = ptr_is_owned(obj);
36391         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36392         obj_conv.is_owned = false;
36393         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
36394         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36395         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36396         CVec_u8Z_free(ret_var);
36397         return ret_arr;
36398 }
36399
36400 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
36401         LDKu8slice ser_ref;
36402         ser_ref.datalen = ser->arr_len;
36403         ser_ref.data = ser->elems;
36404         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
36405         *ret_conv = ChannelReestablish_read(ser_ref);
36406         FREE(ser);
36407         return tag_ptr(ret_conv, true);
36408 }
36409
36410 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
36411         LDKClosingSigned obj_conv;
36412         obj_conv.inner = untag_ptr(obj);
36413         obj_conv.is_owned = ptr_is_owned(obj);
36414         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36415         obj_conv.is_owned = false;
36416         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
36417         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36418         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36419         CVec_u8Z_free(ret_var);
36420         return ret_arr;
36421 }
36422
36423 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
36424         LDKu8slice ser_ref;
36425         ser_ref.datalen = ser->arr_len;
36426         ser_ref.data = ser->elems;
36427         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
36428         *ret_conv = ClosingSigned_read(ser_ref);
36429         FREE(ser);
36430         return tag_ptr(ret_conv, true);
36431 }
36432
36433 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
36434         LDKClosingSignedFeeRange obj_conv;
36435         obj_conv.inner = untag_ptr(obj);
36436         obj_conv.is_owned = ptr_is_owned(obj);
36437         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36438         obj_conv.is_owned = false;
36439         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
36440         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36441         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36442         CVec_u8Z_free(ret_var);
36443         return ret_arr;
36444 }
36445
36446 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
36447         LDKu8slice ser_ref;
36448         ser_ref.datalen = ser->arr_len;
36449         ser_ref.data = ser->elems;
36450         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
36451         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
36452         FREE(ser);
36453         return tag_ptr(ret_conv, true);
36454 }
36455
36456 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
36457         LDKCommitmentSigned obj_conv;
36458         obj_conv.inner = untag_ptr(obj);
36459         obj_conv.is_owned = ptr_is_owned(obj);
36460         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36461         obj_conv.is_owned = false;
36462         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
36463         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36464         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36465         CVec_u8Z_free(ret_var);
36466         return ret_arr;
36467 }
36468
36469 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
36470         LDKu8slice ser_ref;
36471         ser_ref.datalen = ser->arr_len;
36472         ser_ref.data = ser->elems;
36473         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
36474         *ret_conv = CommitmentSigned_read(ser_ref);
36475         FREE(ser);
36476         return tag_ptr(ret_conv, true);
36477 }
36478
36479 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
36480         LDKFundingCreated obj_conv;
36481         obj_conv.inner = untag_ptr(obj);
36482         obj_conv.is_owned = ptr_is_owned(obj);
36483         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36484         obj_conv.is_owned = false;
36485         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
36486         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36487         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36488         CVec_u8Z_free(ret_var);
36489         return ret_arr;
36490 }
36491
36492 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
36493         LDKu8slice ser_ref;
36494         ser_ref.datalen = ser->arr_len;
36495         ser_ref.data = ser->elems;
36496         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
36497         *ret_conv = FundingCreated_read(ser_ref);
36498         FREE(ser);
36499         return tag_ptr(ret_conv, true);
36500 }
36501
36502 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
36503         LDKFundingSigned obj_conv;
36504         obj_conv.inner = untag_ptr(obj);
36505         obj_conv.is_owned = ptr_is_owned(obj);
36506         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36507         obj_conv.is_owned = false;
36508         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
36509         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36510         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36511         CVec_u8Z_free(ret_var);
36512         return ret_arr;
36513 }
36514
36515 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
36516         LDKu8slice ser_ref;
36517         ser_ref.datalen = ser->arr_len;
36518         ser_ref.data = ser->elems;
36519         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
36520         *ret_conv = FundingSigned_read(ser_ref);
36521         FREE(ser);
36522         return tag_ptr(ret_conv, true);
36523 }
36524
36525 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
36526         LDKChannelReady obj_conv;
36527         obj_conv.inner = untag_ptr(obj);
36528         obj_conv.is_owned = ptr_is_owned(obj);
36529         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36530         obj_conv.is_owned = false;
36531         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
36532         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36533         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36534         CVec_u8Z_free(ret_var);
36535         return ret_arr;
36536 }
36537
36538 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
36539         LDKu8slice ser_ref;
36540         ser_ref.datalen = ser->arr_len;
36541         ser_ref.data = ser->elems;
36542         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
36543         *ret_conv = ChannelReady_read(ser_ref);
36544         FREE(ser);
36545         return tag_ptr(ret_conv, true);
36546 }
36547
36548 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
36549         LDKInit obj_conv;
36550         obj_conv.inner = untag_ptr(obj);
36551         obj_conv.is_owned = ptr_is_owned(obj);
36552         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36553         obj_conv.is_owned = false;
36554         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
36555         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36556         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36557         CVec_u8Z_free(ret_var);
36558         return ret_arr;
36559 }
36560
36561 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
36562         LDKu8slice ser_ref;
36563         ser_ref.datalen = ser->arr_len;
36564         ser_ref.data = ser->elems;
36565         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
36566         *ret_conv = Init_read(ser_ref);
36567         FREE(ser);
36568         return tag_ptr(ret_conv, true);
36569 }
36570
36571 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
36572         LDKOpenChannel obj_conv;
36573         obj_conv.inner = untag_ptr(obj);
36574         obj_conv.is_owned = ptr_is_owned(obj);
36575         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36576         obj_conv.is_owned = false;
36577         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
36578         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36579         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36580         CVec_u8Z_free(ret_var);
36581         return ret_arr;
36582 }
36583
36584 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
36585         LDKu8slice ser_ref;
36586         ser_ref.datalen = ser->arr_len;
36587         ser_ref.data = ser->elems;
36588         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
36589         *ret_conv = OpenChannel_read(ser_ref);
36590         FREE(ser);
36591         return tag_ptr(ret_conv, true);
36592 }
36593
36594 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
36595         LDKRevokeAndACK obj_conv;
36596         obj_conv.inner = untag_ptr(obj);
36597         obj_conv.is_owned = ptr_is_owned(obj);
36598         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36599         obj_conv.is_owned = false;
36600         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
36601         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36602         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36603         CVec_u8Z_free(ret_var);
36604         return ret_arr;
36605 }
36606
36607 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
36608         LDKu8slice ser_ref;
36609         ser_ref.datalen = ser->arr_len;
36610         ser_ref.data = ser->elems;
36611         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
36612         *ret_conv = RevokeAndACK_read(ser_ref);
36613         FREE(ser);
36614         return tag_ptr(ret_conv, true);
36615 }
36616
36617 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
36618         LDKShutdown obj_conv;
36619         obj_conv.inner = untag_ptr(obj);
36620         obj_conv.is_owned = ptr_is_owned(obj);
36621         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36622         obj_conv.is_owned = false;
36623         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
36624         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36625         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36626         CVec_u8Z_free(ret_var);
36627         return ret_arr;
36628 }
36629
36630 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
36631         LDKu8slice ser_ref;
36632         ser_ref.datalen = ser->arr_len;
36633         ser_ref.data = ser->elems;
36634         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
36635         *ret_conv = Shutdown_read(ser_ref);
36636         FREE(ser);
36637         return tag_ptr(ret_conv, true);
36638 }
36639
36640 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
36641         LDKUpdateFailHTLC obj_conv;
36642         obj_conv.inner = untag_ptr(obj);
36643         obj_conv.is_owned = ptr_is_owned(obj);
36644         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36645         obj_conv.is_owned = false;
36646         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
36647         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36648         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36649         CVec_u8Z_free(ret_var);
36650         return ret_arr;
36651 }
36652
36653 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
36654         LDKu8slice ser_ref;
36655         ser_ref.datalen = ser->arr_len;
36656         ser_ref.data = ser->elems;
36657         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
36658         *ret_conv = UpdateFailHTLC_read(ser_ref);
36659         FREE(ser);
36660         return tag_ptr(ret_conv, true);
36661 }
36662
36663 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
36664         LDKUpdateFailMalformedHTLC obj_conv;
36665         obj_conv.inner = untag_ptr(obj);
36666         obj_conv.is_owned = ptr_is_owned(obj);
36667         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36668         obj_conv.is_owned = false;
36669         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
36670         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36671         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36672         CVec_u8Z_free(ret_var);
36673         return ret_arr;
36674 }
36675
36676 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
36677         LDKu8slice ser_ref;
36678         ser_ref.datalen = ser->arr_len;
36679         ser_ref.data = ser->elems;
36680         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
36681         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
36682         FREE(ser);
36683         return tag_ptr(ret_conv, true);
36684 }
36685
36686 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
36687         LDKUpdateFee obj_conv;
36688         obj_conv.inner = untag_ptr(obj);
36689         obj_conv.is_owned = ptr_is_owned(obj);
36690         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36691         obj_conv.is_owned = false;
36692         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
36693         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36694         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36695         CVec_u8Z_free(ret_var);
36696         return ret_arr;
36697 }
36698
36699 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
36700         LDKu8slice ser_ref;
36701         ser_ref.datalen = ser->arr_len;
36702         ser_ref.data = ser->elems;
36703         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
36704         *ret_conv = UpdateFee_read(ser_ref);
36705         FREE(ser);
36706         return tag_ptr(ret_conv, true);
36707 }
36708
36709 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
36710         LDKUpdateFulfillHTLC obj_conv;
36711         obj_conv.inner = untag_ptr(obj);
36712         obj_conv.is_owned = ptr_is_owned(obj);
36713         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36714         obj_conv.is_owned = false;
36715         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
36716         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36717         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36718         CVec_u8Z_free(ret_var);
36719         return ret_arr;
36720 }
36721
36722 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
36723         LDKu8slice ser_ref;
36724         ser_ref.datalen = ser->arr_len;
36725         ser_ref.data = ser->elems;
36726         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
36727         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
36728         FREE(ser);
36729         return tag_ptr(ret_conv, true);
36730 }
36731
36732 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
36733         LDKUpdateAddHTLC obj_conv;
36734         obj_conv.inner = untag_ptr(obj);
36735         obj_conv.is_owned = ptr_is_owned(obj);
36736         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36737         obj_conv.is_owned = false;
36738         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
36739         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36740         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36741         CVec_u8Z_free(ret_var);
36742         return ret_arr;
36743 }
36744
36745 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
36746         LDKu8slice ser_ref;
36747         ser_ref.datalen = ser->arr_len;
36748         ser_ref.data = ser->elems;
36749         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
36750         *ret_conv = UpdateAddHTLC_read(ser_ref);
36751         FREE(ser);
36752         return tag_ptr(ret_conv, true);
36753 }
36754
36755 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
36756         LDKu8slice ser_ref;
36757         ser_ref.datalen = ser->arr_len;
36758         ser_ref.data = ser->elems;
36759         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
36760         *ret_conv = OnionMessage_read(ser_ref);
36761         FREE(ser);
36762         return tag_ptr(ret_conv, true);
36763 }
36764
36765 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
36766         LDKOnionMessage obj_conv;
36767         obj_conv.inner = untag_ptr(obj);
36768         obj_conv.is_owned = ptr_is_owned(obj);
36769         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36770         obj_conv.is_owned = false;
36771         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
36772         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36773         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36774         CVec_u8Z_free(ret_var);
36775         return ret_arr;
36776 }
36777
36778 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
36779         LDKPing obj_conv;
36780         obj_conv.inner = untag_ptr(obj);
36781         obj_conv.is_owned = ptr_is_owned(obj);
36782         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36783         obj_conv.is_owned = false;
36784         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
36785         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36786         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36787         CVec_u8Z_free(ret_var);
36788         return ret_arr;
36789 }
36790
36791 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
36792         LDKu8slice ser_ref;
36793         ser_ref.datalen = ser->arr_len;
36794         ser_ref.data = ser->elems;
36795         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
36796         *ret_conv = Ping_read(ser_ref);
36797         FREE(ser);
36798         return tag_ptr(ret_conv, true);
36799 }
36800
36801 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
36802         LDKPong obj_conv;
36803         obj_conv.inner = untag_ptr(obj);
36804         obj_conv.is_owned = ptr_is_owned(obj);
36805         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36806         obj_conv.is_owned = false;
36807         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
36808         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36809         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36810         CVec_u8Z_free(ret_var);
36811         return ret_arr;
36812 }
36813
36814 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
36815         LDKu8slice ser_ref;
36816         ser_ref.datalen = ser->arr_len;
36817         ser_ref.data = ser->elems;
36818         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
36819         *ret_conv = Pong_read(ser_ref);
36820         FREE(ser);
36821         return tag_ptr(ret_conv, true);
36822 }
36823
36824 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
36825         LDKUnsignedChannelAnnouncement obj_conv;
36826         obj_conv.inner = untag_ptr(obj);
36827         obj_conv.is_owned = ptr_is_owned(obj);
36828         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36829         obj_conv.is_owned = false;
36830         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
36831         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36832         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36833         CVec_u8Z_free(ret_var);
36834         return ret_arr;
36835 }
36836
36837 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
36838         LDKu8slice ser_ref;
36839         ser_ref.datalen = ser->arr_len;
36840         ser_ref.data = ser->elems;
36841         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
36842         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
36843         FREE(ser);
36844         return tag_ptr(ret_conv, true);
36845 }
36846
36847 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
36848         LDKChannelAnnouncement obj_conv;
36849         obj_conv.inner = untag_ptr(obj);
36850         obj_conv.is_owned = ptr_is_owned(obj);
36851         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36852         obj_conv.is_owned = false;
36853         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
36854         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36855         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36856         CVec_u8Z_free(ret_var);
36857         return ret_arr;
36858 }
36859
36860 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
36861         LDKu8slice ser_ref;
36862         ser_ref.datalen = ser->arr_len;
36863         ser_ref.data = ser->elems;
36864         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
36865         *ret_conv = ChannelAnnouncement_read(ser_ref);
36866         FREE(ser);
36867         return tag_ptr(ret_conv, true);
36868 }
36869
36870 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
36871         LDKUnsignedChannelUpdate obj_conv;
36872         obj_conv.inner = untag_ptr(obj);
36873         obj_conv.is_owned = ptr_is_owned(obj);
36874         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36875         obj_conv.is_owned = false;
36876         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
36877         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36878         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36879         CVec_u8Z_free(ret_var);
36880         return ret_arr;
36881 }
36882
36883 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
36884         LDKu8slice ser_ref;
36885         ser_ref.datalen = ser->arr_len;
36886         ser_ref.data = ser->elems;
36887         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
36888         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
36889         FREE(ser);
36890         return tag_ptr(ret_conv, true);
36891 }
36892
36893 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
36894         LDKChannelUpdate obj_conv;
36895         obj_conv.inner = untag_ptr(obj);
36896         obj_conv.is_owned = ptr_is_owned(obj);
36897         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36898         obj_conv.is_owned = false;
36899         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
36900         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36901         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36902         CVec_u8Z_free(ret_var);
36903         return ret_arr;
36904 }
36905
36906 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
36907         LDKu8slice ser_ref;
36908         ser_ref.datalen = ser->arr_len;
36909         ser_ref.data = ser->elems;
36910         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
36911         *ret_conv = ChannelUpdate_read(ser_ref);
36912         FREE(ser);
36913         return tag_ptr(ret_conv, true);
36914 }
36915
36916 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
36917         LDKErrorMessage obj_conv;
36918         obj_conv.inner = untag_ptr(obj);
36919         obj_conv.is_owned = ptr_is_owned(obj);
36920         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36921         obj_conv.is_owned = false;
36922         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
36923         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36924         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36925         CVec_u8Z_free(ret_var);
36926         return ret_arr;
36927 }
36928
36929 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
36930         LDKu8slice ser_ref;
36931         ser_ref.datalen = ser->arr_len;
36932         ser_ref.data = ser->elems;
36933         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
36934         *ret_conv = ErrorMessage_read(ser_ref);
36935         FREE(ser);
36936         return tag_ptr(ret_conv, true);
36937 }
36938
36939 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
36940         LDKWarningMessage obj_conv;
36941         obj_conv.inner = untag_ptr(obj);
36942         obj_conv.is_owned = ptr_is_owned(obj);
36943         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36944         obj_conv.is_owned = false;
36945         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
36946         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36947         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36948         CVec_u8Z_free(ret_var);
36949         return ret_arr;
36950 }
36951
36952 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
36953         LDKu8slice ser_ref;
36954         ser_ref.datalen = ser->arr_len;
36955         ser_ref.data = ser->elems;
36956         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
36957         *ret_conv = WarningMessage_read(ser_ref);
36958         FREE(ser);
36959         return tag_ptr(ret_conv, true);
36960 }
36961
36962 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
36963         LDKUnsignedNodeAnnouncement obj_conv;
36964         obj_conv.inner = untag_ptr(obj);
36965         obj_conv.is_owned = ptr_is_owned(obj);
36966         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36967         obj_conv.is_owned = false;
36968         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
36969         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36970         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36971         CVec_u8Z_free(ret_var);
36972         return ret_arr;
36973 }
36974
36975 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
36976         LDKu8slice ser_ref;
36977         ser_ref.datalen = ser->arr_len;
36978         ser_ref.data = ser->elems;
36979         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
36980         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
36981         FREE(ser);
36982         return tag_ptr(ret_conv, true);
36983 }
36984
36985 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
36986         LDKNodeAnnouncement obj_conv;
36987         obj_conv.inner = untag_ptr(obj);
36988         obj_conv.is_owned = ptr_is_owned(obj);
36989         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36990         obj_conv.is_owned = false;
36991         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
36992         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36993         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36994         CVec_u8Z_free(ret_var);
36995         return ret_arr;
36996 }
36997
36998 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
36999         LDKu8slice ser_ref;
37000         ser_ref.datalen = ser->arr_len;
37001         ser_ref.data = ser->elems;
37002         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
37003         *ret_conv = NodeAnnouncement_read(ser_ref);
37004         FREE(ser);
37005         return tag_ptr(ret_conv, true);
37006 }
37007
37008 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
37009         LDKu8slice ser_ref;
37010         ser_ref.datalen = ser->arr_len;
37011         ser_ref.data = ser->elems;
37012         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
37013         *ret_conv = QueryShortChannelIds_read(ser_ref);
37014         FREE(ser);
37015         return tag_ptr(ret_conv, true);
37016 }
37017
37018 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
37019         LDKQueryShortChannelIds obj_conv;
37020         obj_conv.inner = untag_ptr(obj);
37021         obj_conv.is_owned = ptr_is_owned(obj);
37022         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37023         obj_conv.is_owned = false;
37024         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
37025         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37026         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37027         CVec_u8Z_free(ret_var);
37028         return ret_arr;
37029 }
37030
37031 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
37032         LDKReplyShortChannelIdsEnd obj_conv;
37033         obj_conv.inner = untag_ptr(obj);
37034         obj_conv.is_owned = ptr_is_owned(obj);
37035         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37036         obj_conv.is_owned = false;
37037         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
37038         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37039         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37040         CVec_u8Z_free(ret_var);
37041         return ret_arr;
37042 }
37043
37044 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
37045         LDKu8slice ser_ref;
37046         ser_ref.datalen = ser->arr_len;
37047         ser_ref.data = ser->elems;
37048         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
37049         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
37050         FREE(ser);
37051         return tag_ptr(ret_conv, true);
37052 }
37053
37054 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
37055         LDKQueryChannelRange this_arg_conv;
37056         this_arg_conv.inner = untag_ptr(this_arg);
37057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37059         this_arg_conv.is_owned = false;
37060         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
37061         return ret_conv;
37062 }
37063
37064 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
37065         LDKQueryChannelRange obj_conv;
37066         obj_conv.inner = untag_ptr(obj);
37067         obj_conv.is_owned = ptr_is_owned(obj);
37068         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37069         obj_conv.is_owned = false;
37070         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
37071         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37072         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37073         CVec_u8Z_free(ret_var);
37074         return ret_arr;
37075 }
37076
37077 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
37078         LDKu8slice ser_ref;
37079         ser_ref.datalen = ser->arr_len;
37080         ser_ref.data = ser->elems;
37081         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
37082         *ret_conv = QueryChannelRange_read(ser_ref);
37083         FREE(ser);
37084         return tag_ptr(ret_conv, true);
37085 }
37086
37087 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
37088         LDKu8slice ser_ref;
37089         ser_ref.datalen = ser->arr_len;
37090         ser_ref.data = ser->elems;
37091         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
37092         *ret_conv = ReplyChannelRange_read(ser_ref);
37093         FREE(ser);
37094         return tag_ptr(ret_conv, true);
37095 }
37096
37097 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
37098         LDKReplyChannelRange obj_conv;
37099         obj_conv.inner = untag_ptr(obj);
37100         obj_conv.is_owned = ptr_is_owned(obj);
37101         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37102         obj_conv.is_owned = false;
37103         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
37104         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37105         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37106         CVec_u8Z_free(ret_var);
37107         return ret_arr;
37108 }
37109
37110 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
37111         LDKGossipTimestampFilter obj_conv;
37112         obj_conv.inner = untag_ptr(obj);
37113         obj_conv.is_owned = ptr_is_owned(obj);
37114         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37115         obj_conv.is_owned = false;
37116         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
37117         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37118         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37119         CVec_u8Z_free(ret_var);
37120         return ret_arr;
37121 }
37122
37123 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
37124         LDKu8slice ser_ref;
37125         ser_ref.datalen = ser->arr_len;
37126         ser_ref.data = ser->elems;
37127         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
37128         *ret_conv = GossipTimestampFilter_read(ser_ref);
37129         FREE(ser);
37130         return tag_ptr(ret_conv, true);
37131 }
37132
37133 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
37134         if (!ptr_is_owned(this_ptr)) return;
37135         void* this_ptr_ptr = untag_ptr(this_ptr);
37136         CHECK_ACCESS(this_ptr_ptr);
37137         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
37138         FREE(untag_ptr(this_ptr));
37139         CustomMessageHandler_free(this_ptr_conv);
37140 }
37141
37142 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
37143         LDKIgnoringMessageHandler this_obj_conv;
37144         this_obj_conv.inner = untag_ptr(this_obj);
37145         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37147         IgnoringMessageHandler_free(this_obj_conv);
37148 }
37149
37150 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
37151         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
37152         uint64_t ret_ref = 0;
37153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37155         return ret_ref;
37156 }
37157
37158 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
37159         LDKIgnoringMessageHandler this_arg_conv;
37160         this_arg_conv.inner = untag_ptr(this_arg);
37161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37163         this_arg_conv.is_owned = false;
37164         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
37165         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
37166         return tag_ptr(ret_ret, true);
37167 }
37168
37169 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
37170         LDKIgnoringMessageHandler this_arg_conv;
37171         this_arg_conv.inner = untag_ptr(this_arg);
37172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37174         this_arg_conv.is_owned = false;
37175         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
37176         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
37177         return tag_ptr(ret_ret, true);
37178 }
37179
37180 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageProvider"))) TS_IgnoringMessageHandler_as_OnionMessageProvider(uint64_t this_arg) {
37181         LDKIgnoringMessageHandler this_arg_conv;
37182         this_arg_conv.inner = untag_ptr(this_arg);
37183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37185         this_arg_conv.is_owned = false;
37186         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
37187         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
37188         return tag_ptr(ret_ret, true);
37189 }
37190
37191 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
37192         LDKIgnoringMessageHandler this_arg_conv;
37193         this_arg_conv.inner = untag_ptr(this_arg);
37194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37196         this_arg_conv.is_owned = false;
37197         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
37198         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
37199         return tag_ptr(ret_ret, true);
37200 }
37201
37202 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
37203         LDKIgnoringMessageHandler this_arg_conv;
37204         this_arg_conv.inner = untag_ptr(this_arg);
37205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37207         this_arg_conv.is_owned = false;
37208         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
37209         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
37210         return tag_ptr(ret_ret, true);
37211 }
37212
37213 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
37214         LDKIgnoringMessageHandler this_arg_conv;
37215         this_arg_conv.inner = untag_ptr(this_arg);
37216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37218         this_arg_conv.is_owned = false;
37219         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
37220         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
37221         return tag_ptr(ret_ret, true);
37222 }
37223
37224 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
37225         LDKIgnoringMessageHandler this_arg_conv;
37226         this_arg_conv.inner = untag_ptr(this_arg);
37227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37229         this_arg_conv.is_owned = false;
37230         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
37231         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
37232         return tag_ptr(ret_ret, true);
37233 }
37234
37235 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
37236         LDKErroringMessageHandler this_obj_conv;
37237         this_obj_conv.inner = untag_ptr(this_obj);
37238         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37240         ErroringMessageHandler_free(this_obj_conv);
37241 }
37242
37243 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
37244         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
37245         uint64_t ret_ref = 0;
37246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37248         return ret_ref;
37249 }
37250
37251 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
37252         LDKErroringMessageHandler this_arg_conv;
37253         this_arg_conv.inner = untag_ptr(this_arg);
37254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37256         this_arg_conv.is_owned = false;
37257         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
37258         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
37259         return tag_ptr(ret_ret, true);
37260 }
37261
37262 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
37263         LDKErroringMessageHandler this_arg_conv;
37264         this_arg_conv.inner = untag_ptr(this_arg);
37265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37267         this_arg_conv.is_owned = false;
37268         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
37269         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
37270         return tag_ptr(ret_ret, true);
37271 }
37272
37273 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
37274         LDKMessageHandler this_obj_conv;
37275         this_obj_conv.inner = untag_ptr(this_obj);
37276         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37278         MessageHandler_free(this_obj_conv);
37279 }
37280
37281 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
37282         LDKMessageHandler this_ptr_conv;
37283         this_ptr_conv.inner = untag_ptr(this_ptr);
37284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37286         this_ptr_conv.is_owned = false;
37287         // WARNING: This object doesn't live past this scope, needs clone!
37288         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
37289         return ret_ret;
37290 }
37291
37292 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
37293         LDKMessageHandler this_ptr_conv;
37294         this_ptr_conv.inner = untag_ptr(this_ptr);
37295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37297         this_ptr_conv.is_owned = false;
37298         void* val_ptr = untag_ptr(val);
37299         CHECK_ACCESS(val_ptr);
37300         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
37301         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
37302                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37303                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
37304         }
37305         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
37306 }
37307
37308 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
37309         LDKMessageHandler this_ptr_conv;
37310         this_ptr_conv.inner = untag_ptr(this_ptr);
37311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37313         this_ptr_conv.is_owned = false;
37314         // WARNING: This object doesn't live past this scope, needs clone!
37315         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
37316         return ret_ret;
37317 }
37318
37319 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
37320         LDKMessageHandler this_ptr_conv;
37321         this_ptr_conv.inner = untag_ptr(this_ptr);
37322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37324         this_ptr_conv.is_owned = false;
37325         void* val_ptr = untag_ptr(val);
37326         CHECK_ACCESS(val_ptr);
37327         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
37328         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
37329                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37330                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
37331         }
37332         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
37333 }
37334
37335 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
37336         LDKMessageHandler this_ptr_conv;
37337         this_ptr_conv.inner = untag_ptr(this_ptr);
37338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37340         this_ptr_conv.is_owned = false;
37341         // WARNING: This object doesn't live past this scope, needs clone!
37342         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
37343         return ret_ret;
37344 }
37345
37346 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
37347         LDKMessageHandler this_ptr_conv;
37348         this_ptr_conv.inner = untag_ptr(this_ptr);
37349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37351         this_ptr_conv.is_owned = false;
37352         void* val_ptr = untag_ptr(val);
37353         CHECK_ACCESS(val_ptr);
37354         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
37355         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
37356                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37357                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
37358         }
37359         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
37360 }
37361
37362 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) {
37363         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
37364         CHECK_ACCESS(chan_handler_arg_ptr);
37365         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
37366         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
37367                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37368                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
37369         }
37370         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
37371         CHECK_ACCESS(route_handler_arg_ptr);
37372         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
37373         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
37374                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37375                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
37376         }
37377         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
37378         CHECK_ACCESS(onion_message_handler_arg_ptr);
37379         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
37380         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
37381                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37382                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
37383         }
37384         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv);
37385         uint64_t ret_ref = 0;
37386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37388         return ret_ref;
37389 }
37390
37391 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
37392         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37393         *ret_ret = SocketDescriptor_clone(arg);
37394         return tag_ptr(ret_ret, true);
37395 }
37396 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
37397         void* arg_ptr = untag_ptr(arg);
37398         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
37399         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
37400         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
37401         return ret_conv;
37402 }
37403
37404 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
37405         void* orig_ptr = untag_ptr(orig);
37406         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
37407         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
37408         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37409         *ret_ret = SocketDescriptor_clone(orig_conv);
37410         return tag_ptr(ret_ret, true);
37411 }
37412
37413 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
37414         if (!ptr_is_owned(this_ptr)) return;
37415         void* this_ptr_ptr = untag_ptr(this_ptr);
37416         CHECK_ACCESS(this_ptr_ptr);
37417         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
37418         FREE(untag_ptr(this_ptr));
37419         SocketDescriptor_free(this_ptr_conv);
37420 }
37421
37422 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
37423         LDKPeerHandleError this_obj_conv;
37424         this_obj_conv.inner = untag_ptr(this_obj);
37425         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37427         PeerHandleError_free(this_obj_conv);
37428 }
37429
37430 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new() {
37431         LDKPeerHandleError ret_var = PeerHandleError_new();
37432         uint64_t ret_ref = 0;
37433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37435         return ret_ref;
37436 }
37437
37438 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
37439         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
37440         uint64_t ret_ref = 0;
37441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37443         return ret_ref;
37444 }
37445 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
37446         LDKPeerHandleError arg_conv;
37447         arg_conv.inner = untag_ptr(arg);
37448         arg_conv.is_owned = ptr_is_owned(arg);
37449         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37450         arg_conv.is_owned = false;
37451         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
37452         return ret_conv;
37453 }
37454
37455 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
37456         LDKPeerHandleError orig_conv;
37457         orig_conv.inner = untag_ptr(orig);
37458         orig_conv.is_owned = ptr_is_owned(orig);
37459         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37460         orig_conv.is_owned = false;
37461         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
37462         uint64_t ret_ref = 0;
37463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37465         return ret_ref;
37466 }
37467
37468 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
37469         LDKPeerManager this_obj_conv;
37470         this_obj_conv.inner = untag_ptr(this_obj);
37471         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37473         PeerManager_free(this_obj_conv);
37474 }
37475
37476 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) {
37477         LDKMessageHandler message_handler_conv;
37478         message_handler_conv.inner = untag_ptr(message_handler);
37479         message_handler_conv.is_owned = ptr_is_owned(message_handler);
37480         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
37481         // WARNING: we need a move here but no clone is available for LDKMessageHandler
37482         
37483         uint8_t ephemeral_random_data_arr[32];
37484         CHECK(ephemeral_random_data->arr_len == 32);
37485         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
37486         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
37487         void* logger_ptr = untag_ptr(logger);
37488         CHECK_ACCESS(logger_ptr);
37489         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37490         if (logger_conv.free == LDKLogger_JCalls_free) {
37491                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37492                 LDKLogger_JCalls_cloned(&logger_conv);
37493         }
37494         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
37495         CHECK_ACCESS(custom_message_handler_ptr);
37496         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
37497         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
37498                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37499                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
37500         }
37501         void* node_signer_ptr = untag_ptr(node_signer);
37502         CHECK_ACCESS(node_signer_ptr);
37503         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
37504         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
37505                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37506                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
37507         }
37508         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv, node_signer_conv);
37509         uint64_t ret_ref = 0;
37510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37512         return ret_ref;
37513 }
37514
37515 uint64_tArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
37516         LDKPeerManager this_arg_conv;
37517         this_arg_conv.inner = untag_ptr(this_arg);
37518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37520         this_arg_conv.is_owned = false;
37521         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
37522         uint64_tArray ret_arr = NULL;
37523         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
37524         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
37525         for (size_t o = 0; o < ret_var.datalen; o++) {
37526                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
37527                 *ret_conv_40_conv = ret_var.data[o];
37528                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
37529         }
37530         
37531         FREE(ret_var.data);
37532         return ret_arr;
37533 }
37534
37535 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) {
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         LDKPublicKey their_node_id_ref;
37542         CHECK(their_node_id->arr_len == 33);
37543         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
37544         void* descriptor_ptr = untag_ptr(descriptor);
37545         CHECK_ACCESS(descriptor_ptr);
37546         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37547         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37548                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37549                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37550         }
37551         void* remote_network_address_ptr = untag_ptr(remote_network_address);
37552         CHECK_ACCESS(remote_network_address_ptr);
37553         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37554         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
37555         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
37556         return tag_ptr(ret_conv, true);
37557 }
37558
37559 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) {
37560         LDKPeerManager this_arg_conv;
37561         this_arg_conv.inner = untag_ptr(this_arg);
37562         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37564         this_arg_conv.is_owned = false;
37565         void* descriptor_ptr = untag_ptr(descriptor);
37566         CHECK_ACCESS(descriptor_ptr);
37567         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37568         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37569                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37570                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37571         }
37572         void* remote_network_address_ptr = untag_ptr(remote_network_address);
37573         CHECK_ACCESS(remote_network_address_ptr);
37574         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37575         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37576         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
37577         return tag_ptr(ret_conv, true);
37578 }
37579
37580 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
37581         LDKPeerManager this_arg_conv;
37582         this_arg_conv.inner = untag_ptr(this_arg);
37583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37585         this_arg_conv.is_owned = false;
37586         void* descriptor_ptr = untag_ptr(descriptor);
37587         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
37588         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37589         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37590         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
37591         return tag_ptr(ret_conv, true);
37592 }
37593
37594 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
37595         LDKPeerManager this_arg_conv;
37596         this_arg_conv.inner = untag_ptr(this_arg);
37597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37599         this_arg_conv.is_owned = false;
37600         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
37601         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
37602         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
37603         LDKu8slice data_ref;
37604         data_ref.datalen = data->arr_len;
37605         data_ref.data = data->elems;
37606         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
37607         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
37608         FREE(data);
37609         return tag_ptr(ret_conv, true);
37610 }
37611
37612 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
37613         LDKPeerManager this_arg_conv;
37614         this_arg_conv.inner = untag_ptr(this_arg);
37615         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37617         this_arg_conv.is_owned = false;
37618         PeerManager_process_events(&this_arg_conv);
37619 }
37620
37621 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
37622         LDKPeerManager this_arg_conv;
37623         this_arg_conv.inner = untag_ptr(this_arg);
37624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37626         this_arg_conv.is_owned = false;
37627         void* descriptor_ptr = untag_ptr(descriptor);
37628         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
37629         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37630         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
37631 }
37632
37633 void  __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id) {
37634         LDKPeerManager this_arg_conv;
37635         this_arg_conv.inner = untag_ptr(this_arg);
37636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37638         this_arg_conv.is_owned = false;
37639         LDKPublicKey node_id_ref;
37640         CHECK(node_id->arr_len == 33);
37641         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
37642         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
37643 }
37644
37645 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
37646         LDKPeerManager this_arg_conv;
37647         this_arg_conv.inner = untag_ptr(this_arg);
37648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37650         this_arg_conv.is_owned = false;
37651         PeerManager_disconnect_all_peers(&this_arg_conv);
37652 }
37653
37654 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
37655         LDKPeerManager this_arg_conv;
37656         this_arg_conv.inner = untag_ptr(this_arg);
37657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37659         this_arg_conv.is_owned = false;
37660         PeerManager_timer_tick_occurred(&this_arg_conv);
37661 }
37662
37663 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) {
37664         LDKPeerManager this_arg_conv;
37665         this_arg_conv.inner = untag_ptr(this_arg);
37666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37668         this_arg_conv.is_owned = false;
37669         LDKThreeBytes rgb_ref;
37670         CHECK(rgb->arr_len == 3);
37671         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
37672         LDKThirtyTwoBytes alias_ref;
37673         CHECK(alias->arr_len == 32);
37674         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
37675         LDKCVec_NetAddressZ addresses_constr;
37676         addresses_constr.datalen = addresses->arr_len;
37677         if (addresses_constr.datalen > 0)
37678                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
37679         else
37680                 addresses_constr.data = NULL;
37681         uint64_t* addresses_vals = addresses->elems;
37682         for (size_t m = 0; m < addresses_constr.datalen; m++) {
37683                 uint64_t addresses_conv_12 = addresses_vals[m];
37684                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
37685                 CHECK_ACCESS(addresses_conv_12_ptr);
37686                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
37687                 addresses_constr.data[m] = addresses_conv_12_conv;
37688         }
37689         FREE(addresses);
37690         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
37691 }
37692
37693 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
37694         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
37695         return ret_conv;
37696 }
37697
37698 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
37699         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
37700         return ret_conv;
37701 }
37702
37703 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
37704         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
37705         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
37706         return ret_conv;
37707 }
37708
37709 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
37710         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
37711         return ret_conv;
37712 }
37713
37714 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
37715         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
37716         return ret_conv;
37717 }
37718
37719 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
37720         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
37721         return ret_conv;
37722 }
37723
37724 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
37725         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
37726         return ret_conv;
37727 }
37728
37729 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
37730         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
37731         return ret_conv;
37732 }
37733
37734 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
37735         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
37736         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
37737         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
37738         return ret_conv;
37739 }
37740
37741 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
37742         LDKWitness witness_ref;
37743         witness_ref.datalen = witness->arr_len;
37744         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
37745         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
37746         witness_ref.data_is_owned = true;
37747         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
37748         *ret_copy = HTLCClaim_from_witness(witness_ref);
37749         uint64_t ret_ref = tag_ptr(ret_copy, true);
37750         return ret_ref;
37751 }
37752
37753 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
37754         uint8_t commitment_seed_arr[32];
37755         CHECK(commitment_seed->arr_len == 32);
37756         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
37757         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
37758         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37759         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
37760         return ret_arr;
37761 }
37762
37763 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) {
37764         LDKCVec_u8Z to_holder_script_ref;
37765         to_holder_script_ref.datalen = to_holder_script->arr_len;
37766         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
37767         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
37768         LDKCVec_u8Z to_counterparty_script_ref;
37769         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
37770         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
37771         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
37772         LDKOutPoint funding_outpoint_conv;
37773         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
37774         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
37775         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37776         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37777         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);
37778         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37779         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37780         Transaction_free(ret_var);
37781         return ret_arr;
37782 }
37783
37784 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
37785         LDKCounterpartyCommitmentSecrets this_obj_conv;
37786         this_obj_conv.inner = untag_ptr(this_obj);
37787         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37789         CounterpartyCommitmentSecrets_free(this_obj_conv);
37790 }
37791
37792 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
37793         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
37794         uint64_t ret_ref = 0;
37795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37797         return ret_ref;
37798 }
37799 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
37800         LDKCounterpartyCommitmentSecrets arg_conv;
37801         arg_conv.inner = untag_ptr(arg);
37802         arg_conv.is_owned = ptr_is_owned(arg);
37803         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37804         arg_conv.is_owned = false;
37805         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
37806         return ret_conv;
37807 }
37808
37809 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
37810         LDKCounterpartyCommitmentSecrets orig_conv;
37811         orig_conv.inner = untag_ptr(orig);
37812         orig_conv.is_owned = ptr_is_owned(orig);
37813         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37814         orig_conv.is_owned = false;
37815         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
37816         uint64_t ret_ref = 0;
37817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37819         return ret_ref;
37820 }
37821
37822 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
37823         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
37824         uint64_t ret_ref = 0;
37825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37827         return ret_ref;
37828 }
37829
37830 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
37831         LDKCounterpartyCommitmentSecrets this_arg_conv;
37832         this_arg_conv.inner = untag_ptr(this_arg);
37833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37835         this_arg_conv.is_owned = false;
37836         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
37837         return ret_conv;
37838 }
37839
37840 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
37841         LDKCounterpartyCommitmentSecrets this_arg_conv;
37842         this_arg_conv.inner = untag_ptr(this_arg);
37843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37845         this_arg_conv.is_owned = false;
37846         LDKThirtyTwoBytes secret_ref;
37847         CHECK(secret->arr_len == 32);
37848         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
37849         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
37850         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
37851         return tag_ptr(ret_conv, true);
37852 }
37853
37854 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
37855         LDKCounterpartyCommitmentSecrets this_arg_conv;
37856         this_arg_conv.inner = untag_ptr(this_arg);
37857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37859         this_arg_conv.is_owned = false;
37860         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37861         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
37862         return ret_arr;
37863 }
37864
37865 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
37866         LDKCounterpartyCommitmentSecrets obj_conv;
37867         obj_conv.inner = untag_ptr(obj);
37868         obj_conv.is_owned = ptr_is_owned(obj);
37869         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37870         obj_conv.is_owned = false;
37871         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
37872         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37873         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37874         CVec_u8Z_free(ret_var);
37875         return ret_arr;
37876 }
37877
37878 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
37879         LDKu8slice ser_ref;
37880         ser_ref.datalen = ser->arr_len;
37881         ser_ref.data = ser->elems;
37882         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
37883         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
37884         FREE(ser);
37885         return tag_ptr(ret_conv, true);
37886 }
37887
37888 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
37889         LDKPublicKey per_commitment_point_ref;
37890         CHECK(per_commitment_point->arr_len == 33);
37891         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37892         uint8_t base_secret_arr[32];
37893         CHECK(base_secret->arr_len == 32);
37894         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
37895         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
37896         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37897         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
37898         return ret_arr;
37899 }
37900
37901 int8_tArray  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
37902         LDKPublicKey per_commitment_point_ref;
37903         CHECK(per_commitment_point->arr_len == 33);
37904         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37905         LDKPublicKey base_point_ref;
37906         CHECK(base_point->arr_len == 33);
37907         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
37908         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37909         memcpy(ret_arr->elems, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form, 33);
37910         return ret_arr;
37911 }
37912
37913 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) {
37914         uint8_t per_commitment_secret_arr[32];
37915         CHECK(per_commitment_secret->arr_len == 32);
37916         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
37917         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
37918         uint8_t countersignatory_revocation_base_secret_arr[32];
37919         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
37920         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
37921         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
37922         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37923         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
37924         return ret_arr;
37925 }
37926
37927 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) {
37928         LDKPublicKey per_commitment_point_ref;
37929         CHECK(per_commitment_point->arr_len == 33);
37930         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37931         LDKPublicKey countersignatory_revocation_base_point_ref;
37932         CHECK(countersignatory_revocation_base_point->arr_len == 33);
37933         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
37934         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37935         memcpy(ret_arr->elems, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form, 33);
37936         return ret_arr;
37937 }
37938
37939 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
37940         LDKTxCreationKeys this_obj_conv;
37941         this_obj_conv.inner = untag_ptr(this_obj);
37942         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37944         TxCreationKeys_free(this_obj_conv);
37945 }
37946
37947 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
37948         LDKTxCreationKeys this_ptr_conv;
37949         this_ptr_conv.inner = untag_ptr(this_ptr);
37950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37952         this_ptr_conv.is_owned = false;
37953         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37954         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
37955         return ret_arr;
37956 }
37957
37958 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
37959         LDKTxCreationKeys this_ptr_conv;
37960         this_ptr_conv.inner = untag_ptr(this_ptr);
37961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37963         this_ptr_conv.is_owned = false;
37964         LDKPublicKey val_ref;
37965         CHECK(val->arr_len == 33);
37966         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37967         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
37968 }
37969
37970 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
37971         LDKTxCreationKeys this_ptr_conv;
37972         this_ptr_conv.inner = untag_ptr(this_ptr);
37973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37975         this_ptr_conv.is_owned = false;
37976         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37977         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
37978         return ret_arr;
37979 }
37980
37981 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
37982         LDKTxCreationKeys this_ptr_conv;
37983         this_ptr_conv.inner = untag_ptr(this_ptr);
37984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37986         this_ptr_conv.is_owned = false;
37987         LDKPublicKey val_ref;
37988         CHECK(val->arr_len == 33);
37989         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37990         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
37991 }
37992
37993 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
37994         LDKTxCreationKeys this_ptr_conv;
37995         this_ptr_conv.inner = untag_ptr(this_ptr);
37996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37998         this_ptr_conv.is_owned = false;
37999         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38000         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
38001         return ret_arr;
38002 }
38003
38004 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
38005         LDKTxCreationKeys this_ptr_conv;
38006         this_ptr_conv.inner = untag_ptr(this_ptr);
38007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38009         this_ptr_conv.is_owned = false;
38010         LDKPublicKey val_ref;
38011         CHECK(val->arr_len == 33);
38012         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38013         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
38014 }
38015
38016 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
38017         LDKTxCreationKeys this_ptr_conv;
38018         this_ptr_conv.inner = untag_ptr(this_ptr);
38019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38021         this_ptr_conv.is_owned = false;
38022         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38023         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
38024         return ret_arr;
38025 }
38026
38027 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
38028         LDKTxCreationKeys this_ptr_conv;
38029         this_ptr_conv.inner = untag_ptr(this_ptr);
38030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38032         this_ptr_conv.is_owned = false;
38033         LDKPublicKey val_ref;
38034         CHECK(val->arr_len == 33);
38035         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38036         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
38037 }
38038
38039 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
38040         LDKTxCreationKeys this_ptr_conv;
38041         this_ptr_conv.inner = untag_ptr(this_ptr);
38042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38044         this_ptr_conv.is_owned = false;
38045         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38046         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
38047         return ret_arr;
38048 }
38049
38050 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) {
38051         LDKTxCreationKeys this_ptr_conv;
38052         this_ptr_conv.inner = untag_ptr(this_ptr);
38053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38055         this_ptr_conv.is_owned = false;
38056         LDKPublicKey val_ref;
38057         CHECK(val->arr_len == 33);
38058         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38059         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
38060 }
38061
38062 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) {
38063         LDKPublicKey per_commitment_point_arg_ref;
38064         CHECK(per_commitment_point_arg->arr_len == 33);
38065         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
38066         LDKPublicKey revocation_key_arg_ref;
38067         CHECK(revocation_key_arg->arr_len == 33);
38068         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
38069         LDKPublicKey broadcaster_htlc_key_arg_ref;
38070         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
38071         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
38072         LDKPublicKey countersignatory_htlc_key_arg_ref;
38073         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
38074         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
38075         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
38076         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
38077         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
38078         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);
38079         uint64_t ret_ref = 0;
38080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38082         return ret_ref;
38083 }
38084
38085 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
38086         LDKTxCreationKeys a_conv;
38087         a_conv.inner = untag_ptr(a);
38088         a_conv.is_owned = ptr_is_owned(a);
38089         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38090         a_conv.is_owned = false;
38091         LDKTxCreationKeys b_conv;
38092         b_conv.inner = untag_ptr(b);
38093         b_conv.is_owned = ptr_is_owned(b);
38094         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38095         b_conv.is_owned = false;
38096         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
38097         return ret_conv;
38098 }
38099
38100 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
38101         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
38102         uint64_t ret_ref = 0;
38103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38105         return ret_ref;
38106 }
38107 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
38108         LDKTxCreationKeys arg_conv;
38109         arg_conv.inner = untag_ptr(arg);
38110         arg_conv.is_owned = ptr_is_owned(arg);
38111         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38112         arg_conv.is_owned = false;
38113         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
38114         return ret_conv;
38115 }
38116
38117 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
38118         LDKTxCreationKeys orig_conv;
38119         orig_conv.inner = untag_ptr(orig);
38120         orig_conv.is_owned = ptr_is_owned(orig);
38121         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38122         orig_conv.is_owned = false;
38123         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
38124         uint64_t ret_ref = 0;
38125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38127         return ret_ref;
38128 }
38129
38130 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
38131         LDKTxCreationKeys obj_conv;
38132         obj_conv.inner = untag_ptr(obj);
38133         obj_conv.is_owned = ptr_is_owned(obj);
38134         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38135         obj_conv.is_owned = false;
38136         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
38137         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38138         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38139         CVec_u8Z_free(ret_var);
38140         return ret_arr;
38141 }
38142
38143 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
38144         LDKu8slice ser_ref;
38145         ser_ref.datalen = ser->arr_len;
38146         ser_ref.data = ser->elems;
38147         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
38148         *ret_conv = TxCreationKeys_read(ser_ref);
38149         FREE(ser);
38150         return tag_ptr(ret_conv, true);
38151 }
38152
38153 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
38154         LDKChannelPublicKeys this_obj_conv;
38155         this_obj_conv.inner = untag_ptr(this_obj);
38156         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38158         ChannelPublicKeys_free(this_obj_conv);
38159 }
38160
38161 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
38162         LDKChannelPublicKeys this_ptr_conv;
38163         this_ptr_conv.inner = untag_ptr(this_ptr);
38164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38166         this_ptr_conv.is_owned = false;
38167         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38168         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
38169         return ret_arr;
38170 }
38171
38172 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
38173         LDKChannelPublicKeys this_ptr_conv;
38174         this_ptr_conv.inner = untag_ptr(this_ptr);
38175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38177         this_ptr_conv.is_owned = false;
38178         LDKPublicKey val_ref;
38179         CHECK(val->arr_len == 33);
38180         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38181         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
38182 }
38183
38184 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
38185         LDKChannelPublicKeys this_ptr_conv;
38186         this_ptr_conv.inner = untag_ptr(this_ptr);
38187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38189         this_ptr_conv.is_owned = false;
38190         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38191         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
38192         return ret_arr;
38193 }
38194
38195 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
38196         LDKChannelPublicKeys this_ptr_conv;
38197         this_ptr_conv.inner = untag_ptr(this_ptr);
38198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38200         this_ptr_conv.is_owned = false;
38201         LDKPublicKey val_ref;
38202         CHECK(val->arr_len == 33);
38203         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38204         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
38205 }
38206
38207 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
38208         LDKChannelPublicKeys this_ptr_conv;
38209         this_ptr_conv.inner = untag_ptr(this_ptr);
38210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38212         this_ptr_conv.is_owned = false;
38213         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38214         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
38215         return ret_arr;
38216 }
38217
38218 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
38219         LDKChannelPublicKeys this_ptr_conv;
38220         this_ptr_conv.inner = untag_ptr(this_ptr);
38221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38223         this_ptr_conv.is_owned = false;
38224         LDKPublicKey val_ref;
38225         CHECK(val->arr_len == 33);
38226         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38227         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
38228 }
38229
38230 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
38231         LDKChannelPublicKeys this_ptr_conv;
38232         this_ptr_conv.inner = untag_ptr(this_ptr);
38233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38235         this_ptr_conv.is_owned = false;
38236         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38237         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
38238         return ret_arr;
38239 }
38240
38241 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
38242         LDKChannelPublicKeys this_ptr_conv;
38243         this_ptr_conv.inner = untag_ptr(this_ptr);
38244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38246         this_ptr_conv.is_owned = false;
38247         LDKPublicKey val_ref;
38248         CHECK(val->arr_len == 33);
38249         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38250         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
38251 }
38252
38253 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
38254         LDKChannelPublicKeys this_ptr_conv;
38255         this_ptr_conv.inner = untag_ptr(this_ptr);
38256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38258         this_ptr_conv.is_owned = false;
38259         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38260         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
38261         return ret_arr;
38262 }
38263
38264 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
38265         LDKChannelPublicKeys this_ptr_conv;
38266         this_ptr_conv.inner = untag_ptr(this_ptr);
38267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38269         this_ptr_conv.is_owned = false;
38270         LDKPublicKey val_ref;
38271         CHECK(val->arr_len == 33);
38272         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38273         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
38274 }
38275
38276 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) {
38277         LDKPublicKey funding_pubkey_arg_ref;
38278         CHECK(funding_pubkey_arg->arr_len == 33);
38279         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
38280         LDKPublicKey revocation_basepoint_arg_ref;
38281         CHECK(revocation_basepoint_arg->arr_len == 33);
38282         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
38283         LDKPublicKey payment_point_arg_ref;
38284         CHECK(payment_point_arg->arr_len == 33);
38285         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
38286         LDKPublicKey delayed_payment_basepoint_arg_ref;
38287         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
38288         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
38289         LDKPublicKey htlc_basepoint_arg_ref;
38290         CHECK(htlc_basepoint_arg->arr_len == 33);
38291         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
38292         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);
38293         uint64_t ret_ref = 0;
38294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38296         return ret_ref;
38297 }
38298
38299 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
38300         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
38301         uint64_t ret_ref = 0;
38302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38304         return ret_ref;
38305 }
38306 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
38307         LDKChannelPublicKeys arg_conv;
38308         arg_conv.inner = untag_ptr(arg);
38309         arg_conv.is_owned = ptr_is_owned(arg);
38310         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38311         arg_conv.is_owned = false;
38312         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
38313         return ret_conv;
38314 }
38315
38316 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
38317         LDKChannelPublicKeys orig_conv;
38318         orig_conv.inner = untag_ptr(orig);
38319         orig_conv.is_owned = ptr_is_owned(orig);
38320         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38321         orig_conv.is_owned = false;
38322         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
38323         uint64_t ret_ref = 0;
38324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38326         return ret_ref;
38327 }
38328
38329 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
38330         LDKChannelPublicKeys a_conv;
38331         a_conv.inner = untag_ptr(a);
38332         a_conv.is_owned = ptr_is_owned(a);
38333         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38334         a_conv.is_owned = false;
38335         LDKChannelPublicKeys b_conv;
38336         b_conv.inner = untag_ptr(b);
38337         b_conv.is_owned = ptr_is_owned(b);
38338         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38339         b_conv.is_owned = false;
38340         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
38341         return ret_conv;
38342 }
38343
38344 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
38345         LDKChannelPublicKeys obj_conv;
38346         obj_conv.inner = untag_ptr(obj);
38347         obj_conv.is_owned = ptr_is_owned(obj);
38348         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38349         obj_conv.is_owned = false;
38350         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
38351         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38352         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38353         CVec_u8Z_free(ret_var);
38354         return ret_arr;
38355 }
38356
38357 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
38358         LDKu8slice ser_ref;
38359         ser_ref.datalen = ser->arr_len;
38360         ser_ref.data = ser->elems;
38361         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
38362         *ret_conv = ChannelPublicKeys_read(ser_ref);
38363         FREE(ser);
38364         return tag_ptr(ret_conv, true);
38365 }
38366
38367 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) {
38368         LDKPublicKey per_commitment_point_ref;
38369         CHECK(per_commitment_point->arr_len == 33);
38370         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
38371         LDKPublicKey broadcaster_delayed_payment_base_ref;
38372         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
38373         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
38374         LDKPublicKey broadcaster_htlc_base_ref;
38375         CHECK(broadcaster_htlc_base->arr_len == 33);
38376         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
38377         LDKPublicKey countersignatory_revocation_base_ref;
38378         CHECK(countersignatory_revocation_base->arr_len == 33);
38379         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
38380         LDKPublicKey countersignatory_htlc_base_ref;
38381         CHECK(countersignatory_htlc_base->arr_len == 33);
38382         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
38383         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);
38384         uint64_t ret_ref = 0;
38385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38387         return ret_ref;
38388 }
38389
38390 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) {
38391         LDKPublicKey per_commitment_point_ref;
38392         CHECK(per_commitment_point->arr_len == 33);
38393         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
38394         LDKChannelPublicKeys broadcaster_keys_conv;
38395         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
38396         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
38397         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
38398         broadcaster_keys_conv.is_owned = false;
38399         LDKChannelPublicKeys countersignatory_keys_conv;
38400         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
38401         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
38402         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
38403         countersignatory_keys_conv.is_owned = false;
38404         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
38405         uint64_t ret_ref = 0;
38406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38408         return ret_ref;
38409 }
38410
38411 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) {
38412         LDKPublicKey revocation_key_ref;
38413         CHECK(revocation_key->arr_len == 33);
38414         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
38415         LDKPublicKey broadcaster_delayed_payment_key_ref;
38416         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
38417         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
38418         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
38419         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38420         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38421         CVec_u8Z_free(ret_var);
38422         return ret_arr;
38423 }
38424
38425 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
38426         LDKHTLCOutputInCommitment this_obj_conv;
38427         this_obj_conv.inner = untag_ptr(this_obj);
38428         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38430         HTLCOutputInCommitment_free(this_obj_conv);
38431 }
38432
38433 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
38434         LDKHTLCOutputInCommitment this_ptr_conv;
38435         this_ptr_conv.inner = untag_ptr(this_ptr);
38436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38438         this_ptr_conv.is_owned = false;
38439         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
38440         return ret_conv;
38441 }
38442
38443 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
38444         LDKHTLCOutputInCommitment this_ptr_conv;
38445         this_ptr_conv.inner = untag_ptr(this_ptr);
38446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38448         this_ptr_conv.is_owned = false;
38449         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
38450 }
38451
38452 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
38453         LDKHTLCOutputInCommitment this_ptr_conv;
38454         this_ptr_conv.inner = untag_ptr(this_ptr);
38455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38457         this_ptr_conv.is_owned = false;
38458         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
38459         return ret_conv;
38460 }
38461
38462 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
38463         LDKHTLCOutputInCommitment this_ptr_conv;
38464         this_ptr_conv.inner = untag_ptr(this_ptr);
38465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38467         this_ptr_conv.is_owned = false;
38468         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
38469 }
38470
38471 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
38472         LDKHTLCOutputInCommitment this_ptr_conv;
38473         this_ptr_conv.inner = untag_ptr(this_ptr);
38474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38476         this_ptr_conv.is_owned = false;
38477         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
38478         return ret_conv;
38479 }
38480
38481 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
38482         LDKHTLCOutputInCommitment this_ptr_conv;
38483         this_ptr_conv.inner = untag_ptr(this_ptr);
38484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38486         this_ptr_conv.is_owned = false;
38487         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
38488 }
38489
38490 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
38491         LDKHTLCOutputInCommitment this_ptr_conv;
38492         this_ptr_conv.inner = untag_ptr(this_ptr);
38493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38495         this_ptr_conv.is_owned = false;
38496         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38497         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
38498         return ret_arr;
38499 }
38500
38501 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray 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         LDKThirtyTwoBytes val_ref;
38508         CHECK(val->arr_len == 32);
38509         memcpy(val_ref.data, val->elems, 32); FREE(val);
38510         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
38511 }
38512
38513 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
38514         LDKHTLCOutputInCommitment this_ptr_conv;
38515         this_ptr_conv.inner = untag_ptr(this_ptr);
38516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38518         this_ptr_conv.is_owned = false;
38519         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
38520         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
38521         uint64_t ret_ref = tag_ptr(ret_copy, true);
38522         return ret_ref;
38523 }
38524
38525 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
38526         LDKHTLCOutputInCommitment this_ptr_conv;
38527         this_ptr_conv.inner = untag_ptr(this_ptr);
38528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38530         this_ptr_conv.is_owned = false;
38531         void* val_ptr = untag_ptr(val);
38532         CHECK_ACCESS(val_ptr);
38533         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
38534         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
38535         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
38536 }
38537
38538 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) {
38539         LDKThirtyTwoBytes payment_hash_arg_ref;
38540         CHECK(payment_hash_arg->arr_len == 32);
38541         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
38542         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
38543         CHECK_ACCESS(transaction_output_index_arg_ptr);
38544         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
38545         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
38546         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
38547         uint64_t ret_ref = 0;
38548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38550         return ret_ref;
38551 }
38552
38553 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
38554         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
38555         uint64_t ret_ref = 0;
38556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38558         return ret_ref;
38559 }
38560 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
38561         LDKHTLCOutputInCommitment arg_conv;
38562         arg_conv.inner = untag_ptr(arg);
38563         arg_conv.is_owned = ptr_is_owned(arg);
38564         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38565         arg_conv.is_owned = false;
38566         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
38567         return ret_conv;
38568 }
38569
38570 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
38571         LDKHTLCOutputInCommitment orig_conv;
38572         orig_conv.inner = untag_ptr(orig);
38573         orig_conv.is_owned = ptr_is_owned(orig);
38574         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38575         orig_conv.is_owned = false;
38576         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
38577         uint64_t ret_ref = 0;
38578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38580         return ret_ref;
38581 }
38582
38583 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
38584         LDKHTLCOutputInCommitment a_conv;
38585         a_conv.inner = untag_ptr(a);
38586         a_conv.is_owned = ptr_is_owned(a);
38587         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38588         a_conv.is_owned = false;
38589         LDKHTLCOutputInCommitment b_conv;
38590         b_conv.inner = untag_ptr(b);
38591         b_conv.is_owned = ptr_is_owned(b);
38592         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38593         b_conv.is_owned = false;
38594         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
38595         return ret_conv;
38596 }
38597
38598 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
38599         LDKHTLCOutputInCommitment obj_conv;
38600         obj_conv.inner = untag_ptr(obj);
38601         obj_conv.is_owned = ptr_is_owned(obj);
38602         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38603         obj_conv.is_owned = false;
38604         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
38605         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38606         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38607         CVec_u8Z_free(ret_var);
38608         return ret_arr;
38609 }
38610
38611 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
38612         LDKu8slice ser_ref;
38613         ser_ref.datalen = ser->arr_len;
38614         ser_ref.data = ser->elems;
38615         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
38616         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
38617         FREE(ser);
38618         return tag_ptr(ret_conv, true);
38619 }
38620
38621 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, jboolean opt_anchors, uint64_t keys) {
38622         LDKHTLCOutputInCommitment htlc_conv;
38623         htlc_conv.inner = untag_ptr(htlc);
38624         htlc_conv.is_owned = ptr_is_owned(htlc);
38625         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38626         htlc_conv.is_owned = false;
38627         LDKTxCreationKeys keys_conv;
38628         keys_conv.inner = untag_ptr(keys);
38629         keys_conv.is_owned = ptr_is_owned(keys);
38630         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
38631         keys_conv.is_owned = false;
38632         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
38633         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38634         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38635         CVec_u8Z_free(ret_var);
38636         return ret_arr;
38637 }
38638
38639 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
38640         LDKPublicKey broadcaster_ref;
38641         CHECK(broadcaster->arr_len == 33);
38642         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
38643         LDKPublicKey countersignatory_ref;
38644         CHECK(countersignatory->arr_len == 33);
38645         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
38646         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
38647         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38648         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38649         CVec_u8Z_free(ret_var);
38650         return ret_arr;
38651 }
38652
38653 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) {
38654         uint8_t commitment_txid_arr[32];
38655         CHECK(commitment_txid->arr_len == 32);
38656         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
38657         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
38658         LDKHTLCOutputInCommitment htlc_conv;
38659         htlc_conv.inner = untag_ptr(htlc);
38660         htlc_conv.is_owned = ptr_is_owned(htlc);
38661         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38662         htlc_conv.is_owned = false;
38663         LDKPublicKey broadcaster_delayed_payment_key_ref;
38664         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
38665         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
38666         LDKPublicKey revocation_key_ref;
38667         CHECK(revocation_key->arr_len == 33);
38668         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
38669         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);
38670         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38671         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38672         Transaction_free(ret_var);
38673         return ret_arr;
38674 }
38675
38676 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) {
38677         LDKSignature local_sig_ref;
38678         CHECK(local_sig->arr_len == 64);
38679         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
38680         LDKSignature remote_sig_ref;
38681         CHECK(remote_sig->arr_len == 64);
38682         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
38683         LDKThirtyTwoBytes preimage_ref;
38684         CHECK(preimage->arr_len == 32);
38685         memcpy(preimage_ref.data, preimage->elems, 32); FREE(preimage);
38686         LDKu8slice redeem_script_ref;
38687         redeem_script_ref.datalen = redeem_script->arr_len;
38688         redeem_script_ref.data = redeem_script->elems;
38689         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_ref, redeem_script_ref, opt_anchors);
38690         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38691         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38692         Witness_free(ret_var);
38693         FREE(redeem_script);
38694         return ret_arr;
38695 }
38696
38697 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
38698         LDKPublicKey payment_point_ref;
38699         CHECK(payment_point->arr_len == 33);
38700         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
38701         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
38702         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38703         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38704         CVec_u8Z_free(ret_var);
38705         return ret_arr;
38706 }
38707
38708 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
38709         LDKPublicKey funding_pubkey_ref;
38710         CHECK(funding_pubkey->arr_len == 33);
38711         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
38712         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
38713         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38714         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38715         CVec_u8Z_free(ret_var);
38716         return ret_arr;
38717 }
38718
38719 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
38720         LDKPublicKey funding_key_ref;
38721         CHECK(funding_key->arr_len == 33);
38722         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
38723         LDKSignature funding_sig_ref;
38724         CHECK(funding_sig->arr_len == 64);
38725         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
38726         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
38727         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38728         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38729         Witness_free(ret_var);
38730         return ret_arr;
38731 }
38732
38733 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
38734         LDKChannelTransactionParameters this_obj_conv;
38735         this_obj_conv.inner = untag_ptr(this_obj);
38736         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38738         ChannelTransactionParameters_free(this_obj_conv);
38739 }
38740
38741 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
38742         LDKChannelTransactionParameters this_ptr_conv;
38743         this_ptr_conv.inner = untag_ptr(this_ptr);
38744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38746         this_ptr_conv.is_owned = false;
38747         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
38748         uint64_t ret_ref = 0;
38749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38751         return ret_ref;
38752 }
38753
38754 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
38755         LDKChannelTransactionParameters this_ptr_conv;
38756         this_ptr_conv.inner = untag_ptr(this_ptr);
38757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38759         this_ptr_conv.is_owned = false;
38760         LDKChannelPublicKeys val_conv;
38761         val_conv.inner = untag_ptr(val);
38762         val_conv.is_owned = ptr_is_owned(val);
38763         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38764         val_conv = ChannelPublicKeys_clone(&val_conv);
38765         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
38766 }
38767
38768 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
38769         LDKChannelTransactionParameters this_ptr_conv;
38770         this_ptr_conv.inner = untag_ptr(this_ptr);
38771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38773         this_ptr_conv.is_owned = false;
38774         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
38775         return ret_conv;
38776 }
38777
38778 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) {
38779         LDKChannelTransactionParameters this_ptr_conv;
38780         this_ptr_conv.inner = untag_ptr(this_ptr);
38781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38783         this_ptr_conv.is_owned = false;
38784         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
38785 }
38786
38787 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
38788         LDKChannelTransactionParameters this_ptr_conv;
38789         this_ptr_conv.inner = untag_ptr(this_ptr);
38790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38792         this_ptr_conv.is_owned = false;
38793         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
38794         return ret_conv;
38795 }
38796
38797 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
38798         LDKChannelTransactionParameters this_ptr_conv;
38799         this_ptr_conv.inner = untag_ptr(this_ptr);
38800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38802         this_ptr_conv.is_owned = false;
38803         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
38804 }
38805
38806 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
38807         LDKChannelTransactionParameters this_ptr_conv;
38808         this_ptr_conv.inner = untag_ptr(this_ptr);
38809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38811         this_ptr_conv.is_owned = false;
38812         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
38813         uint64_t ret_ref = 0;
38814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38816         return ret_ref;
38817 }
38818
38819 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
38820         LDKChannelTransactionParameters this_ptr_conv;
38821         this_ptr_conv.inner = untag_ptr(this_ptr);
38822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38824         this_ptr_conv.is_owned = false;
38825         LDKCounterpartyChannelTransactionParameters val_conv;
38826         val_conv.inner = untag_ptr(val);
38827         val_conv.is_owned = ptr_is_owned(val);
38828         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38829         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
38830         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
38831 }
38832
38833 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
38834         LDKChannelTransactionParameters this_ptr_conv;
38835         this_ptr_conv.inner = untag_ptr(this_ptr);
38836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38838         this_ptr_conv.is_owned = false;
38839         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
38840         uint64_t ret_ref = 0;
38841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38843         return ret_ref;
38844 }
38845
38846 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
38847         LDKChannelTransactionParameters this_ptr_conv;
38848         this_ptr_conv.inner = untag_ptr(this_ptr);
38849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38851         this_ptr_conv.is_owned = false;
38852         LDKOutPoint val_conv;
38853         val_conv.inner = untag_ptr(val);
38854         val_conv.is_owned = ptr_is_owned(val);
38855         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38856         val_conv = OutPoint_clone(&val_conv);
38857         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
38858 }
38859
38860 uint32_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint64_t this_ptr) {
38861         LDKChannelTransactionParameters this_ptr_conv;
38862         this_ptr_conv.inner = untag_ptr(this_ptr);
38863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38865         this_ptr_conv.is_owned = false;
38866         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
38867         return ret_conv;
38868 }
38869
38870 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint64_t this_ptr, uint32_t val) {
38871         LDKChannelTransactionParameters this_ptr_conv;
38872         this_ptr_conv.inner = untag_ptr(this_ptr);
38873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38875         this_ptr_conv.is_owned = false;
38876         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
38877         ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
38878 }
38879
38880 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) {
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_non_zero_fee_anchors(&this_ptr_conv));
38887         return ret_conv;
38888 }
38889
38890 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) {
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_non_zero_fee_anchors(&this_ptr_conv, val_conv);
38898 }
38899
38900 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) {
38901         LDKChannelPublicKeys holder_pubkeys_arg_conv;
38902         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
38903         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
38904         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
38905         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
38906         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
38907         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
38908         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
38909         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
38910         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
38911         LDKOutPoint funding_outpoint_arg_conv;
38912         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
38913         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
38914         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
38915         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
38916         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
38917         LDKCOption_NoneZ opt_non_zero_fee_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_non_zero_fee_anchors_arg);
38918         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);
38919         uint64_t ret_ref = 0;
38920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38922         return ret_ref;
38923 }
38924
38925 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
38926         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
38927         uint64_t ret_ref = 0;
38928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38930         return ret_ref;
38931 }
38932 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
38933         LDKChannelTransactionParameters arg_conv;
38934         arg_conv.inner = untag_ptr(arg);
38935         arg_conv.is_owned = ptr_is_owned(arg);
38936         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38937         arg_conv.is_owned = false;
38938         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
38939         return ret_conv;
38940 }
38941
38942 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
38943         LDKChannelTransactionParameters orig_conv;
38944         orig_conv.inner = untag_ptr(orig);
38945         orig_conv.is_owned = ptr_is_owned(orig);
38946         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38947         orig_conv.is_owned = false;
38948         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
38949         uint64_t ret_ref = 0;
38950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38952         return ret_ref;
38953 }
38954
38955 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_eq"))) TS_ChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
38956         LDKChannelTransactionParameters a_conv;
38957         a_conv.inner = untag_ptr(a);
38958         a_conv.is_owned = ptr_is_owned(a);
38959         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38960         a_conv.is_owned = false;
38961         LDKChannelTransactionParameters b_conv;
38962         b_conv.inner = untag_ptr(b);
38963         b_conv.is_owned = ptr_is_owned(b);
38964         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38965         b_conv.is_owned = false;
38966         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
38967         return ret_conv;
38968 }
38969
38970 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
38971         LDKCounterpartyChannelTransactionParameters this_obj_conv;
38972         this_obj_conv.inner = untag_ptr(this_obj);
38973         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38975         CounterpartyChannelTransactionParameters_free(this_obj_conv);
38976 }
38977
38978 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
38979         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38980         this_ptr_conv.inner = untag_ptr(this_ptr);
38981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38983         this_ptr_conv.is_owned = false;
38984         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
38985         uint64_t ret_ref = 0;
38986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38988         return ret_ref;
38989 }
38990
38991 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
38992         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38993         this_ptr_conv.inner = untag_ptr(this_ptr);
38994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38996         this_ptr_conv.is_owned = false;
38997         LDKChannelPublicKeys val_conv;
38998         val_conv.inner = untag_ptr(val);
38999         val_conv.is_owned = ptr_is_owned(val);
39000         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39001         val_conv = ChannelPublicKeys_clone(&val_conv);
39002         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
39003 }
39004
39005 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
39006         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39007         this_ptr_conv.inner = untag_ptr(this_ptr);
39008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39010         this_ptr_conv.is_owned = false;
39011         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
39012         return ret_conv;
39013 }
39014
39015 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
39016         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39017         this_ptr_conv.inner = untag_ptr(this_ptr);
39018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39020         this_ptr_conv.is_owned = false;
39021         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
39022 }
39023
39024 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
39025         LDKChannelPublicKeys pubkeys_arg_conv;
39026         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
39027         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
39028         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
39029         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
39030         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
39031         uint64_t ret_ref = 0;
39032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39034         return ret_ref;
39035 }
39036
39037 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
39038         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
39039         uint64_t ret_ref = 0;
39040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39042         return ret_ref;
39043 }
39044 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
39045         LDKCounterpartyChannelTransactionParameters arg_conv;
39046         arg_conv.inner = untag_ptr(arg);
39047         arg_conv.is_owned = ptr_is_owned(arg);
39048         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39049         arg_conv.is_owned = false;
39050         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
39051         return ret_conv;
39052 }
39053
39054 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
39055         LDKCounterpartyChannelTransactionParameters orig_conv;
39056         orig_conv.inner = untag_ptr(orig);
39057         orig_conv.is_owned = ptr_is_owned(orig);
39058         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39059         orig_conv.is_owned = false;
39060         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
39061         uint64_t ret_ref = 0;
39062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39064         return ret_ref;
39065 }
39066
39067 jboolean  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_eq"))) TS_CounterpartyChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
39068         LDKCounterpartyChannelTransactionParameters a_conv;
39069         a_conv.inner = untag_ptr(a);
39070         a_conv.is_owned = ptr_is_owned(a);
39071         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39072         a_conv.is_owned = false;
39073         LDKCounterpartyChannelTransactionParameters b_conv;
39074         b_conv.inner = untag_ptr(b);
39075         b_conv.is_owned = ptr_is_owned(b);
39076         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39077         b_conv.is_owned = false;
39078         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
39079         return ret_conv;
39080 }
39081
39082 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
39083         LDKChannelTransactionParameters this_arg_conv;
39084         this_arg_conv.inner = untag_ptr(this_arg);
39085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39087         this_arg_conv.is_owned = false;
39088         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
39089         return ret_conv;
39090 }
39091
39092 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
39093         LDKChannelTransactionParameters this_arg_conv;
39094         this_arg_conv.inner = untag_ptr(this_arg);
39095         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39097         this_arg_conv.is_owned = false;
39098         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
39099         uint64_t ret_ref = 0;
39100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39102         return ret_ref;
39103 }
39104
39105 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
39106         LDKChannelTransactionParameters this_arg_conv;
39107         this_arg_conv.inner = untag_ptr(this_arg);
39108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39110         this_arg_conv.is_owned = false;
39111         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
39112         uint64_t ret_ref = 0;
39113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39115         return ret_ref;
39116 }
39117
39118 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
39119         LDKCounterpartyChannelTransactionParameters obj_conv;
39120         obj_conv.inner = untag_ptr(obj);
39121         obj_conv.is_owned = ptr_is_owned(obj);
39122         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39123         obj_conv.is_owned = false;
39124         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
39125         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39126         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39127         CVec_u8Z_free(ret_var);
39128         return ret_arr;
39129 }
39130
39131 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
39132         LDKu8slice ser_ref;
39133         ser_ref.datalen = ser->arr_len;
39134         ser_ref.data = ser->elems;
39135         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
39136         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
39137         FREE(ser);
39138         return tag_ptr(ret_conv, true);
39139 }
39140
39141 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
39142         LDKChannelTransactionParameters obj_conv;
39143         obj_conv.inner = untag_ptr(obj);
39144         obj_conv.is_owned = ptr_is_owned(obj);
39145         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39146         obj_conv.is_owned = false;
39147         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
39148         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39149         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39150         CVec_u8Z_free(ret_var);
39151         return ret_arr;
39152 }
39153
39154 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
39155         LDKu8slice ser_ref;
39156         ser_ref.datalen = ser->arr_len;
39157         ser_ref.data = ser->elems;
39158         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
39159         *ret_conv = ChannelTransactionParameters_read(ser_ref);
39160         FREE(ser);
39161         return tag_ptr(ret_conv, true);
39162 }
39163
39164 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
39165         LDKDirectedChannelTransactionParameters this_obj_conv;
39166         this_obj_conv.inner = untag_ptr(this_obj);
39167         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39169         DirectedChannelTransactionParameters_free(this_obj_conv);
39170 }
39171
39172 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
39173         LDKDirectedChannelTransactionParameters this_arg_conv;
39174         this_arg_conv.inner = untag_ptr(this_arg);
39175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39177         this_arg_conv.is_owned = false;
39178         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
39179         uint64_t ret_ref = 0;
39180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39182         return ret_ref;
39183 }
39184
39185 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
39186         LDKDirectedChannelTransactionParameters this_arg_conv;
39187         this_arg_conv.inner = untag_ptr(this_arg);
39188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39190         this_arg_conv.is_owned = false;
39191         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
39192         uint64_t ret_ref = 0;
39193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39195         return ret_ref;
39196 }
39197
39198 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
39199         LDKDirectedChannelTransactionParameters this_arg_conv;
39200         this_arg_conv.inner = untag_ptr(this_arg);
39201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39203         this_arg_conv.is_owned = false;
39204         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
39205         return ret_conv;
39206 }
39207
39208 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
39209         LDKDirectedChannelTransactionParameters this_arg_conv;
39210         this_arg_conv.inner = untag_ptr(this_arg);
39211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39213         this_arg_conv.is_owned = false;
39214         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
39215         return ret_conv;
39216 }
39217
39218 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(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         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
39225         uint64_t ret_ref = 0;
39226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39228         return ret_ref;
39229 }
39230
39231 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint64_t this_arg) {
39232         LDKDirectedChannelTransactionParameters this_arg_conv;
39233         this_arg_conv.inner = untag_ptr(this_arg);
39234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39236         this_arg_conv.is_owned = false;
39237         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
39238         return ret_conv;
39239 }
39240
39241 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
39242         LDKHolderCommitmentTransaction this_obj_conv;
39243         this_obj_conv.inner = untag_ptr(this_obj);
39244         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39246         HolderCommitmentTransaction_free(this_obj_conv);
39247 }
39248
39249 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
39250         LDKHolderCommitmentTransaction this_ptr_conv;
39251         this_ptr_conv.inner = untag_ptr(this_ptr);
39252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39254         this_ptr_conv.is_owned = false;
39255         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39256         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
39257         return ret_arr;
39258 }
39259
39260 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
39261         LDKHolderCommitmentTransaction this_ptr_conv;
39262         this_ptr_conv.inner = untag_ptr(this_ptr);
39263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39265         this_ptr_conv.is_owned = false;
39266         LDKSignature val_ref;
39267         CHECK(val->arr_len == 64);
39268         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
39269         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
39270 }
39271
39272 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
39273         LDKHolderCommitmentTransaction this_ptr_conv;
39274         this_ptr_conv.inner = untag_ptr(this_ptr);
39275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39277         this_ptr_conv.is_owned = false;
39278         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
39279         ptrArray ret_arr = NULL;
39280         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
39281         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
39282         for (size_t m = 0; m < ret_var.datalen; m++) {
39283                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
39284                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
39285                 ret_arr_ptr[m] = ret_conv_12_arr;
39286         }
39287         
39288         FREE(ret_var.data);
39289         return ret_arr;
39290 }
39291
39292 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
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 val_constr;
39299         val_constr.datalen = val->arr_len;
39300         if (val_constr.datalen > 0)
39301                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39302         else
39303                 val_constr.data = NULL;
39304         int8_tArray* val_vals = (void*) val->elems;
39305         for (size_t m = 0; m < val_constr.datalen; m++) {
39306                 int8_tArray val_conv_12 = val_vals[m];
39307                 LDKSignature val_conv_12_ref;
39308                 CHECK(val_conv_12->arr_len == 64);
39309                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
39310                 val_constr.data[m] = val_conv_12_ref;
39311         }
39312         FREE(val);
39313         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
39314 }
39315
39316 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
39317         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
39318         uint64_t ret_ref = 0;
39319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39321         return ret_ref;
39322 }
39323 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
39324         LDKHolderCommitmentTransaction arg_conv;
39325         arg_conv.inner = untag_ptr(arg);
39326         arg_conv.is_owned = ptr_is_owned(arg);
39327         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39328         arg_conv.is_owned = false;
39329         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
39330         return ret_conv;
39331 }
39332
39333 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
39334         LDKHolderCommitmentTransaction orig_conv;
39335         orig_conv.inner = untag_ptr(orig);
39336         orig_conv.is_owned = ptr_is_owned(orig);
39337         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39338         orig_conv.is_owned = false;
39339         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
39340         uint64_t ret_ref = 0;
39341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39343         return ret_ref;
39344 }
39345
39346 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
39347         LDKHolderCommitmentTransaction obj_conv;
39348         obj_conv.inner = untag_ptr(obj);
39349         obj_conv.is_owned = ptr_is_owned(obj);
39350         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39351         obj_conv.is_owned = false;
39352         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
39353         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39354         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39355         CVec_u8Z_free(ret_var);
39356         return ret_arr;
39357 }
39358
39359 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
39360         LDKu8slice ser_ref;
39361         ser_ref.datalen = ser->arr_len;
39362         ser_ref.data = ser->elems;
39363         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
39364         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
39365         FREE(ser);
39366         return tag_ptr(ret_conv, true);
39367 }
39368
39369 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) {
39370         LDKCommitmentTransaction commitment_tx_conv;
39371         commitment_tx_conv.inner = untag_ptr(commitment_tx);
39372         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
39373         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
39374         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
39375         LDKSignature counterparty_sig_ref;
39376         CHECK(counterparty_sig->arr_len == 64);
39377         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
39378         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
39379         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
39380         if (counterparty_htlc_sigs_constr.datalen > 0)
39381                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39382         else
39383                 counterparty_htlc_sigs_constr.data = NULL;
39384         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
39385         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
39386                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
39387                 LDKSignature counterparty_htlc_sigs_conv_12_ref;
39388                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
39389                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
39390                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
39391         }
39392         FREE(counterparty_htlc_sigs);
39393         LDKPublicKey holder_funding_key_ref;
39394         CHECK(holder_funding_key->arr_len == 33);
39395         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
39396         LDKPublicKey counterparty_funding_key_ref;
39397         CHECK(counterparty_funding_key->arr_len == 33);
39398         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
39399         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
39400         uint64_t ret_ref = 0;
39401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39403         return ret_ref;
39404 }
39405
39406 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
39407         LDKBuiltCommitmentTransaction this_obj_conv;
39408         this_obj_conv.inner = untag_ptr(this_obj);
39409         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39411         BuiltCommitmentTransaction_free(this_obj_conv);
39412 }
39413
39414 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
39415         LDKBuiltCommitmentTransaction this_ptr_conv;
39416         this_ptr_conv.inner = untag_ptr(this_ptr);
39417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39419         this_ptr_conv.is_owned = false;
39420         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
39421         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39422         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39423         Transaction_free(ret_var);
39424         return ret_arr;
39425 }
39426
39427 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
39428         LDKBuiltCommitmentTransaction this_ptr_conv;
39429         this_ptr_conv.inner = untag_ptr(this_ptr);
39430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39432         this_ptr_conv.is_owned = false;
39433         LDKTransaction val_ref;
39434         val_ref.datalen = val->arr_len;
39435         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
39436         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
39437         val_ref.data_is_owned = true;
39438         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
39439 }
39440
39441 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
39442         LDKBuiltCommitmentTransaction this_ptr_conv;
39443         this_ptr_conv.inner = untag_ptr(this_ptr);
39444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39446         this_ptr_conv.is_owned = false;
39447         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39448         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
39449         return ret_arr;
39450 }
39451
39452 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
39453         LDKBuiltCommitmentTransaction this_ptr_conv;
39454         this_ptr_conv.inner = untag_ptr(this_ptr);
39455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39457         this_ptr_conv.is_owned = false;
39458         LDKThirtyTwoBytes val_ref;
39459         CHECK(val->arr_len == 32);
39460         memcpy(val_ref.data, val->elems, 32); FREE(val);
39461         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
39462 }
39463
39464 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
39465         LDKTransaction transaction_arg_ref;
39466         transaction_arg_ref.datalen = transaction_arg->arr_len;
39467         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
39468         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
39469         transaction_arg_ref.data_is_owned = true;
39470         LDKThirtyTwoBytes txid_arg_ref;
39471         CHECK(txid_arg->arr_len == 32);
39472         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
39473         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
39474         uint64_t ret_ref = 0;
39475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39477         return ret_ref;
39478 }
39479
39480 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
39481         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
39482         uint64_t ret_ref = 0;
39483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39485         return ret_ref;
39486 }
39487 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
39488         LDKBuiltCommitmentTransaction arg_conv;
39489         arg_conv.inner = untag_ptr(arg);
39490         arg_conv.is_owned = ptr_is_owned(arg);
39491         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39492         arg_conv.is_owned = false;
39493         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
39494         return ret_conv;
39495 }
39496
39497 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
39498         LDKBuiltCommitmentTransaction orig_conv;
39499         orig_conv.inner = untag_ptr(orig);
39500         orig_conv.is_owned = ptr_is_owned(orig);
39501         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39502         orig_conv.is_owned = false;
39503         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
39504         uint64_t ret_ref = 0;
39505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39507         return ret_ref;
39508 }
39509
39510 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
39511         LDKBuiltCommitmentTransaction obj_conv;
39512         obj_conv.inner = untag_ptr(obj);
39513         obj_conv.is_owned = ptr_is_owned(obj);
39514         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39515         obj_conv.is_owned = false;
39516         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
39517         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39518         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39519         CVec_u8Z_free(ret_var);
39520         return ret_arr;
39521 }
39522
39523 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
39524         LDKu8slice ser_ref;
39525         ser_ref.datalen = ser->arr_len;
39526         ser_ref.data = ser->elems;
39527         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
39528         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
39529         FREE(ser);
39530         return tag_ptr(ret_conv, true);
39531 }
39532
39533 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) {
39534         LDKBuiltCommitmentTransaction this_arg_conv;
39535         this_arg_conv.inner = untag_ptr(this_arg);
39536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39538         this_arg_conv.is_owned = false;
39539         LDKu8slice funding_redeemscript_ref;
39540         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39541         funding_redeemscript_ref.data = funding_redeemscript->elems;
39542         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39543         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
39544         FREE(funding_redeemscript);
39545         return ret_arr;
39546 }
39547
39548 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) {
39549         LDKBuiltCommitmentTransaction this_arg_conv;
39550         this_arg_conv.inner = untag_ptr(this_arg);
39551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39553         this_arg_conv.is_owned = false;
39554         uint8_t funding_key_arr[32];
39555         CHECK(funding_key->arr_len == 32);
39556         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
39557         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
39558         LDKu8slice funding_redeemscript_ref;
39559         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39560         funding_redeemscript_ref.data = funding_redeemscript->elems;
39561         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39562         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
39563         FREE(funding_redeemscript);
39564         return ret_arr;
39565 }
39566
39567 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) {
39568         LDKBuiltCommitmentTransaction this_arg_conv;
39569         this_arg_conv.inner = untag_ptr(this_arg);
39570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39572         this_arg_conv.is_owned = false;
39573         uint8_t funding_key_arr[32];
39574         CHECK(funding_key->arr_len == 32);
39575         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
39576         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
39577         LDKu8slice funding_redeemscript_ref;
39578         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39579         funding_redeemscript_ref.data = funding_redeemscript->elems;
39580         void* entropy_source_ptr = untag_ptr(entropy_source);
39581         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
39582         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
39583         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39584         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);
39585         FREE(funding_redeemscript);
39586         return ret_arr;
39587 }
39588
39589 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
39590         LDKClosingTransaction this_obj_conv;
39591         this_obj_conv.inner = untag_ptr(this_obj);
39592         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39594         ClosingTransaction_free(this_obj_conv);
39595 }
39596
39597 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
39598         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
39599         uint64_t ret_ref = 0;
39600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39602         return ret_ref;
39603 }
39604 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
39605         LDKClosingTransaction arg_conv;
39606         arg_conv.inner = untag_ptr(arg);
39607         arg_conv.is_owned = ptr_is_owned(arg);
39608         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39609         arg_conv.is_owned = false;
39610         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
39611         return ret_conv;
39612 }
39613
39614 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
39615         LDKClosingTransaction orig_conv;
39616         orig_conv.inner = untag_ptr(orig);
39617         orig_conv.is_owned = ptr_is_owned(orig);
39618         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39619         orig_conv.is_owned = false;
39620         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
39621         uint64_t ret_ref = 0;
39622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39624         return ret_ref;
39625 }
39626
39627 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
39628         LDKClosingTransaction o_conv;
39629         o_conv.inner = untag_ptr(o);
39630         o_conv.is_owned = ptr_is_owned(o);
39631         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39632         o_conv.is_owned = false;
39633         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
39634         return ret_conv;
39635 }
39636
39637 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
39638         LDKClosingTransaction a_conv;
39639         a_conv.inner = untag_ptr(a);
39640         a_conv.is_owned = ptr_is_owned(a);
39641         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39642         a_conv.is_owned = false;
39643         LDKClosingTransaction b_conv;
39644         b_conv.inner = untag_ptr(b);
39645         b_conv.is_owned = ptr_is_owned(b);
39646         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39647         b_conv.is_owned = false;
39648         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
39649         return ret_conv;
39650 }
39651
39652 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) {
39653         LDKCVec_u8Z to_holder_script_ref;
39654         to_holder_script_ref.datalen = to_holder_script->arr_len;
39655         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
39656         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
39657         LDKCVec_u8Z to_counterparty_script_ref;
39658         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
39659         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
39660         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
39661         LDKOutPoint funding_outpoint_conv;
39662         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
39663         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
39664         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39665         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39666         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
39667         uint64_t ret_ref = 0;
39668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39670         return ret_ref;
39671 }
39672
39673 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
39674         LDKClosingTransaction this_arg_conv;
39675         this_arg_conv.inner = untag_ptr(this_arg);
39676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39678         this_arg_conv.is_owned = false;
39679         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
39680         uint64_t ret_ref = 0;
39681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39683         return ret_ref;
39684 }
39685
39686 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
39687         LDKClosingTransaction this_arg_conv;
39688         this_arg_conv.inner = untag_ptr(this_arg);
39689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39691         this_arg_conv.is_owned = false;
39692         LDKOutPoint funding_outpoint_conv;
39693         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
39694         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
39695         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39696         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39697         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
39698         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
39699         return tag_ptr(ret_conv, true);
39700 }
39701
39702 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
39703         LDKClosingTransaction this_arg_conv;
39704         this_arg_conv.inner = untag_ptr(this_arg);
39705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39707         this_arg_conv.is_owned = false;
39708         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
39709         return ret_conv;
39710 }
39711
39712 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
39713         LDKClosingTransaction this_arg_conv;
39714         this_arg_conv.inner = untag_ptr(this_arg);
39715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39717         this_arg_conv.is_owned = false;
39718         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
39719         return ret_conv;
39720 }
39721
39722 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(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         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
39729         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39730         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39731         return ret_arr;
39732 }
39733
39734 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
39735         LDKClosingTransaction this_arg_conv;
39736         this_arg_conv.inner = untag_ptr(this_arg);
39737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39739         this_arg_conv.is_owned = false;
39740         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
39741         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39742         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39743         return ret_arr;
39744 }
39745
39746 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
39747         LDKTrustedClosingTransaction this_obj_conv;
39748         this_obj_conv.inner = untag_ptr(this_obj);
39749         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39751         TrustedClosingTransaction_free(this_obj_conv);
39752 }
39753
39754 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
39755         LDKTrustedClosingTransaction 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         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&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         Transaction_free(ret_var);
39764         return ret_arr;
39765 }
39766
39767 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) {
39768         LDKTrustedClosingTransaction this_arg_conv;
39769         this_arg_conv.inner = untag_ptr(this_arg);
39770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39772         this_arg_conv.is_owned = false;
39773         LDKu8slice funding_redeemscript_ref;
39774         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39775         funding_redeemscript_ref.data = funding_redeemscript->elems;
39776         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39777         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
39778         FREE(funding_redeemscript);
39779         return ret_arr;
39780 }
39781
39782 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) {
39783         LDKTrustedClosingTransaction this_arg_conv;
39784         this_arg_conv.inner = untag_ptr(this_arg);
39785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39787         this_arg_conv.is_owned = false;
39788         uint8_t funding_key_arr[32];
39789         CHECK(funding_key->arr_len == 32);
39790         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
39791         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
39792         LDKu8slice funding_redeemscript_ref;
39793         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39794         funding_redeemscript_ref.data = funding_redeemscript->elems;
39795         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39796         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
39797         FREE(funding_redeemscript);
39798         return ret_arr;
39799 }
39800
39801 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
39802         LDKCommitmentTransaction this_obj_conv;
39803         this_obj_conv.inner = untag_ptr(this_obj);
39804         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39806         CommitmentTransaction_free(this_obj_conv);
39807 }
39808
39809 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
39810         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
39811         uint64_t ret_ref = 0;
39812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39814         return ret_ref;
39815 }
39816 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
39817         LDKCommitmentTransaction arg_conv;
39818         arg_conv.inner = untag_ptr(arg);
39819         arg_conv.is_owned = ptr_is_owned(arg);
39820         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39821         arg_conv.is_owned = false;
39822         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
39823         return ret_conv;
39824 }
39825
39826 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
39827         LDKCommitmentTransaction orig_conv;
39828         orig_conv.inner = untag_ptr(orig);
39829         orig_conv.is_owned = ptr_is_owned(orig);
39830         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39831         orig_conv.is_owned = false;
39832         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
39833         uint64_t ret_ref = 0;
39834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39836         return ret_ref;
39837 }
39838
39839 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
39840         LDKCommitmentTransaction obj_conv;
39841         obj_conv.inner = untag_ptr(obj);
39842         obj_conv.is_owned = ptr_is_owned(obj);
39843         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39844         obj_conv.is_owned = false;
39845         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
39846         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39847         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39848         CVec_u8Z_free(ret_var);
39849         return ret_arr;
39850 }
39851
39852 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
39853         LDKu8slice ser_ref;
39854         ser_ref.datalen = ser->arr_len;
39855         ser_ref.data = ser->elems;
39856         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
39857         *ret_conv = CommitmentTransaction_read(ser_ref);
39858         FREE(ser);
39859         return tag_ptr(ret_conv, true);
39860 }
39861
39862 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
39863         LDKCommitmentTransaction this_arg_conv;
39864         this_arg_conv.inner = untag_ptr(this_arg);
39865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39867         this_arg_conv.is_owned = false;
39868         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
39869         return ret_conv;
39870 }
39871
39872 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
39873         LDKCommitmentTransaction this_arg_conv;
39874         this_arg_conv.inner = untag_ptr(this_arg);
39875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39877         this_arg_conv.is_owned = false;
39878         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
39879         return ret_conv;
39880 }
39881
39882 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(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_to_countersignatory_value_sat(&this_arg_conv);
39889         return ret_conv;
39890 }
39891
39892 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(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         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
39899         return ret_conv;
39900 }
39901
39902 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(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         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
39909         uint64_t ret_ref = 0;
39910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39912         return ret_ref;
39913 }
39914
39915 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) {
39916         LDKCommitmentTransaction this_arg_conv;
39917         this_arg_conv.inner = untag_ptr(this_arg);
39918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39920         this_arg_conv.is_owned = false;
39921         LDKDirectedChannelTransactionParameters channel_parameters_conv;
39922         channel_parameters_conv.inner = untag_ptr(channel_parameters);
39923         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
39924         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39925         channel_parameters_conv.is_owned = false;
39926         LDKChannelPublicKeys broadcaster_keys_conv;
39927         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
39928         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
39929         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
39930         broadcaster_keys_conv.is_owned = false;
39931         LDKChannelPublicKeys countersignatory_keys_conv;
39932         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
39933         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
39934         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
39935         countersignatory_keys_conv.is_owned = false;
39936         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
39937         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
39938         return tag_ptr(ret_conv, true);
39939 }
39940
39941 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
39942         LDKTrustedCommitmentTransaction this_obj_conv;
39943         this_obj_conv.inner = untag_ptr(this_obj);
39944         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39946         TrustedCommitmentTransaction_free(this_obj_conv);
39947 }
39948
39949 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
39950         LDKTrustedCommitmentTransaction this_arg_conv;
39951         this_arg_conv.inner = untag_ptr(this_arg);
39952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39954         this_arg_conv.is_owned = false;
39955         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39956         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
39957         return ret_arr;
39958 }
39959
39960 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
39961         LDKTrustedCommitmentTransaction this_arg_conv;
39962         this_arg_conv.inner = untag_ptr(this_arg);
39963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39965         this_arg_conv.is_owned = false;
39966         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
39967         uint64_t ret_ref = 0;
39968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39970         return ret_ref;
39971 }
39972
39973 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
39974         LDKTrustedCommitmentTransaction this_arg_conv;
39975         this_arg_conv.inner = untag_ptr(this_arg);
39976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39978         this_arg_conv.is_owned = false;
39979         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
39980         uint64_t ret_ref = 0;
39981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39983         return ret_ref;
39984 }
39985
39986 jboolean  __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint64_t this_arg) {
39987         LDKTrustedCommitmentTransaction this_arg_conv;
39988         this_arg_conv.inner = untag_ptr(this_arg);
39989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39991         this_arg_conv.is_owned = false;
39992         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
39993         return ret_conv;
39994 }
39995
39996 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) {
39997         LDKTrustedCommitmentTransaction this_arg_conv;
39998         this_arg_conv.inner = untag_ptr(this_arg);
39999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40001         this_arg_conv.is_owned = false;
40002         uint8_t htlc_base_key_arr[32];
40003         CHECK(htlc_base_key->arr_len == 32);
40004         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
40005         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
40006         LDKDirectedChannelTransactionParameters channel_parameters_conv;
40007         channel_parameters_conv.inner = untag_ptr(channel_parameters);
40008         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
40009         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
40010         channel_parameters_conv.is_owned = false;
40011         void* entropy_source_ptr = untag_ptr(entropy_source);
40012         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
40013         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
40014         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
40015         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
40016         return tag_ptr(ret_conv, true);
40017 }
40018
40019 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) {
40020         LDKPublicKey broadcaster_payment_basepoint_ref;
40021         CHECK(broadcaster_payment_basepoint->arr_len == 33);
40022         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
40023         LDKPublicKey countersignatory_payment_basepoint_ref;
40024         CHECK(countersignatory_payment_basepoint->arr_len == 33);
40025         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
40026         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
40027         return ret_conv;
40028 }
40029
40030 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
40031         LDKInitFeatures a_conv;
40032         a_conv.inner = untag_ptr(a);
40033         a_conv.is_owned = ptr_is_owned(a);
40034         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40035         a_conv.is_owned = false;
40036         LDKInitFeatures b_conv;
40037         b_conv.inner = untag_ptr(b);
40038         b_conv.is_owned = ptr_is_owned(b);
40039         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40040         b_conv.is_owned = false;
40041         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
40042         return ret_conv;
40043 }
40044
40045 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
40046         LDKNodeFeatures a_conv;
40047         a_conv.inner = untag_ptr(a);
40048         a_conv.is_owned = ptr_is_owned(a);
40049         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40050         a_conv.is_owned = false;
40051         LDKNodeFeatures b_conv;
40052         b_conv.inner = untag_ptr(b);
40053         b_conv.is_owned = ptr_is_owned(b);
40054         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40055         b_conv.is_owned = false;
40056         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
40057         return ret_conv;
40058 }
40059
40060 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
40061         LDKChannelFeatures a_conv;
40062         a_conv.inner = untag_ptr(a);
40063         a_conv.is_owned = ptr_is_owned(a);
40064         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40065         a_conv.is_owned = false;
40066         LDKChannelFeatures b_conv;
40067         b_conv.inner = untag_ptr(b);
40068         b_conv.is_owned = ptr_is_owned(b);
40069         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40070         b_conv.is_owned = false;
40071         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
40072         return ret_conv;
40073 }
40074
40075 jboolean  __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint64_t a, uint64_t b) {
40076         LDKInvoiceFeatures a_conv;
40077         a_conv.inner = untag_ptr(a);
40078         a_conv.is_owned = ptr_is_owned(a);
40079         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40080         a_conv.is_owned = false;
40081         LDKInvoiceFeatures b_conv;
40082         b_conv.inner = untag_ptr(b);
40083         b_conv.is_owned = ptr_is_owned(b);
40084         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40085         b_conv.is_owned = false;
40086         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
40087         return ret_conv;
40088 }
40089
40090 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
40091         LDKOfferFeatures a_conv;
40092         a_conv.inner = untag_ptr(a);
40093         a_conv.is_owned = ptr_is_owned(a);
40094         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40095         a_conv.is_owned = false;
40096         LDKOfferFeatures b_conv;
40097         b_conv.inner = untag_ptr(b);
40098         b_conv.is_owned = ptr_is_owned(b);
40099         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40100         b_conv.is_owned = false;
40101         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
40102         return ret_conv;
40103 }
40104
40105 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
40106         LDKInvoiceRequestFeatures a_conv;
40107         a_conv.inner = untag_ptr(a);
40108         a_conv.is_owned = ptr_is_owned(a);
40109         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40110         a_conv.is_owned = false;
40111         LDKInvoiceRequestFeatures b_conv;
40112         b_conv.inner = untag_ptr(b);
40113         b_conv.is_owned = ptr_is_owned(b);
40114         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40115         b_conv.is_owned = false;
40116         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
40117         return ret_conv;
40118 }
40119
40120 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_eq"))) TS_Bolt12InvoiceFeatures_eq(uint64_t a, uint64_t b) {
40121         LDKBolt12InvoiceFeatures a_conv;
40122         a_conv.inner = untag_ptr(a);
40123         a_conv.is_owned = ptr_is_owned(a);
40124         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40125         a_conv.is_owned = false;
40126         LDKBolt12InvoiceFeatures b_conv;
40127         b_conv.inner = untag_ptr(b);
40128         b_conv.is_owned = ptr_is_owned(b);
40129         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40130         b_conv.is_owned = false;
40131         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
40132         return ret_conv;
40133 }
40134
40135 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_eq"))) TS_BlindedHopFeatures_eq(uint64_t a, uint64_t b) {
40136         LDKBlindedHopFeatures a_conv;
40137         a_conv.inner = untag_ptr(a);
40138         a_conv.is_owned = ptr_is_owned(a);
40139         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40140         a_conv.is_owned = false;
40141         LDKBlindedHopFeatures b_conv;
40142         b_conv.inner = untag_ptr(b);
40143         b_conv.is_owned = ptr_is_owned(b);
40144         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40145         b_conv.is_owned = false;
40146         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
40147         return ret_conv;
40148 }
40149
40150 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
40151         LDKChannelTypeFeatures a_conv;
40152         a_conv.inner = untag_ptr(a);
40153         a_conv.is_owned = ptr_is_owned(a);
40154         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40155         a_conv.is_owned = false;
40156         LDKChannelTypeFeatures b_conv;
40157         b_conv.inner = untag_ptr(b);
40158         b_conv.is_owned = ptr_is_owned(b);
40159         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40160         b_conv.is_owned = false;
40161         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
40162         return ret_conv;
40163 }
40164
40165 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
40166         LDKInitFeatures ret_var = InitFeatures_clone(arg);
40167         uint64_t ret_ref = 0;
40168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40170         return ret_ref;
40171 }
40172 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
40173         LDKInitFeatures arg_conv;
40174         arg_conv.inner = untag_ptr(arg);
40175         arg_conv.is_owned = ptr_is_owned(arg);
40176         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40177         arg_conv.is_owned = false;
40178         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
40179         return ret_conv;
40180 }
40181
40182 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
40183         LDKInitFeatures orig_conv;
40184         orig_conv.inner = untag_ptr(orig);
40185         orig_conv.is_owned = ptr_is_owned(orig);
40186         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40187         orig_conv.is_owned = false;
40188         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
40189         uint64_t ret_ref = 0;
40190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40192         return ret_ref;
40193 }
40194
40195 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
40196         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
40197         uint64_t ret_ref = 0;
40198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40200         return ret_ref;
40201 }
40202 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
40203         LDKNodeFeatures arg_conv;
40204         arg_conv.inner = untag_ptr(arg);
40205         arg_conv.is_owned = ptr_is_owned(arg);
40206         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40207         arg_conv.is_owned = false;
40208         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
40209         return ret_conv;
40210 }
40211
40212 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
40213         LDKNodeFeatures orig_conv;
40214         orig_conv.inner = untag_ptr(orig);
40215         orig_conv.is_owned = ptr_is_owned(orig);
40216         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40217         orig_conv.is_owned = false;
40218         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
40219         uint64_t ret_ref = 0;
40220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40222         return ret_ref;
40223 }
40224
40225 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
40226         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
40227         uint64_t ret_ref = 0;
40228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40230         return ret_ref;
40231 }
40232 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
40233         LDKChannelFeatures arg_conv;
40234         arg_conv.inner = untag_ptr(arg);
40235         arg_conv.is_owned = ptr_is_owned(arg);
40236         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40237         arg_conv.is_owned = false;
40238         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
40239         return ret_conv;
40240 }
40241
40242 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
40243         LDKChannelFeatures orig_conv;
40244         orig_conv.inner = untag_ptr(orig);
40245         orig_conv.is_owned = ptr_is_owned(orig);
40246         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40247         orig_conv.is_owned = false;
40248         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
40249         uint64_t ret_ref = 0;
40250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40252         return ret_ref;
40253 }
40254
40255 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
40256         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
40257         uint64_t ret_ref = 0;
40258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40260         return ret_ref;
40261 }
40262 int64_t  __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint64_t arg) {
40263         LDKInvoiceFeatures arg_conv;
40264         arg_conv.inner = untag_ptr(arg);
40265         arg_conv.is_owned = ptr_is_owned(arg);
40266         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40267         arg_conv.is_owned = false;
40268         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
40269         return ret_conv;
40270 }
40271
40272 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint64_t orig) {
40273         LDKInvoiceFeatures orig_conv;
40274         orig_conv.inner = untag_ptr(orig);
40275         orig_conv.is_owned = ptr_is_owned(orig);
40276         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40277         orig_conv.is_owned = false;
40278         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
40279         uint64_t ret_ref = 0;
40280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40282         return ret_ref;
40283 }
40284
40285 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
40286         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
40287         uint64_t ret_ref = 0;
40288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40290         return ret_ref;
40291 }
40292 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
40293         LDKOfferFeatures arg_conv;
40294         arg_conv.inner = untag_ptr(arg);
40295         arg_conv.is_owned = ptr_is_owned(arg);
40296         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40297         arg_conv.is_owned = false;
40298         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
40299         return ret_conv;
40300 }
40301
40302 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
40303         LDKOfferFeatures orig_conv;
40304         orig_conv.inner = untag_ptr(orig);
40305         orig_conv.is_owned = ptr_is_owned(orig);
40306         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40307         orig_conv.is_owned = false;
40308         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
40309         uint64_t ret_ref = 0;
40310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40312         return ret_ref;
40313 }
40314
40315 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
40316         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
40317         uint64_t ret_ref = 0;
40318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40320         return ret_ref;
40321 }
40322 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
40323         LDKInvoiceRequestFeatures arg_conv;
40324         arg_conv.inner = untag_ptr(arg);
40325         arg_conv.is_owned = ptr_is_owned(arg);
40326         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40327         arg_conv.is_owned = false;
40328         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
40329         return ret_conv;
40330 }
40331
40332 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
40333         LDKInvoiceRequestFeatures orig_conv;
40334         orig_conv.inner = untag_ptr(orig);
40335         orig_conv.is_owned = ptr_is_owned(orig);
40336         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40337         orig_conv.is_owned = false;
40338         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
40339         uint64_t ret_ref = 0;
40340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40342         return ret_ref;
40343 }
40344
40345 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
40346         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
40347         uint64_t ret_ref = 0;
40348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40350         return ret_ref;
40351 }
40352 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone_ptr"))) TS_Bolt12InvoiceFeatures_clone_ptr(uint64_t arg) {
40353         LDKBolt12InvoiceFeatures arg_conv;
40354         arg_conv.inner = untag_ptr(arg);
40355         arg_conv.is_owned = ptr_is_owned(arg);
40356         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40357         arg_conv.is_owned = false;
40358         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
40359         return ret_conv;
40360 }
40361
40362 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone"))) TS_Bolt12InvoiceFeatures_clone(uint64_t orig) {
40363         LDKBolt12InvoiceFeatures orig_conv;
40364         orig_conv.inner = untag_ptr(orig);
40365         orig_conv.is_owned = ptr_is_owned(orig);
40366         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40367         orig_conv.is_owned = false;
40368         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
40369         uint64_t ret_ref = 0;
40370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40372         return ret_ref;
40373 }
40374
40375 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
40376         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
40377         uint64_t ret_ref = 0;
40378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40380         return ret_ref;
40381 }
40382 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone_ptr"))) TS_BlindedHopFeatures_clone_ptr(uint64_t arg) {
40383         LDKBlindedHopFeatures arg_conv;
40384         arg_conv.inner = untag_ptr(arg);
40385         arg_conv.is_owned = ptr_is_owned(arg);
40386         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40387         arg_conv.is_owned = false;
40388         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
40389         return ret_conv;
40390 }
40391
40392 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone"))) TS_BlindedHopFeatures_clone(uint64_t orig) {
40393         LDKBlindedHopFeatures orig_conv;
40394         orig_conv.inner = untag_ptr(orig);
40395         orig_conv.is_owned = ptr_is_owned(orig);
40396         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40397         orig_conv.is_owned = false;
40398         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
40399         uint64_t ret_ref = 0;
40400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40402         return ret_ref;
40403 }
40404
40405 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
40406         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
40407         uint64_t ret_ref = 0;
40408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40410         return ret_ref;
40411 }
40412 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
40413         LDKChannelTypeFeatures arg_conv;
40414         arg_conv.inner = untag_ptr(arg);
40415         arg_conv.is_owned = ptr_is_owned(arg);
40416         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40417         arg_conv.is_owned = false;
40418         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
40419         return ret_conv;
40420 }
40421
40422 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
40423         LDKChannelTypeFeatures orig_conv;
40424         orig_conv.inner = untag_ptr(orig);
40425         orig_conv.is_owned = ptr_is_owned(orig);
40426         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40427         orig_conv.is_owned = false;
40428         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
40429         uint64_t ret_ref = 0;
40430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40432         return ret_ref;
40433 }
40434
40435 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
40436         LDKInitFeatures this_obj_conv;
40437         this_obj_conv.inner = untag_ptr(this_obj);
40438         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40440         InitFeatures_free(this_obj_conv);
40441 }
40442
40443 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
40444         LDKNodeFeatures this_obj_conv;
40445         this_obj_conv.inner = untag_ptr(this_obj);
40446         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40448         NodeFeatures_free(this_obj_conv);
40449 }
40450
40451 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
40452         LDKChannelFeatures this_obj_conv;
40453         this_obj_conv.inner = untag_ptr(this_obj);
40454         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40456         ChannelFeatures_free(this_obj_conv);
40457 }
40458
40459 void  __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint64_t this_obj) {
40460         LDKInvoiceFeatures this_obj_conv;
40461         this_obj_conv.inner = untag_ptr(this_obj);
40462         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40464         InvoiceFeatures_free(this_obj_conv);
40465 }
40466
40467 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
40468         LDKOfferFeatures this_obj_conv;
40469         this_obj_conv.inner = untag_ptr(this_obj);
40470         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40472         OfferFeatures_free(this_obj_conv);
40473 }
40474
40475 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
40476         LDKInvoiceRequestFeatures this_obj_conv;
40477         this_obj_conv.inner = untag_ptr(this_obj);
40478         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40480         InvoiceRequestFeatures_free(this_obj_conv);
40481 }
40482
40483 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_free"))) TS_Bolt12InvoiceFeatures_free(uint64_t this_obj) {
40484         LDKBolt12InvoiceFeatures this_obj_conv;
40485         this_obj_conv.inner = untag_ptr(this_obj);
40486         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40488         Bolt12InvoiceFeatures_free(this_obj_conv);
40489 }
40490
40491 void  __attribute__((export_name("TS_BlindedHopFeatures_free"))) TS_BlindedHopFeatures_free(uint64_t this_obj) {
40492         LDKBlindedHopFeatures this_obj_conv;
40493         this_obj_conv.inner = untag_ptr(this_obj);
40494         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40496         BlindedHopFeatures_free(this_obj_conv);
40497 }
40498
40499 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
40500         LDKChannelTypeFeatures this_obj_conv;
40501         this_obj_conv.inner = untag_ptr(this_obj);
40502         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40504         ChannelTypeFeatures_free(this_obj_conv);
40505 }
40506
40507 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
40508         LDKInitFeatures ret_var = InitFeatures_empty();
40509         uint64_t ret_ref = 0;
40510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40512         return ret_ref;
40513 }
40514
40515 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
40516         LDKInitFeatures this_arg_conv;
40517         this_arg_conv.inner = untag_ptr(this_arg);
40518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40520         this_arg_conv.is_owned = false;
40521         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
40522         return ret_conv;
40523 }
40524
40525 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
40526         LDKNodeFeatures ret_var = NodeFeatures_empty();
40527         uint64_t ret_ref = 0;
40528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40530         return ret_ref;
40531 }
40532
40533 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
40534         LDKNodeFeatures this_arg_conv;
40535         this_arg_conv.inner = untag_ptr(this_arg);
40536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40538         this_arg_conv.is_owned = false;
40539         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
40540         return ret_conv;
40541 }
40542
40543 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
40544         LDKChannelFeatures ret_var = ChannelFeatures_empty();
40545         uint64_t ret_ref = 0;
40546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40548         return ret_ref;
40549 }
40550
40551 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
40552         LDKChannelFeatures this_arg_conv;
40553         this_arg_conv.inner = untag_ptr(this_arg);
40554         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40556         this_arg_conv.is_owned = false;
40557         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
40558         return ret_conv;
40559 }
40560
40561 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
40562         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
40563         uint64_t ret_ref = 0;
40564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40566         return ret_ref;
40567 }
40568
40569 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
40570         LDKInvoiceFeatures this_arg_conv;
40571         this_arg_conv.inner = untag_ptr(this_arg);
40572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40574         this_arg_conv.is_owned = false;
40575         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
40576         return ret_conv;
40577 }
40578
40579 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
40580         LDKOfferFeatures ret_var = OfferFeatures_empty();
40581         uint64_t ret_ref = 0;
40582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40584         return ret_ref;
40585 }
40586
40587 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
40588         LDKOfferFeatures this_arg_conv;
40589         this_arg_conv.inner = untag_ptr(this_arg);
40590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40592         this_arg_conv.is_owned = false;
40593         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
40594         return ret_conv;
40595 }
40596
40597 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
40598         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
40599         uint64_t ret_ref = 0;
40600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40602         return ret_ref;
40603 }
40604
40605 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
40606         LDKInvoiceRequestFeatures this_arg_conv;
40607         this_arg_conv.inner = untag_ptr(this_arg);
40608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40610         this_arg_conv.is_owned = false;
40611         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
40612         return ret_conv;
40613 }
40614
40615 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_empty"))) TS_Bolt12InvoiceFeatures_empty() {
40616         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
40617         uint64_t ret_ref = 0;
40618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40620         return ret_ref;
40621 }
40622
40623 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
40624         LDKBolt12InvoiceFeatures this_arg_conv;
40625         this_arg_conv.inner = untag_ptr(this_arg);
40626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40628         this_arg_conv.is_owned = false;
40629         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
40630         return ret_conv;
40631 }
40632
40633 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_empty"))) TS_BlindedHopFeatures_empty() {
40634         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
40635         uint64_t ret_ref = 0;
40636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40638         return ret_ref;
40639 }
40640
40641 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits"))) TS_BlindedHopFeatures_requires_unknown_bits(uint64_t this_arg) {
40642         LDKBlindedHopFeatures this_arg_conv;
40643         this_arg_conv.inner = untag_ptr(this_arg);
40644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40646         this_arg_conv.is_owned = false;
40647         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
40648         return ret_conv;
40649 }
40650
40651 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
40652         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
40653         uint64_t ret_ref = 0;
40654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40656         return ret_ref;
40657 }
40658
40659 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
40660         LDKChannelTypeFeatures this_arg_conv;
40661         this_arg_conv.inner = untag_ptr(this_arg);
40662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40664         this_arg_conv.is_owned = false;
40665         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
40666         return ret_conv;
40667 }
40668
40669 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
40670         LDKInitFeatures obj_conv;
40671         obj_conv.inner = untag_ptr(obj);
40672         obj_conv.is_owned = ptr_is_owned(obj);
40673         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40674         obj_conv.is_owned = false;
40675         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
40676         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40677         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40678         CVec_u8Z_free(ret_var);
40679         return ret_arr;
40680 }
40681
40682 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
40683         LDKu8slice ser_ref;
40684         ser_ref.datalen = ser->arr_len;
40685         ser_ref.data = ser->elems;
40686         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
40687         *ret_conv = InitFeatures_read(ser_ref);
40688         FREE(ser);
40689         return tag_ptr(ret_conv, true);
40690 }
40691
40692 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
40693         LDKChannelFeatures obj_conv;
40694         obj_conv.inner = untag_ptr(obj);
40695         obj_conv.is_owned = ptr_is_owned(obj);
40696         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40697         obj_conv.is_owned = false;
40698         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
40699         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40700         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40701         CVec_u8Z_free(ret_var);
40702         return ret_arr;
40703 }
40704
40705 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
40706         LDKu8slice ser_ref;
40707         ser_ref.datalen = ser->arr_len;
40708         ser_ref.data = ser->elems;
40709         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
40710         *ret_conv = ChannelFeatures_read(ser_ref);
40711         FREE(ser);
40712         return tag_ptr(ret_conv, true);
40713 }
40714
40715 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
40716         LDKNodeFeatures obj_conv;
40717         obj_conv.inner = untag_ptr(obj);
40718         obj_conv.is_owned = ptr_is_owned(obj);
40719         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40720         obj_conv.is_owned = false;
40721         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
40722         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40723         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40724         CVec_u8Z_free(ret_var);
40725         return ret_arr;
40726 }
40727
40728 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
40729         LDKu8slice ser_ref;
40730         ser_ref.datalen = ser->arr_len;
40731         ser_ref.data = ser->elems;
40732         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
40733         *ret_conv = NodeFeatures_read(ser_ref);
40734         FREE(ser);
40735         return tag_ptr(ret_conv, true);
40736 }
40737
40738 int8_tArray  __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint64_t obj) {
40739         LDKInvoiceFeatures obj_conv;
40740         obj_conv.inner = untag_ptr(obj);
40741         obj_conv.is_owned = ptr_is_owned(obj);
40742         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40743         obj_conv.is_owned = false;
40744         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
40745         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40746         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40747         CVec_u8Z_free(ret_var);
40748         return ret_arr;
40749 }
40750
40751 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
40752         LDKu8slice ser_ref;
40753         ser_ref.datalen = ser->arr_len;
40754         ser_ref.data = ser->elems;
40755         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
40756         *ret_conv = InvoiceFeatures_read(ser_ref);
40757         FREE(ser);
40758         return tag_ptr(ret_conv, true);
40759 }
40760
40761 int8_tArray  __attribute__((export_name("TS_BlindedHopFeatures_write"))) TS_BlindedHopFeatures_write(uint64_t obj) {
40762         LDKBlindedHopFeatures obj_conv;
40763         obj_conv.inner = untag_ptr(obj);
40764         obj_conv.is_owned = ptr_is_owned(obj);
40765         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40766         obj_conv.is_owned = false;
40767         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
40768         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40769         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40770         CVec_u8Z_free(ret_var);
40771         return ret_arr;
40772 }
40773
40774 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_read"))) TS_BlindedHopFeatures_read(int8_tArray ser) {
40775         LDKu8slice ser_ref;
40776         ser_ref.datalen = ser->arr_len;
40777         ser_ref.data = ser->elems;
40778         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
40779         *ret_conv = BlindedHopFeatures_read(ser_ref);
40780         FREE(ser);
40781         return tag_ptr(ret_conv, true);
40782 }
40783
40784 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
40785         LDKChannelTypeFeatures obj_conv;
40786         obj_conv.inner = untag_ptr(obj);
40787         obj_conv.is_owned = ptr_is_owned(obj);
40788         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40789         obj_conv.is_owned = false;
40790         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
40791         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40792         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40793         CVec_u8Z_free(ret_var);
40794         return ret_arr;
40795 }
40796
40797 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
40798         LDKu8slice ser_ref;
40799         ser_ref.datalen = ser->arr_len;
40800         ser_ref.data = ser->elems;
40801         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
40802         *ret_conv = ChannelTypeFeatures_read(ser_ref);
40803         FREE(ser);
40804         return tag_ptr(ret_conv, true);
40805 }
40806
40807 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
40808         LDKInitFeatures this_arg_conv;
40809         this_arg_conv.inner = untag_ptr(this_arg);
40810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40812         this_arg_conv.is_owned = false;
40813         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
40814 }
40815
40816 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
40817         LDKInitFeatures this_arg_conv;
40818         this_arg_conv.inner = untag_ptr(this_arg);
40819         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40821         this_arg_conv.is_owned = false;
40822         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
40823 }
40824
40825 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
40826         LDKInitFeatures this_arg_conv;
40827         this_arg_conv.inner = untag_ptr(this_arg);
40828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40830         this_arg_conv.is_owned = false;
40831         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
40832         return ret_conv;
40833 }
40834
40835 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
40836         LDKNodeFeatures this_arg_conv;
40837         this_arg_conv.inner = untag_ptr(this_arg);
40838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40840         this_arg_conv.is_owned = false;
40841         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
40842 }
40843
40844 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
40845         LDKNodeFeatures this_arg_conv;
40846         this_arg_conv.inner = untag_ptr(this_arg);
40847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40849         this_arg_conv.is_owned = false;
40850         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
40851 }
40852
40853 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
40854         LDKNodeFeatures this_arg_conv;
40855         this_arg_conv.inner = untag_ptr(this_arg);
40856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40858         this_arg_conv.is_owned = false;
40859         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
40860         return ret_conv;
40861 }
40862
40863 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
40864         LDKInitFeatures this_arg_conv;
40865         this_arg_conv.inner = untag_ptr(this_arg);
40866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40868         this_arg_conv.is_owned = false;
40869         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
40870         return ret_conv;
40871 }
40872
40873 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_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_requires_data_loss_protect(&this_arg_conv);
40880         return ret_conv;
40881 }
40882
40883 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(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         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
40890 }
40891
40892 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
40893         LDKInitFeatures this_arg_conv;
40894         this_arg_conv.inner = untag_ptr(this_arg);
40895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40897         this_arg_conv.is_owned = false;
40898         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
40899 }
40900
40901 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
40902         LDKInitFeatures this_arg_conv;
40903         this_arg_conv.inner = untag_ptr(this_arg);
40904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40906         this_arg_conv.is_owned = false;
40907         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
40908         return ret_conv;
40909 }
40910
40911 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
40912         LDKInitFeatures this_arg_conv;
40913         this_arg_conv.inner = untag_ptr(this_arg);
40914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40916         this_arg_conv.is_owned = false;
40917         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40918 }
40919
40920 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
40921         LDKInitFeatures this_arg_conv;
40922         this_arg_conv.inner = untag_ptr(this_arg);
40923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40925         this_arg_conv.is_owned = false;
40926         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40927 }
40928
40929 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
40930         LDKInitFeatures this_arg_conv;
40931         this_arg_conv.inner = untag_ptr(this_arg);
40932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40934         this_arg_conv.is_owned = false;
40935         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40936         return ret_conv;
40937 }
40938
40939 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
40940         LDKNodeFeatures this_arg_conv;
40941         this_arg_conv.inner = untag_ptr(this_arg);
40942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40944         this_arg_conv.is_owned = false;
40945         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40946 }
40947
40948 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
40949         LDKNodeFeatures this_arg_conv;
40950         this_arg_conv.inner = untag_ptr(this_arg);
40951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40953         this_arg_conv.is_owned = false;
40954         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40955 }
40956
40957 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
40958         LDKNodeFeatures this_arg_conv;
40959         this_arg_conv.inner = untag_ptr(this_arg);
40960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40962         this_arg_conv.is_owned = false;
40963         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40964         return ret_conv;
40965 }
40966
40967 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
40968         LDKInitFeatures this_arg_conv;
40969         this_arg_conv.inner = untag_ptr(this_arg);
40970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40972         this_arg_conv.is_owned = false;
40973         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
40974         return ret_conv;
40975 }
40976
40977 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_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_requires_upfront_shutdown_script(&this_arg_conv);
40984         return ret_conv;
40985 }
40986
40987 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(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         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
40994 }
40995
40996 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
40997         LDKInitFeatures this_arg_conv;
40998         this_arg_conv.inner = untag_ptr(this_arg);
40999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41001         this_arg_conv.is_owned = false;
41002         InitFeatures_set_gossip_queries_required(&this_arg_conv);
41003 }
41004
41005 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
41006         LDKInitFeatures this_arg_conv;
41007         this_arg_conv.inner = untag_ptr(this_arg);
41008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41010         this_arg_conv.is_owned = false;
41011         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
41012         return ret_conv;
41013 }
41014
41015 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
41016         LDKNodeFeatures this_arg_conv;
41017         this_arg_conv.inner = untag_ptr(this_arg);
41018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41020         this_arg_conv.is_owned = false;
41021         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
41022 }
41023
41024 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
41025         LDKNodeFeatures this_arg_conv;
41026         this_arg_conv.inner = untag_ptr(this_arg);
41027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41029         this_arg_conv.is_owned = false;
41030         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
41031 }
41032
41033 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
41034         LDKNodeFeatures this_arg_conv;
41035         this_arg_conv.inner = untag_ptr(this_arg);
41036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41038         this_arg_conv.is_owned = false;
41039         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
41040         return ret_conv;
41041 }
41042
41043 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
41044         LDKInitFeatures this_arg_conv;
41045         this_arg_conv.inner = untag_ptr(this_arg);
41046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41048         this_arg_conv.is_owned = false;
41049         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
41050         return ret_conv;
41051 }
41052
41053 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_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_requires_gossip_queries(&this_arg_conv);
41060         return ret_conv;
41061 }
41062
41063 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(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         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
41070 }
41071
41072 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
41073         LDKInitFeatures this_arg_conv;
41074         this_arg_conv.inner = untag_ptr(this_arg);
41075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41077         this_arg_conv.is_owned = false;
41078         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
41079 }
41080
41081 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
41082         LDKInitFeatures this_arg_conv;
41083         this_arg_conv.inner = untag_ptr(this_arg);
41084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41086         this_arg_conv.is_owned = false;
41087         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
41088         return ret_conv;
41089 }
41090
41091 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
41092         LDKNodeFeatures this_arg_conv;
41093         this_arg_conv.inner = untag_ptr(this_arg);
41094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41096         this_arg_conv.is_owned = false;
41097         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
41098 }
41099
41100 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
41101         LDKNodeFeatures this_arg_conv;
41102         this_arg_conv.inner = untag_ptr(this_arg);
41103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41105         this_arg_conv.is_owned = false;
41106         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
41107 }
41108
41109 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
41110         LDKNodeFeatures this_arg_conv;
41111         this_arg_conv.inner = untag_ptr(this_arg);
41112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41114         this_arg_conv.is_owned = false;
41115         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
41116         return ret_conv;
41117 }
41118
41119 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_optional"))) TS_InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
41120         LDKInvoiceFeatures this_arg_conv;
41121         this_arg_conv.inner = untag_ptr(this_arg);
41122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41124         this_arg_conv.is_owned = false;
41125         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
41126 }
41127
41128 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_required"))) TS_InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
41129         LDKInvoiceFeatures this_arg_conv;
41130         this_arg_conv.inner = untag_ptr(this_arg);
41131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41133         this_arg_conv.is_owned = false;
41134         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
41135 }
41136
41137 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_variable_length_onion"))) TS_InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
41138         LDKInvoiceFeatures this_arg_conv;
41139         this_arg_conv.inner = untag_ptr(this_arg);
41140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41142         this_arg_conv.is_owned = false;
41143         jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
41144         return ret_conv;
41145 }
41146
41147 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
41148         LDKInitFeatures this_arg_conv;
41149         this_arg_conv.inner = untag_ptr(this_arg);
41150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41152         this_arg_conv.is_owned = false;
41153         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
41154         return ret_conv;
41155 }
41156
41157 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
41158         LDKNodeFeatures 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 = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
41164         return ret_conv;
41165 }
41166
41167 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_variable_length_onion"))) TS_InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
41168         LDKInvoiceFeatures 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 = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
41174         return ret_conv;
41175 }
41176
41177 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
41178         LDKInitFeatures 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         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
41184 }
41185
41186 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
41187         LDKInitFeatures this_arg_conv;
41188         this_arg_conv.inner = untag_ptr(this_arg);
41189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41191         this_arg_conv.is_owned = false;
41192         InitFeatures_set_static_remote_key_required(&this_arg_conv);
41193 }
41194
41195 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
41196         LDKInitFeatures this_arg_conv;
41197         this_arg_conv.inner = untag_ptr(this_arg);
41198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41200         this_arg_conv.is_owned = false;
41201         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
41202         return ret_conv;
41203 }
41204
41205 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
41206         LDKNodeFeatures this_arg_conv;
41207         this_arg_conv.inner = untag_ptr(this_arg);
41208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41210         this_arg_conv.is_owned = false;
41211         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
41212 }
41213
41214 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
41215         LDKNodeFeatures this_arg_conv;
41216         this_arg_conv.inner = untag_ptr(this_arg);
41217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41219         this_arg_conv.is_owned = false;
41220         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
41221 }
41222
41223 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
41224         LDKNodeFeatures this_arg_conv;
41225         this_arg_conv.inner = untag_ptr(this_arg);
41226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41228         this_arg_conv.is_owned = false;
41229         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
41230         return ret_conv;
41231 }
41232
41233 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
41234         LDKChannelTypeFeatures this_arg_conv;
41235         this_arg_conv.inner = untag_ptr(this_arg);
41236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41238         this_arg_conv.is_owned = false;
41239         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
41240 }
41241
41242 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
41243         LDKChannelTypeFeatures this_arg_conv;
41244         this_arg_conv.inner = untag_ptr(this_arg);
41245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41247         this_arg_conv.is_owned = false;
41248         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
41249 }
41250
41251 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
41252         LDKChannelTypeFeatures this_arg_conv;
41253         this_arg_conv.inner = untag_ptr(this_arg);
41254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41256         this_arg_conv.is_owned = false;
41257         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
41258         return ret_conv;
41259 }
41260
41261 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
41262         LDKInitFeatures this_arg_conv;
41263         this_arg_conv.inner = untag_ptr(this_arg);
41264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41266         this_arg_conv.is_owned = false;
41267         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
41268         return ret_conv;
41269 }
41270
41271 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
41272         LDKNodeFeatures 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 = NodeFeatures_requires_static_remote_key(&this_arg_conv);
41278         return ret_conv;
41279 }
41280
41281 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
41282         LDKChannelTypeFeatures 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 = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
41288         return ret_conv;
41289 }
41290
41291 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
41292         LDKInitFeatures 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         InitFeatures_set_payment_secret_optional(&this_arg_conv);
41298 }
41299
41300 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
41301         LDKInitFeatures this_arg_conv;
41302         this_arg_conv.inner = untag_ptr(this_arg);
41303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41305         this_arg_conv.is_owned = false;
41306         InitFeatures_set_payment_secret_required(&this_arg_conv);
41307 }
41308
41309 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
41310         LDKInitFeatures this_arg_conv;
41311         this_arg_conv.inner = untag_ptr(this_arg);
41312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41314         this_arg_conv.is_owned = false;
41315         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
41316         return ret_conv;
41317 }
41318
41319 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
41320         LDKNodeFeatures this_arg_conv;
41321         this_arg_conv.inner = untag_ptr(this_arg);
41322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41324         this_arg_conv.is_owned = false;
41325         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
41326 }
41327
41328 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
41329         LDKNodeFeatures this_arg_conv;
41330         this_arg_conv.inner = untag_ptr(this_arg);
41331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41333         this_arg_conv.is_owned = false;
41334         NodeFeatures_set_payment_secret_required(&this_arg_conv);
41335 }
41336
41337 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
41338         LDKNodeFeatures this_arg_conv;
41339         this_arg_conv.inner = untag_ptr(this_arg);
41340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41342         this_arg_conv.is_owned = false;
41343         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
41344         return ret_conv;
41345 }
41346
41347 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_optional"))) TS_InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
41348         LDKInvoiceFeatures this_arg_conv;
41349         this_arg_conv.inner = untag_ptr(this_arg);
41350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41352         this_arg_conv.is_owned = false;
41353         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
41354 }
41355
41356 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_required"))) TS_InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
41357         LDKInvoiceFeatures this_arg_conv;
41358         this_arg_conv.inner = untag_ptr(this_arg);
41359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41361         this_arg_conv.is_owned = false;
41362         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
41363 }
41364
41365 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_payment_secret"))) TS_InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
41366         LDKInvoiceFeatures this_arg_conv;
41367         this_arg_conv.inner = untag_ptr(this_arg);
41368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41370         this_arg_conv.is_owned = false;
41371         jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
41372         return ret_conv;
41373 }
41374
41375 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
41376         LDKInitFeatures this_arg_conv;
41377         this_arg_conv.inner = untag_ptr(this_arg);
41378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41380         this_arg_conv.is_owned = false;
41381         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
41382         return ret_conv;
41383 }
41384
41385 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
41386         LDKNodeFeatures 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 = NodeFeatures_requires_payment_secret(&this_arg_conv);
41392         return ret_conv;
41393 }
41394
41395 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_payment_secret"))) TS_InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
41396         LDKInvoiceFeatures 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 = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
41402         return ret_conv;
41403 }
41404
41405 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41406         LDKInitFeatures 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         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
41412 }
41413
41414 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
41415         LDKInitFeatures this_arg_conv;
41416         this_arg_conv.inner = untag_ptr(this_arg);
41417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41419         this_arg_conv.is_owned = false;
41420         InitFeatures_set_basic_mpp_required(&this_arg_conv);
41421 }
41422
41423 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
41424         LDKInitFeatures this_arg_conv;
41425         this_arg_conv.inner = untag_ptr(this_arg);
41426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41428         this_arg_conv.is_owned = false;
41429         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
41430         return ret_conv;
41431 }
41432
41433 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41434         LDKNodeFeatures this_arg_conv;
41435         this_arg_conv.inner = untag_ptr(this_arg);
41436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41438         this_arg_conv.is_owned = false;
41439         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
41440 }
41441
41442 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
41443         LDKNodeFeatures this_arg_conv;
41444         this_arg_conv.inner = untag_ptr(this_arg);
41445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41447         this_arg_conv.is_owned = false;
41448         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
41449 }
41450
41451 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
41452         LDKNodeFeatures this_arg_conv;
41453         this_arg_conv.inner = untag_ptr(this_arg);
41454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41456         this_arg_conv.is_owned = false;
41457         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
41458         return ret_conv;
41459 }
41460
41461 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_optional"))) TS_InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41462         LDKInvoiceFeatures this_arg_conv;
41463         this_arg_conv.inner = untag_ptr(this_arg);
41464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41466         this_arg_conv.is_owned = false;
41467         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
41468 }
41469
41470 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_required"))) TS_InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
41471         LDKInvoiceFeatures this_arg_conv;
41472         this_arg_conv.inner = untag_ptr(this_arg);
41473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41475         this_arg_conv.is_owned = false;
41476         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
41477 }
41478
41479 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) TS_InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
41480         LDKInvoiceFeatures this_arg_conv;
41481         this_arg_conv.inner = untag_ptr(this_arg);
41482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41484         this_arg_conv.is_owned = false;
41485         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
41486         return ret_conv;
41487 }
41488
41489 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
41490         LDKBolt12InvoiceFeatures this_arg_conv;
41491         this_arg_conv.inner = untag_ptr(this_arg);
41492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41494         this_arg_conv.is_owned = false;
41495         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
41496 }
41497
41498 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
41499         LDKBolt12InvoiceFeatures this_arg_conv;
41500         this_arg_conv.inner = untag_ptr(this_arg);
41501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41503         this_arg_conv.is_owned = false;
41504         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
41505 }
41506
41507 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_supports_basic_mpp"))) TS_Bolt12InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
41508         LDKBolt12InvoiceFeatures this_arg_conv;
41509         this_arg_conv.inner = untag_ptr(this_arg);
41510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41512         this_arg_conv.is_owned = false;
41513         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
41514         return ret_conv;
41515 }
41516
41517 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
41518         LDKInitFeatures this_arg_conv;
41519         this_arg_conv.inner = untag_ptr(this_arg);
41520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41522         this_arg_conv.is_owned = false;
41523         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
41524         return ret_conv;
41525 }
41526
41527 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
41528         LDKNodeFeatures 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 = NodeFeatures_requires_basic_mpp(&this_arg_conv);
41534         return ret_conv;
41535 }
41536
41537 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) TS_InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
41538         LDKInvoiceFeatures 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 = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
41544         return ret_conv;
41545 }
41546
41547 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_basic_mpp"))) TS_Bolt12InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
41548         LDKBolt12InvoiceFeatures 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 = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
41554         return ret_conv;
41555 }
41556
41557 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
41558         LDKInitFeatures 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         InitFeatures_set_wumbo_optional(&this_arg_conv);
41564 }
41565
41566 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
41567         LDKInitFeatures this_arg_conv;
41568         this_arg_conv.inner = untag_ptr(this_arg);
41569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41571         this_arg_conv.is_owned = false;
41572         InitFeatures_set_wumbo_required(&this_arg_conv);
41573 }
41574
41575 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
41576         LDKInitFeatures this_arg_conv;
41577         this_arg_conv.inner = untag_ptr(this_arg);
41578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41580         this_arg_conv.is_owned = false;
41581         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
41582         return ret_conv;
41583 }
41584
41585 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
41586         LDKNodeFeatures this_arg_conv;
41587         this_arg_conv.inner = untag_ptr(this_arg);
41588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41590         this_arg_conv.is_owned = false;
41591         NodeFeatures_set_wumbo_optional(&this_arg_conv);
41592 }
41593
41594 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
41595         LDKNodeFeatures this_arg_conv;
41596         this_arg_conv.inner = untag_ptr(this_arg);
41597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41599         this_arg_conv.is_owned = false;
41600         NodeFeatures_set_wumbo_required(&this_arg_conv);
41601 }
41602
41603 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
41604         LDKNodeFeatures this_arg_conv;
41605         this_arg_conv.inner = untag_ptr(this_arg);
41606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41608         this_arg_conv.is_owned = false;
41609         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
41610         return ret_conv;
41611 }
41612
41613 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
41614         LDKInitFeatures this_arg_conv;
41615         this_arg_conv.inner = untag_ptr(this_arg);
41616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41618         this_arg_conv.is_owned = false;
41619         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
41620         return ret_conv;
41621 }
41622
41623 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_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_requires_wumbo(&this_arg_conv);
41630         return ret_conv;
41631 }
41632
41633 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) {
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         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
41640 }
41641
41642 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) {
41643         LDKInitFeatures this_arg_conv;
41644         this_arg_conv.inner = untag_ptr(this_arg);
41645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41647         this_arg_conv.is_owned = false;
41648         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
41649 }
41650
41651 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41652         LDKInitFeatures this_arg_conv;
41653         this_arg_conv.inner = untag_ptr(this_arg);
41654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41656         this_arg_conv.is_owned = false;
41657         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
41658         return ret_conv;
41659 }
41660
41661 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) {
41662         LDKNodeFeatures this_arg_conv;
41663         this_arg_conv.inner = untag_ptr(this_arg);
41664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41666         this_arg_conv.is_owned = false;
41667         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
41668 }
41669
41670 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) {
41671         LDKNodeFeatures this_arg_conv;
41672         this_arg_conv.inner = untag_ptr(this_arg);
41673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41675         this_arg_conv.is_owned = false;
41676         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
41677 }
41678
41679 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41680         LDKNodeFeatures this_arg_conv;
41681         this_arg_conv.inner = untag_ptr(this_arg);
41682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41684         this_arg_conv.is_owned = false;
41685         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
41686         return ret_conv;
41687 }
41688
41689 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) {
41690         LDKChannelTypeFeatures this_arg_conv;
41691         this_arg_conv.inner = untag_ptr(this_arg);
41692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41694         this_arg_conv.is_owned = false;
41695         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
41696 }
41697
41698 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) {
41699         LDKChannelTypeFeatures this_arg_conv;
41700         this_arg_conv.inner = untag_ptr(this_arg);
41701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41703         this_arg_conv.is_owned = false;
41704         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
41705 }
41706
41707 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41708         LDKChannelTypeFeatures this_arg_conv;
41709         this_arg_conv.inner = untag_ptr(this_arg);
41710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41712         this_arg_conv.is_owned = false;
41713         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
41714         return ret_conv;
41715 }
41716
41717 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41718         LDKInitFeatures this_arg_conv;
41719         this_arg_conv.inner = untag_ptr(this_arg);
41720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41722         this_arg_conv.is_owned = false;
41723         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
41724         return ret_conv;
41725 }
41726
41727 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41728         LDKNodeFeatures 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 = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
41734         return ret_conv;
41735 }
41736
41737 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
41738         LDKChannelTypeFeatures 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 = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
41744         return ret_conv;
41745 }
41746
41747 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
41748         LDKInitFeatures 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         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
41754 }
41755
41756 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
41757         LDKInitFeatures this_arg_conv;
41758         this_arg_conv.inner = untag_ptr(this_arg);
41759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41761         this_arg_conv.is_owned = false;
41762         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
41763 }
41764
41765 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
41766         LDKInitFeatures this_arg_conv;
41767         this_arg_conv.inner = untag_ptr(this_arg);
41768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41770         this_arg_conv.is_owned = false;
41771         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
41772         return ret_conv;
41773 }
41774
41775 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
41776         LDKNodeFeatures this_arg_conv;
41777         this_arg_conv.inner = untag_ptr(this_arg);
41778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41780         this_arg_conv.is_owned = false;
41781         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
41782 }
41783
41784 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
41785         LDKNodeFeatures this_arg_conv;
41786         this_arg_conv.inner = untag_ptr(this_arg);
41787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41789         this_arg_conv.is_owned = false;
41790         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
41791 }
41792
41793 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
41794         LDKNodeFeatures this_arg_conv;
41795         this_arg_conv.inner = untag_ptr(this_arg);
41796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41798         this_arg_conv.is_owned = false;
41799         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
41800         return ret_conv;
41801 }
41802
41803 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
41804         LDKInitFeatures this_arg_conv;
41805         this_arg_conv.inner = untag_ptr(this_arg);
41806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41808         this_arg_conv.is_owned = false;
41809         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
41810         return ret_conv;
41811 }
41812
41813 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_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_requires_shutdown_anysegwit(&this_arg_conv);
41820         return ret_conv;
41821 }
41822
41823 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(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         InitFeatures_set_onion_messages_optional(&this_arg_conv);
41830 }
41831
41832 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
41833         LDKInitFeatures this_arg_conv;
41834         this_arg_conv.inner = untag_ptr(this_arg);
41835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41837         this_arg_conv.is_owned = false;
41838         InitFeatures_set_onion_messages_required(&this_arg_conv);
41839 }
41840
41841 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
41842         LDKInitFeatures this_arg_conv;
41843         this_arg_conv.inner = untag_ptr(this_arg);
41844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41846         this_arg_conv.is_owned = false;
41847         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
41848         return ret_conv;
41849 }
41850
41851 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
41852         LDKNodeFeatures this_arg_conv;
41853         this_arg_conv.inner = untag_ptr(this_arg);
41854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41856         this_arg_conv.is_owned = false;
41857         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
41858 }
41859
41860 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
41861         LDKNodeFeatures this_arg_conv;
41862         this_arg_conv.inner = untag_ptr(this_arg);
41863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41865         this_arg_conv.is_owned = false;
41866         NodeFeatures_set_onion_messages_required(&this_arg_conv);
41867 }
41868
41869 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
41870         LDKNodeFeatures this_arg_conv;
41871         this_arg_conv.inner = untag_ptr(this_arg);
41872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41874         this_arg_conv.is_owned = false;
41875         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
41876         return ret_conv;
41877 }
41878
41879 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
41880         LDKInitFeatures this_arg_conv;
41881         this_arg_conv.inner = untag_ptr(this_arg);
41882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41884         this_arg_conv.is_owned = false;
41885         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
41886         return ret_conv;
41887 }
41888
41889 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_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_requires_onion_messages(&this_arg_conv);
41896         return ret_conv;
41897 }
41898
41899 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(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         InitFeatures_set_channel_type_optional(&this_arg_conv);
41906 }
41907
41908 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
41909         LDKInitFeatures this_arg_conv;
41910         this_arg_conv.inner = untag_ptr(this_arg);
41911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41913         this_arg_conv.is_owned = false;
41914         InitFeatures_set_channel_type_required(&this_arg_conv);
41915 }
41916
41917 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
41918         LDKInitFeatures this_arg_conv;
41919         this_arg_conv.inner = untag_ptr(this_arg);
41920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41922         this_arg_conv.is_owned = false;
41923         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
41924         return ret_conv;
41925 }
41926
41927 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
41928         LDKNodeFeatures this_arg_conv;
41929         this_arg_conv.inner = untag_ptr(this_arg);
41930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41932         this_arg_conv.is_owned = false;
41933         NodeFeatures_set_channel_type_optional(&this_arg_conv);
41934 }
41935
41936 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
41937         LDKNodeFeatures this_arg_conv;
41938         this_arg_conv.inner = untag_ptr(this_arg);
41939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41941         this_arg_conv.is_owned = false;
41942         NodeFeatures_set_channel_type_required(&this_arg_conv);
41943 }
41944
41945 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
41946         LDKNodeFeatures this_arg_conv;
41947         this_arg_conv.inner = untag_ptr(this_arg);
41948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41950         this_arg_conv.is_owned = false;
41951         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
41952         return ret_conv;
41953 }
41954
41955 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
41956         LDKInitFeatures this_arg_conv;
41957         this_arg_conv.inner = untag_ptr(this_arg);
41958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41960         this_arg_conv.is_owned = false;
41961         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
41962         return ret_conv;
41963 }
41964
41965 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_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_requires_channel_type(&this_arg_conv);
41972         return ret_conv;
41973 }
41974
41975 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(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         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
41982 }
41983
41984 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
41985         LDKInitFeatures this_arg_conv;
41986         this_arg_conv.inner = untag_ptr(this_arg);
41987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41989         this_arg_conv.is_owned = false;
41990         InitFeatures_set_scid_privacy_required(&this_arg_conv);
41991 }
41992
41993 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
41994         LDKInitFeatures this_arg_conv;
41995         this_arg_conv.inner = untag_ptr(this_arg);
41996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41998         this_arg_conv.is_owned = false;
41999         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
42000         return ret_conv;
42001 }
42002
42003 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
42004         LDKNodeFeatures this_arg_conv;
42005         this_arg_conv.inner = untag_ptr(this_arg);
42006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42008         this_arg_conv.is_owned = false;
42009         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
42010 }
42011
42012 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
42013         LDKNodeFeatures this_arg_conv;
42014         this_arg_conv.inner = untag_ptr(this_arg);
42015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42017         this_arg_conv.is_owned = false;
42018         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
42019 }
42020
42021 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
42022         LDKNodeFeatures this_arg_conv;
42023         this_arg_conv.inner = untag_ptr(this_arg);
42024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42026         this_arg_conv.is_owned = false;
42027         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
42028         return ret_conv;
42029 }
42030
42031 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
42032         LDKChannelTypeFeatures this_arg_conv;
42033         this_arg_conv.inner = untag_ptr(this_arg);
42034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42036         this_arg_conv.is_owned = false;
42037         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
42038 }
42039
42040 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
42041         LDKChannelTypeFeatures this_arg_conv;
42042         this_arg_conv.inner = untag_ptr(this_arg);
42043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42045         this_arg_conv.is_owned = false;
42046         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
42047 }
42048
42049 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
42050         LDKChannelTypeFeatures this_arg_conv;
42051         this_arg_conv.inner = untag_ptr(this_arg);
42052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42054         this_arg_conv.is_owned = false;
42055         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
42056         return ret_conv;
42057 }
42058
42059 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
42060         LDKInitFeatures this_arg_conv;
42061         this_arg_conv.inner = untag_ptr(this_arg);
42062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42064         this_arg_conv.is_owned = false;
42065         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
42066         return ret_conv;
42067 }
42068
42069 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
42070         LDKNodeFeatures 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 = NodeFeatures_requires_scid_privacy(&this_arg_conv);
42076         return ret_conv;
42077 }
42078
42079 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
42080         LDKChannelTypeFeatures 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 = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
42086         return ret_conv;
42087 }
42088
42089 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_metadata_optional"))) TS_InvoiceFeatures_set_payment_metadata_optional(uint64_t this_arg) {
42090         LDKInvoiceFeatures 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         InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
42096 }
42097
42098 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_metadata_required"))) TS_InvoiceFeatures_set_payment_metadata_required(uint64_t this_arg) {
42099         LDKInvoiceFeatures this_arg_conv;
42100         this_arg_conv.inner = untag_ptr(this_arg);
42101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42103         this_arg_conv.is_owned = false;
42104         InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
42105 }
42106
42107 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_payment_metadata"))) TS_InvoiceFeatures_supports_payment_metadata(uint64_t this_arg) {
42108         LDKInvoiceFeatures this_arg_conv;
42109         this_arg_conv.inner = untag_ptr(this_arg);
42110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42112         this_arg_conv.is_owned = false;
42113         jboolean ret_conv = InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
42114         return ret_conv;
42115 }
42116
42117 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_payment_metadata"))) TS_InvoiceFeatures_requires_payment_metadata(uint64_t this_arg) {
42118         LDKInvoiceFeatures this_arg_conv;
42119         this_arg_conv.inner = untag_ptr(this_arg);
42120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42122         this_arg_conv.is_owned = false;
42123         jboolean ret_conv = InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
42124         return ret_conv;
42125 }
42126
42127 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
42128         LDKInitFeatures 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         InitFeatures_set_zero_conf_optional(&this_arg_conv);
42134 }
42135
42136 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
42137         LDKInitFeatures this_arg_conv;
42138         this_arg_conv.inner = untag_ptr(this_arg);
42139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42141         this_arg_conv.is_owned = false;
42142         InitFeatures_set_zero_conf_required(&this_arg_conv);
42143 }
42144
42145 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
42146         LDKInitFeatures this_arg_conv;
42147         this_arg_conv.inner = untag_ptr(this_arg);
42148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42150         this_arg_conv.is_owned = false;
42151         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
42152         return ret_conv;
42153 }
42154
42155 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
42156         LDKNodeFeatures this_arg_conv;
42157         this_arg_conv.inner = untag_ptr(this_arg);
42158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42160         this_arg_conv.is_owned = false;
42161         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
42162 }
42163
42164 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
42165         LDKNodeFeatures this_arg_conv;
42166         this_arg_conv.inner = untag_ptr(this_arg);
42167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42169         this_arg_conv.is_owned = false;
42170         NodeFeatures_set_zero_conf_required(&this_arg_conv);
42171 }
42172
42173 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
42174         LDKNodeFeatures this_arg_conv;
42175         this_arg_conv.inner = untag_ptr(this_arg);
42176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42178         this_arg_conv.is_owned = false;
42179         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
42180         return ret_conv;
42181 }
42182
42183 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
42184         LDKChannelTypeFeatures this_arg_conv;
42185         this_arg_conv.inner = untag_ptr(this_arg);
42186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42188         this_arg_conv.is_owned = false;
42189         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
42190 }
42191
42192 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
42193         LDKChannelTypeFeatures this_arg_conv;
42194         this_arg_conv.inner = untag_ptr(this_arg);
42195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42197         this_arg_conv.is_owned = false;
42198         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
42199 }
42200
42201 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
42202         LDKChannelTypeFeatures this_arg_conv;
42203         this_arg_conv.inner = untag_ptr(this_arg);
42204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42206         this_arg_conv.is_owned = false;
42207         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
42208         return ret_conv;
42209 }
42210
42211 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
42212         LDKInitFeatures this_arg_conv;
42213         this_arg_conv.inner = untag_ptr(this_arg);
42214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42216         this_arg_conv.is_owned = false;
42217         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
42218         return ret_conv;
42219 }
42220
42221 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
42222         LDKNodeFeatures 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 = NodeFeatures_requires_zero_conf(&this_arg_conv);
42228         return ret_conv;
42229 }
42230
42231 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
42232         LDKChannelTypeFeatures 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 = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
42238         return ret_conv;
42239 }
42240
42241 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(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         NodeFeatures_set_keysend_optional(&this_arg_conv);
42248 }
42249
42250 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
42251         LDKNodeFeatures this_arg_conv;
42252         this_arg_conv.inner = untag_ptr(this_arg);
42253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42255         this_arg_conv.is_owned = false;
42256         NodeFeatures_set_keysend_required(&this_arg_conv);
42257 }
42258
42259 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
42260         LDKNodeFeatures this_arg_conv;
42261         this_arg_conv.inner = untag_ptr(this_arg);
42262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42264         this_arg_conv.is_owned = false;
42265         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
42266         return ret_conv;
42267 }
42268
42269 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
42270         LDKNodeFeatures this_arg_conv;
42271         this_arg_conv.inner = untag_ptr(this_arg);
42272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42274         this_arg_conv.is_owned = false;
42275         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
42276         return ret_conv;
42277 }
42278
42279 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
42280         LDKShutdownScript this_obj_conv;
42281         this_obj_conv.inner = untag_ptr(this_obj);
42282         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42284         ShutdownScript_free(this_obj_conv);
42285 }
42286
42287 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
42288         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
42289         uint64_t ret_ref = 0;
42290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42292         return ret_ref;
42293 }
42294 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
42295         LDKShutdownScript arg_conv;
42296         arg_conv.inner = untag_ptr(arg);
42297         arg_conv.is_owned = ptr_is_owned(arg);
42298         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42299         arg_conv.is_owned = false;
42300         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
42301         return ret_conv;
42302 }
42303
42304 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
42305         LDKShutdownScript orig_conv;
42306         orig_conv.inner = untag_ptr(orig);
42307         orig_conv.is_owned = ptr_is_owned(orig);
42308         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42309         orig_conv.is_owned = false;
42310         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
42311         uint64_t ret_ref = 0;
42312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42314         return ret_ref;
42315 }
42316
42317 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
42318         LDKShutdownScript a_conv;
42319         a_conv.inner = untag_ptr(a);
42320         a_conv.is_owned = ptr_is_owned(a);
42321         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42322         a_conv.is_owned = false;
42323         LDKShutdownScript b_conv;
42324         b_conv.inner = untag_ptr(b);
42325         b_conv.is_owned = ptr_is_owned(b);
42326         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42327         b_conv.is_owned = false;
42328         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
42329         return ret_conv;
42330 }
42331
42332 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
42333         LDKInvalidShutdownScript this_obj_conv;
42334         this_obj_conv.inner = untag_ptr(this_obj);
42335         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42337         InvalidShutdownScript_free(this_obj_conv);
42338 }
42339
42340 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
42341         LDKInvalidShutdownScript this_ptr_conv;
42342         this_ptr_conv.inner = untag_ptr(this_ptr);
42343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42345         this_ptr_conv.is_owned = false;
42346         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
42347         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42348         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42349         return ret_arr;
42350 }
42351
42352 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
42353         LDKInvalidShutdownScript this_ptr_conv;
42354         this_ptr_conv.inner = untag_ptr(this_ptr);
42355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42357         this_ptr_conv.is_owned = false;
42358         LDKCVec_u8Z val_ref;
42359         val_ref.datalen = val->arr_len;
42360         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
42361         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
42362         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
42363 }
42364
42365 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
42366         LDKCVec_u8Z script_arg_ref;
42367         script_arg_ref.datalen = script_arg->arr_len;
42368         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
42369         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
42370         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
42371         uint64_t ret_ref = 0;
42372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42374         return ret_ref;
42375 }
42376
42377 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
42378         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
42379         uint64_t ret_ref = 0;
42380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42382         return ret_ref;
42383 }
42384 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
42385         LDKInvalidShutdownScript arg_conv;
42386         arg_conv.inner = untag_ptr(arg);
42387         arg_conv.is_owned = ptr_is_owned(arg);
42388         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42389         arg_conv.is_owned = false;
42390         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
42391         return ret_conv;
42392 }
42393
42394 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
42395         LDKInvalidShutdownScript orig_conv;
42396         orig_conv.inner = untag_ptr(orig);
42397         orig_conv.is_owned = ptr_is_owned(orig);
42398         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42399         orig_conv.is_owned = false;
42400         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
42401         uint64_t ret_ref = 0;
42402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42404         return ret_ref;
42405 }
42406
42407 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
42408         LDKShutdownScript obj_conv;
42409         obj_conv.inner = untag_ptr(obj);
42410         obj_conv.is_owned = ptr_is_owned(obj);
42411         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42412         obj_conv.is_owned = false;
42413         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
42414         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42415         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42416         CVec_u8Z_free(ret_var);
42417         return ret_arr;
42418 }
42419
42420 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
42421         LDKu8slice ser_ref;
42422         ser_ref.datalen = ser->arr_len;
42423         ser_ref.data = ser->elems;
42424         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
42425         *ret_conv = ShutdownScript_read(ser_ref);
42426         FREE(ser);
42427         return tag_ptr(ret_conv, true);
42428 }
42429
42430 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
42431         uint8_t pubkey_hash_arr[20];
42432         CHECK(pubkey_hash->arr_len == 20);
42433         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
42434         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
42435         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
42436         uint64_t ret_ref = 0;
42437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42439         return ret_ref;
42440 }
42441
42442 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
42443         uint8_t script_hash_arr[32];
42444         CHECK(script_hash->arr_len == 32);
42445         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
42446         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
42447         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
42448         uint64_t ret_ref = 0;
42449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42451         return ret_ref;
42452 }
42453
42454 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
42455         
42456         LDKu8slice program_ref;
42457         program_ref.datalen = program->arr_len;
42458         program_ref.data = program->elems;
42459         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
42460         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
42461         FREE(program);
42462         return tag_ptr(ret_conv, true);
42463 }
42464
42465 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
42466         LDKShutdownScript this_arg_conv;
42467         this_arg_conv.inner = untag_ptr(this_arg);
42468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42470         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
42471         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
42472         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42473         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42474         CVec_u8Z_free(ret_var);
42475         return ret_arr;
42476 }
42477
42478 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
42479         LDKShutdownScript this_arg_conv;
42480         this_arg_conv.inner = untag_ptr(this_arg);
42481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42483         this_arg_conv.is_owned = false;
42484         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42485         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
42486         return ret_arr;
42487 }
42488
42489 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
42490         LDKShutdownScript this_arg_conv;
42491         this_arg_conv.inner = untag_ptr(this_arg);
42492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42494         this_arg_conv.is_owned = false;
42495         LDKInitFeatures features_conv;
42496         features_conv.inner = untag_ptr(features);
42497         features_conv.is_owned = ptr_is_owned(features);
42498         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
42499         features_conv.is_owned = false;
42500         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
42501         return ret_conv;
42502 }
42503
42504 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
42505         if (!ptr_is_owned(this_ptr)) return;
42506         void* this_ptr_ptr = untag_ptr(this_ptr);
42507         CHECK_ACCESS(this_ptr_ptr);
42508         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
42509         FREE(untag_ptr(this_ptr));
42510         Retry_free(this_ptr_conv);
42511 }
42512
42513 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
42514         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
42515         *ret_copy = Retry_clone(arg);
42516         uint64_t ret_ref = tag_ptr(ret_copy, true);
42517         return ret_ref;
42518 }
42519 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
42520         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
42521         int64_t ret_conv = Retry_clone_ptr(arg_conv);
42522         return ret_conv;
42523 }
42524
42525 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
42526         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
42527         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
42528         *ret_copy = Retry_clone(orig_conv);
42529         uint64_t ret_ref = tag_ptr(ret_copy, true);
42530         return ret_ref;
42531 }
42532
42533 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
42534         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
42535         *ret_copy = Retry_attempts(a);
42536         uint64_t ret_ref = tag_ptr(ret_copy, true);
42537         return ret_ref;
42538 }
42539
42540 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
42541         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
42542         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
42543         jboolean ret_conv = Retry_eq(a_conv, b_conv);
42544         return ret_conv;
42545 }
42546
42547 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
42548         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
42549         int64_t ret_conv = Retry_hash(o_conv);
42550         return ret_conv;
42551 }
42552
42553 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_clone"))) TS_RetryableSendFailure_clone(uint64_t orig) {
42554         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
42555         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_clone(orig_conv));
42556         return ret_conv;
42557 }
42558
42559 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_payment_expired"))) TS_RetryableSendFailure_payment_expired() {
42560         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_payment_expired());
42561         return ret_conv;
42562 }
42563
42564 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_route_not_found"))) TS_RetryableSendFailure_route_not_found() {
42565         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_route_not_found());
42566         return ret_conv;
42567 }
42568
42569 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_duplicate_payment"))) TS_RetryableSendFailure_duplicate_payment() {
42570         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_duplicate_payment());
42571         return ret_conv;
42572 }
42573
42574 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
42575         if (!ptr_is_owned(this_ptr)) return;
42576         void* this_ptr_ptr = untag_ptr(this_ptr);
42577         CHECK_ACCESS(this_ptr_ptr);
42578         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
42579         FREE(untag_ptr(this_ptr));
42580         PaymentSendFailure_free(this_ptr_conv);
42581 }
42582
42583 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
42584         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42585         *ret_copy = PaymentSendFailure_clone(arg);
42586         uint64_t ret_ref = tag_ptr(ret_copy, true);
42587         return ret_ref;
42588 }
42589 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
42590         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
42591         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
42592         return ret_conv;
42593 }
42594
42595 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
42596         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
42597         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42598         *ret_copy = PaymentSendFailure_clone(orig_conv);
42599         uint64_t ret_ref = tag_ptr(ret_copy, true);
42600         return ret_ref;
42601 }
42602
42603 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
42604         void* a_ptr = untag_ptr(a);
42605         CHECK_ACCESS(a_ptr);
42606         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
42607         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
42608         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42609         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
42610         uint64_t ret_ref = tag_ptr(ret_copy, true);
42611         return ret_ref;
42612 }
42613
42614 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
42615         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
42616         a_constr.datalen = a->arr_len;
42617         if (a_constr.datalen > 0)
42618                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
42619         else
42620                 a_constr.data = NULL;
42621         uint64_t* a_vals = a->elems;
42622         for (size_t w = 0; w < a_constr.datalen; w++) {
42623                 uint64_t a_conv_22 = a_vals[w];
42624                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
42625                 CHECK_ACCESS(a_conv_22_ptr);
42626                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
42627                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
42628                 a_constr.data[w] = a_conv_22_conv;
42629         }
42630         FREE(a);
42631         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42632         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
42633         uint64_t ret_ref = tag_ptr(ret_copy, true);
42634         return ret_ref;
42635 }
42636
42637 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
42638         LDKCVec_APIErrorZ a_constr;
42639         a_constr.datalen = a->arr_len;
42640         if (a_constr.datalen > 0)
42641                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
42642         else
42643                 a_constr.data = NULL;
42644         uint64_t* a_vals = a->elems;
42645         for (size_t k = 0; k < a_constr.datalen; k++) {
42646                 uint64_t a_conv_10 = a_vals[k];
42647                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
42648                 CHECK_ACCESS(a_conv_10_ptr);
42649                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
42650                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
42651                 a_constr.data[k] = a_conv_10_conv;
42652         }
42653         FREE(a);
42654         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42655         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
42656         uint64_t ret_ref = tag_ptr(ret_copy, true);
42657         return ret_ref;
42658 }
42659
42660 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
42661         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42662         *ret_copy = PaymentSendFailure_duplicate_payment();
42663         uint64_t ret_ref = tag_ptr(ret_copy, true);
42664         return ret_ref;
42665 }
42666
42667 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) {
42668         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
42669         results_constr.datalen = results->arr_len;
42670         if (results_constr.datalen > 0)
42671                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
42672         else
42673                 results_constr.data = NULL;
42674         uint64_t* results_vals = results->elems;
42675         for (size_t w = 0; w < results_constr.datalen; w++) {
42676                 uint64_t results_conv_22 = results_vals[w];
42677                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
42678                 CHECK_ACCESS(results_conv_22_ptr);
42679                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
42680                 results_constr.data[w] = results_conv_22_conv;
42681         }
42682         FREE(results);
42683         LDKRouteParameters failed_paths_retry_conv;
42684         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
42685         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
42686         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
42687         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
42688         LDKThirtyTwoBytes payment_id_ref;
42689         CHECK(payment_id->arr_len == 32);
42690         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42691         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
42692         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
42693         uint64_t ret_ref = tag_ptr(ret_copy, true);
42694         return ret_ref;
42695 }
42696
42697 void  __attribute__((export_name("TS_RecipientOnionFields_free"))) TS_RecipientOnionFields_free(uint64_t this_obj) {
42698         LDKRecipientOnionFields this_obj_conv;
42699         this_obj_conv.inner = untag_ptr(this_obj);
42700         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42702         RecipientOnionFields_free(this_obj_conv);
42703 }
42704
42705 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_get_payment_secret"))) TS_RecipientOnionFields_get_payment_secret(uint64_t this_ptr) {
42706         LDKRecipientOnionFields this_ptr_conv;
42707         this_ptr_conv.inner = untag_ptr(this_ptr);
42708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42710         this_ptr_conv.is_owned = false;
42711         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42712         memcpy(ret_arr->elems, RecipientOnionFields_get_payment_secret(&this_ptr_conv).data, 32);
42713         return ret_arr;
42714 }
42715
42716 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_secret"))) TS_RecipientOnionFields_set_payment_secret(uint64_t this_ptr, int8_tArray val) {
42717         LDKRecipientOnionFields this_ptr_conv;
42718         this_ptr_conv.inner = untag_ptr(this_ptr);
42719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42721         this_ptr_conv.is_owned = false;
42722         LDKThirtyTwoBytes val_ref;
42723         CHECK(val->arr_len == 32);
42724         memcpy(val_ref.data, val->elems, 32); FREE(val);
42725         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_ref);
42726 }
42727
42728 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_metadata"))) TS_RecipientOnionFields_get_payment_metadata(uint64_t this_ptr) {
42729         LDKRecipientOnionFields this_ptr_conv;
42730         this_ptr_conv.inner = untag_ptr(this_ptr);
42731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42733         this_ptr_conv.is_owned = false;
42734         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
42735         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
42736         uint64_t ret_ref = tag_ptr(ret_copy, true);
42737         return ret_ref;
42738 }
42739
42740 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_metadata"))) TS_RecipientOnionFields_set_payment_metadata(uint64_t this_ptr, uint64_t val) {
42741         LDKRecipientOnionFields this_ptr_conv;
42742         this_ptr_conv.inner = untag_ptr(this_ptr);
42743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42745         this_ptr_conv.is_owned = false;
42746         void* val_ptr = untag_ptr(val);
42747         CHECK_ACCESS(val_ptr);
42748         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
42749         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
42750         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
42751 }
42752
42753 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_new"))) TS_RecipientOnionFields_new(int8_tArray payment_secret_arg, uint64_t payment_metadata_arg) {
42754         LDKThirtyTwoBytes payment_secret_arg_ref;
42755         CHECK(payment_secret_arg->arr_len == 32);
42756         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
42757         void* payment_metadata_arg_ptr = untag_ptr(payment_metadata_arg);
42758         CHECK_ACCESS(payment_metadata_arg_ptr);
42759         LDKCOption_CVec_u8ZZ payment_metadata_arg_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_arg_ptr);
42760         payment_metadata_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata_arg));
42761         LDKRecipientOnionFields ret_var = RecipientOnionFields_new(payment_secret_arg_ref, payment_metadata_arg_conv);
42762         uint64_t ret_ref = 0;
42763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42765         return ret_ref;
42766 }
42767
42768 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
42769         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
42770         uint64_t ret_ref = 0;
42771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42773         return ret_ref;
42774 }
42775 int64_t  __attribute__((export_name("TS_RecipientOnionFields_clone_ptr"))) TS_RecipientOnionFields_clone_ptr(uint64_t arg) {
42776         LDKRecipientOnionFields arg_conv;
42777         arg_conv.inner = untag_ptr(arg);
42778         arg_conv.is_owned = ptr_is_owned(arg);
42779         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42780         arg_conv.is_owned = false;
42781         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
42782         return ret_conv;
42783 }
42784
42785 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_clone"))) TS_RecipientOnionFields_clone(uint64_t orig) {
42786         LDKRecipientOnionFields orig_conv;
42787         orig_conv.inner = untag_ptr(orig);
42788         orig_conv.is_owned = ptr_is_owned(orig);
42789         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42790         orig_conv.is_owned = false;
42791         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
42792         uint64_t ret_ref = 0;
42793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42795         return ret_ref;
42796 }
42797
42798 jboolean  __attribute__((export_name("TS_RecipientOnionFields_eq"))) TS_RecipientOnionFields_eq(uint64_t a, uint64_t b) {
42799         LDKRecipientOnionFields a_conv;
42800         a_conv.inner = untag_ptr(a);
42801         a_conv.is_owned = ptr_is_owned(a);
42802         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42803         a_conv.is_owned = false;
42804         LDKRecipientOnionFields b_conv;
42805         b_conv.inner = untag_ptr(b);
42806         b_conv.is_owned = ptr_is_owned(b);
42807         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42808         b_conv.is_owned = false;
42809         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
42810         return ret_conv;
42811 }
42812
42813 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_write"))) TS_RecipientOnionFields_write(uint64_t obj) {
42814         LDKRecipientOnionFields obj_conv;
42815         obj_conv.inner = untag_ptr(obj);
42816         obj_conv.is_owned = ptr_is_owned(obj);
42817         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42818         obj_conv.is_owned = false;
42819         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
42820         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42821         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42822         CVec_u8Z_free(ret_var);
42823         return ret_arr;
42824 }
42825
42826 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_read"))) TS_RecipientOnionFields_read(int8_tArray ser) {
42827         LDKu8slice ser_ref;
42828         ser_ref.datalen = ser->arr_len;
42829         ser_ref.data = ser->elems;
42830         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
42831         *ret_conv = RecipientOnionFields_read(ser_ref);
42832         FREE(ser);
42833         return tag_ptr(ret_conv, true);
42834 }
42835
42836 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_secret_only"))) TS_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
42837         LDKThirtyTwoBytes payment_secret_ref;
42838         CHECK(payment_secret->arr_len == 32);
42839         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
42840         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
42841         uint64_t ret_ref = 0;
42842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42844         return ret_ref;
42845 }
42846
42847 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_spontaneous_empty"))) TS_RecipientOnionFields_spontaneous_empty() {
42848         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
42849         uint64_t ret_ref = 0;
42850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42852         return ret_ref;
42853 }
42854
42855 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
42856         if (!ptr_is_owned(this_ptr)) return;
42857         void* this_ptr_ptr = untag_ptr(this_ptr);
42858         CHECK_ACCESS(this_ptr_ptr);
42859         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
42860         FREE(untag_ptr(this_ptr));
42861         CustomMessageReader_free(this_ptr_conv);
42862 }
42863
42864 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
42865         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
42866         *ret_ret = Type_clone(arg);
42867         return tag_ptr(ret_ret, true);
42868 }
42869 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
42870         void* arg_ptr = untag_ptr(arg);
42871         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
42872         LDKType* arg_conv = (LDKType*)arg_ptr;
42873         int64_t ret_conv = Type_clone_ptr(arg_conv);
42874         return ret_conv;
42875 }
42876
42877 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
42878         void* orig_ptr = untag_ptr(orig);
42879         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
42880         LDKType* orig_conv = (LDKType*)orig_ptr;
42881         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
42882         *ret_ret = Type_clone(orig_conv);
42883         return tag_ptr(ret_ret, true);
42884 }
42885
42886 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
42887         if (!ptr_is_owned(this_ptr)) return;
42888         void* this_ptr_ptr = untag_ptr(this_ptr);
42889         CHECK_ACCESS(this_ptr_ptr);
42890         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
42891         FREE(untag_ptr(this_ptr));
42892         Type_free(this_ptr_conv);
42893 }
42894
42895 void  __attribute__((export_name("TS_UnsignedInvoice_free"))) TS_UnsignedInvoice_free(uint64_t this_obj) {
42896         LDKUnsignedInvoice this_obj_conv;
42897         this_obj_conv.inner = untag_ptr(this_obj);
42898         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42900         UnsignedInvoice_free(this_obj_conv);
42901 }
42902
42903 int8_tArray  __attribute__((export_name("TS_UnsignedInvoice_signing_pubkey"))) TS_UnsignedInvoice_signing_pubkey(uint64_t this_arg) {
42904         LDKUnsignedInvoice this_arg_conv;
42905         this_arg_conv.inner = untag_ptr(this_arg);
42906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42908         this_arg_conv.is_owned = false;
42909         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42910         memcpy(ret_arr->elems, UnsignedInvoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
42911         return ret_arr;
42912 }
42913
42914 void  __attribute__((export_name("TS_BlindedPayInfo_free"))) TS_BlindedPayInfo_free(uint64_t this_obj) {
42915         LDKBlindedPayInfo this_obj_conv;
42916         this_obj_conv.inner = untag_ptr(this_obj);
42917         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42919         BlindedPayInfo_free(this_obj_conv);
42920 }
42921
42922 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_base_msat"))) TS_BlindedPayInfo_get_fee_base_msat(uint64_t this_ptr) {
42923         LDKBlindedPayInfo this_ptr_conv;
42924         this_ptr_conv.inner = untag_ptr(this_ptr);
42925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42927         this_ptr_conv.is_owned = false;
42928         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
42929         return ret_conv;
42930 }
42931
42932 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_base_msat"))) TS_BlindedPayInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
42933         LDKBlindedPayInfo this_ptr_conv;
42934         this_ptr_conv.inner = untag_ptr(this_ptr);
42935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42937         this_ptr_conv.is_owned = false;
42938         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
42939 }
42940
42941 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_proportional_millionths"))) TS_BlindedPayInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
42942         LDKBlindedPayInfo this_ptr_conv;
42943         this_ptr_conv.inner = untag_ptr(this_ptr);
42944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42946         this_ptr_conv.is_owned = false;
42947         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
42948         return ret_conv;
42949 }
42950
42951 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_proportional_millionths"))) TS_BlindedPayInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
42952         LDKBlindedPayInfo this_ptr_conv;
42953         this_ptr_conv.inner = untag_ptr(this_ptr);
42954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42956         this_ptr_conv.is_owned = false;
42957         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
42958 }
42959
42960 int16_t  __attribute__((export_name("TS_BlindedPayInfo_get_cltv_expiry_delta"))) TS_BlindedPayInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
42961         LDKBlindedPayInfo this_ptr_conv;
42962         this_ptr_conv.inner = untag_ptr(this_ptr);
42963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42965         this_ptr_conv.is_owned = false;
42966         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
42967         return ret_conv;
42968 }
42969
42970 void  __attribute__((export_name("TS_BlindedPayInfo_set_cltv_expiry_delta"))) TS_BlindedPayInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
42971         LDKBlindedPayInfo this_ptr_conv;
42972         this_ptr_conv.inner = untag_ptr(this_ptr);
42973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42975         this_ptr_conv.is_owned = false;
42976         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
42977 }
42978
42979 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_minimum_msat"))) TS_BlindedPayInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
42980         LDKBlindedPayInfo this_ptr_conv;
42981         this_ptr_conv.inner = untag_ptr(this_ptr);
42982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42984         this_ptr_conv.is_owned = false;
42985         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
42986         return ret_conv;
42987 }
42988
42989 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_minimum_msat"))) TS_BlindedPayInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
42990         LDKBlindedPayInfo this_ptr_conv;
42991         this_ptr_conv.inner = untag_ptr(this_ptr);
42992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42994         this_ptr_conv.is_owned = false;
42995         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
42996 }
42997
42998 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_maximum_msat"))) TS_BlindedPayInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
42999         LDKBlindedPayInfo this_ptr_conv;
43000         this_ptr_conv.inner = untag_ptr(this_ptr);
43001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43003         this_ptr_conv.is_owned = false;
43004         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
43005         return ret_conv;
43006 }
43007
43008 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_maximum_msat"))) TS_BlindedPayInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
43009         LDKBlindedPayInfo this_ptr_conv;
43010         this_ptr_conv.inner = untag_ptr(this_ptr);
43011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43013         this_ptr_conv.is_owned = false;
43014         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
43015 }
43016
43017 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_get_features"))) TS_BlindedPayInfo_get_features(uint64_t this_ptr) {
43018         LDKBlindedPayInfo this_ptr_conv;
43019         this_ptr_conv.inner = untag_ptr(this_ptr);
43020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43022         this_ptr_conv.is_owned = false;
43023         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
43024         uint64_t ret_ref = 0;
43025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43027         return ret_ref;
43028 }
43029
43030 void  __attribute__((export_name("TS_BlindedPayInfo_set_features"))) TS_BlindedPayInfo_set_features(uint64_t this_ptr, uint64_t val) {
43031         LDKBlindedPayInfo this_ptr_conv;
43032         this_ptr_conv.inner = untag_ptr(this_ptr);
43033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43035         this_ptr_conv.is_owned = false;
43036         LDKBlindedHopFeatures val_conv;
43037         val_conv.inner = untag_ptr(val);
43038         val_conv.is_owned = ptr_is_owned(val);
43039         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43040         val_conv = BlindedHopFeatures_clone(&val_conv);
43041         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
43042 }
43043
43044 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) {
43045         LDKBlindedHopFeatures features_arg_conv;
43046         features_arg_conv.inner = untag_ptr(features_arg);
43047         features_arg_conv.is_owned = ptr_is_owned(features_arg);
43048         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
43049         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
43050         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);
43051         uint64_t ret_ref = 0;
43052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43054         return ret_ref;
43055 }
43056
43057 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
43058         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
43059         uint64_t ret_ref = 0;
43060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43062         return ret_ref;
43063 }
43064 int64_t  __attribute__((export_name("TS_BlindedPayInfo_clone_ptr"))) TS_BlindedPayInfo_clone_ptr(uint64_t arg) {
43065         LDKBlindedPayInfo arg_conv;
43066         arg_conv.inner = untag_ptr(arg);
43067         arg_conv.is_owned = ptr_is_owned(arg);
43068         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43069         arg_conv.is_owned = false;
43070         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
43071         return ret_conv;
43072 }
43073
43074 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_clone"))) TS_BlindedPayInfo_clone(uint64_t orig) {
43075         LDKBlindedPayInfo orig_conv;
43076         orig_conv.inner = untag_ptr(orig);
43077         orig_conv.is_owned = ptr_is_owned(orig);
43078         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43079         orig_conv.is_owned = false;
43080         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
43081         uint64_t ret_ref = 0;
43082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43084         return ret_ref;
43085 }
43086
43087 int64_t  __attribute__((export_name("TS_BlindedPayInfo_hash"))) TS_BlindedPayInfo_hash(uint64_t o) {
43088         LDKBlindedPayInfo o_conv;
43089         o_conv.inner = untag_ptr(o);
43090         o_conv.is_owned = ptr_is_owned(o);
43091         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43092         o_conv.is_owned = false;
43093         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
43094         return ret_conv;
43095 }
43096
43097 jboolean  __attribute__((export_name("TS_BlindedPayInfo_eq"))) TS_BlindedPayInfo_eq(uint64_t a, uint64_t b) {
43098         LDKBlindedPayInfo a_conv;
43099         a_conv.inner = untag_ptr(a);
43100         a_conv.is_owned = ptr_is_owned(a);
43101         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43102         a_conv.is_owned = false;
43103         LDKBlindedPayInfo b_conv;
43104         b_conv.inner = untag_ptr(b);
43105         b_conv.is_owned = ptr_is_owned(b);
43106         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43107         b_conv.is_owned = false;
43108         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
43109         return ret_conv;
43110 }
43111
43112 int8_tArray  __attribute__((export_name("TS_BlindedPayInfo_write"))) TS_BlindedPayInfo_write(uint64_t obj) {
43113         LDKBlindedPayInfo obj_conv;
43114         obj_conv.inner = untag_ptr(obj);
43115         obj_conv.is_owned = ptr_is_owned(obj);
43116         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43117         obj_conv.is_owned = false;
43118         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
43119         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43120         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43121         CVec_u8Z_free(ret_var);
43122         return ret_arr;
43123 }
43124
43125 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_read"))) TS_BlindedPayInfo_read(int8_tArray ser) {
43126         LDKu8slice ser_ref;
43127         ser_ref.datalen = ser->arr_len;
43128         ser_ref.data = ser->elems;
43129         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
43130         *ret_conv = BlindedPayInfo_read(ser_ref);
43131         FREE(ser);
43132         return tag_ptr(ret_conv, true);
43133 }
43134
43135 void  __attribute__((export_name("TS_UnsignedInvoiceRequest_free"))) TS_UnsignedInvoiceRequest_free(uint64_t this_obj) {
43136         LDKUnsignedInvoiceRequest this_obj_conv;
43137         this_obj_conv.inner = untag_ptr(this_obj);
43138         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43140         UnsignedInvoiceRequest_free(this_obj_conv);
43141 }
43142
43143 void  __attribute__((export_name("TS_InvoiceRequest_free"))) TS_InvoiceRequest_free(uint64_t this_obj) {
43144         LDKInvoiceRequest this_obj_conv;
43145         this_obj_conv.inner = untag_ptr(this_obj);
43146         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43148         InvoiceRequest_free(this_obj_conv);
43149 }
43150
43151 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
43152         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
43153         uint64_t ret_ref = 0;
43154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43156         return ret_ref;
43157 }
43158 int64_t  __attribute__((export_name("TS_InvoiceRequest_clone_ptr"))) TS_InvoiceRequest_clone_ptr(uint64_t arg) {
43159         LDKInvoiceRequest arg_conv;
43160         arg_conv.inner = untag_ptr(arg);
43161         arg_conv.is_owned = ptr_is_owned(arg);
43162         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43163         arg_conv.is_owned = false;
43164         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
43165         return ret_conv;
43166 }
43167
43168 uint64_t  __attribute__((export_name("TS_InvoiceRequest_clone"))) TS_InvoiceRequest_clone(uint64_t orig) {
43169         LDKInvoiceRequest orig_conv;
43170         orig_conv.inner = untag_ptr(orig);
43171         orig_conv.is_owned = ptr_is_owned(orig);
43172         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43173         orig_conv.is_owned = false;
43174         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
43175         uint64_t ret_ref = 0;
43176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43178         return ret_ref;
43179 }
43180
43181 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_metadata"))) TS_InvoiceRequest_metadata(uint64_t this_arg) {
43182         LDKInvoiceRequest this_arg_conv;
43183         this_arg_conv.inner = untag_ptr(this_arg);
43184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43186         this_arg_conv.is_owned = false;
43187         LDKu8slice ret_var = InvoiceRequest_metadata(&this_arg_conv);
43188         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43189         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43190         return ret_arr;
43191 }
43192
43193 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_chain"))) TS_InvoiceRequest_chain(uint64_t this_arg) {
43194         LDKInvoiceRequest this_arg_conv;
43195         this_arg_conv.inner = untag_ptr(this_arg);
43196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43198         this_arg_conv.is_owned = false;
43199         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43200         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
43201         return ret_arr;
43202 }
43203
43204 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount_msats"))) TS_InvoiceRequest_amount_msats(uint64_t this_arg) {
43205         LDKInvoiceRequest this_arg_conv;
43206         this_arg_conv.inner = untag_ptr(this_arg);
43207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43209         this_arg_conv.is_owned = false;
43210         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43211         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
43212         uint64_t ret_ref = tag_ptr(ret_copy, true);
43213         return ret_ref;
43214 }
43215
43216 uint64_t  __attribute__((export_name("TS_InvoiceRequest_features"))) TS_InvoiceRequest_features(uint64_t this_arg) {
43217         LDKInvoiceRequest this_arg_conv;
43218         this_arg_conv.inner = untag_ptr(this_arg);
43219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43221         this_arg_conv.is_owned = false;
43222         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_features(&this_arg_conv);
43223         uint64_t ret_ref = 0;
43224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43226         return ret_ref;
43227 }
43228
43229 uint64_t  __attribute__((export_name("TS_InvoiceRequest_quantity"))) TS_InvoiceRequest_quantity(uint64_t this_arg) {
43230         LDKInvoiceRequest this_arg_conv;
43231         this_arg_conv.inner = untag_ptr(this_arg);
43232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43234         this_arg_conv.is_owned = false;
43235         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43236         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
43237         uint64_t ret_ref = tag_ptr(ret_copy, true);
43238         return ret_ref;
43239 }
43240
43241 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_id"))) TS_InvoiceRequest_payer_id(uint64_t this_arg) {
43242         LDKInvoiceRequest this_arg_conv;
43243         this_arg_conv.inner = untag_ptr(this_arg);
43244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43246         this_arg_conv.is_owned = false;
43247         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43248         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
43249         return ret_arr;
43250 }
43251
43252 uint64_t  __attribute__((export_name("TS_InvoiceRequest_payer_note"))) TS_InvoiceRequest_payer_note(uint64_t this_arg) {
43253         LDKInvoiceRequest this_arg_conv;
43254         this_arg_conv.inner = untag_ptr(this_arg);
43255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43257         this_arg_conv.is_owned = false;
43258         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
43259         uint64_t ret_ref = 0;
43260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43262         return ret_ref;
43263 }
43264
43265 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_write"))) TS_InvoiceRequest_write(uint64_t obj) {
43266         LDKInvoiceRequest obj_conv;
43267         obj_conv.inner = untag_ptr(obj);
43268         obj_conv.is_owned = ptr_is_owned(obj);
43269         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43270         obj_conv.is_owned = false;
43271         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
43272         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43273         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43274         CVec_u8Z_free(ret_var);
43275         return ret_arr;
43276 }
43277
43278 void  __attribute__((export_name("TS_Offer_free"))) TS_Offer_free(uint64_t this_obj) {
43279         LDKOffer this_obj_conv;
43280         this_obj_conv.inner = untag_ptr(this_obj);
43281         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43283         Offer_free(this_obj_conv);
43284 }
43285
43286 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
43287         LDKOffer ret_var = Offer_clone(arg);
43288         uint64_t ret_ref = 0;
43289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43291         return ret_ref;
43292 }
43293 int64_t  __attribute__((export_name("TS_Offer_clone_ptr"))) TS_Offer_clone_ptr(uint64_t arg) {
43294         LDKOffer arg_conv;
43295         arg_conv.inner = untag_ptr(arg);
43296         arg_conv.is_owned = ptr_is_owned(arg);
43297         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43298         arg_conv.is_owned = false;
43299         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
43300         return ret_conv;
43301 }
43302
43303 uint64_t  __attribute__((export_name("TS_Offer_clone"))) TS_Offer_clone(uint64_t orig) {
43304         LDKOffer orig_conv;
43305         orig_conv.inner = untag_ptr(orig);
43306         orig_conv.is_owned = ptr_is_owned(orig);
43307         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43308         orig_conv.is_owned = false;
43309         LDKOffer ret_var = Offer_clone(&orig_conv);
43310         uint64_t ret_ref = 0;
43311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43313         return ret_ref;
43314 }
43315
43316 ptrArray  __attribute__((export_name("TS_Offer_chains"))) TS_Offer_chains(uint64_t this_arg) {
43317         LDKOffer this_arg_conv;
43318         this_arg_conv.inner = untag_ptr(this_arg);
43319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43321         this_arg_conv.is_owned = false;
43322         LDKCVec_ChainHashZ ret_var = Offer_chains(&this_arg_conv);
43323         ptrArray ret_arr = NULL;
43324         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
43325         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
43326         for (size_t m = 0; m < ret_var.datalen; m++) {
43327                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
43328                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
43329                 ret_arr_ptr[m] = ret_conv_12_arr;
43330         }
43331         
43332         FREE(ret_var.data);
43333         return ret_arr;
43334 }
43335
43336 jboolean  __attribute__((export_name("TS_Offer_supports_chain"))) TS_Offer_supports_chain(uint64_t this_arg, int8_tArray chain) {
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         LDKThirtyTwoBytes chain_ref;
43343         CHECK(chain->arr_len == 32);
43344         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
43345         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
43346         return ret_conv;
43347 }
43348
43349 uint64_t  __attribute__((export_name("TS_Offer_metadata"))) TS_Offer_metadata(uint64_t this_arg) {
43350         LDKOffer this_arg_conv;
43351         this_arg_conv.inner = untag_ptr(this_arg);
43352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43354         this_arg_conv.is_owned = false;
43355         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
43356         *ret_copy = Offer_metadata(&this_arg_conv);
43357         uint64_t ret_ref = tag_ptr(ret_copy, true);
43358         return ret_ref;
43359 }
43360
43361 uint64_t  __attribute__((export_name("TS_Offer_amount"))) TS_Offer_amount(uint64_t this_arg) {
43362         LDKOffer this_arg_conv;
43363         this_arg_conv.inner = untag_ptr(this_arg);
43364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43366         this_arg_conv.is_owned = false;
43367         LDKAmount ret_var = Offer_amount(&this_arg_conv);
43368         uint64_t ret_ref = 0;
43369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43371         return ret_ref;
43372 }
43373
43374 uint64_t  __attribute__((export_name("TS_Offer_description"))) TS_Offer_description(uint64_t this_arg) {
43375         LDKOffer this_arg_conv;
43376         this_arg_conv.inner = untag_ptr(this_arg);
43377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43379         this_arg_conv.is_owned = false;
43380         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
43381         uint64_t ret_ref = 0;
43382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43384         return ret_ref;
43385 }
43386
43387 uint64_t  __attribute__((export_name("TS_Offer_features"))) TS_Offer_features(uint64_t this_arg) {
43388         LDKOffer this_arg_conv;
43389         this_arg_conv.inner = untag_ptr(this_arg);
43390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43392         this_arg_conv.is_owned = false;
43393         LDKOfferFeatures ret_var = Offer_features(&this_arg_conv);
43394         uint64_t ret_ref = 0;
43395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43397         return ret_ref;
43398 }
43399
43400 uint64_t  __attribute__((export_name("TS_Offer_absolute_expiry"))) TS_Offer_absolute_expiry(uint64_t this_arg) {
43401         LDKOffer this_arg_conv;
43402         this_arg_conv.inner = untag_ptr(this_arg);
43403         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43405         this_arg_conv.is_owned = false;
43406         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
43407         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
43408         uint64_t ret_ref = tag_ptr(ret_copy, true);
43409         return ret_ref;
43410 }
43411
43412 uint64_t  __attribute__((export_name("TS_Offer_issuer"))) TS_Offer_issuer(uint64_t this_arg) {
43413         LDKOffer this_arg_conv;
43414         this_arg_conv.inner = untag_ptr(this_arg);
43415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43417         this_arg_conv.is_owned = false;
43418         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
43419         uint64_t ret_ref = 0;
43420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43422         return ret_ref;
43423 }
43424
43425 uint64_tArray  __attribute__((export_name("TS_Offer_paths"))) TS_Offer_paths(uint64_t this_arg) {
43426         LDKOffer this_arg_conv;
43427         this_arg_conv.inner = untag_ptr(this_arg);
43428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43430         this_arg_conv.is_owned = false;
43431         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
43432         uint64_tArray ret_arr = NULL;
43433         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43434         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43435         for (size_t n = 0; n < ret_var.datalen; n++) {
43436                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
43437                 uint64_t ret_conv_13_ref = 0;
43438                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
43439                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
43440                 ret_arr_ptr[n] = ret_conv_13_ref;
43441         }
43442         
43443         FREE(ret_var.data);
43444         return ret_arr;
43445 }
43446
43447 uint64_t  __attribute__((export_name("TS_Offer_supported_quantity"))) TS_Offer_supported_quantity(uint64_t this_arg) {
43448         LDKOffer this_arg_conv;
43449         this_arg_conv.inner = untag_ptr(this_arg);
43450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43452         this_arg_conv.is_owned = false;
43453         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
43454         uint64_t ret_ref = 0;
43455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43457         return ret_ref;
43458 }
43459
43460 jboolean  __attribute__((export_name("TS_Offer_is_valid_quantity"))) TS_Offer_is_valid_quantity(uint64_t this_arg, int64_t quantity) {
43461         LDKOffer this_arg_conv;
43462         this_arg_conv.inner = untag_ptr(this_arg);
43463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43465         this_arg_conv.is_owned = false;
43466         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
43467         return ret_conv;
43468 }
43469
43470 jboolean  __attribute__((export_name("TS_Offer_expects_quantity"))) TS_Offer_expects_quantity(uint64_t this_arg) {
43471         LDKOffer this_arg_conv;
43472         this_arg_conv.inner = untag_ptr(this_arg);
43473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43475         this_arg_conv.is_owned = false;
43476         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
43477         return ret_conv;
43478 }
43479
43480 int8_tArray  __attribute__((export_name("TS_Offer_signing_pubkey"))) TS_Offer_signing_pubkey(uint64_t this_arg) {
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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43487         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
43488         return ret_arr;
43489 }
43490
43491 int8_tArray  __attribute__((export_name("TS_Offer_write"))) TS_Offer_write(uint64_t obj) {
43492         LDKOffer obj_conv;
43493         obj_conv.inner = untag_ptr(obj);
43494         obj_conv.is_owned = ptr_is_owned(obj);
43495         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43496         obj_conv.is_owned = false;
43497         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
43498         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43499         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43500         CVec_u8Z_free(ret_var);
43501         return ret_arr;
43502 }
43503
43504 void  __attribute__((export_name("TS_Amount_free"))) TS_Amount_free(uint64_t this_obj) {
43505         LDKAmount this_obj_conv;
43506         this_obj_conv.inner = untag_ptr(this_obj);
43507         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43509         Amount_free(this_obj_conv);
43510 }
43511
43512 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
43513         LDKAmount ret_var = Amount_clone(arg);
43514         uint64_t ret_ref = 0;
43515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43517         return ret_ref;
43518 }
43519 int64_t  __attribute__((export_name("TS_Amount_clone_ptr"))) TS_Amount_clone_ptr(uint64_t arg) {
43520         LDKAmount arg_conv;
43521         arg_conv.inner = untag_ptr(arg);
43522         arg_conv.is_owned = ptr_is_owned(arg);
43523         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43524         arg_conv.is_owned = false;
43525         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
43526         return ret_conv;
43527 }
43528
43529 uint64_t  __attribute__((export_name("TS_Amount_clone"))) TS_Amount_clone(uint64_t orig) {
43530         LDKAmount orig_conv;
43531         orig_conv.inner = untag_ptr(orig);
43532         orig_conv.is_owned = ptr_is_owned(orig);
43533         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43534         orig_conv.is_owned = false;
43535         LDKAmount ret_var = Amount_clone(&orig_conv);
43536         uint64_t ret_ref = 0;
43537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43539         return ret_ref;
43540 }
43541
43542 void  __attribute__((export_name("TS_Quantity_free"))) TS_Quantity_free(uint64_t this_obj) {
43543         LDKQuantity this_obj_conv;
43544         this_obj_conv.inner = untag_ptr(this_obj);
43545         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43547         Quantity_free(this_obj_conv);
43548 }
43549
43550 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
43551         LDKQuantity ret_var = Quantity_clone(arg);
43552         uint64_t ret_ref = 0;
43553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43555         return ret_ref;
43556 }
43557 int64_t  __attribute__((export_name("TS_Quantity_clone_ptr"))) TS_Quantity_clone_ptr(uint64_t arg) {
43558         LDKQuantity arg_conv;
43559         arg_conv.inner = untag_ptr(arg);
43560         arg_conv.is_owned = ptr_is_owned(arg);
43561         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43562         arg_conv.is_owned = false;
43563         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
43564         return ret_conv;
43565 }
43566
43567 uint64_t  __attribute__((export_name("TS_Quantity_clone"))) TS_Quantity_clone(uint64_t orig) {
43568         LDKQuantity orig_conv;
43569         orig_conv.inner = untag_ptr(orig);
43570         orig_conv.is_owned = ptr_is_owned(orig);
43571         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43572         orig_conv.is_owned = false;
43573         LDKQuantity ret_var = Quantity_clone(&orig_conv);
43574         uint64_t ret_ref = 0;
43575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43577         return ret_ref;
43578 }
43579
43580 void  __attribute__((export_name("TS_Refund_free"))) TS_Refund_free(uint64_t this_obj) {
43581         LDKRefund this_obj_conv;
43582         this_obj_conv.inner = untag_ptr(this_obj);
43583         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43585         Refund_free(this_obj_conv);
43586 }
43587
43588 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
43589         LDKRefund ret_var = Refund_clone(arg);
43590         uint64_t ret_ref = 0;
43591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43593         return ret_ref;
43594 }
43595 int64_t  __attribute__((export_name("TS_Refund_clone_ptr"))) TS_Refund_clone_ptr(uint64_t arg) {
43596         LDKRefund arg_conv;
43597         arg_conv.inner = untag_ptr(arg);
43598         arg_conv.is_owned = ptr_is_owned(arg);
43599         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43600         arg_conv.is_owned = false;
43601         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
43602         return ret_conv;
43603 }
43604
43605 uint64_t  __attribute__((export_name("TS_Refund_clone"))) TS_Refund_clone(uint64_t orig) {
43606         LDKRefund orig_conv;
43607         orig_conv.inner = untag_ptr(orig);
43608         orig_conv.is_owned = ptr_is_owned(orig);
43609         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43610         orig_conv.is_owned = false;
43611         LDKRefund ret_var = Refund_clone(&orig_conv);
43612         uint64_t ret_ref = 0;
43613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43615         return ret_ref;
43616 }
43617
43618 uint64_t  __attribute__((export_name("TS_Refund_description"))) TS_Refund_description(uint64_t this_arg) {
43619         LDKRefund this_arg_conv;
43620         this_arg_conv.inner = untag_ptr(this_arg);
43621         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43623         this_arg_conv.is_owned = false;
43624         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
43625         uint64_t ret_ref = 0;
43626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43628         return ret_ref;
43629 }
43630
43631 uint64_t  __attribute__((export_name("TS_Refund_absolute_expiry"))) TS_Refund_absolute_expiry(uint64_t this_arg) {
43632         LDKRefund this_arg_conv;
43633         this_arg_conv.inner = untag_ptr(this_arg);
43634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43636         this_arg_conv.is_owned = false;
43637         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
43638         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
43639         uint64_t ret_ref = tag_ptr(ret_copy, true);
43640         return ret_ref;
43641 }
43642
43643 uint64_t  __attribute__((export_name("TS_Refund_issuer"))) TS_Refund_issuer(uint64_t this_arg) {
43644         LDKRefund this_arg_conv;
43645         this_arg_conv.inner = untag_ptr(this_arg);
43646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43648         this_arg_conv.is_owned = false;
43649         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
43650         uint64_t ret_ref = 0;
43651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43653         return ret_ref;
43654 }
43655
43656 uint64_tArray  __attribute__((export_name("TS_Refund_paths"))) TS_Refund_paths(uint64_t this_arg) {
43657         LDKRefund this_arg_conv;
43658         this_arg_conv.inner = untag_ptr(this_arg);
43659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43661         this_arg_conv.is_owned = false;
43662         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
43663         uint64_tArray ret_arr = NULL;
43664         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43665         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43666         for (size_t n = 0; n < ret_var.datalen; n++) {
43667                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
43668                 uint64_t ret_conv_13_ref = 0;
43669                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
43670                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
43671                 ret_arr_ptr[n] = ret_conv_13_ref;
43672         }
43673         
43674         FREE(ret_var.data);
43675         return ret_arr;
43676 }
43677
43678 int8_tArray  __attribute__((export_name("TS_Refund_metadata"))) TS_Refund_metadata(uint64_t this_arg) {
43679         LDKRefund this_arg_conv;
43680         this_arg_conv.inner = untag_ptr(this_arg);
43681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43683         this_arg_conv.is_owned = false;
43684         LDKu8slice ret_var = Refund_metadata(&this_arg_conv);
43685         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43686         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43687         return ret_arr;
43688 }
43689
43690 int8_tArray  __attribute__((export_name("TS_Refund_chain"))) TS_Refund_chain(uint64_t this_arg) {
43691         LDKRefund this_arg_conv;
43692         this_arg_conv.inner = untag_ptr(this_arg);
43693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43695         this_arg_conv.is_owned = false;
43696         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43697         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
43698         return ret_arr;
43699 }
43700
43701 int64_t  __attribute__((export_name("TS_Refund_amount_msats"))) TS_Refund_amount_msats(uint64_t this_arg) {
43702         LDKRefund this_arg_conv;
43703         this_arg_conv.inner = untag_ptr(this_arg);
43704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43706         this_arg_conv.is_owned = false;
43707         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
43708         return ret_conv;
43709 }
43710
43711 uint64_t  __attribute__((export_name("TS_Refund_features"))) TS_Refund_features(uint64_t this_arg) {
43712         LDKRefund this_arg_conv;
43713         this_arg_conv.inner = untag_ptr(this_arg);
43714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43716         this_arg_conv.is_owned = false;
43717         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
43718         uint64_t ret_ref = 0;
43719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43721         return ret_ref;
43722 }
43723
43724 uint64_t  __attribute__((export_name("TS_Refund_quantity"))) TS_Refund_quantity(uint64_t this_arg) {
43725         LDKRefund this_arg_conv;
43726         this_arg_conv.inner = untag_ptr(this_arg);
43727         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43729         this_arg_conv.is_owned = false;
43730         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43731         *ret_copy = Refund_quantity(&this_arg_conv);
43732         uint64_t ret_ref = tag_ptr(ret_copy, true);
43733         return ret_ref;
43734 }
43735
43736 int8_tArray  __attribute__((export_name("TS_Refund_payer_id"))) TS_Refund_payer_id(uint64_t this_arg) {
43737         LDKRefund this_arg_conv;
43738         this_arg_conv.inner = untag_ptr(this_arg);
43739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43741         this_arg_conv.is_owned = false;
43742         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43743         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
43744         return ret_arr;
43745 }
43746
43747 uint64_t  __attribute__((export_name("TS_Refund_payer_note"))) TS_Refund_payer_note(uint64_t this_arg) {
43748         LDKRefund this_arg_conv;
43749         this_arg_conv.inner = untag_ptr(this_arg);
43750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43752         this_arg_conv.is_owned = false;
43753         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
43754         uint64_t ret_ref = 0;
43755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43757         return ret_ref;
43758 }
43759
43760 int8_tArray  __attribute__((export_name("TS_Refund_write"))) TS_Refund_write(uint64_t obj) {
43761         LDKRefund obj_conv;
43762         obj_conv.inner = untag_ptr(obj);
43763         obj_conv.is_owned = ptr_is_owned(obj);
43764         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43765         obj_conv.is_owned = false;
43766         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
43767         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43768         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43769         CVec_u8Z_free(ret_var);
43770         return ret_arr;
43771 }
43772
43773 uint32_t  __attribute__((export_name("TS_UtxoLookupError_clone"))) TS_UtxoLookupError_clone(uint64_t orig) {
43774         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
43775         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_clone(orig_conv));
43776         return ret_conv;
43777 }
43778
43779 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_chain"))) TS_UtxoLookupError_unknown_chain() {
43780         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_chain());
43781         return ret_conv;
43782 }
43783
43784 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_tx"))) TS_UtxoLookupError_unknown_tx() {
43785         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_tx());
43786         return ret_conv;
43787 }
43788
43789 void  __attribute__((export_name("TS_UtxoResult_free"))) TS_UtxoResult_free(uint64_t this_ptr) {
43790         if (!ptr_is_owned(this_ptr)) return;
43791         void* this_ptr_ptr = untag_ptr(this_ptr);
43792         CHECK_ACCESS(this_ptr_ptr);
43793         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
43794         FREE(untag_ptr(this_ptr));
43795         UtxoResult_free(this_ptr_conv);
43796 }
43797
43798 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
43799         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
43800         *ret_copy = UtxoResult_clone(arg);
43801         uint64_t ret_ref = tag_ptr(ret_copy, true);
43802         return ret_ref;
43803 }
43804 int64_t  __attribute__((export_name("TS_UtxoResult_clone_ptr"))) TS_UtxoResult_clone_ptr(uint64_t arg) {
43805         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
43806         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
43807         return ret_conv;
43808 }
43809
43810 uint64_t  __attribute__((export_name("TS_UtxoResult_clone"))) TS_UtxoResult_clone(uint64_t orig) {
43811         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
43812         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
43813         *ret_copy = UtxoResult_clone(orig_conv);
43814         uint64_t ret_ref = tag_ptr(ret_copy, true);
43815         return ret_ref;
43816 }
43817
43818 uint64_t  __attribute__((export_name("TS_UtxoResult_sync"))) TS_UtxoResult_sync(uint64_t a) {
43819         void* a_ptr = untag_ptr(a);
43820         CHECK_ACCESS(a_ptr);
43821         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
43822         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
43823         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
43824         *ret_copy = UtxoResult_sync(a_conv);
43825         uint64_t ret_ref = tag_ptr(ret_copy, true);
43826         return ret_ref;
43827 }
43828
43829 uint64_t  __attribute__((export_name("TS_UtxoResult_async"))) TS_UtxoResult_async(uint64_t a) {
43830         LDKUtxoFuture a_conv;
43831         a_conv.inner = untag_ptr(a);
43832         a_conv.is_owned = ptr_is_owned(a);
43833         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43834         a_conv = UtxoFuture_clone(&a_conv);
43835         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
43836         *ret_copy = UtxoResult_async(a_conv);
43837         uint64_t ret_ref = tag_ptr(ret_copy, true);
43838         return ret_ref;
43839 }
43840
43841 void  __attribute__((export_name("TS_UtxoLookup_free"))) TS_UtxoLookup_free(uint64_t this_ptr) {
43842         if (!ptr_is_owned(this_ptr)) return;
43843         void* this_ptr_ptr = untag_ptr(this_ptr);
43844         CHECK_ACCESS(this_ptr_ptr);
43845         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
43846         FREE(untag_ptr(this_ptr));
43847         UtxoLookup_free(this_ptr_conv);
43848 }
43849
43850 void  __attribute__((export_name("TS_UtxoFuture_free"))) TS_UtxoFuture_free(uint64_t this_obj) {
43851         LDKUtxoFuture this_obj_conv;
43852         this_obj_conv.inner = untag_ptr(this_obj);
43853         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43855         UtxoFuture_free(this_obj_conv);
43856 }
43857
43858 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
43859         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
43860         uint64_t ret_ref = 0;
43861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43863         return ret_ref;
43864 }
43865 int64_t  __attribute__((export_name("TS_UtxoFuture_clone_ptr"))) TS_UtxoFuture_clone_ptr(uint64_t arg) {
43866         LDKUtxoFuture arg_conv;
43867         arg_conv.inner = untag_ptr(arg);
43868         arg_conv.is_owned = ptr_is_owned(arg);
43869         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43870         arg_conv.is_owned = false;
43871         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
43872         return ret_conv;
43873 }
43874
43875 uint64_t  __attribute__((export_name("TS_UtxoFuture_clone"))) TS_UtxoFuture_clone(uint64_t orig) {
43876         LDKUtxoFuture orig_conv;
43877         orig_conv.inner = untag_ptr(orig);
43878         orig_conv.is_owned = ptr_is_owned(orig);
43879         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43880         orig_conv.is_owned = false;
43881         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
43882         uint64_t ret_ref = 0;
43883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43885         return ret_ref;
43886 }
43887
43888 uint64_t  __attribute__((export_name("TS_UtxoFuture_new"))) TS_UtxoFuture_new() {
43889         LDKUtxoFuture ret_var = UtxoFuture_new();
43890         uint64_t ret_ref = 0;
43891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43893         return ret_ref;
43894 }
43895
43896 void  __attribute__((export_name("TS_UtxoFuture_resolve_without_forwarding"))) TS_UtxoFuture_resolve_without_forwarding(uint64_t this_arg, uint64_t graph, uint64_t result) {
43897         LDKUtxoFuture this_arg_conv;
43898         this_arg_conv.inner = untag_ptr(this_arg);
43899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43901         this_arg_conv.is_owned = false;
43902         LDKNetworkGraph graph_conv;
43903         graph_conv.inner = untag_ptr(graph);
43904         graph_conv.is_owned = ptr_is_owned(graph);
43905         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
43906         graph_conv.is_owned = false;
43907         void* result_ptr = untag_ptr(result);
43908         CHECK_ACCESS(result_ptr);
43909         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
43910         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
43911 }
43912
43913 void  __attribute__((export_name("TS_UtxoFuture_resolve"))) TS_UtxoFuture_resolve(uint64_t this_arg, uint64_t graph, uint64_t gossip, uint64_t result) {
43914         LDKUtxoFuture this_arg_conv;
43915         this_arg_conv.inner = untag_ptr(this_arg);
43916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43918         this_arg_conv.is_owned = false;
43919         LDKNetworkGraph graph_conv;
43920         graph_conv.inner = untag_ptr(graph);
43921         graph_conv.is_owned = ptr_is_owned(graph);
43922         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
43923         graph_conv.is_owned = false;
43924         LDKP2PGossipSync gossip_conv;
43925         gossip_conv.inner = untag_ptr(gossip);
43926         gossip_conv.is_owned = ptr_is_owned(gossip);
43927         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
43928         gossip_conv.is_owned = false;
43929         void* result_ptr = untag_ptr(result);
43930         CHECK_ACCESS(result_ptr);
43931         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
43932         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
43933 }
43934
43935 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
43936         LDKNodeId this_obj_conv;
43937         this_obj_conv.inner = untag_ptr(this_obj);
43938         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43940         NodeId_free(this_obj_conv);
43941 }
43942
43943 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
43944         LDKNodeId ret_var = NodeId_clone(arg);
43945         uint64_t ret_ref = 0;
43946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43948         return ret_ref;
43949 }
43950 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
43951         LDKNodeId arg_conv;
43952         arg_conv.inner = untag_ptr(arg);
43953         arg_conv.is_owned = ptr_is_owned(arg);
43954         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43955         arg_conv.is_owned = false;
43956         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
43957         return ret_conv;
43958 }
43959
43960 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
43961         LDKNodeId orig_conv;
43962         orig_conv.inner = untag_ptr(orig);
43963         orig_conv.is_owned = ptr_is_owned(orig);
43964         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43965         orig_conv.is_owned = false;
43966         LDKNodeId ret_var = NodeId_clone(&orig_conv);
43967         uint64_t ret_ref = 0;
43968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43970         return ret_ref;
43971 }
43972
43973 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
43974         LDKPublicKey pubkey_ref;
43975         CHECK(pubkey->arr_len == 33);
43976         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
43977         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
43978         uint64_t ret_ref = 0;
43979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43981         return ret_ref;
43982 }
43983
43984 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
43985         LDKNodeId this_arg_conv;
43986         this_arg_conv.inner = untag_ptr(this_arg);
43987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43989         this_arg_conv.is_owned = false;
43990         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
43991         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43992         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43993         return ret_arr;
43994 }
43995
43996 uint64_t  __attribute__((export_name("TS_NodeId_as_pubkey"))) TS_NodeId_as_pubkey(uint64_t this_arg) {
43997         LDKNodeId this_arg_conv;
43998         this_arg_conv.inner = untag_ptr(this_arg);
43999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44001         this_arg_conv.is_owned = false;
44002         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
44003         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
44004         return tag_ptr(ret_conv, true);
44005 }
44006
44007 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
44008         LDKNodeId o_conv;
44009         o_conv.inner = untag_ptr(o);
44010         o_conv.is_owned = ptr_is_owned(o);
44011         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44012         o_conv.is_owned = false;
44013         int64_t ret_conv = NodeId_hash(&o_conv);
44014         return ret_conv;
44015 }
44016
44017 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
44018         LDKNodeId obj_conv;
44019         obj_conv.inner = untag_ptr(obj);
44020         obj_conv.is_owned = ptr_is_owned(obj);
44021         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44022         obj_conv.is_owned = false;
44023         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
44024         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44025         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44026         CVec_u8Z_free(ret_var);
44027         return ret_arr;
44028 }
44029
44030 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
44031         LDKu8slice ser_ref;
44032         ser_ref.datalen = ser->arr_len;
44033         ser_ref.data = ser->elems;
44034         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
44035         *ret_conv = NodeId_read(ser_ref);
44036         FREE(ser);
44037         return tag_ptr(ret_conv, true);
44038 }
44039
44040 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
44041         LDKNetworkGraph this_obj_conv;
44042         this_obj_conv.inner = untag_ptr(this_obj);
44043         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44045         NetworkGraph_free(this_obj_conv);
44046 }
44047
44048 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
44049         LDKReadOnlyNetworkGraph this_obj_conv;
44050         this_obj_conv.inner = untag_ptr(this_obj);
44051         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44053         ReadOnlyNetworkGraph_free(this_obj_conv);
44054 }
44055
44056 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
44057         if (!ptr_is_owned(this_ptr)) return;
44058         void* this_ptr_ptr = untag_ptr(this_ptr);
44059         CHECK_ACCESS(this_ptr_ptr);
44060         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
44061         FREE(untag_ptr(this_ptr));
44062         NetworkUpdate_free(this_ptr_conv);
44063 }
44064
44065 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
44066         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44067         *ret_copy = NetworkUpdate_clone(arg);
44068         uint64_t ret_ref = tag_ptr(ret_copy, true);
44069         return ret_ref;
44070 }
44071 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
44072         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
44073         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
44074         return ret_conv;
44075 }
44076
44077 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
44078         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
44079         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44080         *ret_copy = NetworkUpdate_clone(orig_conv);
44081         uint64_t ret_ref = tag_ptr(ret_copy, true);
44082         return ret_ref;
44083 }
44084
44085 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
44086         LDKChannelUpdate msg_conv;
44087         msg_conv.inner = untag_ptr(msg);
44088         msg_conv.is_owned = ptr_is_owned(msg);
44089         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44090         msg_conv = ChannelUpdate_clone(&msg_conv);
44091         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44092         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
44093         uint64_t ret_ref = tag_ptr(ret_copy, true);
44094         return ret_ref;
44095 }
44096
44097 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
44098         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44099         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
44100         uint64_t ret_ref = tag_ptr(ret_copy, true);
44101         return ret_ref;
44102 }
44103
44104 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
44105         LDKPublicKey node_id_ref;
44106         CHECK(node_id->arr_len == 33);
44107         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
44108         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
44109         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
44110         uint64_t ret_ref = tag_ptr(ret_copy, true);
44111         return ret_ref;
44112 }
44113
44114 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
44115         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
44116         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
44117         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
44118         return ret_conv;
44119 }
44120
44121 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
44122         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
44123         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
44124         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44125         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44126         CVec_u8Z_free(ret_var);
44127         return ret_arr;
44128 }
44129
44130 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
44131         LDKu8slice ser_ref;
44132         ser_ref.datalen = ser->arr_len;
44133         ser_ref.data = ser->elems;
44134         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
44135         *ret_conv = NetworkUpdate_read(ser_ref);
44136         FREE(ser);
44137         return tag_ptr(ret_conv, true);
44138 }
44139
44140 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
44141         LDKP2PGossipSync this_obj_conv;
44142         this_obj_conv.inner = untag_ptr(this_obj);
44143         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44145         P2PGossipSync_free(this_obj_conv);
44146 }
44147
44148 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t utxo_lookup, uint64_t logger) {
44149         LDKNetworkGraph network_graph_conv;
44150         network_graph_conv.inner = untag_ptr(network_graph);
44151         network_graph_conv.is_owned = ptr_is_owned(network_graph);
44152         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44153         network_graph_conv.is_owned = false;
44154         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
44155         CHECK_ACCESS(utxo_lookup_ptr);
44156         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
44157         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
44158         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
44159                 // Manually implement clone for Java trait instances
44160                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
44161                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44162                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
44163                 }
44164         }
44165         void* logger_ptr = untag_ptr(logger);
44166         CHECK_ACCESS(logger_ptr);
44167         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44168         if (logger_conv.free == LDKLogger_JCalls_free) {
44169                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44170                 LDKLogger_JCalls_cloned(&logger_conv);
44171         }
44172         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
44173         uint64_t ret_ref = 0;
44174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44176         return ret_ref;
44177 }
44178
44179 void  __attribute__((export_name("TS_P2PGossipSync_add_utxo_lookup"))) TS_P2PGossipSync_add_utxo_lookup(uint64_t this_arg, uint64_t utxo_lookup) {
44180         LDKP2PGossipSync this_arg_conv;
44181         this_arg_conv.inner = untag_ptr(this_arg);
44182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44184         this_arg_conv.is_owned = false;
44185         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
44186         CHECK_ACCESS(utxo_lookup_ptr);
44187         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
44188         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
44189         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
44190                 // Manually implement clone for Java trait instances
44191                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
44192                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44193                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
44194                 }
44195         }
44196         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
44197 }
44198
44199 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
44200         LDKNetworkGraph 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         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
44206         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
44207 }
44208
44209 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
44210         LDKP2PGossipSync this_arg_conv;
44211         this_arg_conv.inner = untag_ptr(this_arg);
44212         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44214         this_arg_conv.is_owned = false;
44215         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
44216         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
44217         return tag_ptr(ret_ret, true);
44218 }
44219
44220 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
44221         LDKP2PGossipSync this_arg_conv;
44222         this_arg_conv.inner = untag_ptr(this_arg);
44223         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44225         this_arg_conv.is_owned = false;
44226         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
44227         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
44228         return tag_ptr(ret_ret, true);
44229 }
44230
44231 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
44232         LDKChannelUpdateInfo this_obj_conv;
44233         this_obj_conv.inner = untag_ptr(this_obj);
44234         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44236         ChannelUpdateInfo_free(this_obj_conv);
44237 }
44238
44239 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
44240         LDKChannelUpdateInfo this_ptr_conv;
44241         this_ptr_conv.inner = untag_ptr(this_ptr);
44242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44244         this_ptr_conv.is_owned = false;
44245         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
44246         return ret_conv;
44247 }
44248
44249 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
44250         LDKChannelUpdateInfo this_ptr_conv;
44251         this_ptr_conv.inner = untag_ptr(this_ptr);
44252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44254         this_ptr_conv.is_owned = false;
44255         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
44256 }
44257
44258 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
44259         LDKChannelUpdateInfo this_ptr_conv;
44260         this_ptr_conv.inner = untag_ptr(this_ptr);
44261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44263         this_ptr_conv.is_owned = false;
44264         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
44265         return ret_conv;
44266 }
44267
44268 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
44269         LDKChannelUpdateInfo this_ptr_conv;
44270         this_ptr_conv.inner = untag_ptr(this_ptr);
44271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44273         this_ptr_conv.is_owned = false;
44274         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
44275 }
44276
44277 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
44278         LDKChannelUpdateInfo this_ptr_conv;
44279         this_ptr_conv.inner = untag_ptr(this_ptr);
44280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44282         this_ptr_conv.is_owned = false;
44283         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
44284         return ret_conv;
44285 }
44286
44287 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
44288         LDKChannelUpdateInfo this_ptr_conv;
44289         this_ptr_conv.inner = untag_ptr(this_ptr);
44290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44292         this_ptr_conv.is_owned = false;
44293         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
44294 }
44295
44296 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
44297         LDKChannelUpdateInfo this_ptr_conv;
44298         this_ptr_conv.inner = untag_ptr(this_ptr);
44299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44301         this_ptr_conv.is_owned = false;
44302         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
44303         return ret_conv;
44304 }
44305
44306 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
44307         LDKChannelUpdateInfo this_ptr_conv;
44308         this_ptr_conv.inner = untag_ptr(this_ptr);
44309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44311         this_ptr_conv.is_owned = false;
44312         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
44313 }
44314
44315 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
44316         LDKChannelUpdateInfo this_ptr_conv;
44317         this_ptr_conv.inner = untag_ptr(this_ptr);
44318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44320         this_ptr_conv.is_owned = false;
44321         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
44322         return ret_conv;
44323 }
44324
44325 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
44326         LDKChannelUpdateInfo this_ptr_conv;
44327         this_ptr_conv.inner = untag_ptr(this_ptr);
44328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44330         this_ptr_conv.is_owned = false;
44331         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
44332 }
44333
44334 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
44335         LDKChannelUpdateInfo this_ptr_conv;
44336         this_ptr_conv.inner = untag_ptr(this_ptr);
44337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44339         this_ptr_conv.is_owned = false;
44340         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
44341         uint64_t ret_ref = 0;
44342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44344         return ret_ref;
44345 }
44346
44347 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
44348         LDKChannelUpdateInfo this_ptr_conv;
44349         this_ptr_conv.inner = untag_ptr(this_ptr);
44350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44352         this_ptr_conv.is_owned = false;
44353         LDKRoutingFees val_conv;
44354         val_conv.inner = untag_ptr(val);
44355         val_conv.is_owned = ptr_is_owned(val);
44356         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44357         val_conv = RoutingFees_clone(&val_conv);
44358         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
44359 }
44360
44361 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
44362         LDKChannelUpdateInfo this_ptr_conv;
44363         this_ptr_conv.inner = untag_ptr(this_ptr);
44364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44366         this_ptr_conv.is_owned = false;
44367         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
44368         uint64_t ret_ref = 0;
44369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44371         return ret_ref;
44372 }
44373
44374 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
44375         LDKChannelUpdateInfo this_ptr_conv;
44376         this_ptr_conv.inner = untag_ptr(this_ptr);
44377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44379         this_ptr_conv.is_owned = false;
44380         LDKChannelUpdate val_conv;
44381         val_conv.inner = untag_ptr(val);
44382         val_conv.is_owned = ptr_is_owned(val);
44383         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44384         val_conv = ChannelUpdate_clone(&val_conv);
44385         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
44386 }
44387
44388 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) {
44389         LDKRoutingFees fees_arg_conv;
44390         fees_arg_conv.inner = untag_ptr(fees_arg);
44391         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
44392         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
44393         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
44394         LDKChannelUpdate last_update_message_arg_conv;
44395         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
44396         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
44397         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
44398         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
44399         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);
44400         uint64_t ret_ref = 0;
44401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44403         return ret_ref;
44404 }
44405
44406 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
44407         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
44408         uint64_t ret_ref = 0;
44409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44411         return ret_ref;
44412 }
44413 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
44414         LDKChannelUpdateInfo arg_conv;
44415         arg_conv.inner = untag_ptr(arg);
44416         arg_conv.is_owned = ptr_is_owned(arg);
44417         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44418         arg_conv.is_owned = false;
44419         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
44420         return ret_conv;
44421 }
44422
44423 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
44424         LDKChannelUpdateInfo orig_conv;
44425         orig_conv.inner = untag_ptr(orig);
44426         orig_conv.is_owned = ptr_is_owned(orig);
44427         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44428         orig_conv.is_owned = false;
44429         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
44430         uint64_t ret_ref = 0;
44431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44433         return ret_ref;
44434 }
44435
44436 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
44437         LDKChannelUpdateInfo a_conv;
44438         a_conv.inner = untag_ptr(a);
44439         a_conv.is_owned = ptr_is_owned(a);
44440         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44441         a_conv.is_owned = false;
44442         LDKChannelUpdateInfo b_conv;
44443         b_conv.inner = untag_ptr(b);
44444         b_conv.is_owned = ptr_is_owned(b);
44445         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44446         b_conv.is_owned = false;
44447         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
44448         return ret_conv;
44449 }
44450
44451 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
44452         LDKChannelUpdateInfo obj_conv;
44453         obj_conv.inner = untag_ptr(obj);
44454         obj_conv.is_owned = ptr_is_owned(obj);
44455         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44456         obj_conv.is_owned = false;
44457         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
44458         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44459         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44460         CVec_u8Z_free(ret_var);
44461         return ret_arr;
44462 }
44463
44464 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
44465         LDKu8slice ser_ref;
44466         ser_ref.datalen = ser->arr_len;
44467         ser_ref.data = ser->elems;
44468         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
44469         *ret_conv = ChannelUpdateInfo_read(ser_ref);
44470         FREE(ser);
44471         return tag_ptr(ret_conv, true);
44472 }
44473
44474 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
44475         LDKChannelInfo this_obj_conv;
44476         this_obj_conv.inner = untag_ptr(this_obj);
44477         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44479         ChannelInfo_free(this_obj_conv);
44480 }
44481
44482 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
44483         LDKChannelInfo this_ptr_conv;
44484         this_ptr_conv.inner = untag_ptr(this_ptr);
44485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44487         this_ptr_conv.is_owned = false;
44488         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
44489         uint64_t ret_ref = 0;
44490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44492         return ret_ref;
44493 }
44494
44495 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
44496         LDKChannelInfo this_ptr_conv;
44497         this_ptr_conv.inner = untag_ptr(this_ptr);
44498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44500         this_ptr_conv.is_owned = false;
44501         LDKChannelFeatures val_conv;
44502         val_conv.inner = untag_ptr(val);
44503         val_conv.is_owned = ptr_is_owned(val);
44504         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44505         val_conv = ChannelFeatures_clone(&val_conv);
44506         ChannelInfo_set_features(&this_ptr_conv, val_conv);
44507 }
44508
44509 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
44510         LDKChannelInfo this_ptr_conv;
44511         this_ptr_conv.inner = untag_ptr(this_ptr);
44512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44514         this_ptr_conv.is_owned = false;
44515         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
44516         uint64_t ret_ref = 0;
44517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44519         return ret_ref;
44520 }
44521
44522 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
44523         LDKChannelInfo this_ptr_conv;
44524         this_ptr_conv.inner = untag_ptr(this_ptr);
44525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44527         this_ptr_conv.is_owned = false;
44528         LDKNodeId val_conv;
44529         val_conv.inner = untag_ptr(val);
44530         val_conv.is_owned = ptr_is_owned(val);
44531         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44532         val_conv = NodeId_clone(&val_conv);
44533         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
44534 }
44535
44536 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
44537         LDKChannelInfo this_ptr_conv;
44538         this_ptr_conv.inner = untag_ptr(this_ptr);
44539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44541         this_ptr_conv.is_owned = false;
44542         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
44543         uint64_t ret_ref = 0;
44544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44546         return ret_ref;
44547 }
44548
44549 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
44550         LDKChannelInfo this_ptr_conv;
44551         this_ptr_conv.inner = untag_ptr(this_ptr);
44552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44554         this_ptr_conv.is_owned = false;
44555         LDKChannelUpdateInfo val_conv;
44556         val_conv.inner = untag_ptr(val);
44557         val_conv.is_owned = ptr_is_owned(val);
44558         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44559         val_conv = ChannelUpdateInfo_clone(&val_conv);
44560         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
44561 }
44562
44563 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
44564         LDKChannelInfo this_ptr_conv;
44565         this_ptr_conv.inner = untag_ptr(this_ptr);
44566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44568         this_ptr_conv.is_owned = false;
44569         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
44570         uint64_t ret_ref = 0;
44571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44573         return ret_ref;
44574 }
44575
44576 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
44577         LDKChannelInfo this_ptr_conv;
44578         this_ptr_conv.inner = untag_ptr(this_ptr);
44579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44581         this_ptr_conv.is_owned = false;
44582         LDKNodeId val_conv;
44583         val_conv.inner = untag_ptr(val);
44584         val_conv.is_owned = ptr_is_owned(val);
44585         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44586         val_conv = NodeId_clone(&val_conv);
44587         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
44588 }
44589
44590 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
44591         LDKChannelInfo this_ptr_conv;
44592         this_ptr_conv.inner = untag_ptr(this_ptr);
44593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44595         this_ptr_conv.is_owned = false;
44596         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
44597         uint64_t ret_ref = 0;
44598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44600         return ret_ref;
44601 }
44602
44603 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
44604         LDKChannelInfo this_ptr_conv;
44605         this_ptr_conv.inner = untag_ptr(this_ptr);
44606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44608         this_ptr_conv.is_owned = false;
44609         LDKChannelUpdateInfo val_conv;
44610         val_conv.inner = untag_ptr(val);
44611         val_conv.is_owned = ptr_is_owned(val);
44612         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44613         val_conv = ChannelUpdateInfo_clone(&val_conv);
44614         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
44615 }
44616
44617 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
44618         LDKChannelInfo this_ptr_conv;
44619         this_ptr_conv.inner = untag_ptr(this_ptr);
44620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44622         this_ptr_conv.is_owned = false;
44623         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44624         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
44625         uint64_t ret_ref = tag_ptr(ret_copy, true);
44626         return ret_ref;
44627 }
44628
44629 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
44630         LDKChannelInfo this_ptr_conv;
44631         this_ptr_conv.inner = untag_ptr(this_ptr);
44632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44634         this_ptr_conv.is_owned = false;
44635         void* val_ptr = untag_ptr(val);
44636         CHECK_ACCESS(val_ptr);
44637         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44638         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44639         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
44640 }
44641
44642 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
44643         LDKChannelInfo this_ptr_conv;
44644         this_ptr_conv.inner = untag_ptr(this_ptr);
44645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44647         this_ptr_conv.is_owned = false;
44648         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
44649         uint64_t ret_ref = 0;
44650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44652         return ret_ref;
44653 }
44654
44655 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
44656         LDKChannelInfo this_ptr_conv;
44657         this_ptr_conv.inner = untag_ptr(this_ptr);
44658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44660         this_ptr_conv.is_owned = false;
44661         LDKChannelAnnouncement val_conv;
44662         val_conv.inner = untag_ptr(val);
44663         val_conv.is_owned = ptr_is_owned(val);
44664         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44665         val_conv = ChannelAnnouncement_clone(&val_conv);
44666         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
44667 }
44668
44669 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
44670         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
44671         uint64_t ret_ref = 0;
44672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44674         return ret_ref;
44675 }
44676 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
44677         LDKChannelInfo arg_conv;
44678         arg_conv.inner = untag_ptr(arg);
44679         arg_conv.is_owned = ptr_is_owned(arg);
44680         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44681         arg_conv.is_owned = false;
44682         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
44683         return ret_conv;
44684 }
44685
44686 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
44687         LDKChannelInfo orig_conv;
44688         orig_conv.inner = untag_ptr(orig);
44689         orig_conv.is_owned = ptr_is_owned(orig);
44690         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44691         orig_conv.is_owned = false;
44692         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
44693         uint64_t ret_ref = 0;
44694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44696         return ret_ref;
44697 }
44698
44699 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
44700         LDKChannelInfo a_conv;
44701         a_conv.inner = untag_ptr(a);
44702         a_conv.is_owned = ptr_is_owned(a);
44703         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44704         a_conv.is_owned = false;
44705         LDKChannelInfo b_conv;
44706         b_conv.inner = untag_ptr(b);
44707         b_conv.is_owned = ptr_is_owned(b);
44708         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44709         b_conv.is_owned = false;
44710         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
44711         return ret_conv;
44712 }
44713
44714 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
44715         LDKChannelInfo this_arg_conv;
44716         this_arg_conv.inner = untag_ptr(this_arg);
44717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44719         this_arg_conv.is_owned = false;
44720         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
44721         uint64_t ret_ref = 0;
44722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44724         return ret_ref;
44725 }
44726
44727 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
44728         LDKChannelInfo obj_conv;
44729         obj_conv.inner = untag_ptr(obj);
44730         obj_conv.is_owned = ptr_is_owned(obj);
44731         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44732         obj_conv.is_owned = false;
44733         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
44734         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44735         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44736         CVec_u8Z_free(ret_var);
44737         return ret_arr;
44738 }
44739
44740 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
44741         LDKu8slice ser_ref;
44742         ser_ref.datalen = ser->arr_len;
44743         ser_ref.data = ser->elems;
44744         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
44745         *ret_conv = ChannelInfo_read(ser_ref);
44746         FREE(ser);
44747         return tag_ptr(ret_conv, true);
44748 }
44749
44750 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
44751         LDKDirectedChannelInfo this_obj_conv;
44752         this_obj_conv.inner = untag_ptr(this_obj);
44753         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44755         DirectedChannelInfo_free(this_obj_conv);
44756 }
44757
44758 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
44759         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
44760         uint64_t ret_ref = 0;
44761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44763         return ret_ref;
44764 }
44765 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
44766         LDKDirectedChannelInfo arg_conv;
44767         arg_conv.inner = untag_ptr(arg);
44768         arg_conv.is_owned = ptr_is_owned(arg);
44769         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44770         arg_conv.is_owned = false;
44771         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
44772         return ret_conv;
44773 }
44774
44775 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
44776         LDKDirectedChannelInfo orig_conv;
44777         orig_conv.inner = untag_ptr(orig);
44778         orig_conv.is_owned = ptr_is_owned(orig);
44779         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44780         orig_conv.is_owned = false;
44781         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
44782         uint64_t ret_ref = 0;
44783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44785         return ret_ref;
44786 }
44787
44788 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
44789         LDKDirectedChannelInfo this_arg_conv;
44790         this_arg_conv.inner = untag_ptr(this_arg);
44791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44793         this_arg_conv.is_owned = false;
44794         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
44795         uint64_t ret_ref = 0;
44796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44798         return ret_ref;
44799 }
44800
44801 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
44802         LDKDirectedChannelInfo this_arg_conv;
44803         this_arg_conv.inner = untag_ptr(this_arg);
44804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44806         this_arg_conv.is_owned = false;
44807         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
44808         return ret_conv;
44809 }
44810
44811 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
44812         LDKDirectedChannelInfo this_arg_conv;
44813         this_arg_conv.inner = untag_ptr(this_arg);
44814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44816         this_arg_conv.is_owned = false;
44817         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44818         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
44819         uint64_t ret_ref = tag_ptr(ret_copy, true);
44820         return ret_ref;
44821 }
44822
44823 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
44824         if (!ptr_is_owned(this_ptr)) return;
44825         void* this_ptr_ptr = untag_ptr(this_ptr);
44826         CHECK_ACCESS(this_ptr_ptr);
44827         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
44828         FREE(untag_ptr(this_ptr));
44829         EffectiveCapacity_free(this_ptr_conv);
44830 }
44831
44832 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
44833         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44834         *ret_copy = EffectiveCapacity_clone(arg);
44835         uint64_t ret_ref = tag_ptr(ret_copy, true);
44836         return ret_ref;
44837 }
44838 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
44839         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
44840         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
44841         return ret_conv;
44842 }
44843
44844 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
44845         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
44846         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44847         *ret_copy = EffectiveCapacity_clone(orig_conv);
44848         uint64_t ret_ref = tag_ptr(ret_copy, true);
44849         return ret_ref;
44850 }
44851
44852 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
44853         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44854         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
44855         uint64_t ret_ref = tag_ptr(ret_copy, true);
44856         return ret_ref;
44857 }
44858
44859 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
44860         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44861         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
44862         uint64_t ret_ref = tag_ptr(ret_copy, true);
44863         return ret_ref;
44864 }
44865
44866 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
44867         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44868         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
44869         uint64_t ret_ref = tag_ptr(ret_copy, true);
44870         return ret_ref;
44871 }
44872
44873 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
44874         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44875         *ret_copy = EffectiveCapacity_infinite();
44876         uint64_t ret_ref = tag_ptr(ret_copy, true);
44877         return ret_ref;
44878 }
44879
44880 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
44881         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44882         *ret_copy = EffectiveCapacity_unknown();
44883         uint64_t ret_ref = tag_ptr(ret_copy, true);
44884         return ret_ref;
44885 }
44886
44887 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
44888         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
44889         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
44890         return ret_conv;
44891 }
44892
44893 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
44894         LDKRoutingFees this_obj_conv;
44895         this_obj_conv.inner = untag_ptr(this_obj);
44896         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44898         RoutingFees_free(this_obj_conv);
44899 }
44900
44901 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
44902         LDKRoutingFees this_ptr_conv;
44903         this_ptr_conv.inner = untag_ptr(this_ptr);
44904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44906         this_ptr_conv.is_owned = false;
44907         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
44908         return ret_conv;
44909 }
44910
44911 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
44912         LDKRoutingFees this_ptr_conv;
44913         this_ptr_conv.inner = untag_ptr(this_ptr);
44914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44916         this_ptr_conv.is_owned = false;
44917         RoutingFees_set_base_msat(&this_ptr_conv, val);
44918 }
44919
44920 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
44921         LDKRoutingFees this_ptr_conv;
44922         this_ptr_conv.inner = untag_ptr(this_ptr);
44923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44925         this_ptr_conv.is_owned = false;
44926         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
44927         return ret_conv;
44928 }
44929
44930 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
44931         LDKRoutingFees this_ptr_conv;
44932         this_ptr_conv.inner = untag_ptr(this_ptr);
44933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44935         this_ptr_conv.is_owned = false;
44936         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
44937 }
44938
44939 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
44940         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
44941         uint64_t ret_ref = 0;
44942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44944         return ret_ref;
44945 }
44946
44947 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
44948         LDKRoutingFees a_conv;
44949         a_conv.inner = untag_ptr(a);
44950         a_conv.is_owned = ptr_is_owned(a);
44951         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44952         a_conv.is_owned = false;
44953         LDKRoutingFees b_conv;
44954         b_conv.inner = untag_ptr(b);
44955         b_conv.is_owned = ptr_is_owned(b);
44956         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44957         b_conv.is_owned = false;
44958         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
44959         return ret_conv;
44960 }
44961
44962 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
44963         LDKRoutingFees ret_var = RoutingFees_clone(arg);
44964         uint64_t ret_ref = 0;
44965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44967         return ret_ref;
44968 }
44969 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
44970         LDKRoutingFees arg_conv;
44971         arg_conv.inner = untag_ptr(arg);
44972         arg_conv.is_owned = ptr_is_owned(arg);
44973         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44974         arg_conv.is_owned = false;
44975         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
44976         return ret_conv;
44977 }
44978
44979 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
44980         LDKRoutingFees orig_conv;
44981         orig_conv.inner = untag_ptr(orig);
44982         orig_conv.is_owned = ptr_is_owned(orig);
44983         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44984         orig_conv.is_owned = false;
44985         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
44986         uint64_t ret_ref = 0;
44987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44989         return ret_ref;
44990 }
44991
44992 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
44993         LDKRoutingFees o_conv;
44994         o_conv.inner = untag_ptr(o);
44995         o_conv.is_owned = ptr_is_owned(o);
44996         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44997         o_conv.is_owned = false;
44998         int64_t ret_conv = RoutingFees_hash(&o_conv);
44999         return ret_conv;
45000 }
45001
45002 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
45003         LDKRoutingFees obj_conv;
45004         obj_conv.inner = untag_ptr(obj);
45005         obj_conv.is_owned = ptr_is_owned(obj);
45006         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45007         obj_conv.is_owned = false;
45008         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
45009         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45010         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45011         CVec_u8Z_free(ret_var);
45012         return ret_arr;
45013 }
45014
45015 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
45016         LDKu8slice ser_ref;
45017         ser_ref.datalen = ser->arr_len;
45018         ser_ref.data = ser->elems;
45019         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
45020         *ret_conv = RoutingFees_read(ser_ref);
45021         FREE(ser);
45022         return tag_ptr(ret_conv, true);
45023 }
45024
45025 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
45026         LDKNodeAnnouncementInfo this_obj_conv;
45027         this_obj_conv.inner = untag_ptr(this_obj);
45028         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45030         NodeAnnouncementInfo_free(this_obj_conv);
45031 }
45032
45033 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
45034         LDKNodeAnnouncementInfo this_ptr_conv;
45035         this_ptr_conv.inner = untag_ptr(this_ptr);
45036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45038         this_ptr_conv.is_owned = false;
45039         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
45040         uint64_t ret_ref = 0;
45041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45043         return ret_ref;
45044 }
45045
45046 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
45047         LDKNodeAnnouncementInfo this_ptr_conv;
45048         this_ptr_conv.inner = untag_ptr(this_ptr);
45049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45051         this_ptr_conv.is_owned = false;
45052         LDKNodeFeatures val_conv;
45053         val_conv.inner = untag_ptr(val);
45054         val_conv.is_owned = ptr_is_owned(val);
45055         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45056         val_conv = NodeFeatures_clone(&val_conv);
45057         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
45058 }
45059
45060 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
45061         LDKNodeAnnouncementInfo this_ptr_conv;
45062         this_ptr_conv.inner = untag_ptr(this_ptr);
45063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45065         this_ptr_conv.is_owned = false;
45066         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
45067         return ret_conv;
45068 }
45069
45070 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
45071         LDKNodeAnnouncementInfo this_ptr_conv;
45072         this_ptr_conv.inner = untag_ptr(this_ptr);
45073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45075         this_ptr_conv.is_owned = false;
45076         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
45077 }
45078
45079 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
45080         LDKNodeAnnouncementInfo this_ptr_conv;
45081         this_ptr_conv.inner = untag_ptr(this_ptr);
45082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45084         this_ptr_conv.is_owned = false;
45085         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
45086         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
45087         return ret_arr;
45088 }
45089
45090 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray 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         LDKThreeBytes val_ref;
45097         CHECK(val->arr_len == 3);
45098         memcpy(val_ref.data, val->elems, 3); FREE(val);
45099         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
45100 }
45101
45102 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
45103         LDKNodeAnnouncementInfo this_ptr_conv;
45104         this_ptr_conv.inner = untag_ptr(this_ptr);
45105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45107         this_ptr_conv.is_owned = false;
45108         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
45109         uint64_t ret_ref = 0;
45110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45112         return ret_ref;
45113 }
45114
45115 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
45116         LDKNodeAnnouncementInfo this_ptr_conv;
45117         this_ptr_conv.inner = untag_ptr(this_ptr);
45118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45120         this_ptr_conv.is_owned = false;
45121         LDKNodeAlias val_conv;
45122         val_conv.inner = untag_ptr(val);
45123         val_conv.is_owned = ptr_is_owned(val);
45124         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45125         val_conv = NodeAlias_clone(&val_conv);
45126         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
45127 }
45128
45129 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
45130         LDKNodeAnnouncementInfo this_ptr_conv;
45131         this_ptr_conv.inner = untag_ptr(this_ptr);
45132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45134         this_ptr_conv.is_owned = false;
45135         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
45136         uint64_t ret_ref = 0;
45137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45139         return ret_ref;
45140 }
45141
45142 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
45143         LDKNodeAnnouncementInfo this_ptr_conv;
45144         this_ptr_conv.inner = untag_ptr(this_ptr);
45145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45147         this_ptr_conv.is_owned = false;
45148         LDKNodeAnnouncement val_conv;
45149         val_conv.inner = untag_ptr(val);
45150         val_conv.is_owned = ptr_is_owned(val);
45151         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45152         val_conv = NodeAnnouncement_clone(&val_conv);
45153         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
45154 }
45155
45156 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) {
45157         LDKNodeFeatures features_arg_conv;
45158         features_arg_conv.inner = untag_ptr(features_arg);
45159         features_arg_conv.is_owned = ptr_is_owned(features_arg);
45160         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
45161         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
45162         LDKThreeBytes rgb_arg_ref;
45163         CHECK(rgb_arg->arr_len == 3);
45164         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
45165         LDKNodeAlias alias_arg_conv;
45166         alias_arg_conv.inner = untag_ptr(alias_arg);
45167         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
45168         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
45169         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
45170         LDKNodeAnnouncement announcement_message_arg_conv;
45171         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
45172         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
45173         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
45174         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
45175         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
45176         uint64_t ret_ref = 0;
45177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45179         return ret_ref;
45180 }
45181
45182 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
45183         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
45184         uint64_t ret_ref = 0;
45185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45187         return ret_ref;
45188 }
45189 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
45190         LDKNodeAnnouncementInfo arg_conv;
45191         arg_conv.inner = untag_ptr(arg);
45192         arg_conv.is_owned = ptr_is_owned(arg);
45193         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45194         arg_conv.is_owned = false;
45195         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
45196         return ret_conv;
45197 }
45198
45199 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
45200         LDKNodeAnnouncementInfo orig_conv;
45201         orig_conv.inner = untag_ptr(orig);
45202         orig_conv.is_owned = ptr_is_owned(orig);
45203         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45204         orig_conv.is_owned = false;
45205         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
45206         uint64_t ret_ref = 0;
45207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45209         return ret_ref;
45210 }
45211
45212 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
45213         LDKNodeAnnouncementInfo a_conv;
45214         a_conv.inner = untag_ptr(a);
45215         a_conv.is_owned = ptr_is_owned(a);
45216         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45217         a_conv.is_owned = false;
45218         LDKNodeAnnouncementInfo b_conv;
45219         b_conv.inner = untag_ptr(b);
45220         b_conv.is_owned = ptr_is_owned(b);
45221         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45222         b_conv.is_owned = false;
45223         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
45224         return ret_conv;
45225 }
45226
45227 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_addresses"))) TS_NodeAnnouncementInfo_addresses(uint64_t this_arg) {
45228         LDKNodeAnnouncementInfo this_arg_conv;
45229         this_arg_conv.inner = untag_ptr(this_arg);
45230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45232         this_arg_conv.is_owned = false;
45233         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
45234         uint64_tArray ret_arr = NULL;
45235         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45236         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45237         for (size_t m = 0; m < ret_var.datalen; m++) {
45238                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45239                 *ret_conv_12_copy = ret_var.data[m];
45240                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
45241                 ret_arr_ptr[m] = ret_conv_12_ref;
45242         }
45243         
45244         FREE(ret_var.data);
45245         return ret_arr;
45246 }
45247
45248 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
45249         LDKNodeAnnouncementInfo obj_conv;
45250         obj_conv.inner = untag_ptr(obj);
45251         obj_conv.is_owned = ptr_is_owned(obj);
45252         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45253         obj_conv.is_owned = false;
45254         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
45255         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45256         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45257         CVec_u8Z_free(ret_var);
45258         return ret_arr;
45259 }
45260
45261 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
45262         LDKu8slice ser_ref;
45263         ser_ref.datalen = ser->arr_len;
45264         ser_ref.data = ser->elems;
45265         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
45266         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
45267         FREE(ser);
45268         return tag_ptr(ret_conv, true);
45269 }
45270
45271 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
45272         LDKNodeAlias this_obj_conv;
45273         this_obj_conv.inner = untag_ptr(this_obj);
45274         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45276         NodeAlias_free(this_obj_conv);
45277 }
45278
45279 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
45280         LDKNodeAlias this_ptr_conv;
45281         this_ptr_conv.inner = untag_ptr(this_ptr);
45282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45284         this_ptr_conv.is_owned = false;
45285         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45286         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
45287         return ret_arr;
45288 }
45289
45290 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
45291         LDKNodeAlias this_ptr_conv;
45292         this_ptr_conv.inner = untag_ptr(this_ptr);
45293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45295         this_ptr_conv.is_owned = false;
45296         LDKThirtyTwoBytes val_ref;
45297         CHECK(val->arr_len == 32);
45298         memcpy(val_ref.data, val->elems, 32); FREE(val);
45299         NodeAlias_set_a(&this_ptr_conv, val_ref);
45300 }
45301
45302 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
45303         LDKThirtyTwoBytes a_arg_ref;
45304         CHECK(a_arg->arr_len == 32);
45305         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
45306         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
45307         uint64_t ret_ref = 0;
45308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45310         return ret_ref;
45311 }
45312
45313 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
45314         LDKNodeAlias ret_var = NodeAlias_clone(arg);
45315         uint64_t ret_ref = 0;
45316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45318         return ret_ref;
45319 }
45320 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
45321         LDKNodeAlias arg_conv;
45322         arg_conv.inner = untag_ptr(arg);
45323         arg_conv.is_owned = ptr_is_owned(arg);
45324         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45325         arg_conv.is_owned = false;
45326         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
45327         return ret_conv;
45328 }
45329
45330 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
45331         LDKNodeAlias orig_conv;
45332         orig_conv.inner = untag_ptr(orig);
45333         orig_conv.is_owned = ptr_is_owned(orig);
45334         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45335         orig_conv.is_owned = false;
45336         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
45337         uint64_t ret_ref = 0;
45338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45340         return ret_ref;
45341 }
45342
45343 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
45344         LDKNodeAlias a_conv;
45345         a_conv.inner = untag_ptr(a);
45346         a_conv.is_owned = ptr_is_owned(a);
45347         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45348         a_conv.is_owned = false;
45349         LDKNodeAlias b_conv;
45350         b_conv.inner = untag_ptr(b);
45351         b_conv.is_owned = ptr_is_owned(b);
45352         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45353         b_conv.is_owned = false;
45354         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
45355         return ret_conv;
45356 }
45357
45358 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
45359         LDKNodeAlias obj_conv;
45360         obj_conv.inner = untag_ptr(obj);
45361         obj_conv.is_owned = ptr_is_owned(obj);
45362         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45363         obj_conv.is_owned = false;
45364         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
45365         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45366         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45367         CVec_u8Z_free(ret_var);
45368         return ret_arr;
45369 }
45370
45371 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
45372         LDKu8slice ser_ref;
45373         ser_ref.datalen = ser->arr_len;
45374         ser_ref.data = ser->elems;
45375         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
45376         *ret_conv = NodeAlias_read(ser_ref);
45377         FREE(ser);
45378         return tag_ptr(ret_conv, true);
45379 }
45380
45381 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
45382         LDKNodeInfo this_obj_conv;
45383         this_obj_conv.inner = untag_ptr(this_obj);
45384         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45386         NodeInfo_free(this_obj_conv);
45387 }
45388
45389 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
45390         LDKNodeInfo this_ptr_conv;
45391         this_ptr_conv.inner = untag_ptr(this_ptr);
45392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45394         this_ptr_conv.is_owned = false;
45395         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
45396         int64_tArray ret_arr = NULL;
45397         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
45398         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
45399         for (size_t i = 0; i < ret_var.datalen; i++) {
45400                 int64_t ret_conv_8_conv = ret_var.data[i];
45401                 ret_arr_ptr[i] = ret_conv_8_conv;
45402         }
45403         
45404         FREE(ret_var.data);
45405         return ret_arr;
45406 }
45407
45408 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
45409         LDKNodeInfo this_ptr_conv;
45410         this_ptr_conv.inner = untag_ptr(this_ptr);
45411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45413         this_ptr_conv.is_owned = false;
45414         LDKCVec_u64Z val_constr;
45415         val_constr.datalen = val->arr_len;
45416         if (val_constr.datalen > 0)
45417                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
45418         else
45419                 val_constr.data = NULL;
45420         int64_t* val_vals = val->elems;
45421         for (size_t i = 0; i < val_constr.datalen; i++) {
45422                 int64_t val_conv_8 = val_vals[i];
45423                 val_constr.data[i] = val_conv_8;
45424         }
45425         FREE(val);
45426         NodeInfo_set_channels(&this_ptr_conv, val_constr);
45427 }
45428
45429 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
45430         LDKNodeInfo this_ptr_conv;
45431         this_ptr_conv.inner = untag_ptr(this_ptr);
45432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45434         this_ptr_conv.is_owned = false;
45435         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
45436         uint64_t ret_ref = 0;
45437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45439         return ret_ref;
45440 }
45441
45442 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
45443         LDKNodeInfo this_ptr_conv;
45444         this_ptr_conv.inner = untag_ptr(this_ptr);
45445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45447         this_ptr_conv.is_owned = false;
45448         LDKNodeAnnouncementInfo val_conv;
45449         val_conv.inner = untag_ptr(val);
45450         val_conv.is_owned = ptr_is_owned(val);
45451         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45452         val_conv = NodeAnnouncementInfo_clone(&val_conv);
45453         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
45454 }
45455
45456 uint64_t  __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t announcement_info_arg) {
45457         LDKCVec_u64Z channels_arg_constr;
45458         channels_arg_constr.datalen = channels_arg->arr_len;
45459         if (channels_arg_constr.datalen > 0)
45460                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
45461         else
45462                 channels_arg_constr.data = NULL;
45463         int64_t* channels_arg_vals = channels_arg->elems;
45464         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
45465                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
45466                 channels_arg_constr.data[i] = channels_arg_conv_8;
45467         }
45468         FREE(channels_arg);
45469         LDKNodeAnnouncementInfo announcement_info_arg_conv;
45470         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
45471         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
45472         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
45473         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
45474         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
45475         uint64_t ret_ref = 0;
45476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45478         return ret_ref;
45479 }
45480
45481 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
45482         LDKNodeInfo ret_var = NodeInfo_clone(arg);
45483         uint64_t ret_ref = 0;
45484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45486         return ret_ref;
45487 }
45488 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
45489         LDKNodeInfo arg_conv;
45490         arg_conv.inner = untag_ptr(arg);
45491         arg_conv.is_owned = ptr_is_owned(arg);
45492         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45493         arg_conv.is_owned = false;
45494         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
45495         return ret_conv;
45496 }
45497
45498 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
45499         LDKNodeInfo orig_conv;
45500         orig_conv.inner = untag_ptr(orig);
45501         orig_conv.is_owned = ptr_is_owned(orig);
45502         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45503         orig_conv.is_owned = false;
45504         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
45505         uint64_t ret_ref = 0;
45506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45508         return ret_ref;
45509 }
45510
45511 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
45512         LDKNodeInfo a_conv;
45513         a_conv.inner = untag_ptr(a);
45514         a_conv.is_owned = ptr_is_owned(a);
45515         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45516         a_conv.is_owned = false;
45517         LDKNodeInfo b_conv;
45518         b_conv.inner = untag_ptr(b);
45519         b_conv.is_owned = ptr_is_owned(b);
45520         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45521         b_conv.is_owned = false;
45522         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
45523         return ret_conv;
45524 }
45525
45526 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
45527         LDKNodeInfo obj_conv;
45528         obj_conv.inner = untag_ptr(obj);
45529         obj_conv.is_owned = ptr_is_owned(obj);
45530         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45531         obj_conv.is_owned = false;
45532         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
45533         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45534         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45535         CVec_u8Z_free(ret_var);
45536         return ret_arr;
45537 }
45538
45539 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
45540         LDKu8slice ser_ref;
45541         ser_ref.datalen = ser->arr_len;
45542         ser_ref.data = ser->elems;
45543         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
45544         *ret_conv = NodeInfo_read(ser_ref);
45545         FREE(ser);
45546         return tag_ptr(ret_conv, true);
45547 }
45548
45549 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
45550         LDKNetworkGraph obj_conv;
45551         obj_conv.inner = untag_ptr(obj);
45552         obj_conv.is_owned = ptr_is_owned(obj);
45553         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45554         obj_conv.is_owned = false;
45555         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
45556         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45557         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45558         CVec_u8Z_free(ret_var);
45559         return ret_arr;
45560 }
45561
45562 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
45563         LDKu8slice ser_ref;
45564         ser_ref.datalen = ser->arr_len;
45565         ser_ref.data = ser->elems;
45566         void* arg_ptr = untag_ptr(arg);
45567         CHECK_ACCESS(arg_ptr);
45568         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
45569         if (arg_conv.free == LDKLogger_JCalls_free) {
45570                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45571                 LDKLogger_JCalls_cloned(&arg_conv);
45572         }
45573         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
45574         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
45575         FREE(ser);
45576         return tag_ptr(ret_conv, true);
45577 }
45578
45579 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(uint32_t network, uint64_t logger) {
45580         LDKNetwork network_conv = LDKNetwork_from_js(network);
45581         void* logger_ptr = untag_ptr(logger);
45582         CHECK_ACCESS(logger_ptr);
45583         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45584         if (logger_conv.free == LDKLogger_JCalls_free) {
45585                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45586                 LDKLogger_JCalls_cloned(&logger_conv);
45587         }
45588         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
45589         uint64_t ret_ref = 0;
45590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45592         return ret_ref;
45593 }
45594
45595 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
45596         LDKNetworkGraph this_arg_conv;
45597         this_arg_conv.inner = untag_ptr(this_arg);
45598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45600         this_arg_conv.is_owned = false;
45601         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
45602         uint64_t ret_ref = 0;
45603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45605         return ret_ref;
45606 }
45607
45608 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) {
45609         LDKNetworkGraph this_arg_conv;
45610         this_arg_conv.inner = untag_ptr(this_arg);
45611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45613         this_arg_conv.is_owned = false;
45614         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
45615         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
45616         uint64_t ret_ref = tag_ptr(ret_copy, true);
45617         return ret_ref;
45618 }
45619
45620 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) {
45621         LDKNetworkGraph this_arg_conv;
45622         this_arg_conv.inner = untag_ptr(this_arg);
45623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45625         this_arg_conv.is_owned = false;
45626         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
45627 }
45628
45629 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
45630         LDKNetworkGraph this_arg_conv;
45631         this_arg_conv.inner = untag_ptr(this_arg);
45632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45634         this_arg_conv.is_owned = false;
45635         LDKNodeAnnouncement msg_conv;
45636         msg_conv.inner = untag_ptr(msg);
45637         msg_conv.is_owned = ptr_is_owned(msg);
45638         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45639         msg_conv.is_owned = false;
45640         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45641         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
45642         return tag_ptr(ret_conv, true);
45643 }
45644
45645 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) {
45646         LDKNetworkGraph this_arg_conv;
45647         this_arg_conv.inner = untag_ptr(this_arg);
45648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45650         this_arg_conv.is_owned = false;
45651         LDKUnsignedNodeAnnouncement msg_conv;
45652         msg_conv.inner = untag_ptr(msg);
45653         msg_conv.is_owned = ptr_is_owned(msg);
45654         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45655         msg_conv.is_owned = false;
45656         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45657         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
45658         return tag_ptr(ret_conv, true);
45659 }
45660
45661 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) {
45662         LDKNetworkGraph this_arg_conv;
45663         this_arg_conv.inner = untag_ptr(this_arg);
45664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45666         this_arg_conv.is_owned = false;
45667         LDKChannelAnnouncement msg_conv;
45668         msg_conv.inner = untag_ptr(msg);
45669         msg_conv.is_owned = ptr_is_owned(msg);
45670         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45671         msg_conv.is_owned = false;
45672         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
45673         CHECK_ACCESS(utxo_lookup_ptr);
45674         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
45675         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
45676         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
45677                 // Manually implement clone for Java trait instances
45678                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
45679                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45680                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
45681                 }
45682         }
45683         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45684         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
45685         return tag_ptr(ret_conv, true);
45686 }
45687
45688 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) {
45689         LDKNetworkGraph this_arg_conv;
45690         this_arg_conv.inner = untag_ptr(this_arg);
45691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45693         this_arg_conv.is_owned = false;
45694         LDKUnsignedChannelAnnouncement msg_conv;
45695         msg_conv.inner = untag_ptr(msg);
45696         msg_conv.is_owned = ptr_is_owned(msg);
45697         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45698         msg_conv.is_owned = false;
45699         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
45700         CHECK_ACCESS(utxo_lookup_ptr);
45701         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
45702         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
45703         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
45704                 // Manually implement clone for Java trait instances
45705                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
45706                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45707                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
45708                 }
45709         }
45710         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45711         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
45712         return tag_ptr(ret_conv, true);
45713 }
45714
45715 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) {
45716         LDKNetworkGraph this_arg_conv;
45717         this_arg_conv.inner = untag_ptr(this_arg);
45718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45720         this_arg_conv.is_owned = false;
45721         LDKChannelFeatures features_conv;
45722         features_conv.inner = untag_ptr(features);
45723         features_conv.is_owned = ptr_is_owned(features);
45724         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
45725         features_conv = ChannelFeatures_clone(&features_conv);
45726         LDKPublicKey node_id_1_ref;
45727         CHECK(node_id_1->arr_len == 33);
45728         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
45729         LDKPublicKey node_id_2_ref;
45730         CHECK(node_id_2->arr_len == 33);
45731         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
45732         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45733         *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);
45734         return tag_ptr(ret_conv, true);
45735 }
45736
45737 void  __attribute__((export_name("TS_NetworkGraph_channel_failed_permanent"))) TS_NetworkGraph_channel_failed_permanent(uint64_t this_arg, int64_t short_channel_id) {
45738         LDKNetworkGraph this_arg_conv;
45739         this_arg_conv.inner = untag_ptr(this_arg);
45740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45742         this_arg_conv.is_owned = false;
45743         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
45744 }
45745
45746 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
45747         LDKNetworkGraph this_arg_conv;
45748         this_arg_conv.inner = untag_ptr(this_arg);
45749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45751         this_arg_conv.is_owned = false;
45752         LDKPublicKey node_id_ref;
45753         CHECK(node_id->arr_len == 33);
45754         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
45755         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
45756 }
45757
45758 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) {
45759         LDKNetworkGraph this_arg_conv;
45760         this_arg_conv.inner = untag_ptr(this_arg);
45761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45763         this_arg_conv.is_owned = false;
45764         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
45765 }
45766
45767 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
45768         LDKNetworkGraph this_arg_conv;
45769         this_arg_conv.inner = untag_ptr(this_arg);
45770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45772         this_arg_conv.is_owned = false;
45773         LDKChannelUpdate msg_conv;
45774         msg_conv.inner = untag_ptr(msg);
45775         msg_conv.is_owned = ptr_is_owned(msg);
45776         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45777         msg_conv.is_owned = false;
45778         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45779         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
45780         return tag_ptr(ret_conv, true);
45781 }
45782
45783 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
45784         LDKNetworkGraph this_arg_conv;
45785         this_arg_conv.inner = untag_ptr(this_arg);
45786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45788         this_arg_conv.is_owned = false;
45789         LDKUnsignedChannelUpdate msg_conv;
45790         msg_conv.inner = untag_ptr(msg);
45791         msg_conv.is_owned = ptr_is_owned(msg);
45792         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45793         msg_conv.is_owned = false;
45794         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45795         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
45796         return tag_ptr(ret_conv, true);
45797 }
45798
45799 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
45800         LDKReadOnlyNetworkGraph this_arg_conv;
45801         this_arg_conv.inner = untag_ptr(this_arg);
45802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45804         this_arg_conv.is_owned = false;
45805         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
45806         uint64_t ret_ref = 0;
45807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45809         return ret_ref;
45810 }
45811
45812 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
45813         LDKReadOnlyNetworkGraph this_arg_conv;
45814         this_arg_conv.inner = untag_ptr(this_arg);
45815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45817         this_arg_conv.is_owned = false;
45818         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
45819         int64_tArray ret_arr = NULL;
45820         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
45821         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
45822         for (size_t i = 0; i < ret_var.datalen; i++) {
45823                 int64_t ret_conv_8_conv = ret_var.data[i];
45824                 ret_arr_ptr[i] = ret_conv_8_conv;
45825         }
45826         
45827         FREE(ret_var.data);
45828         return ret_arr;
45829 }
45830
45831 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
45832         LDKReadOnlyNetworkGraph this_arg_conv;
45833         this_arg_conv.inner = untag_ptr(this_arg);
45834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45836         this_arg_conv.is_owned = false;
45837         LDKNodeId node_id_conv;
45838         node_id_conv.inner = untag_ptr(node_id);
45839         node_id_conv.is_owned = ptr_is_owned(node_id);
45840         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45841         node_id_conv.is_owned = false;
45842         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
45843         uint64_t ret_ref = 0;
45844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45846         return ret_ref;
45847 }
45848
45849 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
45850         LDKReadOnlyNetworkGraph this_arg_conv;
45851         this_arg_conv.inner = untag_ptr(this_arg);
45852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45854         this_arg_conv.is_owned = false;
45855         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
45856         uint64_tArray ret_arr = NULL;
45857         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45858         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45859         for (size_t i = 0; i < ret_var.datalen; i++) {
45860                 LDKNodeId ret_conv_8_var = ret_var.data[i];
45861                 uint64_t ret_conv_8_ref = 0;
45862                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
45863                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
45864                 ret_arr_ptr[i] = ret_conv_8_ref;
45865         }
45866         
45867         FREE(ret_var.data);
45868         return ret_arr;
45869 }
45870
45871 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
45872         LDKReadOnlyNetworkGraph this_arg_conv;
45873         this_arg_conv.inner = untag_ptr(this_arg);
45874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45876         this_arg_conv.is_owned = false;
45877         LDKPublicKey pubkey_ref;
45878         CHECK(pubkey->arr_len == 33);
45879         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
45880         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
45881         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
45882         uint64_t ret_ref = tag_ptr(ret_copy, true);
45883         return ret_ref;
45884 }
45885
45886 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
45887         LDKDefaultRouter this_obj_conv;
45888         this_obj_conv.inner = untag_ptr(this_obj);
45889         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45891         DefaultRouter_free(this_obj_conv);
45892 }
45893
45894 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) {
45895         LDKNetworkGraph network_graph_conv;
45896         network_graph_conv.inner = untag_ptr(network_graph);
45897         network_graph_conv.is_owned = ptr_is_owned(network_graph);
45898         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45899         network_graph_conv.is_owned = false;
45900         void* logger_ptr = untag_ptr(logger);
45901         CHECK_ACCESS(logger_ptr);
45902         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45903         if (logger_conv.free == LDKLogger_JCalls_free) {
45904                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45905                 LDKLogger_JCalls_cloned(&logger_conv);
45906         }
45907         LDKThirtyTwoBytes random_seed_bytes_ref;
45908         CHECK(random_seed_bytes->arr_len == 32);
45909         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
45910         void* scorer_ptr = untag_ptr(scorer);
45911         CHECK_ACCESS(scorer_ptr);
45912         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
45913         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
45914                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45915                 LDKLockableScore_JCalls_cloned(&scorer_conv);
45916         }
45917         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv);
45918         uint64_t ret_ref = 0;
45919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45921         return ret_ref;
45922 }
45923
45924 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
45925         LDKDefaultRouter this_arg_conv;
45926         this_arg_conv.inner = untag_ptr(this_arg);
45927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45929         this_arg_conv.is_owned = false;
45930         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
45931         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
45932         return tag_ptr(ret_ret, true);
45933 }
45934
45935 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
45936         if (!ptr_is_owned(this_ptr)) return;
45937         void* this_ptr_ptr = untag_ptr(this_ptr);
45938         CHECK_ACCESS(this_ptr_ptr);
45939         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
45940         FREE(untag_ptr(this_ptr));
45941         Router_free(this_ptr_conv);
45942 }
45943
45944 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
45945         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
45946         this_obj_conv.inner = untag_ptr(this_obj);
45947         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45949         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
45950 }
45951
45952 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
45953         void* scorer_ptr = untag_ptr(scorer);
45954         CHECK_ACCESS(scorer_ptr);
45955         LDKScore scorer_conv = *(LDKScore*)(scorer_ptr);
45956         if (scorer_conv.free == LDKScore_JCalls_free) {
45957                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45958                 LDKScore_JCalls_cloned(&scorer_conv);
45959         }
45960         LDKInFlightHtlcs inflight_htlcs_conv;
45961         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
45962         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
45963         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
45964         inflight_htlcs_conv.is_owned = false;
45965         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
45966         uint64_t ret_ref = 0;
45967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45969         return ret_ref;
45970 }
45971
45972 int8_tArray  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_write"))) TS_ScorerAccountingForInFlightHtlcs_write(uint64_t obj) {
45973         LDKScorerAccountingForInFlightHtlcs obj_conv;
45974         obj_conv.inner = untag_ptr(obj);
45975         obj_conv.is_owned = ptr_is_owned(obj);
45976         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45977         obj_conv.is_owned = false;
45978         LDKCVec_u8Z ret_var = ScorerAccountingForInFlightHtlcs_write(&obj_conv);
45979         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45980         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45981         CVec_u8Z_free(ret_var);
45982         return ret_arr;
45983 }
45984
45985 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_Score"))) TS_ScorerAccountingForInFlightHtlcs_as_Score(uint64_t this_arg) {
45986         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
45987         this_arg_conv.inner = untag_ptr(this_arg);
45988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45990         this_arg_conv.is_owned = false;
45991         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45992         *ret_ret = ScorerAccountingForInFlightHtlcs_as_Score(&this_arg_conv);
45993         return tag_ptr(ret_ret, true);
45994 }
45995
45996 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
45997         LDKInFlightHtlcs this_obj_conv;
45998         this_obj_conv.inner = untag_ptr(this_obj);
45999         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46001         InFlightHtlcs_free(this_obj_conv);
46002 }
46003
46004 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
46005         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
46006         uint64_t ret_ref = 0;
46007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46009         return ret_ref;
46010 }
46011 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
46012         LDKInFlightHtlcs arg_conv;
46013         arg_conv.inner = untag_ptr(arg);
46014         arg_conv.is_owned = ptr_is_owned(arg);
46015         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46016         arg_conv.is_owned = false;
46017         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
46018         return ret_conv;
46019 }
46020
46021 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
46022         LDKInFlightHtlcs orig_conv;
46023         orig_conv.inner = untag_ptr(orig);
46024         orig_conv.is_owned = ptr_is_owned(orig);
46025         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46026         orig_conv.is_owned = false;
46027         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
46028         uint64_t ret_ref = 0;
46029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46031         return ret_ref;
46032 }
46033
46034 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
46035         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
46036         uint64_t ret_ref = 0;
46037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46039         return ret_ref;
46040 }
46041
46042 void  __attribute__((export_name("TS_InFlightHtlcs_process_path"))) TS_InFlightHtlcs_process_path(uint64_t this_arg, uint64_t path, int8_tArray payer_node_id) {
46043         LDKInFlightHtlcs this_arg_conv;
46044         this_arg_conv.inner = untag_ptr(this_arg);
46045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46047         this_arg_conv.is_owned = false;
46048         LDKPath path_conv;
46049         path_conv.inner = untag_ptr(path);
46050         path_conv.is_owned = ptr_is_owned(path);
46051         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
46052         path_conv.is_owned = false;
46053         LDKPublicKey payer_node_id_ref;
46054         CHECK(payer_node_id->arr_len == 33);
46055         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
46056         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
46057 }
46058
46059 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) {
46060         LDKInFlightHtlcs this_arg_conv;
46061         this_arg_conv.inner = untag_ptr(this_arg);
46062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46064         this_arg_conv.is_owned = false;
46065         LDKNodeId source_conv;
46066         source_conv.inner = untag_ptr(source);
46067         source_conv.is_owned = ptr_is_owned(source);
46068         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
46069         source_conv.is_owned = false;
46070         LDKNodeId target_conv;
46071         target_conv.inner = untag_ptr(target);
46072         target_conv.is_owned = ptr_is_owned(target);
46073         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
46074         target_conv.is_owned = false;
46075         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46076         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
46077         uint64_t ret_ref = tag_ptr(ret_copy, true);
46078         return ret_ref;
46079 }
46080
46081 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
46082         LDKInFlightHtlcs obj_conv;
46083         obj_conv.inner = untag_ptr(obj);
46084         obj_conv.is_owned = ptr_is_owned(obj);
46085         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46086         obj_conv.is_owned = false;
46087         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
46088         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46089         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46090         CVec_u8Z_free(ret_var);
46091         return ret_arr;
46092 }
46093
46094 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
46095         LDKu8slice ser_ref;
46096         ser_ref.datalen = ser->arr_len;
46097         ser_ref.data = ser->elems;
46098         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
46099         *ret_conv = InFlightHtlcs_read(ser_ref);
46100         FREE(ser);
46101         return tag_ptr(ret_conv, true);
46102 }
46103
46104 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
46105         LDKRouteHop this_obj_conv;
46106         this_obj_conv.inner = untag_ptr(this_obj);
46107         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46109         RouteHop_free(this_obj_conv);
46110 }
46111
46112 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
46113         LDKRouteHop this_ptr_conv;
46114         this_ptr_conv.inner = untag_ptr(this_ptr);
46115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46117         this_ptr_conv.is_owned = false;
46118         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46119         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
46120         return ret_arr;
46121 }
46122
46123 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
46124         LDKRouteHop this_ptr_conv;
46125         this_ptr_conv.inner = untag_ptr(this_ptr);
46126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46128         this_ptr_conv.is_owned = false;
46129         LDKPublicKey val_ref;
46130         CHECK(val->arr_len == 33);
46131         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46132         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
46133 }
46134
46135 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
46136         LDKRouteHop this_ptr_conv;
46137         this_ptr_conv.inner = untag_ptr(this_ptr);
46138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46140         this_ptr_conv.is_owned = false;
46141         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
46142         uint64_t ret_ref = 0;
46143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46145         return ret_ref;
46146 }
46147
46148 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
46149         LDKRouteHop this_ptr_conv;
46150         this_ptr_conv.inner = untag_ptr(this_ptr);
46151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46153         this_ptr_conv.is_owned = false;
46154         LDKNodeFeatures val_conv;
46155         val_conv.inner = untag_ptr(val);
46156         val_conv.is_owned = ptr_is_owned(val);
46157         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46158         val_conv = NodeFeatures_clone(&val_conv);
46159         RouteHop_set_node_features(&this_ptr_conv, val_conv);
46160 }
46161
46162 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
46163         LDKRouteHop this_ptr_conv;
46164         this_ptr_conv.inner = untag_ptr(this_ptr);
46165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46167         this_ptr_conv.is_owned = false;
46168         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
46169         return ret_conv;
46170 }
46171
46172 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
46173         LDKRouteHop this_ptr_conv;
46174         this_ptr_conv.inner = untag_ptr(this_ptr);
46175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46177         this_ptr_conv.is_owned = false;
46178         RouteHop_set_short_channel_id(&this_ptr_conv, val);
46179 }
46180
46181 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
46182         LDKRouteHop this_ptr_conv;
46183         this_ptr_conv.inner = untag_ptr(this_ptr);
46184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46186         this_ptr_conv.is_owned = false;
46187         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
46188         uint64_t ret_ref = 0;
46189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46191         return ret_ref;
46192 }
46193
46194 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
46195         LDKRouteHop this_ptr_conv;
46196         this_ptr_conv.inner = untag_ptr(this_ptr);
46197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46199         this_ptr_conv.is_owned = false;
46200         LDKChannelFeatures val_conv;
46201         val_conv.inner = untag_ptr(val);
46202         val_conv.is_owned = ptr_is_owned(val);
46203         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46204         val_conv = ChannelFeatures_clone(&val_conv);
46205         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
46206 }
46207
46208 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
46209         LDKRouteHop this_ptr_conv;
46210         this_ptr_conv.inner = untag_ptr(this_ptr);
46211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46213         this_ptr_conv.is_owned = false;
46214         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
46215         return ret_conv;
46216 }
46217
46218 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
46219         LDKRouteHop this_ptr_conv;
46220         this_ptr_conv.inner = untag_ptr(this_ptr);
46221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46223         this_ptr_conv.is_owned = false;
46224         RouteHop_set_fee_msat(&this_ptr_conv, val);
46225 }
46226
46227 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
46228         LDKRouteHop this_ptr_conv;
46229         this_ptr_conv.inner = untag_ptr(this_ptr);
46230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46232         this_ptr_conv.is_owned = false;
46233         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
46234         return ret_conv;
46235 }
46236
46237 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
46238         LDKRouteHop this_ptr_conv;
46239         this_ptr_conv.inner = untag_ptr(this_ptr);
46240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46242         this_ptr_conv.is_owned = false;
46243         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
46244 }
46245
46246 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) {
46247         LDKPublicKey pubkey_arg_ref;
46248         CHECK(pubkey_arg->arr_len == 33);
46249         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
46250         LDKNodeFeatures node_features_arg_conv;
46251         node_features_arg_conv.inner = untag_ptr(node_features_arg);
46252         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
46253         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
46254         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
46255         LDKChannelFeatures channel_features_arg_conv;
46256         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
46257         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
46258         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
46259         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
46260         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);
46261         uint64_t ret_ref = 0;
46262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46264         return ret_ref;
46265 }
46266
46267 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
46268         LDKRouteHop ret_var = RouteHop_clone(arg);
46269         uint64_t ret_ref = 0;
46270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46272         return ret_ref;
46273 }
46274 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
46275         LDKRouteHop arg_conv;
46276         arg_conv.inner = untag_ptr(arg);
46277         arg_conv.is_owned = ptr_is_owned(arg);
46278         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46279         arg_conv.is_owned = false;
46280         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
46281         return ret_conv;
46282 }
46283
46284 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
46285         LDKRouteHop orig_conv;
46286         orig_conv.inner = untag_ptr(orig);
46287         orig_conv.is_owned = ptr_is_owned(orig);
46288         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46289         orig_conv.is_owned = false;
46290         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
46291         uint64_t ret_ref = 0;
46292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46294         return ret_ref;
46295 }
46296
46297 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
46298         LDKRouteHop o_conv;
46299         o_conv.inner = untag_ptr(o);
46300         o_conv.is_owned = ptr_is_owned(o);
46301         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46302         o_conv.is_owned = false;
46303         int64_t ret_conv = RouteHop_hash(&o_conv);
46304         return ret_conv;
46305 }
46306
46307 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
46308         LDKRouteHop a_conv;
46309         a_conv.inner = untag_ptr(a);
46310         a_conv.is_owned = ptr_is_owned(a);
46311         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46312         a_conv.is_owned = false;
46313         LDKRouteHop b_conv;
46314         b_conv.inner = untag_ptr(b);
46315         b_conv.is_owned = ptr_is_owned(b);
46316         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46317         b_conv.is_owned = false;
46318         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
46319         return ret_conv;
46320 }
46321
46322 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
46323         LDKRouteHop obj_conv;
46324         obj_conv.inner = untag_ptr(obj);
46325         obj_conv.is_owned = ptr_is_owned(obj);
46326         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46327         obj_conv.is_owned = false;
46328         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
46329         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46330         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46331         CVec_u8Z_free(ret_var);
46332         return ret_arr;
46333 }
46334
46335 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
46336         LDKu8slice ser_ref;
46337         ser_ref.datalen = ser->arr_len;
46338         ser_ref.data = ser->elems;
46339         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
46340         *ret_conv = RouteHop_read(ser_ref);
46341         FREE(ser);
46342         return tag_ptr(ret_conv, true);
46343 }
46344
46345 void  __attribute__((export_name("TS_BlindedTail_free"))) TS_BlindedTail_free(uint64_t this_obj) {
46346         LDKBlindedTail this_obj_conv;
46347         this_obj_conv.inner = untag_ptr(this_obj);
46348         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46350         BlindedTail_free(this_obj_conv);
46351 }
46352
46353 uint64_tArray  __attribute__((export_name("TS_BlindedTail_get_hops"))) TS_BlindedTail_get_hops(uint64_t this_ptr) {
46354         LDKBlindedTail this_ptr_conv;
46355         this_ptr_conv.inner = untag_ptr(this_ptr);
46356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46358         this_ptr_conv.is_owned = false;
46359         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
46360         uint64_tArray ret_arr = NULL;
46361         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46362         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46363         for (size_t m = 0; m < ret_var.datalen; m++) {
46364                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
46365                 uint64_t ret_conv_12_ref = 0;
46366                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
46367                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
46368                 ret_arr_ptr[m] = ret_conv_12_ref;
46369         }
46370         
46371         FREE(ret_var.data);
46372         return ret_arr;
46373 }
46374
46375 void  __attribute__((export_name("TS_BlindedTail_set_hops"))) TS_BlindedTail_set_hops(uint64_t this_ptr, uint64_tArray val) {
46376         LDKBlindedTail this_ptr_conv;
46377         this_ptr_conv.inner = untag_ptr(this_ptr);
46378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46380         this_ptr_conv.is_owned = false;
46381         LDKCVec_BlindedHopZ val_constr;
46382         val_constr.datalen = val->arr_len;
46383         if (val_constr.datalen > 0)
46384                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
46385         else
46386                 val_constr.data = NULL;
46387         uint64_t* val_vals = val->elems;
46388         for (size_t m = 0; m < val_constr.datalen; m++) {
46389                 uint64_t val_conv_12 = val_vals[m];
46390                 LDKBlindedHop val_conv_12_conv;
46391                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
46392                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
46393                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
46394                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
46395                 val_constr.data[m] = val_conv_12_conv;
46396         }
46397         FREE(val);
46398         BlindedTail_set_hops(&this_ptr_conv, val_constr);
46399 }
46400
46401 int8_tArray  __attribute__((export_name("TS_BlindedTail_get_blinding_point"))) TS_BlindedTail_get_blinding_point(uint64_t this_ptr) {
46402         LDKBlindedTail this_ptr_conv;
46403         this_ptr_conv.inner = untag_ptr(this_ptr);
46404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46406         this_ptr_conv.is_owned = false;
46407         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46408         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
46409         return ret_arr;
46410 }
46411
46412 void  __attribute__((export_name("TS_BlindedTail_set_blinding_point"))) TS_BlindedTail_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
46413         LDKBlindedTail this_ptr_conv;
46414         this_ptr_conv.inner = untag_ptr(this_ptr);
46415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46417         this_ptr_conv.is_owned = false;
46418         LDKPublicKey val_ref;
46419         CHECK(val->arr_len == 33);
46420         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46421         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
46422 }
46423
46424 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) {
46425         LDKBlindedTail this_ptr_conv;
46426         this_ptr_conv.inner = untag_ptr(this_ptr);
46427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46429         this_ptr_conv.is_owned = false;
46430         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
46431         return ret_conv;
46432 }
46433
46434 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) {
46435         LDKBlindedTail this_ptr_conv;
46436         this_ptr_conv.inner = untag_ptr(this_ptr);
46437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46439         this_ptr_conv.is_owned = false;
46440         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
46441 }
46442
46443 int64_t  __attribute__((export_name("TS_BlindedTail_get_final_value_msat"))) TS_BlindedTail_get_final_value_msat(uint64_t this_ptr) {
46444         LDKBlindedTail this_ptr_conv;
46445         this_ptr_conv.inner = untag_ptr(this_ptr);
46446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46448         this_ptr_conv.is_owned = false;
46449         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
46450         return ret_conv;
46451 }
46452
46453 void  __attribute__((export_name("TS_BlindedTail_set_final_value_msat"))) TS_BlindedTail_set_final_value_msat(uint64_t this_ptr, int64_t val) {
46454         LDKBlindedTail this_ptr_conv;
46455         this_ptr_conv.inner = untag_ptr(this_ptr);
46456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46458         this_ptr_conv.is_owned = false;
46459         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
46460 }
46461
46462 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) {
46463         LDKCVec_BlindedHopZ hops_arg_constr;
46464         hops_arg_constr.datalen = hops_arg->arr_len;
46465         if (hops_arg_constr.datalen > 0)
46466                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
46467         else
46468                 hops_arg_constr.data = NULL;
46469         uint64_t* hops_arg_vals = hops_arg->elems;
46470         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
46471                 uint64_t hops_arg_conv_12 = hops_arg_vals[m];
46472                 LDKBlindedHop hops_arg_conv_12_conv;
46473                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
46474                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
46475                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
46476                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
46477                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
46478         }
46479         FREE(hops_arg);
46480         LDKPublicKey blinding_point_arg_ref;
46481         CHECK(blinding_point_arg->arr_len == 33);
46482         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
46483         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
46484         uint64_t ret_ref = 0;
46485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46487         return ret_ref;
46488 }
46489
46490 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
46491         LDKBlindedTail ret_var = BlindedTail_clone(arg);
46492         uint64_t ret_ref = 0;
46493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46495         return ret_ref;
46496 }
46497 int64_t  __attribute__((export_name("TS_BlindedTail_clone_ptr"))) TS_BlindedTail_clone_ptr(uint64_t arg) {
46498         LDKBlindedTail arg_conv;
46499         arg_conv.inner = untag_ptr(arg);
46500         arg_conv.is_owned = ptr_is_owned(arg);
46501         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46502         arg_conv.is_owned = false;
46503         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
46504         return ret_conv;
46505 }
46506
46507 uint64_t  __attribute__((export_name("TS_BlindedTail_clone"))) TS_BlindedTail_clone(uint64_t orig) {
46508         LDKBlindedTail orig_conv;
46509         orig_conv.inner = untag_ptr(orig);
46510         orig_conv.is_owned = ptr_is_owned(orig);
46511         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46512         orig_conv.is_owned = false;
46513         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
46514         uint64_t ret_ref = 0;
46515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46517         return ret_ref;
46518 }
46519
46520 int64_t  __attribute__((export_name("TS_BlindedTail_hash"))) TS_BlindedTail_hash(uint64_t o) {
46521         LDKBlindedTail o_conv;
46522         o_conv.inner = untag_ptr(o);
46523         o_conv.is_owned = ptr_is_owned(o);
46524         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46525         o_conv.is_owned = false;
46526         int64_t ret_conv = BlindedTail_hash(&o_conv);
46527         return ret_conv;
46528 }
46529
46530 jboolean  __attribute__((export_name("TS_BlindedTail_eq"))) TS_BlindedTail_eq(uint64_t a, uint64_t b) {
46531         LDKBlindedTail a_conv;
46532         a_conv.inner = untag_ptr(a);
46533         a_conv.is_owned = ptr_is_owned(a);
46534         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46535         a_conv.is_owned = false;
46536         LDKBlindedTail b_conv;
46537         b_conv.inner = untag_ptr(b);
46538         b_conv.is_owned = ptr_is_owned(b);
46539         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46540         b_conv.is_owned = false;
46541         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
46542         return ret_conv;
46543 }
46544
46545 int8_tArray  __attribute__((export_name("TS_BlindedTail_write"))) TS_BlindedTail_write(uint64_t obj) {
46546         LDKBlindedTail obj_conv;
46547         obj_conv.inner = untag_ptr(obj);
46548         obj_conv.is_owned = ptr_is_owned(obj);
46549         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46550         obj_conv.is_owned = false;
46551         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
46552         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46553         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46554         CVec_u8Z_free(ret_var);
46555         return ret_arr;
46556 }
46557
46558 uint64_t  __attribute__((export_name("TS_BlindedTail_read"))) TS_BlindedTail_read(int8_tArray ser) {
46559         LDKu8slice ser_ref;
46560         ser_ref.datalen = ser->arr_len;
46561         ser_ref.data = ser->elems;
46562         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
46563         *ret_conv = BlindedTail_read(ser_ref);
46564         FREE(ser);
46565         return tag_ptr(ret_conv, true);
46566 }
46567
46568 void  __attribute__((export_name("TS_Path_free"))) TS_Path_free(uint64_t this_obj) {
46569         LDKPath this_obj_conv;
46570         this_obj_conv.inner = untag_ptr(this_obj);
46571         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46573         Path_free(this_obj_conv);
46574 }
46575
46576 uint64_tArray  __attribute__((export_name("TS_Path_get_hops"))) TS_Path_get_hops(uint64_t this_ptr) {
46577         LDKPath this_ptr_conv;
46578         this_ptr_conv.inner = untag_ptr(this_ptr);
46579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46581         this_ptr_conv.is_owned = false;
46582         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
46583         uint64_tArray ret_arr = NULL;
46584         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46585         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46586         for (size_t k = 0; k < ret_var.datalen; k++) {
46587                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
46588                 uint64_t ret_conv_10_ref = 0;
46589                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
46590                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
46591                 ret_arr_ptr[k] = ret_conv_10_ref;
46592         }
46593         
46594         FREE(ret_var.data);
46595         return ret_arr;
46596 }
46597
46598 void  __attribute__((export_name("TS_Path_set_hops"))) TS_Path_set_hops(uint64_t this_ptr, uint64_tArray val) {
46599         LDKPath this_ptr_conv;
46600         this_ptr_conv.inner = untag_ptr(this_ptr);
46601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46603         this_ptr_conv.is_owned = false;
46604         LDKCVec_RouteHopZ val_constr;
46605         val_constr.datalen = val->arr_len;
46606         if (val_constr.datalen > 0)
46607                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
46608         else
46609                 val_constr.data = NULL;
46610         uint64_t* val_vals = val->elems;
46611         for (size_t k = 0; k < val_constr.datalen; k++) {
46612                 uint64_t val_conv_10 = val_vals[k];
46613                 LDKRouteHop val_conv_10_conv;
46614                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
46615                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
46616                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
46617                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
46618                 val_constr.data[k] = val_conv_10_conv;
46619         }
46620         FREE(val);
46621         Path_set_hops(&this_ptr_conv, val_constr);
46622 }
46623
46624 uint64_t  __attribute__((export_name("TS_Path_get_blinded_tail"))) TS_Path_get_blinded_tail(uint64_t this_ptr) {
46625         LDKPath this_ptr_conv;
46626         this_ptr_conv.inner = untag_ptr(this_ptr);
46627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46629         this_ptr_conv.is_owned = false;
46630         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
46631         uint64_t ret_ref = 0;
46632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46634         return ret_ref;
46635 }
46636
46637 void  __attribute__((export_name("TS_Path_set_blinded_tail"))) TS_Path_set_blinded_tail(uint64_t this_ptr, uint64_t val) {
46638         LDKPath this_ptr_conv;
46639         this_ptr_conv.inner = untag_ptr(this_ptr);
46640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46642         this_ptr_conv.is_owned = false;
46643         LDKBlindedTail val_conv;
46644         val_conv.inner = untag_ptr(val);
46645         val_conv.is_owned = ptr_is_owned(val);
46646         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46647         val_conv = BlindedTail_clone(&val_conv);
46648         Path_set_blinded_tail(&this_ptr_conv, val_conv);
46649 }
46650
46651 uint64_t  __attribute__((export_name("TS_Path_new"))) TS_Path_new(uint64_tArray hops_arg, uint64_t blinded_tail_arg) {
46652         LDKCVec_RouteHopZ hops_arg_constr;
46653         hops_arg_constr.datalen = hops_arg->arr_len;
46654         if (hops_arg_constr.datalen > 0)
46655                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
46656         else
46657                 hops_arg_constr.data = NULL;
46658         uint64_t* hops_arg_vals = hops_arg->elems;
46659         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
46660                 uint64_t hops_arg_conv_10 = hops_arg_vals[k];
46661                 LDKRouteHop hops_arg_conv_10_conv;
46662                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
46663                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
46664                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
46665                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
46666                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
46667         }
46668         FREE(hops_arg);
46669         LDKBlindedTail blinded_tail_arg_conv;
46670         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
46671         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
46672         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
46673         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
46674         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
46675         uint64_t ret_ref = 0;
46676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46678         return ret_ref;
46679 }
46680
46681 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
46682         LDKPath ret_var = Path_clone(arg);
46683         uint64_t ret_ref = 0;
46684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46686         return ret_ref;
46687 }
46688 int64_t  __attribute__((export_name("TS_Path_clone_ptr"))) TS_Path_clone_ptr(uint64_t arg) {
46689         LDKPath arg_conv;
46690         arg_conv.inner = untag_ptr(arg);
46691         arg_conv.is_owned = ptr_is_owned(arg);
46692         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46693         arg_conv.is_owned = false;
46694         int64_t ret_conv = Path_clone_ptr(&arg_conv);
46695         return ret_conv;
46696 }
46697
46698 uint64_t  __attribute__((export_name("TS_Path_clone"))) TS_Path_clone(uint64_t orig) {
46699         LDKPath orig_conv;
46700         orig_conv.inner = untag_ptr(orig);
46701         orig_conv.is_owned = ptr_is_owned(orig);
46702         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46703         orig_conv.is_owned = false;
46704         LDKPath ret_var = Path_clone(&orig_conv);
46705         uint64_t ret_ref = 0;
46706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46708         return ret_ref;
46709 }
46710
46711 int64_t  __attribute__((export_name("TS_Path_hash"))) TS_Path_hash(uint64_t o) {
46712         LDKPath o_conv;
46713         o_conv.inner = untag_ptr(o);
46714         o_conv.is_owned = ptr_is_owned(o);
46715         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46716         o_conv.is_owned = false;
46717         int64_t ret_conv = Path_hash(&o_conv);
46718         return ret_conv;
46719 }
46720
46721 jboolean  __attribute__((export_name("TS_Path_eq"))) TS_Path_eq(uint64_t a, uint64_t b) {
46722         LDKPath a_conv;
46723         a_conv.inner = untag_ptr(a);
46724         a_conv.is_owned = ptr_is_owned(a);
46725         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46726         a_conv.is_owned = false;
46727         LDKPath b_conv;
46728         b_conv.inner = untag_ptr(b);
46729         b_conv.is_owned = ptr_is_owned(b);
46730         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46731         b_conv.is_owned = false;
46732         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
46733         return ret_conv;
46734 }
46735
46736 int64_t  __attribute__((export_name("TS_Path_fee_msat"))) TS_Path_fee_msat(uint64_t this_arg) {
46737         LDKPath this_arg_conv;
46738         this_arg_conv.inner = untag_ptr(this_arg);
46739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46741         this_arg_conv.is_owned = false;
46742         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
46743         return ret_conv;
46744 }
46745
46746 int64_t  __attribute__((export_name("TS_Path_final_value_msat"))) TS_Path_final_value_msat(uint64_t this_arg) {
46747         LDKPath this_arg_conv;
46748         this_arg_conv.inner = untag_ptr(this_arg);
46749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46751         this_arg_conv.is_owned = false;
46752         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
46753         return ret_conv;
46754 }
46755
46756 uint64_t  __attribute__((export_name("TS_Path_final_cltv_expiry_delta"))) TS_Path_final_cltv_expiry_delta(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         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
46763         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
46764         uint64_t ret_ref = tag_ptr(ret_copy, true);
46765         return ret_ref;
46766 }
46767
46768 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
46769         LDKRoute this_obj_conv;
46770         this_obj_conv.inner = untag_ptr(this_obj);
46771         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46773         Route_free(this_obj_conv);
46774 }
46775
46776 uint64_tArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
46777         LDKRoute this_ptr_conv;
46778         this_ptr_conv.inner = untag_ptr(this_ptr);
46779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46781         this_ptr_conv.is_owned = false;
46782         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
46783         uint64_tArray ret_arr = NULL;
46784         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46785         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46786         for (size_t g = 0; g < ret_var.datalen; g++) {
46787                 LDKPath ret_conv_6_var = ret_var.data[g];
46788                 uint64_t ret_conv_6_ref = 0;
46789                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
46790                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
46791                 ret_arr_ptr[g] = ret_conv_6_ref;
46792         }
46793         
46794         FREE(ret_var.data);
46795         return ret_arr;
46796 }
46797
46798 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, uint64_tArray val) {
46799         LDKRoute this_ptr_conv;
46800         this_ptr_conv.inner = untag_ptr(this_ptr);
46801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46803         this_ptr_conv.is_owned = false;
46804         LDKCVec_PathZ val_constr;
46805         val_constr.datalen = val->arr_len;
46806         if (val_constr.datalen > 0)
46807                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
46808         else
46809                 val_constr.data = NULL;
46810         uint64_t* val_vals = val->elems;
46811         for (size_t g = 0; g < val_constr.datalen; g++) {
46812                 uint64_t val_conv_6 = val_vals[g];
46813                 LDKPath val_conv_6_conv;
46814                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
46815                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
46816                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
46817                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
46818                 val_constr.data[g] = val_conv_6_conv;
46819         }
46820         FREE(val);
46821         Route_set_paths(&this_ptr_conv, val_constr);
46822 }
46823
46824 uint64_t  __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint64_t this_ptr) {
46825         LDKRoute this_ptr_conv;
46826         this_ptr_conv.inner = untag_ptr(this_ptr);
46827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46829         this_ptr_conv.is_owned = false;
46830         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
46831         uint64_t ret_ref = 0;
46832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46834         return ret_ref;
46835 }
46836
46837 void  __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint64_t this_ptr, uint64_t val) {
46838         LDKRoute this_ptr_conv;
46839         this_ptr_conv.inner = untag_ptr(this_ptr);
46840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46842         this_ptr_conv.is_owned = false;
46843         LDKPaymentParameters val_conv;
46844         val_conv.inner = untag_ptr(val);
46845         val_conv.is_owned = ptr_is_owned(val);
46846         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46847         val_conv = PaymentParameters_clone(&val_conv);
46848         Route_set_payment_params(&this_ptr_conv, val_conv);
46849 }
46850
46851 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(uint64_tArray paths_arg, uint64_t payment_params_arg) {
46852         LDKCVec_PathZ paths_arg_constr;
46853         paths_arg_constr.datalen = paths_arg->arr_len;
46854         if (paths_arg_constr.datalen > 0)
46855                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
46856         else
46857                 paths_arg_constr.data = NULL;
46858         uint64_t* paths_arg_vals = paths_arg->elems;
46859         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
46860                 uint64_t paths_arg_conv_6 = paths_arg_vals[g];
46861                 LDKPath paths_arg_conv_6_conv;
46862                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
46863                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
46864                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
46865                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
46866                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
46867         }
46868         FREE(paths_arg);
46869         LDKPaymentParameters payment_params_arg_conv;
46870         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
46871         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
46872         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
46873         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
46874         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
46875         uint64_t ret_ref = 0;
46876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46878         return ret_ref;
46879 }
46880
46881 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
46882         LDKRoute ret_var = Route_clone(arg);
46883         uint64_t ret_ref = 0;
46884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46886         return ret_ref;
46887 }
46888 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
46889         LDKRoute arg_conv;
46890         arg_conv.inner = untag_ptr(arg);
46891         arg_conv.is_owned = ptr_is_owned(arg);
46892         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46893         arg_conv.is_owned = false;
46894         int64_t ret_conv = Route_clone_ptr(&arg_conv);
46895         return ret_conv;
46896 }
46897
46898 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
46899         LDKRoute orig_conv;
46900         orig_conv.inner = untag_ptr(orig);
46901         orig_conv.is_owned = ptr_is_owned(orig);
46902         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46903         orig_conv.is_owned = false;
46904         LDKRoute ret_var = Route_clone(&orig_conv);
46905         uint64_t ret_ref = 0;
46906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46908         return ret_ref;
46909 }
46910
46911 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
46912         LDKRoute o_conv;
46913         o_conv.inner = untag_ptr(o);
46914         o_conv.is_owned = ptr_is_owned(o);
46915         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46916         o_conv.is_owned = false;
46917         int64_t ret_conv = Route_hash(&o_conv);
46918         return ret_conv;
46919 }
46920
46921 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
46922         LDKRoute a_conv;
46923         a_conv.inner = untag_ptr(a);
46924         a_conv.is_owned = ptr_is_owned(a);
46925         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46926         a_conv.is_owned = false;
46927         LDKRoute b_conv;
46928         b_conv.inner = untag_ptr(b);
46929         b_conv.is_owned = ptr_is_owned(b);
46930         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46931         b_conv.is_owned = false;
46932         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
46933         return ret_conv;
46934 }
46935
46936 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
46937         LDKRoute this_arg_conv;
46938         this_arg_conv.inner = untag_ptr(this_arg);
46939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46941         this_arg_conv.is_owned = false;
46942         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
46943         return ret_conv;
46944 }
46945
46946 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
46947         LDKRoute this_arg_conv;
46948         this_arg_conv.inner = untag_ptr(this_arg);
46949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46951         this_arg_conv.is_owned = false;
46952         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
46953         return ret_conv;
46954 }
46955
46956 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
46957         LDKRoute obj_conv;
46958         obj_conv.inner = untag_ptr(obj);
46959         obj_conv.is_owned = ptr_is_owned(obj);
46960         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46961         obj_conv.is_owned = false;
46962         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
46963         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46964         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46965         CVec_u8Z_free(ret_var);
46966         return ret_arr;
46967 }
46968
46969 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
46970         LDKu8slice ser_ref;
46971         ser_ref.datalen = ser->arr_len;
46972         ser_ref.data = ser->elems;
46973         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
46974         *ret_conv = Route_read(ser_ref);
46975         FREE(ser);
46976         return tag_ptr(ret_conv, true);
46977 }
46978
46979 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
46980         LDKRouteParameters this_obj_conv;
46981         this_obj_conv.inner = untag_ptr(this_obj);
46982         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46984         RouteParameters_free(this_obj_conv);
46985 }
46986
46987 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
46988         LDKRouteParameters this_ptr_conv;
46989         this_ptr_conv.inner = untag_ptr(this_ptr);
46990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46992         this_ptr_conv.is_owned = false;
46993         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
46994         uint64_t ret_ref = 0;
46995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46997         return ret_ref;
46998 }
46999
47000 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
47001         LDKRouteParameters this_ptr_conv;
47002         this_ptr_conv.inner = untag_ptr(this_ptr);
47003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47005         this_ptr_conv.is_owned = false;
47006         LDKPaymentParameters val_conv;
47007         val_conv.inner = untag_ptr(val);
47008         val_conv.is_owned = ptr_is_owned(val);
47009         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47010         val_conv = PaymentParameters_clone(&val_conv);
47011         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
47012 }
47013
47014 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
47015         LDKRouteParameters this_ptr_conv;
47016         this_ptr_conv.inner = untag_ptr(this_ptr);
47017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47019         this_ptr_conv.is_owned = false;
47020         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
47021         return ret_conv;
47022 }
47023
47024 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
47025         LDKRouteParameters this_ptr_conv;
47026         this_ptr_conv.inner = untag_ptr(this_ptr);
47027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47029         this_ptr_conv.is_owned = false;
47030         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
47031 }
47032
47033 uint64_t  __attribute__((export_name("TS_RouteParameters_new"))) TS_RouteParameters_new(uint64_t payment_params_arg, int64_t final_value_msat_arg) {
47034         LDKPaymentParameters payment_params_arg_conv;
47035         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
47036         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
47037         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
47038         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
47039         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg);
47040         uint64_t ret_ref = 0;
47041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47043         return ret_ref;
47044 }
47045
47046 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
47047         LDKRouteParameters ret_var = RouteParameters_clone(arg);
47048         uint64_t ret_ref = 0;
47049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47051         return ret_ref;
47052 }
47053 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
47054         LDKRouteParameters arg_conv;
47055         arg_conv.inner = untag_ptr(arg);
47056         arg_conv.is_owned = ptr_is_owned(arg);
47057         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47058         arg_conv.is_owned = false;
47059         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
47060         return ret_conv;
47061 }
47062
47063 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
47064         LDKRouteParameters orig_conv;
47065         orig_conv.inner = untag_ptr(orig);
47066         orig_conv.is_owned = ptr_is_owned(orig);
47067         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47068         orig_conv.is_owned = false;
47069         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
47070         uint64_t ret_ref = 0;
47071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47073         return ret_ref;
47074 }
47075
47076 jboolean  __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) {
47077         LDKRouteParameters a_conv;
47078         a_conv.inner = untag_ptr(a);
47079         a_conv.is_owned = ptr_is_owned(a);
47080         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47081         a_conv.is_owned = false;
47082         LDKRouteParameters b_conv;
47083         b_conv.inner = untag_ptr(b);
47084         b_conv.is_owned = ptr_is_owned(b);
47085         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47086         b_conv.is_owned = false;
47087         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
47088         return ret_conv;
47089 }
47090
47091 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
47092         LDKRouteParameters obj_conv;
47093         obj_conv.inner = untag_ptr(obj);
47094         obj_conv.is_owned = ptr_is_owned(obj);
47095         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47096         obj_conv.is_owned = false;
47097         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
47098         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47099         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47100         CVec_u8Z_free(ret_var);
47101         return ret_arr;
47102 }
47103
47104 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
47105         LDKu8slice ser_ref;
47106         ser_ref.datalen = ser->arr_len;
47107         ser_ref.data = ser->elems;
47108         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
47109         *ret_conv = RouteParameters_read(ser_ref);
47110         FREE(ser);
47111         return tag_ptr(ret_conv, true);
47112 }
47113
47114 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
47115         LDKPaymentParameters this_obj_conv;
47116         this_obj_conv.inner = untag_ptr(this_obj);
47117         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47119         PaymentParameters_free(this_obj_conv);
47120 }
47121
47122 int8_tArray  __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint64_t this_ptr) {
47123         LDKPaymentParameters this_ptr_conv;
47124         this_ptr_conv.inner = untag_ptr(this_ptr);
47125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47127         this_ptr_conv.is_owned = false;
47128         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47129         memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
47130         return ret_arr;
47131 }
47132
47133 void  __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint64_t this_ptr, int8_tArray val) {
47134         LDKPaymentParameters this_ptr_conv;
47135         this_ptr_conv.inner = untag_ptr(this_ptr);
47136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47138         this_ptr_conv.is_owned = false;
47139         LDKPublicKey val_ref;
47140         CHECK(val->arr_len == 33);
47141         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47142         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
47143 }
47144
47145 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint64_t this_ptr) {
47146         LDKPaymentParameters this_ptr_conv;
47147         this_ptr_conv.inner = untag_ptr(this_ptr);
47148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47150         this_ptr_conv.is_owned = false;
47151         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
47152         uint64_t ret_ref = 0;
47153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47155         return ret_ref;
47156 }
47157
47158 void  __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint64_t this_ptr, uint64_t val) {
47159         LDKPaymentParameters this_ptr_conv;
47160         this_ptr_conv.inner = untag_ptr(this_ptr);
47161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47163         this_ptr_conv.is_owned = false;
47164         LDKInvoiceFeatures val_conv;
47165         val_conv.inner = untag_ptr(val);
47166         val_conv.is_owned = ptr_is_owned(val);
47167         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47168         val_conv = InvoiceFeatures_clone(&val_conv);
47169         PaymentParameters_set_features(&this_ptr_conv, val_conv);
47170 }
47171
47172 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint64_t this_ptr) {
47173         LDKPaymentParameters this_ptr_conv;
47174         this_ptr_conv.inner = untag_ptr(this_ptr);
47175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47177         this_ptr_conv.is_owned = false;
47178         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47179         *ret_copy = PaymentParameters_get_route_hints(&this_ptr_conv);
47180         uint64_t ret_ref = tag_ptr(ret_copy, true);
47181         return ret_ref;
47182 }
47183
47184 void  __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint64_t this_ptr, uint64_t val) {
47185         LDKPaymentParameters this_ptr_conv;
47186         this_ptr_conv.inner = untag_ptr(this_ptr);
47187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47189         this_ptr_conv.is_owned = false;
47190         void* val_ptr = untag_ptr(val);
47191         CHECK_ACCESS(val_ptr);
47192         LDKHints val_conv = *(LDKHints*)(val_ptr);
47193         val_conv = Hints_clone((LDKHints*)untag_ptr(val));
47194         PaymentParameters_set_route_hints(&this_ptr_conv, val_conv);
47195 }
47196
47197 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
47198         LDKPaymentParameters this_ptr_conv;
47199         this_ptr_conv.inner = untag_ptr(this_ptr);
47200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47202         this_ptr_conv.is_owned = false;
47203         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47204         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
47205         uint64_t ret_ref = tag_ptr(ret_copy, true);
47206         return ret_ref;
47207 }
47208
47209 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
47210         LDKPaymentParameters this_ptr_conv;
47211         this_ptr_conv.inner = untag_ptr(this_ptr);
47212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47214         this_ptr_conv.is_owned = false;
47215         void* val_ptr = untag_ptr(val);
47216         CHECK_ACCESS(val_ptr);
47217         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47218         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47219         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
47220 }
47221
47222 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) {
47223         LDKPaymentParameters this_ptr_conv;
47224         this_ptr_conv.inner = untag_ptr(this_ptr);
47225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47227         this_ptr_conv.is_owned = false;
47228         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
47229         return ret_conv;
47230 }
47231
47232 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) {
47233         LDKPaymentParameters this_ptr_conv;
47234         this_ptr_conv.inner = untag_ptr(this_ptr);
47235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47237         this_ptr_conv.is_owned = false;
47238         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
47239 }
47240
47241 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
47242         LDKPaymentParameters this_ptr_conv;
47243         this_ptr_conv.inner = untag_ptr(this_ptr);
47244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47246         this_ptr_conv.is_owned = false;
47247         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
47248         return ret_conv;
47249 }
47250
47251 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
47252         LDKPaymentParameters this_ptr_conv;
47253         this_ptr_conv.inner = untag_ptr(this_ptr);
47254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47256         this_ptr_conv.is_owned = false;
47257         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
47258 }
47259
47260 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) {
47261         LDKPaymentParameters this_ptr_conv;
47262         this_ptr_conv.inner = untag_ptr(this_ptr);
47263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47265         this_ptr_conv.is_owned = false;
47266         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
47267         return ret_conv;
47268 }
47269
47270 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) {
47271         LDKPaymentParameters this_ptr_conv;
47272         this_ptr_conv.inner = untag_ptr(this_ptr);
47273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47275         this_ptr_conv.is_owned = false;
47276         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
47277 }
47278
47279 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
47280         LDKPaymentParameters this_ptr_conv;
47281         this_ptr_conv.inner = untag_ptr(this_ptr);
47282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47284         this_ptr_conv.is_owned = false;
47285         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
47286         int64_tArray ret_arr = NULL;
47287         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
47288         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
47289         for (size_t i = 0; i < ret_var.datalen; i++) {
47290                 int64_t ret_conv_8_conv = ret_var.data[i];
47291                 ret_arr_ptr[i] = ret_conv_8_conv;
47292         }
47293         
47294         FREE(ret_var.data);
47295         return ret_arr;
47296 }
47297
47298 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
47299         LDKPaymentParameters this_ptr_conv;
47300         this_ptr_conv.inner = untag_ptr(this_ptr);
47301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47303         this_ptr_conv.is_owned = false;
47304         LDKCVec_u64Z val_constr;
47305         val_constr.datalen = val->arr_len;
47306         if (val_constr.datalen > 0)
47307                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
47308         else
47309                 val_constr.data = NULL;
47310         int64_t* val_vals = val->elems;
47311         for (size_t i = 0; i < val_constr.datalen; i++) {
47312                 int64_t val_conv_8 = val_vals[i];
47313                 val_constr.data[i] = val_conv_8;
47314         }
47315         FREE(val);
47316         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
47317 }
47318
47319 int32_t  __attribute__((export_name("TS_PaymentParameters_get_final_cltv_expiry_delta"))) TS_PaymentParameters_get_final_cltv_expiry_delta(uint64_t this_ptr) {
47320         LDKPaymentParameters this_ptr_conv;
47321         this_ptr_conv.inner = untag_ptr(this_ptr);
47322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47324         this_ptr_conv.is_owned = false;
47325         int32_t ret_conv = PaymentParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
47326         return ret_conv;
47327 }
47328
47329 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) {
47330         LDKPaymentParameters this_ptr_conv;
47331         this_ptr_conv.inner = untag_ptr(this_ptr);
47332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47334         this_ptr_conv.is_owned = false;
47335         PaymentParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
47336 }
47337
47338 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) {
47339         LDKPublicKey payee_pubkey_arg_ref;
47340         CHECK(payee_pubkey_arg->arr_len == 33);
47341         memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
47342         LDKInvoiceFeatures features_arg_conv;
47343         features_arg_conv.inner = untag_ptr(features_arg);
47344         features_arg_conv.is_owned = ptr_is_owned(features_arg);
47345         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
47346         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
47347         void* route_hints_arg_ptr = untag_ptr(route_hints_arg);
47348         CHECK_ACCESS(route_hints_arg_ptr);
47349         LDKHints route_hints_arg_conv = *(LDKHints*)(route_hints_arg_ptr);
47350         route_hints_arg_conv = Hints_clone((LDKHints*)untag_ptr(route_hints_arg));
47351         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
47352         CHECK_ACCESS(expiry_time_arg_ptr);
47353         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
47354         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
47355         LDKCVec_u64Z previously_failed_channels_arg_constr;
47356         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
47357         if (previously_failed_channels_arg_constr.datalen > 0)
47358                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
47359         else
47360                 previously_failed_channels_arg_constr.data = NULL;
47361         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
47362         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
47363                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
47364                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
47365         }
47366         FREE(previously_failed_channels_arg);
47367         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);
47368         uint64_t ret_ref = 0;
47369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47371         return ret_ref;
47372 }
47373
47374 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
47375         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
47376         uint64_t ret_ref = 0;
47377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47379         return ret_ref;
47380 }
47381 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
47382         LDKPaymentParameters arg_conv;
47383         arg_conv.inner = untag_ptr(arg);
47384         arg_conv.is_owned = ptr_is_owned(arg);
47385         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47386         arg_conv.is_owned = false;
47387         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
47388         return ret_conv;
47389 }
47390
47391 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
47392         LDKPaymentParameters orig_conv;
47393         orig_conv.inner = untag_ptr(orig);
47394         orig_conv.is_owned = ptr_is_owned(orig);
47395         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47396         orig_conv.is_owned = false;
47397         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
47398         uint64_t ret_ref = 0;
47399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47401         return ret_ref;
47402 }
47403
47404 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
47405         LDKPaymentParameters o_conv;
47406         o_conv.inner = untag_ptr(o);
47407         o_conv.is_owned = ptr_is_owned(o);
47408         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47409         o_conv.is_owned = false;
47410         int64_t ret_conv = PaymentParameters_hash(&o_conv);
47411         return ret_conv;
47412 }
47413
47414 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
47415         LDKPaymentParameters a_conv;
47416         a_conv.inner = untag_ptr(a);
47417         a_conv.is_owned = ptr_is_owned(a);
47418         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47419         a_conv.is_owned = false;
47420         LDKPaymentParameters b_conv;
47421         b_conv.inner = untag_ptr(b);
47422         b_conv.is_owned = ptr_is_owned(b);
47423         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47424         b_conv.is_owned = false;
47425         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
47426         return ret_conv;
47427 }
47428
47429 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
47430         LDKPaymentParameters obj_conv;
47431         obj_conv.inner = untag_ptr(obj);
47432         obj_conv.is_owned = ptr_is_owned(obj);
47433         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47434         obj_conv.is_owned = false;
47435         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
47436         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47437         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47438         CVec_u8Z_free(ret_var);
47439         return ret_arr;
47440 }
47441
47442 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) {
47443         LDKu8slice ser_ref;
47444         ser_ref.datalen = ser->arr_len;
47445         ser_ref.data = ser->elems;
47446         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
47447         *ret_conv = PaymentParameters_read(ser_ref, arg);
47448         FREE(ser);
47449         return tag_ptr(ret_conv, true);
47450 }
47451
47452 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) {
47453         LDKPublicKey payee_pubkey_ref;
47454         CHECK(payee_pubkey->arr_len == 33);
47455         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
47456         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
47457         uint64_t ret_ref = 0;
47458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47460         return ret_ref;
47461 }
47462
47463 uint64_t  __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) {
47464         LDKPublicKey payee_pubkey_ref;
47465         CHECK(payee_pubkey->arr_len == 33);
47466         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
47467         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta);
47468         uint64_t ret_ref = 0;
47469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47471         return ret_ref;
47472 }
47473
47474 void  __attribute__((export_name("TS_Hints_free"))) TS_Hints_free(uint64_t this_ptr) {
47475         if (!ptr_is_owned(this_ptr)) return;
47476         void* this_ptr_ptr = untag_ptr(this_ptr);
47477         CHECK_ACCESS(this_ptr_ptr);
47478         LDKHints this_ptr_conv = *(LDKHints*)(this_ptr_ptr);
47479         FREE(untag_ptr(this_ptr));
47480         Hints_free(this_ptr_conv);
47481 }
47482
47483 static inline uint64_t Hints_clone_ptr(LDKHints *NONNULL_PTR arg) {
47484         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47485         *ret_copy = Hints_clone(arg);
47486         uint64_t ret_ref = tag_ptr(ret_copy, true);
47487         return ret_ref;
47488 }
47489 int64_t  __attribute__((export_name("TS_Hints_clone_ptr"))) TS_Hints_clone_ptr(uint64_t arg) {
47490         LDKHints* arg_conv = (LDKHints*)untag_ptr(arg);
47491         int64_t ret_conv = Hints_clone_ptr(arg_conv);
47492         return ret_conv;
47493 }
47494
47495 uint64_t  __attribute__((export_name("TS_Hints_clone"))) TS_Hints_clone(uint64_t orig) {
47496         LDKHints* orig_conv = (LDKHints*)untag_ptr(orig);
47497         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47498         *ret_copy = Hints_clone(orig_conv);
47499         uint64_t ret_ref = tag_ptr(ret_copy, true);
47500         return ret_ref;
47501 }
47502
47503 uint64_t  __attribute__((export_name("TS_Hints_blinded"))) TS_Hints_blinded(uint64_tArray a) {
47504         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ a_constr;
47505         a_constr.datalen = a->arr_len;
47506         if (a_constr.datalen > 0)
47507                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
47508         else
47509                 a_constr.data = NULL;
47510         uint64_t* a_vals = a->elems;
47511         for (size_t l = 0; l < a_constr.datalen; l++) {
47512                 uint64_t a_conv_37 = a_vals[l];
47513                 void* a_conv_37_ptr = untag_ptr(a_conv_37);
47514                 CHECK_ACCESS(a_conv_37_ptr);
47515                 LDKC2Tuple_BlindedPayInfoBlindedPathZ a_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(a_conv_37_ptr);
47516                 a_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(a_conv_37));
47517                 a_constr.data[l] = a_conv_37_conv;
47518         }
47519         FREE(a);
47520         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47521         *ret_copy = Hints_blinded(a_constr);
47522         uint64_t ret_ref = tag_ptr(ret_copy, true);
47523         return ret_ref;
47524 }
47525
47526 uint64_t  __attribute__((export_name("TS_Hints_clear"))) TS_Hints_clear(uint64_tArray a) {
47527         LDKCVec_RouteHintZ a_constr;
47528         a_constr.datalen = a->arr_len;
47529         if (a_constr.datalen > 0)
47530                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
47531         else
47532                 a_constr.data = NULL;
47533         uint64_t* a_vals = a->elems;
47534         for (size_t l = 0; l < a_constr.datalen; l++) {
47535                 uint64_t a_conv_11 = a_vals[l];
47536                 LDKRouteHint a_conv_11_conv;
47537                 a_conv_11_conv.inner = untag_ptr(a_conv_11);
47538                 a_conv_11_conv.is_owned = ptr_is_owned(a_conv_11);
47539                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv_11_conv);
47540                 a_conv_11_conv = RouteHint_clone(&a_conv_11_conv);
47541                 a_constr.data[l] = a_conv_11_conv;
47542         }
47543         FREE(a);
47544         LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
47545         *ret_copy = Hints_clear(a_constr);
47546         uint64_t ret_ref = tag_ptr(ret_copy, true);
47547         return ret_ref;
47548 }
47549
47550 int64_t  __attribute__((export_name("TS_Hints_hash"))) TS_Hints_hash(uint64_t o) {
47551         LDKHints* o_conv = (LDKHints*)untag_ptr(o);
47552         int64_t ret_conv = Hints_hash(o_conv);
47553         return ret_conv;
47554 }
47555
47556 jboolean  __attribute__((export_name("TS_Hints_eq"))) TS_Hints_eq(uint64_t a, uint64_t b) {
47557         LDKHints* a_conv = (LDKHints*)untag_ptr(a);
47558         LDKHints* b_conv = (LDKHints*)untag_ptr(b);
47559         jboolean ret_conv = Hints_eq(a_conv, b_conv);
47560         return ret_conv;
47561 }
47562
47563 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
47564         LDKRouteHint this_obj_conv;
47565         this_obj_conv.inner = untag_ptr(this_obj);
47566         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47568         RouteHint_free(this_obj_conv);
47569 }
47570
47571 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
47572         LDKRouteHint this_ptr_conv;
47573         this_ptr_conv.inner = untag_ptr(this_ptr);
47574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47576         this_ptr_conv.is_owned = false;
47577         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
47578         uint64_tArray ret_arr = NULL;
47579         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
47580         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
47581         for (size_t o = 0; o < ret_var.datalen; o++) {
47582                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
47583                 uint64_t ret_conv_14_ref = 0;
47584                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
47585                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
47586                 ret_arr_ptr[o] = ret_conv_14_ref;
47587         }
47588         
47589         FREE(ret_var.data);
47590         return ret_arr;
47591 }
47592
47593 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
47594         LDKRouteHint this_ptr_conv;
47595         this_ptr_conv.inner = untag_ptr(this_ptr);
47596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47598         this_ptr_conv.is_owned = false;
47599         LDKCVec_RouteHintHopZ val_constr;
47600         val_constr.datalen = val->arr_len;
47601         if (val_constr.datalen > 0)
47602                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
47603         else
47604                 val_constr.data = NULL;
47605         uint64_t* val_vals = val->elems;
47606         for (size_t o = 0; o < val_constr.datalen; o++) {
47607                 uint64_t val_conv_14 = val_vals[o];
47608                 LDKRouteHintHop val_conv_14_conv;
47609                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
47610                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
47611                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
47612                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
47613                 val_constr.data[o] = val_conv_14_conv;
47614         }
47615         FREE(val);
47616         RouteHint_set_a(&this_ptr_conv, val_constr);
47617 }
47618
47619 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
47620         LDKCVec_RouteHintHopZ a_arg_constr;
47621         a_arg_constr.datalen = a_arg->arr_len;
47622         if (a_arg_constr.datalen > 0)
47623                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
47624         else
47625                 a_arg_constr.data = NULL;
47626         uint64_t* a_arg_vals = a_arg->elems;
47627         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
47628                 uint64_t a_arg_conv_14 = a_arg_vals[o];
47629                 LDKRouteHintHop a_arg_conv_14_conv;
47630                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
47631                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
47632                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
47633                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
47634                 a_arg_constr.data[o] = a_arg_conv_14_conv;
47635         }
47636         FREE(a_arg);
47637         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
47638         uint64_t ret_ref = 0;
47639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47641         return ret_ref;
47642 }
47643
47644 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
47645         LDKRouteHint ret_var = RouteHint_clone(arg);
47646         uint64_t ret_ref = 0;
47647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47649         return ret_ref;
47650 }
47651 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
47652         LDKRouteHint arg_conv;
47653         arg_conv.inner = untag_ptr(arg);
47654         arg_conv.is_owned = ptr_is_owned(arg);
47655         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47656         arg_conv.is_owned = false;
47657         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
47658         return ret_conv;
47659 }
47660
47661 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
47662         LDKRouteHint orig_conv;
47663         orig_conv.inner = untag_ptr(orig);
47664         orig_conv.is_owned = ptr_is_owned(orig);
47665         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47666         orig_conv.is_owned = false;
47667         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
47668         uint64_t ret_ref = 0;
47669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47671         return ret_ref;
47672 }
47673
47674 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
47675         LDKRouteHint o_conv;
47676         o_conv.inner = untag_ptr(o);
47677         o_conv.is_owned = ptr_is_owned(o);
47678         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47679         o_conv.is_owned = false;
47680         int64_t ret_conv = RouteHint_hash(&o_conv);
47681         return ret_conv;
47682 }
47683
47684 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
47685         LDKRouteHint a_conv;
47686         a_conv.inner = untag_ptr(a);
47687         a_conv.is_owned = ptr_is_owned(a);
47688         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47689         a_conv.is_owned = false;
47690         LDKRouteHint b_conv;
47691         b_conv.inner = untag_ptr(b);
47692         b_conv.is_owned = ptr_is_owned(b);
47693         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47694         b_conv.is_owned = false;
47695         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
47696         return ret_conv;
47697 }
47698
47699 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
47700         LDKRouteHint obj_conv;
47701         obj_conv.inner = untag_ptr(obj);
47702         obj_conv.is_owned = ptr_is_owned(obj);
47703         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47704         obj_conv.is_owned = false;
47705         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
47706         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47707         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47708         CVec_u8Z_free(ret_var);
47709         return ret_arr;
47710 }
47711
47712 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
47713         LDKu8slice ser_ref;
47714         ser_ref.datalen = ser->arr_len;
47715         ser_ref.data = ser->elems;
47716         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
47717         *ret_conv = RouteHint_read(ser_ref);
47718         FREE(ser);
47719         return tag_ptr(ret_conv, true);
47720 }
47721
47722 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
47723         LDKRouteHintHop this_obj_conv;
47724         this_obj_conv.inner = untag_ptr(this_obj);
47725         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47727         RouteHintHop_free(this_obj_conv);
47728 }
47729
47730 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
47731         LDKRouteHintHop this_ptr_conv;
47732         this_ptr_conv.inner = untag_ptr(this_ptr);
47733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47735         this_ptr_conv.is_owned = false;
47736         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47737         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
47738         return ret_arr;
47739 }
47740
47741 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
47742         LDKRouteHintHop this_ptr_conv;
47743         this_ptr_conv.inner = untag_ptr(this_ptr);
47744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47746         this_ptr_conv.is_owned = false;
47747         LDKPublicKey val_ref;
47748         CHECK(val->arr_len == 33);
47749         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47750         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
47751 }
47752
47753 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
47754         LDKRouteHintHop this_ptr_conv;
47755         this_ptr_conv.inner = untag_ptr(this_ptr);
47756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47758         this_ptr_conv.is_owned = false;
47759         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
47760         return ret_conv;
47761 }
47762
47763 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
47764         LDKRouteHintHop this_ptr_conv;
47765         this_ptr_conv.inner = untag_ptr(this_ptr);
47766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47768         this_ptr_conv.is_owned = false;
47769         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
47770 }
47771
47772 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
47773         LDKRouteHintHop this_ptr_conv;
47774         this_ptr_conv.inner = untag_ptr(this_ptr);
47775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47777         this_ptr_conv.is_owned = false;
47778         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
47779         uint64_t ret_ref = 0;
47780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47782         return ret_ref;
47783 }
47784
47785 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
47786         LDKRouteHintHop this_ptr_conv;
47787         this_ptr_conv.inner = untag_ptr(this_ptr);
47788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47790         this_ptr_conv.is_owned = false;
47791         LDKRoutingFees val_conv;
47792         val_conv.inner = untag_ptr(val);
47793         val_conv.is_owned = ptr_is_owned(val);
47794         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47795         val_conv = RoutingFees_clone(&val_conv);
47796         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
47797 }
47798
47799 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
47800         LDKRouteHintHop this_ptr_conv;
47801         this_ptr_conv.inner = untag_ptr(this_ptr);
47802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47804         this_ptr_conv.is_owned = false;
47805         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
47806         return ret_conv;
47807 }
47808
47809 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
47810         LDKRouteHintHop this_ptr_conv;
47811         this_ptr_conv.inner = untag_ptr(this_ptr);
47812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47814         this_ptr_conv.is_owned = false;
47815         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
47816 }
47817
47818 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
47819         LDKRouteHintHop this_ptr_conv;
47820         this_ptr_conv.inner = untag_ptr(this_ptr);
47821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47823         this_ptr_conv.is_owned = false;
47824         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47825         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
47826         uint64_t ret_ref = tag_ptr(ret_copy, true);
47827         return ret_ref;
47828 }
47829
47830 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
47831         LDKRouteHintHop this_ptr_conv;
47832         this_ptr_conv.inner = untag_ptr(this_ptr);
47833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47835         this_ptr_conv.is_owned = false;
47836         void* val_ptr = untag_ptr(val);
47837         CHECK_ACCESS(val_ptr);
47838         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47839         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47840         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
47841 }
47842
47843 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
47844         LDKRouteHintHop this_ptr_conv;
47845         this_ptr_conv.inner = untag_ptr(this_ptr);
47846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47848         this_ptr_conv.is_owned = false;
47849         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47850         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
47851         uint64_t ret_ref = tag_ptr(ret_copy, true);
47852         return ret_ref;
47853 }
47854
47855 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
47856         LDKRouteHintHop this_ptr_conv;
47857         this_ptr_conv.inner = untag_ptr(this_ptr);
47858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47860         this_ptr_conv.is_owned = false;
47861         void* val_ptr = untag_ptr(val);
47862         CHECK_ACCESS(val_ptr);
47863         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47864         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47865         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
47866 }
47867
47868 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) {
47869         LDKPublicKey src_node_id_arg_ref;
47870         CHECK(src_node_id_arg->arr_len == 33);
47871         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
47872         LDKRoutingFees fees_arg_conv;
47873         fees_arg_conv.inner = untag_ptr(fees_arg);
47874         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
47875         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
47876         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
47877         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
47878         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
47879         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
47880         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
47881         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
47882         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
47883         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
47884         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
47885         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);
47886         uint64_t ret_ref = 0;
47887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47889         return ret_ref;
47890 }
47891
47892 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
47893         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
47894         uint64_t ret_ref = 0;
47895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47897         return ret_ref;
47898 }
47899 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
47900         LDKRouteHintHop arg_conv;
47901         arg_conv.inner = untag_ptr(arg);
47902         arg_conv.is_owned = ptr_is_owned(arg);
47903         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47904         arg_conv.is_owned = false;
47905         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
47906         return ret_conv;
47907 }
47908
47909 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
47910         LDKRouteHintHop orig_conv;
47911         orig_conv.inner = untag_ptr(orig);
47912         orig_conv.is_owned = ptr_is_owned(orig);
47913         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47914         orig_conv.is_owned = false;
47915         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
47916         uint64_t ret_ref = 0;
47917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47919         return ret_ref;
47920 }
47921
47922 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
47923         LDKRouteHintHop o_conv;
47924         o_conv.inner = untag_ptr(o);
47925         o_conv.is_owned = ptr_is_owned(o);
47926         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47927         o_conv.is_owned = false;
47928         int64_t ret_conv = RouteHintHop_hash(&o_conv);
47929         return ret_conv;
47930 }
47931
47932 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
47933         LDKRouteHintHop a_conv;
47934         a_conv.inner = untag_ptr(a);
47935         a_conv.is_owned = ptr_is_owned(a);
47936         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47937         a_conv.is_owned = false;
47938         LDKRouteHintHop b_conv;
47939         b_conv.inner = untag_ptr(b);
47940         b_conv.is_owned = ptr_is_owned(b);
47941         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47942         b_conv.is_owned = false;
47943         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
47944         return ret_conv;
47945 }
47946
47947 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
47948         LDKRouteHintHop obj_conv;
47949         obj_conv.inner = untag_ptr(obj);
47950         obj_conv.is_owned = ptr_is_owned(obj);
47951         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47952         obj_conv.is_owned = false;
47953         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
47954         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47955         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47956         CVec_u8Z_free(ret_var);
47957         return ret_arr;
47958 }
47959
47960 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
47961         LDKu8slice ser_ref;
47962         ser_ref.datalen = ser->arr_len;
47963         ser_ref.data = ser->elems;
47964         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
47965         *ret_conv = RouteHintHop_read(ser_ref);
47966         FREE(ser);
47967         return tag_ptr(ret_conv, true);
47968 }
47969
47970 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) {
47971         LDKPublicKey our_node_pubkey_ref;
47972         CHECK(our_node_pubkey->arr_len == 33);
47973         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
47974         LDKRouteParameters route_params_conv;
47975         route_params_conv.inner = untag_ptr(route_params);
47976         route_params_conv.is_owned = ptr_is_owned(route_params);
47977         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
47978         route_params_conv.is_owned = false;
47979         LDKNetworkGraph network_graph_conv;
47980         network_graph_conv.inner = untag_ptr(network_graph);
47981         network_graph_conv.is_owned = ptr_is_owned(network_graph);
47982         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
47983         network_graph_conv.is_owned = false;
47984         LDKCVec_ChannelDetailsZ first_hops_constr;
47985         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
47986         if (first_hops != 0) {
47987                 first_hops_constr.datalen = first_hops->arr_len;
47988                 if (first_hops_constr.datalen > 0)
47989                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
47990                 else
47991                         first_hops_constr.data = NULL;
47992                 uint64_t* first_hops_vals = first_hops->elems;
47993                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
47994                         uint64_t first_hops_conv_16 = first_hops_vals[q];
47995                         LDKChannelDetails first_hops_conv_16_conv;
47996                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
47997                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
47998                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
47999                         first_hops_conv_16_conv.is_owned = false;
48000                         first_hops_constr.data[q] = first_hops_conv_16_conv;
48001                 }
48002                 FREE(first_hops);
48003                 first_hops_ptr = &first_hops_constr;
48004         }
48005         void* logger_ptr = untag_ptr(logger);
48006         CHECK_ACCESS(logger_ptr);
48007         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48008         if (logger_conv.free == LDKLogger_JCalls_free) {
48009                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48010                 LDKLogger_JCalls_cloned(&logger_conv);
48011         }
48012         void* scorer_ptr = untag_ptr(scorer);
48013         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
48014         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
48015         uint8_t random_seed_bytes_arr[32];
48016         CHECK(random_seed_bytes->arr_len == 32);
48017         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
48018         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
48019         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
48020         *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);
48021         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
48022         return tag_ptr(ret_conv, true);
48023 }
48024
48025 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) {
48026         LDKPublicKey our_node_pubkey_ref;
48027         CHECK(our_node_pubkey->arr_len == 33);
48028         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
48029         LDKCVec_PublicKeyZ hops_constr;
48030         hops_constr.datalen = hops->arr_len;
48031         if (hops_constr.datalen > 0)
48032                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
48033         else
48034                 hops_constr.data = NULL;
48035         int8_tArray* hops_vals = (void*) hops->elems;
48036         for (size_t m = 0; m < hops_constr.datalen; m++) {
48037                 int8_tArray hops_conv_12 = hops_vals[m];
48038                 LDKPublicKey hops_conv_12_ref;
48039                 CHECK(hops_conv_12->arr_len == 33);
48040                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
48041                 hops_constr.data[m] = hops_conv_12_ref;
48042         }
48043         FREE(hops);
48044         LDKRouteParameters route_params_conv;
48045         route_params_conv.inner = untag_ptr(route_params);
48046         route_params_conv.is_owned = ptr_is_owned(route_params);
48047         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
48048         route_params_conv.is_owned = false;
48049         LDKNetworkGraph network_graph_conv;
48050         network_graph_conv.inner = untag_ptr(network_graph);
48051         network_graph_conv.is_owned = ptr_is_owned(network_graph);
48052         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
48053         network_graph_conv.is_owned = false;
48054         void* logger_ptr = untag_ptr(logger);
48055         CHECK_ACCESS(logger_ptr);
48056         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48057         if (logger_conv.free == LDKLogger_JCalls_free) {
48058                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48059                 LDKLogger_JCalls_cloned(&logger_conv);
48060         }
48061         uint8_t random_seed_bytes_arr[32];
48062         CHECK(random_seed_bytes->arr_len == 32);
48063         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
48064         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
48065         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
48066         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
48067         return tag_ptr(ret_conv, true);
48068 }
48069
48070 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
48071         if (!ptr_is_owned(this_ptr)) return;
48072         void* this_ptr_ptr = untag_ptr(this_ptr);
48073         CHECK_ACCESS(this_ptr_ptr);
48074         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
48075         FREE(untag_ptr(this_ptr));
48076         Score_free(this_ptr_conv);
48077 }
48078
48079 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
48080         if (!ptr_is_owned(this_ptr)) return;
48081         void* this_ptr_ptr = untag_ptr(this_ptr);
48082         CHECK_ACCESS(this_ptr_ptr);
48083         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
48084         FREE(untag_ptr(this_ptr));
48085         LockableScore_free(this_ptr_conv);
48086 }
48087
48088 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
48089         if (!ptr_is_owned(this_ptr)) return;
48090         void* this_ptr_ptr = untag_ptr(this_ptr);
48091         CHECK_ACCESS(this_ptr_ptr);
48092         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
48093         FREE(untag_ptr(this_ptr));
48094         WriteableScore_free(this_ptr_conv);
48095 }
48096
48097 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
48098         LDKMultiThreadedLockableScore this_obj_conv;
48099         this_obj_conv.inner = untag_ptr(this_obj);
48100         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48102         MultiThreadedLockableScore_free(this_obj_conv);
48103 }
48104
48105 void  __attribute__((export_name("TS_MultiThreadedScoreLock_free"))) TS_MultiThreadedScoreLock_free(uint64_t this_obj) {
48106         LDKMultiThreadedScoreLock this_obj_conv;
48107         this_obj_conv.inner = untag_ptr(this_obj);
48108         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48110         MultiThreadedScoreLock_free(this_obj_conv);
48111 }
48112
48113 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLock_as_Score"))) TS_MultiThreadedScoreLock_as_Score(uint64_t this_arg) {
48114         LDKMultiThreadedScoreLock this_arg_conv;
48115         this_arg_conv.inner = untag_ptr(this_arg);
48116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48118         this_arg_conv.is_owned = false;
48119         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
48120         *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
48121         return tag_ptr(ret_ret, true);
48122 }
48123
48124 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLock_write"))) TS_MultiThreadedScoreLock_write(uint64_t obj) {
48125         LDKMultiThreadedScoreLock obj_conv;
48126         obj_conv.inner = untag_ptr(obj);
48127         obj_conv.is_owned = ptr_is_owned(obj);
48128         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48129         obj_conv.is_owned = false;
48130         LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
48131         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48132         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48133         CVec_u8Z_free(ret_var);
48134         return ret_arr;
48135 }
48136
48137 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
48138         LDKMultiThreadedLockableScore this_arg_conv;
48139         this_arg_conv.inner = untag_ptr(this_arg);
48140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48142         this_arg_conv.is_owned = false;
48143         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
48144         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
48145         return tag_ptr(ret_ret, true);
48146 }
48147
48148 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
48149         LDKMultiThreadedLockableScore obj_conv;
48150         obj_conv.inner = untag_ptr(obj);
48151         obj_conv.is_owned = ptr_is_owned(obj);
48152         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48153         obj_conv.is_owned = false;
48154         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
48155         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48156         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48157         CVec_u8Z_free(ret_var);
48158         return ret_arr;
48159 }
48160
48161 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
48162         LDKMultiThreadedLockableScore this_arg_conv;
48163         this_arg_conv.inner = untag_ptr(this_arg);
48164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48166         this_arg_conv.is_owned = false;
48167         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
48168         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
48169         return tag_ptr(ret_ret, true);
48170 }
48171
48172 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
48173         void* score_ptr = untag_ptr(score);
48174         CHECK_ACCESS(score_ptr);
48175         LDKScore score_conv = *(LDKScore*)(score_ptr);
48176         if (score_conv.free == LDKScore_JCalls_free) {
48177                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48178                 LDKScore_JCalls_cloned(&score_conv);
48179         }
48180         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
48181         uint64_t ret_ref = 0;
48182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48184         return ret_ref;
48185 }
48186
48187 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
48188         LDKChannelUsage this_obj_conv;
48189         this_obj_conv.inner = untag_ptr(this_obj);
48190         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48192         ChannelUsage_free(this_obj_conv);
48193 }
48194
48195 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
48196         LDKChannelUsage this_ptr_conv;
48197         this_ptr_conv.inner = untag_ptr(this_ptr);
48198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48200         this_ptr_conv.is_owned = false;
48201         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
48202         return ret_conv;
48203 }
48204
48205 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
48206         LDKChannelUsage this_ptr_conv;
48207         this_ptr_conv.inner = untag_ptr(this_ptr);
48208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48210         this_ptr_conv.is_owned = false;
48211         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
48212 }
48213
48214 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
48215         LDKChannelUsage this_ptr_conv;
48216         this_ptr_conv.inner = untag_ptr(this_ptr);
48217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48219         this_ptr_conv.is_owned = false;
48220         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
48221         return ret_conv;
48222 }
48223
48224 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
48225         LDKChannelUsage this_ptr_conv;
48226         this_ptr_conv.inner = untag_ptr(this_ptr);
48227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48229         this_ptr_conv.is_owned = false;
48230         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
48231 }
48232
48233 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
48234         LDKChannelUsage this_ptr_conv;
48235         this_ptr_conv.inner = untag_ptr(this_ptr);
48236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48238         this_ptr_conv.is_owned = false;
48239         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
48240         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
48241         uint64_t ret_ref = tag_ptr(ret_copy, true);
48242         return ret_ref;
48243 }
48244
48245 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
48246         LDKChannelUsage this_ptr_conv;
48247         this_ptr_conv.inner = untag_ptr(this_ptr);
48248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48250         this_ptr_conv.is_owned = false;
48251         void* val_ptr = untag_ptr(val);
48252         CHECK_ACCESS(val_ptr);
48253         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
48254         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
48255         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
48256 }
48257
48258 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) {
48259         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
48260         CHECK_ACCESS(effective_capacity_arg_ptr);
48261         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
48262         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
48263         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
48264         uint64_t ret_ref = 0;
48265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48267         return ret_ref;
48268 }
48269
48270 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
48271         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
48272         uint64_t ret_ref = 0;
48273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48275         return ret_ref;
48276 }
48277 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
48278         LDKChannelUsage arg_conv;
48279         arg_conv.inner = untag_ptr(arg);
48280         arg_conv.is_owned = ptr_is_owned(arg);
48281         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48282         arg_conv.is_owned = false;
48283         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
48284         return ret_conv;
48285 }
48286
48287 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
48288         LDKChannelUsage orig_conv;
48289         orig_conv.inner = untag_ptr(orig);
48290         orig_conv.is_owned = ptr_is_owned(orig);
48291         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48292         orig_conv.is_owned = false;
48293         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
48294         uint64_t ret_ref = 0;
48295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48297         return ret_ref;
48298 }
48299
48300 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
48301         LDKFixedPenaltyScorer this_obj_conv;
48302         this_obj_conv.inner = untag_ptr(this_obj);
48303         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48305         FixedPenaltyScorer_free(this_obj_conv);
48306 }
48307
48308 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
48309         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
48310         uint64_t ret_ref = 0;
48311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48313         return ret_ref;
48314 }
48315 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
48316         LDKFixedPenaltyScorer arg_conv;
48317         arg_conv.inner = untag_ptr(arg);
48318         arg_conv.is_owned = ptr_is_owned(arg);
48319         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48320         arg_conv.is_owned = false;
48321         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
48322         return ret_conv;
48323 }
48324
48325 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
48326         LDKFixedPenaltyScorer orig_conv;
48327         orig_conv.inner = untag_ptr(orig);
48328         orig_conv.is_owned = ptr_is_owned(orig);
48329         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48330         orig_conv.is_owned = false;
48331         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
48332         uint64_t ret_ref = 0;
48333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48335         return ret_ref;
48336 }
48337
48338 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
48339         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
48340         uint64_t ret_ref = 0;
48341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48343         return ret_ref;
48344 }
48345
48346 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint64_t this_arg) {
48347         LDKFixedPenaltyScorer this_arg_conv;
48348         this_arg_conv.inner = untag_ptr(this_arg);
48349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48351         this_arg_conv.is_owned = false;
48352         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
48353         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
48354         return tag_ptr(ret_ret, true);
48355 }
48356
48357 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
48358         LDKFixedPenaltyScorer obj_conv;
48359         obj_conv.inner = untag_ptr(obj);
48360         obj_conv.is_owned = ptr_is_owned(obj);
48361         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48362         obj_conv.is_owned = false;
48363         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
48364         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48365         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48366         CVec_u8Z_free(ret_var);
48367         return ret_arr;
48368 }
48369
48370 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
48371         LDKu8slice ser_ref;
48372         ser_ref.datalen = ser->arr_len;
48373         ser_ref.data = ser->elems;
48374         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
48375         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
48376         FREE(ser);
48377         return tag_ptr(ret_conv, true);
48378 }
48379
48380 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
48381         LDKProbabilisticScorer this_obj_conv;
48382         this_obj_conv.inner = untag_ptr(this_obj);
48383         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48385         ProbabilisticScorer_free(this_obj_conv);
48386 }
48387
48388 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint64_t this_obj) {
48389         LDKProbabilisticScoringParameters this_obj_conv;
48390         this_obj_conv.inner = untag_ptr(this_obj);
48391         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48393         ProbabilisticScoringParameters_free(this_obj_conv);
48394 }
48395
48396 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint64_t this_ptr) {
48397         LDKProbabilisticScoringParameters this_ptr_conv;
48398         this_ptr_conv.inner = untag_ptr(this_ptr);
48399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48401         this_ptr_conv.is_owned = false;
48402         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
48403         return ret_conv;
48404 }
48405
48406 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
48407         LDKProbabilisticScoringParameters this_ptr_conv;
48408         this_ptr_conv.inner = untag_ptr(this_ptr);
48409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48411         this_ptr_conv.is_owned = false;
48412         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
48413 }
48414
48415 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) {
48416         LDKProbabilisticScoringParameters this_ptr_conv;
48417         this_ptr_conv.inner = untag_ptr(this_ptr);
48418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48420         this_ptr_conv.is_owned = false;
48421         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
48422         return ret_conv;
48423 }
48424
48425 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) {
48426         LDKProbabilisticScoringParameters this_ptr_conv;
48427         this_ptr_conv.inner = untag_ptr(this_ptr);
48428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48430         this_ptr_conv.is_owned = false;
48431         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
48432 }
48433
48434 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
48435         LDKProbabilisticScoringParameters this_ptr_conv;
48436         this_ptr_conv.inner = untag_ptr(this_ptr);
48437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48439         this_ptr_conv.is_owned = false;
48440         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
48441         return ret_conv;
48442 }
48443
48444 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) {
48445         LDKProbabilisticScoringParameters this_ptr_conv;
48446         this_ptr_conv.inner = untag_ptr(this_ptr);
48447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48449         this_ptr_conv.is_owned = false;
48450         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
48451 }
48452
48453 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
48454         LDKProbabilisticScoringParameters this_ptr_conv;
48455         this_ptr_conv.inner = untag_ptr(this_ptr);
48456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48458         this_ptr_conv.is_owned = false;
48459         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
48460         return ret_conv;
48461 }
48462
48463 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) {
48464         LDKProbabilisticScoringParameters this_ptr_conv;
48465         this_ptr_conv.inner = untag_ptr(this_ptr);
48466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48468         this_ptr_conv.is_owned = false;
48469         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
48470 }
48471
48472 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) {
48473         LDKProbabilisticScoringParameters this_ptr_conv;
48474         this_ptr_conv.inner = untag_ptr(this_ptr);
48475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48477         this_ptr_conv.is_owned = false;
48478         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
48479         return ret_conv;
48480 }
48481
48482 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) {
48483         LDKProbabilisticScoringParameters this_ptr_conv;
48484         this_ptr_conv.inner = untag_ptr(this_ptr);
48485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48487         this_ptr_conv.is_owned = false;
48488         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
48489 }
48490
48491 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) {
48492         LDKProbabilisticScoringParameters this_ptr_conv;
48493         this_ptr_conv.inner = untag_ptr(this_ptr);
48494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48496         this_ptr_conv.is_owned = false;
48497         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
48498         return ret_conv;
48499 }
48500
48501 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) {
48502         LDKProbabilisticScoringParameters this_ptr_conv;
48503         this_ptr_conv.inner = untag_ptr(this_ptr);
48504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48506         this_ptr_conv.is_owned = false;
48507         ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
48508 }
48509
48510 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) {
48511         LDKProbabilisticScoringParameters this_ptr_conv;
48512         this_ptr_conv.inner = untag_ptr(this_ptr);
48513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48515         this_ptr_conv.is_owned = false;
48516         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
48517         return ret_conv;
48518 }
48519
48520 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) {
48521         LDKProbabilisticScoringParameters this_ptr_conv;
48522         this_ptr_conv.inner = untag_ptr(this_ptr);
48523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48525         this_ptr_conv.is_owned = false;
48526         ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
48527 }
48528
48529 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) {
48530         LDKProbabilisticScoringParameters this_ptr_conv;
48531         this_ptr_conv.inner = untag_ptr(this_ptr);
48532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48534         this_ptr_conv.is_owned = false;
48535         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_no_updates_half_life(&this_ptr_conv);
48536         return ret_conv;
48537 }
48538
48539 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) {
48540         LDKProbabilisticScoringParameters this_ptr_conv;
48541         this_ptr_conv.inner = untag_ptr(this_ptr);
48542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48544         this_ptr_conv.is_owned = false;
48545         ProbabilisticScoringParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
48546 }
48547
48548 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
48549         LDKProbabilisticScoringParameters this_ptr_conv;
48550         this_ptr_conv.inner = untag_ptr(this_ptr);
48551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48553         this_ptr_conv.is_owned = false;
48554         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
48555         return ret_conv;
48556 }
48557
48558 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) {
48559         LDKProbabilisticScoringParameters this_ptr_conv;
48560         this_ptr_conv.inner = untag_ptr(this_ptr);
48561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48563         this_ptr_conv.is_owned = false;
48564         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
48565 }
48566
48567 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
48568         LDKProbabilisticScoringParameters this_ptr_conv;
48569         this_ptr_conv.inner = untag_ptr(this_ptr);
48570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48572         this_ptr_conv.is_owned = false;
48573         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
48574         return ret_conv;
48575 }
48576
48577 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) {
48578         LDKProbabilisticScoringParameters this_ptr_conv;
48579         this_ptr_conv.inner = untag_ptr(this_ptr);
48580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48582         this_ptr_conv.is_owned = false;
48583         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
48584 }
48585
48586 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
48587         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
48588         uint64_t ret_ref = 0;
48589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48591         return ret_ref;
48592 }
48593 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint64_t arg) {
48594         LDKProbabilisticScoringParameters arg_conv;
48595         arg_conv.inner = untag_ptr(arg);
48596         arg_conv.is_owned = ptr_is_owned(arg);
48597         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48598         arg_conv.is_owned = false;
48599         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
48600         return ret_conv;
48601 }
48602
48603 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint64_t orig) {
48604         LDKProbabilisticScoringParameters orig_conv;
48605         orig_conv.inner = untag_ptr(orig);
48606         orig_conv.is_owned = ptr_is_owned(orig);
48607         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48608         orig_conv.is_owned = false;
48609         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
48610         uint64_t ret_ref = 0;
48611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48613         return ret_ref;
48614 }
48615
48616 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t params, uint64_t network_graph, uint64_t logger) {
48617         LDKProbabilisticScoringParameters params_conv;
48618         params_conv.inner = untag_ptr(params);
48619         params_conv.is_owned = ptr_is_owned(params);
48620         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
48621         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
48622         LDKNetworkGraph network_graph_conv;
48623         network_graph_conv.inner = untag_ptr(network_graph);
48624         network_graph_conv.is_owned = ptr_is_owned(network_graph);
48625         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
48626         network_graph_conv.is_owned = false;
48627         void* logger_ptr = untag_ptr(logger);
48628         CHECK_ACCESS(logger_ptr);
48629         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48630         if (logger_conv.free == LDKLogger_JCalls_free) {
48631                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48632                 LDKLogger_JCalls_cloned(&logger_conv);
48633         }
48634         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
48635         uint64_t ret_ref = 0;
48636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48638         return ret_ref;
48639 }
48640
48641 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
48642         LDKProbabilisticScorer this_arg_conv;
48643         this_arg_conv.inner = untag_ptr(this_arg);
48644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48646         this_arg_conv.is_owned = false;
48647         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
48648 }
48649
48650 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) {
48651         LDKProbabilisticScorer this_arg_conv;
48652         this_arg_conv.inner = untag_ptr(this_arg);
48653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48655         this_arg_conv.is_owned = false;
48656         LDKNodeId target_conv;
48657         target_conv.inner = untag_ptr(target);
48658         target_conv.is_owned = ptr_is_owned(target);
48659         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
48660         target_conv.is_owned = false;
48661         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
48662         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
48663         uint64_t ret_ref = tag_ptr(ret_copy, true);
48664         return ret_ref;
48665 }
48666
48667 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) {
48668         LDKProbabilisticScorer this_arg_conv;
48669         this_arg_conv.inner = untag_ptr(this_arg);
48670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48672         this_arg_conv.is_owned = false;
48673         LDKNodeId target_conv;
48674         target_conv.inner = untag_ptr(target);
48675         target_conv.is_owned = ptr_is_owned(target);
48676         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
48677         target_conv.is_owned = false;
48678         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
48679         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
48680         uint64_t ret_ref = tag_ptr(ret_copy, true);
48681         return ret_ref;
48682 }
48683
48684 void  __attribute__((export_name("TS_ProbabilisticScorer_add_banned"))) TS_ProbabilisticScorer_add_banned(uint64_t this_arg, uint64_t node_id) {
48685         LDKProbabilisticScorer this_arg_conv;
48686         this_arg_conv.inner = untag_ptr(this_arg);
48687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48689         this_arg_conv.is_owned = false;
48690         LDKNodeId node_id_conv;
48691         node_id_conv.inner = untag_ptr(node_id);
48692         node_id_conv.is_owned = ptr_is_owned(node_id);
48693         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
48694         node_id_conv.is_owned = false;
48695         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
48696 }
48697
48698 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_banned"))) TS_ProbabilisticScorer_remove_banned(uint64_t this_arg, uint64_t node_id) {
48699         LDKProbabilisticScorer this_arg_conv;
48700         this_arg_conv.inner = untag_ptr(this_arg);
48701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48703         this_arg_conv.is_owned = false;
48704         LDKNodeId node_id_conv;
48705         node_id_conv.inner = untag_ptr(node_id);
48706         node_id_conv.is_owned = ptr_is_owned(node_id);
48707         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
48708         node_id_conv.is_owned = false;
48709         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
48710 }
48711
48712 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) {
48713         LDKProbabilisticScorer this_arg_conv;
48714         this_arg_conv.inner = untag_ptr(this_arg);
48715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48717         this_arg_conv.is_owned = false;
48718         LDKNodeId node_id_conv;
48719         node_id_conv.inner = untag_ptr(node_id);
48720         node_id_conv.is_owned = ptr_is_owned(node_id);
48721         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
48722         node_id_conv.is_owned = false;
48723         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
48724 }
48725
48726 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_manual_penalty"))) TS_ProbabilisticScorer_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
48727         LDKProbabilisticScorer this_arg_conv;
48728         this_arg_conv.inner = untag_ptr(this_arg);
48729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48731         this_arg_conv.is_owned = false;
48732         LDKNodeId node_id_conv;
48733         node_id_conv.inner = untag_ptr(node_id);
48734         node_id_conv.is_owned = ptr_is_owned(node_id);
48735         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
48736         node_id_conv.is_owned = false;
48737         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
48738 }
48739
48740 void  __attribute__((export_name("TS_ProbabilisticScorer_clear_manual_penalties"))) TS_ProbabilisticScorer_clear_manual_penalties(uint64_t this_arg) {
48741         LDKProbabilisticScorer this_arg_conv;
48742         this_arg_conv.inner = untag_ptr(this_arg);
48743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48745         this_arg_conv.is_owned = false;
48746         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
48747 }
48748
48749 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_add_banned_from_list"))) TS_ProbabilisticScoringParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
48750         LDKProbabilisticScoringParameters this_arg_conv;
48751         this_arg_conv.inner = untag_ptr(this_arg);
48752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48754         this_arg_conv.is_owned = false;
48755         LDKCVec_NodeIdZ node_ids_constr;
48756         node_ids_constr.datalen = node_ids->arr_len;
48757         if (node_ids_constr.datalen > 0)
48758                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
48759         else
48760                 node_ids_constr.data = NULL;
48761         uint64_t* node_ids_vals = node_ids->elems;
48762         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
48763                 uint64_t node_ids_conv_8 = node_ids_vals[i];
48764                 LDKNodeId node_ids_conv_8_conv;
48765                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
48766                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
48767                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
48768                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
48769                 node_ids_constr.data[i] = node_ids_conv_8_conv;
48770         }
48771         FREE(node_ids);
48772         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
48773 }
48774
48775 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
48776         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
48777         uint64_t ret_ref = 0;
48778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48780         return ret_ref;
48781 }
48782
48783 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
48784         LDKProbabilisticScorer this_arg_conv;
48785         this_arg_conv.inner = untag_ptr(this_arg);
48786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48788         this_arg_conv.is_owned = false;
48789         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
48790         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
48791         return tag_ptr(ret_ret, true);
48792 }
48793
48794 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
48795         LDKProbabilisticScorer obj_conv;
48796         obj_conv.inner = untag_ptr(obj);
48797         obj_conv.is_owned = ptr_is_owned(obj);
48798         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48799         obj_conv.is_owned = false;
48800         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
48801         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48802         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48803         CVec_u8Z_free(ret_var);
48804         return ret_arr;
48805 }
48806
48807 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) {
48808         LDKu8slice ser_ref;
48809         ser_ref.datalen = ser->arr_len;
48810         ser_ref.data = ser->elems;
48811         LDKProbabilisticScoringParameters arg_a_conv;
48812         arg_a_conv.inner = untag_ptr(arg_a);
48813         arg_a_conv.is_owned = ptr_is_owned(arg_a);
48814         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
48815         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
48816         LDKNetworkGraph arg_b_conv;
48817         arg_b_conv.inner = untag_ptr(arg_b);
48818         arg_b_conv.is_owned = ptr_is_owned(arg_b);
48819         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
48820         arg_b_conv.is_owned = false;
48821         void* arg_c_ptr = untag_ptr(arg_c);
48822         CHECK_ACCESS(arg_c_ptr);
48823         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
48824         if (arg_c_conv.free == LDKLogger_JCalls_free) {
48825                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48826                 LDKLogger_JCalls_cloned(&arg_c_conv);
48827         }
48828         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
48829         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
48830         FREE(ser);
48831         return tag_ptr(ret_conv, true);
48832 }
48833
48834 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
48835         LDKOnionMessenger this_obj_conv;
48836         this_obj_conv.inner = untag_ptr(this_obj);
48837         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48839         OnionMessenger_free(this_obj_conv);
48840 }
48841
48842 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
48843         if (!ptr_is_owned(this_ptr)) return;
48844         void* this_ptr_ptr = untag_ptr(this_ptr);
48845         CHECK_ACCESS(this_ptr_ptr);
48846         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
48847         FREE(untag_ptr(this_ptr));
48848         Destination_free(this_ptr_conv);
48849 }
48850
48851 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
48852         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
48853         *ret_copy = Destination_clone(arg);
48854         uint64_t ret_ref = tag_ptr(ret_copy, true);
48855         return ret_ref;
48856 }
48857 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
48858         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
48859         int64_t ret_conv = Destination_clone_ptr(arg_conv);
48860         return ret_conv;
48861 }
48862
48863 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
48864         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
48865         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
48866         *ret_copy = Destination_clone(orig_conv);
48867         uint64_t ret_ref = tag_ptr(ret_copy, true);
48868         return ret_ref;
48869 }
48870
48871 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
48872         LDKPublicKey a_ref;
48873         CHECK(a->arr_len == 33);
48874         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
48875         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
48876         *ret_copy = Destination_node(a_ref);
48877         uint64_t ret_ref = tag_ptr(ret_copy, true);
48878         return ret_ref;
48879 }
48880
48881 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
48882         LDKBlindedPath a_conv;
48883         a_conv.inner = untag_ptr(a);
48884         a_conv.is_owned = ptr_is_owned(a);
48885         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48886         a_conv = BlindedPath_clone(&a_conv);
48887         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
48888         *ret_copy = Destination_blinded_path(a_conv);
48889         uint64_t ret_ref = tag_ptr(ret_copy, true);
48890         return ret_ref;
48891 }
48892
48893 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
48894         if (!ptr_is_owned(this_ptr)) return;
48895         void* this_ptr_ptr = untag_ptr(this_ptr);
48896         CHECK_ACCESS(this_ptr_ptr);
48897         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
48898         FREE(untag_ptr(this_ptr));
48899         SendError_free(this_ptr_conv);
48900 }
48901
48902 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
48903         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48904         *ret_copy = SendError_clone(arg);
48905         uint64_t ret_ref = tag_ptr(ret_copy, true);
48906         return ret_ref;
48907 }
48908 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
48909         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
48910         int64_t ret_conv = SendError_clone_ptr(arg_conv);
48911         return ret_conv;
48912 }
48913
48914 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
48915         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
48916         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48917         *ret_copy = SendError_clone(orig_conv);
48918         uint64_t ret_ref = tag_ptr(ret_copy, true);
48919         return ret_ref;
48920 }
48921
48922 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
48923         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
48924         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48925         *ret_copy = SendError_secp256k1(a_conv);
48926         uint64_t ret_ref = tag_ptr(ret_copy, true);
48927         return ret_ref;
48928 }
48929
48930 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
48931         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48932         *ret_copy = SendError_too_big_packet();
48933         uint64_t ret_ref = tag_ptr(ret_copy, true);
48934         return ret_ref;
48935 }
48936
48937 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
48938         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48939         *ret_copy = SendError_too_few_blinded_hops();
48940         uint64_t ret_ref = tag_ptr(ret_copy, true);
48941         return ret_ref;
48942 }
48943
48944 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
48945         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48946         *ret_copy = SendError_invalid_first_hop();
48947         uint64_t ret_ref = tag_ptr(ret_copy, true);
48948         return ret_ref;
48949 }
48950
48951 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
48952         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48953         *ret_copy = SendError_invalid_message();
48954         uint64_t ret_ref = tag_ptr(ret_copy, true);
48955         return ret_ref;
48956 }
48957
48958 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
48959         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48960         *ret_copy = SendError_buffer_full();
48961         uint64_t ret_ref = tag_ptr(ret_copy, true);
48962         return ret_ref;
48963 }
48964
48965 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
48966         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48967         *ret_copy = SendError_get_node_id_failed();
48968         uint64_t ret_ref = tag_ptr(ret_copy, true);
48969         return ret_ref;
48970 }
48971
48972 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
48973         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
48974         *ret_copy = SendError_blinded_path_advance_failed();
48975         uint64_t ret_ref = tag_ptr(ret_copy, true);
48976         return ret_ref;
48977 }
48978
48979 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
48980         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
48981         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
48982         jboolean ret_conv = SendError_eq(a_conv, b_conv);
48983         return ret_conv;
48984 }
48985
48986 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
48987         if (!ptr_is_owned(this_ptr)) return;
48988         void* this_ptr_ptr = untag_ptr(this_ptr);
48989         CHECK_ACCESS(this_ptr_ptr);
48990         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
48991         FREE(untag_ptr(this_ptr));
48992         CustomOnionMessageHandler_free(this_ptr_conv);
48993 }
48994
48995 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) {
48996         void* entropy_source_ptr = untag_ptr(entropy_source);
48997         CHECK_ACCESS(entropy_source_ptr);
48998         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
48999         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
49000                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49001                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
49002         }
49003         void* node_signer_ptr = untag_ptr(node_signer);
49004         CHECK_ACCESS(node_signer_ptr);
49005         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
49006         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
49007                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49008                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
49009         }
49010         void* logger_ptr = untag_ptr(logger);
49011         CHECK_ACCESS(logger_ptr);
49012         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
49013         if (logger_conv.free == LDKLogger_JCalls_free) {
49014                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49015                 LDKLogger_JCalls_cloned(&logger_conv);
49016         }
49017         void* custom_handler_ptr = untag_ptr(custom_handler);
49018         CHECK_ACCESS(custom_handler_ptr);
49019         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
49020         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
49021                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49022                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
49023         }
49024         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, custom_handler_conv);
49025         uint64_t ret_ref = 0;
49026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49028         return ret_ref;
49029 }
49030
49031 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) {
49032         LDKOnionMessenger this_arg_conv;
49033         this_arg_conv.inner = untag_ptr(this_arg);
49034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49036         this_arg_conv.is_owned = false;
49037         LDKCVec_PublicKeyZ intermediate_nodes_constr;
49038         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
49039         if (intermediate_nodes_constr.datalen > 0)
49040                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
49041         else
49042                 intermediate_nodes_constr.data = NULL;
49043         int8_tArray* intermediate_nodes_vals = (void*) intermediate_nodes->elems;
49044         for (size_t m = 0; m < intermediate_nodes_constr.datalen; m++) {
49045                 int8_tArray intermediate_nodes_conv_12 = intermediate_nodes_vals[m];
49046                 LDKPublicKey intermediate_nodes_conv_12_ref;
49047                 CHECK(intermediate_nodes_conv_12->arr_len == 33);
49048                 memcpy(intermediate_nodes_conv_12_ref.compressed_form, intermediate_nodes_conv_12->elems, 33); FREE(intermediate_nodes_conv_12);
49049                 intermediate_nodes_constr.data[m] = intermediate_nodes_conv_12_ref;
49050         }
49051         FREE(intermediate_nodes);
49052         void* destination_ptr = untag_ptr(destination);
49053         CHECK_ACCESS(destination_ptr);
49054         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
49055         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
49056         void* message_ptr = untag_ptr(message);
49057         CHECK_ACCESS(message_ptr);
49058         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
49059         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
49060         LDKBlindedPath reply_path_conv;
49061         reply_path_conv.inner = untag_ptr(reply_path);
49062         reply_path_conv.is_owned = ptr_is_owned(reply_path);
49063         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
49064         reply_path_conv = BlindedPath_clone(&reply_path_conv);
49065         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
49066         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, intermediate_nodes_constr, destination_conv, message_conv, reply_path_conv);
49067         return tag_ptr(ret_conv, true);
49068 }
49069
49070 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
49071         LDKOnionMessenger this_arg_conv;
49072         this_arg_conv.inner = untag_ptr(this_arg);
49073         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49075         this_arg_conv.is_owned = false;
49076         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
49077         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
49078         return tag_ptr(ret_ret, true);
49079 }
49080
49081 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageProvider"))) TS_OnionMessenger_as_OnionMessageProvider(uint64_t this_arg) {
49082         LDKOnionMessenger this_arg_conv;
49083         this_arg_conv.inner = untag_ptr(this_arg);
49084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49086         this_arg_conv.is_owned = false;
49087         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
49088         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
49089         return tag_ptr(ret_ret, true);
49090 }
49091
49092 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
49093         if (!ptr_is_owned(this_ptr)) return;
49094         void* this_ptr_ptr = untag_ptr(this_ptr);
49095         CHECK_ACCESS(this_ptr_ptr);
49096         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
49097         FREE(untag_ptr(this_ptr));
49098         OnionMessageContents_free(this_ptr_conv);
49099 }
49100
49101 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
49102         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
49103         *ret_copy = OnionMessageContents_clone(arg);
49104         uint64_t ret_ref = tag_ptr(ret_copy, true);
49105         return ret_ref;
49106 }
49107 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
49108         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg);
49109         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
49110         return ret_conv;
49111 }
49112
49113 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
49114         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig);
49115         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
49116         *ret_copy = OnionMessageContents_clone(orig_conv);
49117         uint64_t ret_ref = tag_ptr(ret_copy, true);
49118         return ret_ref;
49119 }
49120
49121 uint64_t  __attribute__((export_name("TS_OnionMessageContents_custom"))) TS_OnionMessageContents_custom(uint64_t a) {
49122         void* a_ptr = untag_ptr(a);
49123         CHECK_ACCESS(a_ptr);
49124         LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr);
49125         if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
49126                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49127                 LDKCustomOnionMessageContents_JCalls_cloned(&a_conv);
49128         }
49129         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
49130         *ret_copy = OnionMessageContents_custom(a_conv);
49131         uint64_t ret_ref = tag_ptr(ret_copy, true);
49132         return ret_ref;
49133 }
49134
49135 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
49136         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
49137         *ret_ret = CustomOnionMessageContents_clone(arg);
49138         return tag_ptr(ret_ret, true);
49139 }
49140 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone_ptr"))) TS_CustomOnionMessageContents_clone_ptr(uint64_t arg) {
49141         void* arg_ptr = untag_ptr(arg);
49142         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
49143         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
49144         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
49145         return ret_conv;
49146 }
49147
49148 uint64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone"))) TS_CustomOnionMessageContents_clone(uint64_t orig) {
49149         void* orig_ptr = untag_ptr(orig);
49150         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
49151         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
49152         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
49153         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
49154         return tag_ptr(ret_ret, true);
49155 }
49156
49157 void  __attribute__((export_name("TS_CustomOnionMessageContents_free"))) TS_CustomOnionMessageContents_free(uint64_t this_ptr) {
49158         if (!ptr_is_owned(this_ptr)) return;
49159         void* this_ptr_ptr = untag_ptr(this_ptr);
49160         CHECK_ACCESS(this_ptr_ptr);
49161         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
49162         FREE(untag_ptr(this_ptr));
49163         CustomOnionMessageContents_free(this_ptr_conv);
49164 }
49165
49166 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
49167         LDKBlindedPath this_obj_conv;
49168         this_obj_conv.inner = untag_ptr(this_obj);
49169         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49171         BlindedPath_free(this_obj_conv);
49172 }
49173
49174 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
49175         LDKBlindedPath ret_var = BlindedPath_clone(arg);
49176         uint64_t ret_ref = 0;
49177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49179         return ret_ref;
49180 }
49181 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
49182         LDKBlindedPath arg_conv;
49183         arg_conv.inner = untag_ptr(arg);
49184         arg_conv.is_owned = ptr_is_owned(arg);
49185         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49186         arg_conv.is_owned = false;
49187         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
49188         return ret_conv;
49189 }
49190
49191 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
49192         LDKBlindedPath orig_conv;
49193         orig_conv.inner = untag_ptr(orig);
49194         orig_conv.is_owned = ptr_is_owned(orig);
49195         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49196         orig_conv.is_owned = false;
49197         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
49198         uint64_t ret_ref = 0;
49199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49201         return ret_ref;
49202 }
49203
49204 int64_t  __attribute__((export_name("TS_BlindedPath_hash"))) TS_BlindedPath_hash(uint64_t o) {
49205         LDKBlindedPath o_conv;
49206         o_conv.inner = untag_ptr(o);
49207         o_conv.is_owned = ptr_is_owned(o);
49208         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49209         o_conv.is_owned = false;
49210         int64_t ret_conv = BlindedPath_hash(&o_conv);
49211         return ret_conv;
49212 }
49213
49214 jboolean  __attribute__((export_name("TS_BlindedPath_eq"))) TS_BlindedPath_eq(uint64_t a, uint64_t b) {
49215         LDKBlindedPath a_conv;
49216         a_conv.inner = untag_ptr(a);
49217         a_conv.is_owned = ptr_is_owned(a);
49218         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49219         a_conv.is_owned = false;
49220         LDKBlindedPath b_conv;
49221         b_conv.inner = untag_ptr(b);
49222         b_conv.is_owned = ptr_is_owned(b);
49223         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49224         b_conv.is_owned = false;
49225         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
49226         return ret_conv;
49227 }
49228
49229 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
49230         LDKBlindedHop this_obj_conv;
49231         this_obj_conv.inner = untag_ptr(this_obj);
49232         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49234         BlindedHop_free(this_obj_conv);
49235 }
49236
49237 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
49238         LDKBlindedHop ret_var = BlindedHop_clone(arg);
49239         uint64_t ret_ref = 0;
49240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49242         return ret_ref;
49243 }
49244 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
49245         LDKBlindedHop arg_conv;
49246         arg_conv.inner = untag_ptr(arg);
49247         arg_conv.is_owned = ptr_is_owned(arg);
49248         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49249         arg_conv.is_owned = false;
49250         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
49251         return ret_conv;
49252 }
49253
49254 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
49255         LDKBlindedHop orig_conv;
49256         orig_conv.inner = untag_ptr(orig);
49257         orig_conv.is_owned = ptr_is_owned(orig);
49258         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49259         orig_conv.is_owned = false;
49260         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
49261         uint64_t ret_ref = 0;
49262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49264         return ret_ref;
49265 }
49266
49267 int64_t  __attribute__((export_name("TS_BlindedHop_hash"))) TS_BlindedHop_hash(uint64_t o) {
49268         LDKBlindedHop o_conv;
49269         o_conv.inner = untag_ptr(o);
49270         o_conv.is_owned = ptr_is_owned(o);
49271         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49272         o_conv.is_owned = false;
49273         int64_t ret_conv = BlindedHop_hash(&o_conv);
49274         return ret_conv;
49275 }
49276
49277 jboolean  __attribute__((export_name("TS_BlindedHop_eq"))) TS_BlindedHop_eq(uint64_t a, uint64_t b) {
49278         LDKBlindedHop a_conv;
49279         a_conv.inner = untag_ptr(a);
49280         a_conv.is_owned = ptr_is_owned(a);
49281         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49282         a_conv.is_owned = false;
49283         LDKBlindedHop b_conv;
49284         b_conv.inner = untag_ptr(b);
49285         b_conv.is_owned = ptr_is_owned(b);
49286         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49287         b_conv.is_owned = false;
49288         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
49289         return ret_conv;
49290 }
49291
49292 uint64_t  __attribute__((export_name("TS_BlindedPath_new_for_message"))) TS_BlindedPath_new_for_message(ptrArray node_pks, uint64_t entropy_source) {
49293         LDKCVec_PublicKeyZ node_pks_constr;
49294         node_pks_constr.datalen = node_pks->arr_len;
49295         if (node_pks_constr.datalen > 0)
49296                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
49297         else
49298                 node_pks_constr.data = NULL;
49299         int8_tArray* node_pks_vals = (void*) node_pks->elems;
49300         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
49301                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
49302                 LDKPublicKey node_pks_conv_12_ref;
49303                 CHECK(node_pks_conv_12->arr_len == 33);
49304                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
49305                 node_pks_constr.data[m] = node_pks_conv_12_ref;
49306         }
49307         FREE(node_pks);
49308         void* entropy_source_ptr = untag_ptr(entropy_source);
49309         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
49310         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
49311         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
49312         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
49313         return tag_ptr(ret_conv, true);
49314 }
49315
49316 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
49317         LDKBlindedPath obj_conv;
49318         obj_conv.inner = untag_ptr(obj);
49319         obj_conv.is_owned = ptr_is_owned(obj);
49320         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49321         obj_conv.is_owned = false;
49322         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
49323         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49324         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49325         CVec_u8Z_free(ret_var);
49326         return ret_arr;
49327 }
49328
49329 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
49330         LDKu8slice ser_ref;
49331         ser_ref.datalen = ser->arr_len;
49332         ser_ref.data = ser->elems;
49333         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
49334         *ret_conv = BlindedPath_read(ser_ref);
49335         FREE(ser);
49336         return tag_ptr(ret_conv, true);
49337 }
49338
49339 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
49340         LDKBlindedHop obj_conv;
49341         obj_conv.inner = untag_ptr(obj);
49342         obj_conv.is_owned = ptr_is_owned(obj);
49343         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49344         obj_conv.is_owned = false;
49345         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
49346         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49347         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49348         CVec_u8Z_free(ret_var);
49349         return ret_arr;
49350 }
49351
49352 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
49353         LDKu8slice ser_ref;
49354         ser_ref.datalen = ser->arr_len;
49355         ser_ref.data = ser->elems;
49356         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
49357         *ret_conv = BlindedHop_read(ser_ref);
49358         FREE(ser);
49359         return tag_ptr(ret_conv, true);
49360 }
49361
49362 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
49363         if (!ptr_is_owned(this_ptr)) return;
49364         void* this_ptr_ptr = untag_ptr(this_ptr);
49365         CHECK_ACCESS(this_ptr_ptr);
49366         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
49367         FREE(untag_ptr(this_ptr));
49368         PaymentPurpose_free(this_ptr_conv);
49369 }
49370
49371 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
49372         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
49373         *ret_copy = PaymentPurpose_clone(arg);
49374         uint64_t ret_ref = tag_ptr(ret_copy, true);
49375         return ret_ref;
49376 }
49377 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
49378         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
49379         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
49380         return ret_conv;
49381 }
49382
49383 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
49384         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
49385         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
49386         *ret_copy = PaymentPurpose_clone(orig_conv);
49387         uint64_t ret_ref = tag_ptr(ret_copy, true);
49388         return ret_ref;
49389 }
49390
49391 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
49392         LDKThirtyTwoBytes payment_preimage_ref;
49393         CHECK(payment_preimage->arr_len == 32);
49394         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
49395         LDKThirtyTwoBytes payment_secret_ref;
49396         CHECK(payment_secret->arr_len == 32);
49397         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
49398         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
49399         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
49400         uint64_t ret_ref = tag_ptr(ret_copy, true);
49401         return ret_ref;
49402 }
49403
49404 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
49405         LDKThirtyTwoBytes a_ref;
49406         CHECK(a->arr_len == 32);
49407         memcpy(a_ref.data, a->elems, 32); FREE(a);
49408         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
49409         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
49410         uint64_t ret_ref = tag_ptr(ret_copy, true);
49411         return ret_ref;
49412 }
49413
49414 jboolean  __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) {
49415         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
49416         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
49417         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
49418         return ret_conv;
49419 }
49420
49421 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
49422         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
49423         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
49424         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49425         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49426         CVec_u8Z_free(ret_var);
49427         return ret_arr;
49428 }
49429
49430 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
49431         LDKu8slice ser_ref;
49432         ser_ref.datalen = ser->arr_len;
49433         ser_ref.data = ser->elems;
49434         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
49435         *ret_conv = PaymentPurpose_read(ser_ref);
49436         FREE(ser);
49437         return tag_ptr(ret_conv, true);
49438 }
49439
49440 void  __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_free(uint64_t this_ptr) {
49441         if (!ptr_is_owned(this_ptr)) return;
49442         void* this_ptr_ptr = untag_ptr(this_ptr);
49443         CHECK_ACCESS(this_ptr_ptr);
49444         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
49445         FREE(untag_ptr(this_ptr));
49446         PathFailure_free(this_ptr_conv);
49447 }
49448
49449 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
49450         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
49451         *ret_copy = PathFailure_clone(arg);
49452         uint64_t ret_ref = tag_ptr(ret_copy, true);
49453         return ret_ref;
49454 }
49455 int64_t  __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) {
49456         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
49457         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
49458         return ret_conv;
49459 }
49460
49461 uint64_t  __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) {
49462         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
49463         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
49464         *ret_copy = PathFailure_clone(orig_conv);
49465         uint64_t ret_ref = tag_ptr(ret_copy, true);
49466         return ret_ref;
49467 }
49468
49469 uint64_t  __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) {
49470         void* err_ptr = untag_ptr(err);
49471         CHECK_ACCESS(err_ptr);
49472         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
49473         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
49474         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
49475         *ret_copy = PathFailure_initial_send(err_conv);
49476         uint64_t ret_ref = tag_ptr(ret_copy, true);
49477         return ret_ref;
49478 }
49479
49480 uint64_t  __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) {
49481         void* network_update_ptr = untag_ptr(network_update);
49482         CHECK_ACCESS(network_update_ptr);
49483         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
49484         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
49485         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
49486         *ret_copy = PathFailure_on_path(network_update_conv);
49487         uint64_t ret_ref = tag_ptr(ret_copy, true);
49488         return ret_ref;
49489 }
49490
49491 jboolean  __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) {
49492         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
49493         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
49494         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
49495         return ret_conv;
49496 }
49497
49498 int8_tArray  __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) {
49499         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
49500         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
49501         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49502         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49503         CVec_u8Z_free(ret_var);
49504         return ret_arr;
49505 }
49506
49507 uint64_t  __attribute__((export_name("TS_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) {
49508         LDKu8slice ser_ref;
49509         ser_ref.datalen = ser->arr_len;
49510         ser_ref.data = ser->elems;
49511         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
49512         *ret_conv = PathFailure_read(ser_ref);
49513         FREE(ser);
49514         return tag_ptr(ret_conv, true);
49515 }
49516
49517 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
49518         if (!ptr_is_owned(this_ptr)) return;
49519         void* this_ptr_ptr = untag_ptr(this_ptr);
49520         CHECK_ACCESS(this_ptr_ptr);
49521         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
49522         FREE(untag_ptr(this_ptr));
49523         ClosureReason_free(this_ptr_conv);
49524 }
49525
49526 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
49527         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49528         *ret_copy = ClosureReason_clone(arg);
49529         uint64_t ret_ref = tag_ptr(ret_copy, true);
49530         return ret_ref;
49531 }
49532 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
49533         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
49534         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
49535         return ret_conv;
49536 }
49537
49538 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
49539         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
49540         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49541         *ret_copy = ClosureReason_clone(orig_conv);
49542         uint64_t ret_ref = tag_ptr(ret_copy, true);
49543         return ret_ref;
49544 }
49545
49546 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(uint64_t peer_msg) {
49547         LDKUntrustedString peer_msg_conv;
49548         peer_msg_conv.inner = untag_ptr(peer_msg);
49549         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
49550         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
49551         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
49552         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49553         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
49554         uint64_t ret_ref = tag_ptr(ret_copy, true);
49555         return ret_ref;
49556 }
49557
49558 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
49559         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49560         *ret_copy = ClosureReason_holder_force_closed();
49561         uint64_t ret_ref = tag_ptr(ret_copy, true);
49562         return ret_ref;
49563 }
49564
49565 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
49566         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49567         *ret_copy = ClosureReason_cooperative_closure();
49568         uint64_t ret_ref = tag_ptr(ret_copy, true);
49569         return ret_ref;
49570 }
49571
49572 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
49573         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49574         *ret_copy = ClosureReason_commitment_tx_confirmed();
49575         uint64_t ret_ref = tag_ptr(ret_copy, true);
49576         return ret_ref;
49577 }
49578
49579 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
49580         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49581         *ret_copy = ClosureReason_funding_timed_out();
49582         uint64_t ret_ref = tag_ptr(ret_copy, true);
49583         return ret_ref;
49584 }
49585
49586 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
49587         LDKStr err_conv = str_ref_to_owned_c(err);
49588         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49589         *ret_copy = ClosureReason_processing_error(err_conv);
49590         uint64_t ret_ref = tag_ptr(ret_copy, true);
49591         return ret_ref;
49592 }
49593
49594 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
49595         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49596         *ret_copy = ClosureReason_disconnected_peer();
49597         uint64_t ret_ref = tag_ptr(ret_copy, true);
49598         return ret_ref;
49599 }
49600
49601 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
49602         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
49603         *ret_copy = ClosureReason_outdated_channel_manager();
49604         uint64_t ret_ref = tag_ptr(ret_copy, true);
49605         return ret_ref;
49606 }
49607
49608 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
49609         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
49610         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
49611         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
49612         return ret_conv;
49613 }
49614
49615 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
49616         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
49617         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
49618         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49619         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49620         CVec_u8Z_free(ret_var);
49621         return ret_arr;
49622 }
49623
49624 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
49625         LDKu8slice ser_ref;
49626         ser_ref.datalen = ser->arr_len;
49627         ser_ref.data = ser->elems;
49628         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
49629         *ret_conv = ClosureReason_read(ser_ref);
49630         FREE(ser);
49631         return tag_ptr(ret_conv, true);
49632 }
49633
49634 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
49635         if (!ptr_is_owned(this_ptr)) return;
49636         void* this_ptr_ptr = untag_ptr(this_ptr);
49637         CHECK_ACCESS(this_ptr_ptr);
49638         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
49639         FREE(untag_ptr(this_ptr));
49640         HTLCDestination_free(this_ptr_conv);
49641 }
49642
49643 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
49644         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49645         *ret_copy = HTLCDestination_clone(arg);
49646         uint64_t ret_ref = tag_ptr(ret_copy, true);
49647         return ret_ref;
49648 }
49649 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
49650         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
49651         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
49652         return ret_conv;
49653 }
49654
49655 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
49656         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
49657         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49658         *ret_copy = HTLCDestination_clone(orig_conv);
49659         uint64_t ret_ref = tag_ptr(ret_copy, true);
49660         return ret_ref;
49661 }
49662
49663 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
49664         LDKPublicKey node_id_ref;
49665         CHECK(node_id->arr_len == 33);
49666         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
49667         LDKThirtyTwoBytes channel_id_ref;
49668         CHECK(channel_id->arr_len == 32);
49669         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
49670         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49671         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
49672         uint64_t ret_ref = tag_ptr(ret_copy, true);
49673         return ret_ref;
49674 }
49675
49676 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
49677         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49678         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
49679         uint64_t ret_ref = tag_ptr(ret_copy, true);
49680         return ret_ref;
49681 }
49682
49683 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
49684         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49685         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
49686         uint64_t ret_ref = tag_ptr(ret_copy, true);
49687         return ret_ref;
49688 }
49689
49690 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
49691         LDKThirtyTwoBytes payment_hash_ref;
49692         CHECK(payment_hash->arr_len == 32);
49693         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49694         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
49695         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
49696         uint64_t ret_ref = tag_ptr(ret_copy, true);
49697         return ret_ref;
49698 }
49699
49700 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
49701         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
49702         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
49703         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
49704         return ret_conv;
49705 }
49706
49707 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
49708         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
49709         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
49710         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49711         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49712         CVec_u8Z_free(ret_var);
49713         return ret_arr;
49714 }
49715
49716 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
49717         LDKu8slice ser_ref;
49718         ser_ref.datalen = ser->arr_len;
49719         ser_ref.data = ser->elems;
49720         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
49721         *ret_conv = HTLCDestination_read(ser_ref);
49722         FREE(ser);
49723         return tag_ptr(ret_conv, true);
49724 }
49725
49726 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_clone"))) TS_PaymentFailureReason_clone(uint64_t orig) {
49727         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
49728         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_clone(orig_conv));
49729         return ret_conv;
49730 }
49731
49732 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_recipient_rejected"))) TS_PaymentFailureReason_recipient_rejected() {
49733         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_recipient_rejected());
49734         return ret_conv;
49735 }
49736
49737 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_user_abandoned"))) TS_PaymentFailureReason_user_abandoned() {
49738         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_user_abandoned());
49739         return ret_conv;
49740 }
49741
49742 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_retries_exhausted"))) TS_PaymentFailureReason_retries_exhausted() {
49743         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_retries_exhausted());
49744         return ret_conv;
49745 }
49746
49747 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_payment_expired"))) TS_PaymentFailureReason_payment_expired() {
49748         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_payment_expired());
49749         return ret_conv;
49750 }
49751
49752 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_route_not_found"))) TS_PaymentFailureReason_route_not_found() {
49753         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_route_not_found());
49754         return ret_conv;
49755 }
49756
49757 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_unexpected_error"))) TS_PaymentFailureReason_unexpected_error() {
49758         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_unexpected_error());
49759         return ret_conv;
49760 }
49761
49762 jboolean  __attribute__((export_name("TS_PaymentFailureReason_eq"))) TS_PaymentFailureReason_eq(uint64_t a, uint64_t b) {
49763         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
49764         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
49765         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
49766         return ret_conv;
49767 }
49768
49769 int8_tArray  __attribute__((export_name("TS_PaymentFailureReason_write"))) TS_PaymentFailureReason_write(uint64_t obj) {
49770         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
49771         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
49772         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49773         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49774         CVec_u8Z_free(ret_var);
49775         return ret_arr;
49776 }
49777
49778 uint64_t  __attribute__((export_name("TS_PaymentFailureReason_read"))) TS_PaymentFailureReason_read(int8_tArray ser) {
49779         LDKu8slice ser_ref;
49780         ser_ref.datalen = ser->arr_len;
49781         ser_ref.data = ser->elems;
49782         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
49783         *ret_conv = PaymentFailureReason_read(ser_ref);
49784         FREE(ser);
49785         return tag_ptr(ret_conv, true);
49786 }
49787
49788 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
49789         if (!ptr_is_owned(this_ptr)) return;
49790         void* this_ptr_ptr = untag_ptr(this_ptr);
49791         CHECK_ACCESS(this_ptr_ptr);
49792         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
49793         FREE(untag_ptr(this_ptr));
49794         Event_free(this_ptr_conv);
49795 }
49796
49797 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
49798         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49799         *ret_copy = Event_clone(arg);
49800         uint64_t ret_ref = tag_ptr(ret_copy, true);
49801         return ret_ref;
49802 }
49803 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
49804         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
49805         int64_t ret_conv = Event_clone_ptr(arg_conv);
49806         return ret_conv;
49807 }
49808
49809 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
49810         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
49811         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49812         *ret_copy = Event_clone(orig_conv);
49813         uint64_t ret_ref = tag_ptr(ret_copy, true);
49814         return ret_ref;
49815 }
49816
49817 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) {
49818         LDKThirtyTwoBytes temporary_channel_id_ref;
49819         CHECK(temporary_channel_id->arr_len == 32);
49820         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
49821         LDKPublicKey counterparty_node_id_ref;
49822         CHECK(counterparty_node_id->arr_len == 33);
49823         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
49824         LDKCVec_u8Z output_script_ref;
49825         output_script_ref.datalen = output_script->arr_len;
49826         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
49827         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
49828         LDKU128 user_channel_id_ref;
49829         CHECK(user_channel_id->arr_len == 16);
49830         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
49831         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49832         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
49833         uint64_t ret_ref = tag_ptr(ret_copy, true);
49834         return ret_ref;
49835 }
49836
49837 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) {
49838         LDKPublicKey receiver_node_id_ref;
49839         CHECK(receiver_node_id->arr_len == 33);
49840         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
49841         LDKThirtyTwoBytes payment_hash_ref;
49842         CHECK(payment_hash->arr_len == 32);
49843         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49844         LDKRecipientOnionFields onion_fields_conv;
49845         onion_fields_conv.inner = untag_ptr(onion_fields);
49846         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
49847         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
49848         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
49849         void* purpose_ptr = untag_ptr(purpose);
49850         CHECK_ACCESS(purpose_ptr);
49851         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
49852         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
49853         LDKThirtyTwoBytes via_channel_id_ref;
49854         CHECK(via_channel_id->arr_len == 32);
49855         memcpy(via_channel_id_ref.data, via_channel_id->elems, 32); FREE(via_channel_id);
49856         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
49857         CHECK_ACCESS(via_user_channel_id_ptr);
49858         LDKCOption_u128Z via_user_channel_id_conv = *(LDKCOption_u128Z*)(via_user_channel_id_ptr);
49859         via_user_channel_id_conv = COption_u128Z_clone((LDKCOption_u128Z*)untag_ptr(via_user_channel_id));
49860         void* claim_deadline_ptr = untag_ptr(claim_deadline);
49861         CHECK_ACCESS(claim_deadline_ptr);
49862         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
49863         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
49864         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49865         *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);
49866         uint64_t ret_ref = tag_ptr(ret_copy, true);
49867         return ret_ref;
49868 }
49869
49870 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) {
49871         LDKPublicKey receiver_node_id_ref;
49872         CHECK(receiver_node_id->arr_len == 33);
49873         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
49874         LDKThirtyTwoBytes payment_hash_ref;
49875         CHECK(payment_hash->arr_len == 32);
49876         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49877         void* purpose_ptr = untag_ptr(purpose);
49878         CHECK_ACCESS(purpose_ptr);
49879         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
49880         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
49881         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49882         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv);
49883         uint64_t ret_ref = tag_ptr(ret_copy, true);
49884         return ret_ref;
49885 }
49886
49887 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) {
49888         LDKThirtyTwoBytes payment_id_ref;
49889         CHECK(payment_id->arr_len == 32);
49890         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49891         LDKThirtyTwoBytes payment_preimage_ref;
49892         CHECK(payment_preimage->arr_len == 32);
49893         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
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* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
49898         CHECK_ACCESS(fee_paid_msat_ptr);
49899         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
49900         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
49901         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49902         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_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_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t reason) {
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_hash_ref;
49912         CHECK(payment_hash->arr_len == 32);
49913         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49914         void* reason_ptr = untag_ptr(reason);
49915         CHECK_ACCESS(reason_ptr);
49916         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
49917         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
49918         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49919         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
49920         uint64_t ret_ref = tag_ptr(ret_copy, true);
49921         return ret_ref;
49922 }
49923
49924 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) {
49925         LDKThirtyTwoBytes payment_id_ref;
49926         CHECK(payment_id->arr_len == 32);
49927         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49928         LDKThirtyTwoBytes payment_hash_ref;
49929         CHECK(payment_hash->arr_len == 32);
49930         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49931         LDKPath path_conv;
49932         path_conv.inner = untag_ptr(path);
49933         path_conv.is_owned = ptr_is_owned(path);
49934         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
49935         path_conv = Path_clone(&path_conv);
49936         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49937         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_conv);
49938         uint64_t ret_ref = tag_ptr(ret_copy, true);
49939         return ret_ref;
49940 }
49941
49942 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) {
49943         LDKThirtyTwoBytes payment_id_ref;
49944         CHECK(payment_id->arr_len == 32);
49945         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49946         LDKThirtyTwoBytes payment_hash_ref;
49947         CHECK(payment_hash->arr_len == 32);
49948         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49949         void* failure_ptr = untag_ptr(failure);
49950         CHECK_ACCESS(failure_ptr);
49951         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
49952         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
49953         LDKPath path_conv;
49954         path_conv.inner = untag_ptr(path);
49955         path_conv.is_owned = ptr_is_owned(path);
49956         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
49957         path_conv = Path_clone(&path_conv);
49958         void* short_channel_id_ptr = untag_ptr(short_channel_id);
49959         CHECK_ACCESS(short_channel_id_ptr);
49960         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
49961         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
49962         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49963         *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
49964         uint64_t ret_ref = tag_ptr(ret_copy, true);
49965         return ret_ref;
49966 }
49967
49968 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path) {
49969         LDKThirtyTwoBytes payment_id_ref;
49970         CHECK(payment_id->arr_len == 32);
49971         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49972         LDKThirtyTwoBytes payment_hash_ref;
49973         CHECK(payment_hash->arr_len == 32);
49974         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49975         LDKPath path_conv;
49976         path_conv.inner = untag_ptr(path);
49977         path_conv.is_owned = ptr_is_owned(path);
49978         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
49979         path_conv = Path_clone(&path_conv);
49980         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
49981         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
49982         uint64_t ret_ref = tag_ptr(ret_copy, true);
49983         return ret_ref;
49984 }
49985
49986 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) {
49987         LDKThirtyTwoBytes payment_id_ref;
49988         CHECK(payment_id->arr_len == 32);
49989         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49990         LDKThirtyTwoBytes payment_hash_ref;
49991         CHECK(payment_hash->arr_len == 32);
49992         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
49993         LDKPath path_conv;
49994         path_conv.inner = untag_ptr(path);
49995         path_conv.is_owned = ptr_is_owned(path);
49996         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
49997         path_conv = Path_clone(&path_conv);
49998         void* short_channel_id_ptr = untag_ptr(short_channel_id);
49999         CHECK_ACCESS(short_channel_id_ptr);
50000         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
50001         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
50002         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50003         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
50004         uint64_t ret_ref = tag_ptr(ret_copy, true);
50005         return ret_ref;
50006 }
50007
50008 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
50009         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50010         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
50011         uint64_t ret_ref = tag_ptr(ret_copy, true);
50012         return ret_ref;
50013 }
50014
50015 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) {
50016         LDKThirtyTwoBytes intercept_id_ref;
50017         CHECK(intercept_id->arr_len == 32);
50018         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
50019         LDKThirtyTwoBytes payment_hash_ref;
50020         CHECK(payment_hash->arr_len == 32);
50021         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
50022         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50023         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
50024         uint64_t ret_ref = tag_ptr(ret_copy, true);
50025         return ret_ref;
50026 }
50027
50028 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs) {
50029         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
50030         outputs_constr.datalen = outputs->arr_len;
50031         if (outputs_constr.datalen > 0)
50032                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
50033         else
50034                 outputs_constr.data = NULL;
50035         uint64_t* outputs_vals = outputs->elems;
50036         for (size_t b = 0; b < outputs_constr.datalen; b++) {
50037                 uint64_t outputs_conv_27 = outputs_vals[b];
50038                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
50039                 CHECK_ACCESS(outputs_conv_27_ptr);
50040                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
50041                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
50042                 outputs_constr.data[b] = outputs_conv_27_conv;
50043         }
50044         FREE(outputs);
50045         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50046         *ret_copy = Event_spendable_outputs(outputs_constr);
50047         uint64_t ret_ref = tag_ptr(ret_copy, true);
50048         return ret_ref;
50049 }
50050
50051 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) {
50052         LDKThirtyTwoBytes prev_channel_id_ref;
50053         CHECK(prev_channel_id->arr_len == 32);
50054         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
50055         LDKThirtyTwoBytes next_channel_id_ref;
50056         CHECK(next_channel_id->arr_len == 32);
50057         memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
50058         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
50059         CHECK_ACCESS(fee_earned_msat_ptr);
50060         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
50061         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
50062         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
50063         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
50064         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
50065         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
50066         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50067         *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);
50068         uint64_t ret_ref = tag_ptr(ret_copy, true);
50069         return ret_ref;
50070 }
50071
50072 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) {
50073         LDKThirtyTwoBytes channel_id_ref;
50074         CHECK(channel_id->arr_len == 32);
50075         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
50076         LDKU128 user_channel_id_ref;
50077         CHECK(user_channel_id->arr_len == 16);
50078         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
50079         LDKThirtyTwoBytes former_temporary_channel_id_ref;
50080         CHECK(former_temporary_channel_id->arr_len == 32);
50081         memcpy(former_temporary_channel_id_ref.data, former_temporary_channel_id->elems, 32); FREE(former_temporary_channel_id);
50082         LDKPublicKey counterparty_node_id_ref;
50083         CHECK(counterparty_node_id->arr_len == 33);
50084         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
50085         LDKOutPoint funding_txo_conv;
50086         funding_txo_conv.inner = untag_ptr(funding_txo);
50087         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
50088         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
50089         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
50090         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50091         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_ref, counterparty_node_id_ref, funding_txo_conv);
50092         uint64_t ret_ref = tag_ptr(ret_copy, true);
50093         return ret_ref;
50094 }
50095
50096 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) {
50097         LDKThirtyTwoBytes channel_id_ref;
50098         CHECK(channel_id->arr_len == 32);
50099         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
50100         LDKU128 user_channel_id_ref;
50101         CHECK(user_channel_id->arr_len == 16);
50102         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
50103         LDKPublicKey counterparty_node_id_ref;
50104         CHECK(counterparty_node_id->arr_len == 33);
50105         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
50106         LDKChannelTypeFeatures channel_type_conv;
50107         channel_type_conv.inner = untag_ptr(channel_type);
50108         channel_type_conv.is_owned = ptr_is_owned(channel_type);
50109         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
50110         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
50111         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50112         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
50113         uint64_t ret_ref = tag_ptr(ret_copy, true);
50114         return ret_ref;
50115 }
50116
50117 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) {
50118         LDKThirtyTwoBytes channel_id_ref;
50119         CHECK(channel_id->arr_len == 32);
50120         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
50121         LDKU128 user_channel_id_ref;
50122         CHECK(user_channel_id->arr_len == 16);
50123         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
50124         void* reason_ptr = untag_ptr(reason);
50125         CHECK_ACCESS(reason_ptr);
50126         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
50127         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
50128         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50129         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv);
50130         uint64_t ret_ref = tag_ptr(ret_copy, true);
50131         return ret_ref;
50132 }
50133
50134 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
50135         LDKThirtyTwoBytes channel_id_ref;
50136         CHECK(channel_id->arr_len == 32);
50137         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
50138         LDKTransaction transaction_ref;
50139         transaction_ref.datalen = transaction->arr_len;
50140         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
50141         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
50142         transaction_ref.data_is_owned = true;
50143         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50144         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
50145         uint64_t ret_ref = tag_ptr(ret_copy, true);
50146         return ret_ref;
50147 }
50148
50149 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) {
50150         LDKThirtyTwoBytes temporary_channel_id_ref;
50151         CHECK(temporary_channel_id->arr_len == 32);
50152         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
50153         LDKPublicKey counterparty_node_id_ref;
50154         CHECK(counterparty_node_id->arr_len == 33);
50155         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
50156         LDKChannelTypeFeatures channel_type_conv;
50157         channel_type_conv.inner = untag_ptr(channel_type);
50158         channel_type_conv.is_owned = ptr_is_owned(channel_type);
50159         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
50160         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
50161         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50162         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
50163         uint64_t ret_ref = tag_ptr(ret_copy, true);
50164         return ret_ref;
50165 }
50166
50167 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
50168         LDKThirtyTwoBytes prev_channel_id_ref;
50169         CHECK(prev_channel_id->arr_len == 32);
50170         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
50171         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
50172         CHECK_ACCESS(failed_next_destination_ptr);
50173         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
50174         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
50175         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
50176         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
50177         uint64_t ret_ref = tag_ptr(ret_copy, true);
50178         return ret_ref;
50179 }
50180
50181 jboolean  __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) {
50182         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
50183         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
50184         jboolean ret_conv = Event_eq(a_conv, b_conv);
50185         return ret_conv;
50186 }
50187
50188 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
50189         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
50190         LDKCVec_u8Z ret_var = Event_write(obj_conv);
50191         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50192         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50193         CVec_u8Z_free(ret_var);
50194         return ret_arr;
50195 }
50196
50197 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
50198         LDKu8slice ser_ref;
50199         ser_ref.datalen = ser->arr_len;
50200         ser_ref.data = ser->elems;
50201         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
50202         *ret_conv = Event_read(ser_ref);
50203         FREE(ser);
50204         return tag_ptr(ret_conv, true);
50205 }
50206
50207 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
50208         if (!ptr_is_owned(this_ptr)) return;
50209         void* this_ptr_ptr = untag_ptr(this_ptr);
50210         CHECK_ACCESS(this_ptr_ptr);
50211         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
50212         FREE(untag_ptr(this_ptr));
50213         MessageSendEvent_free(this_ptr_conv);
50214 }
50215
50216 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
50217         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50218         *ret_copy = MessageSendEvent_clone(arg);
50219         uint64_t ret_ref = tag_ptr(ret_copy, true);
50220         return ret_ref;
50221 }
50222 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
50223         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
50224         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
50225         return ret_conv;
50226 }
50227
50228 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
50229         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
50230         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50231         *ret_copy = MessageSendEvent_clone(orig_conv);
50232         uint64_t ret_ref = tag_ptr(ret_copy, true);
50233         return ret_ref;
50234 }
50235
50236 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
50237         LDKPublicKey node_id_ref;
50238         CHECK(node_id->arr_len == 33);
50239         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50240         LDKAcceptChannel msg_conv;
50241         msg_conv.inner = untag_ptr(msg);
50242         msg_conv.is_owned = ptr_is_owned(msg);
50243         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50244         msg_conv = AcceptChannel_clone(&msg_conv);
50245         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50246         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
50247         uint64_t ret_ref = tag_ptr(ret_copy, true);
50248         return ret_ref;
50249 }
50250
50251 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
50252         LDKPublicKey node_id_ref;
50253         CHECK(node_id->arr_len == 33);
50254         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50255         LDKOpenChannel msg_conv;
50256         msg_conv.inner = untag_ptr(msg);
50257         msg_conv.is_owned = ptr_is_owned(msg);
50258         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50259         msg_conv = OpenChannel_clone(&msg_conv);
50260         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50261         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
50262         uint64_t ret_ref = tag_ptr(ret_copy, true);
50263         return ret_ref;
50264 }
50265
50266 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
50267         LDKPublicKey node_id_ref;
50268         CHECK(node_id->arr_len == 33);
50269         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50270         LDKFundingCreated msg_conv;
50271         msg_conv.inner = untag_ptr(msg);
50272         msg_conv.is_owned = ptr_is_owned(msg);
50273         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50274         msg_conv = FundingCreated_clone(&msg_conv);
50275         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50276         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
50277         uint64_t ret_ref = tag_ptr(ret_copy, true);
50278         return ret_ref;
50279 }
50280
50281 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
50282         LDKPublicKey node_id_ref;
50283         CHECK(node_id->arr_len == 33);
50284         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50285         LDKFundingSigned msg_conv;
50286         msg_conv.inner = untag_ptr(msg);
50287         msg_conv.is_owned = ptr_is_owned(msg);
50288         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50289         msg_conv = FundingSigned_clone(&msg_conv);
50290         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50291         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
50292         uint64_t ret_ref = tag_ptr(ret_copy, true);
50293         return ret_ref;
50294 }
50295
50296 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
50297         LDKPublicKey node_id_ref;
50298         CHECK(node_id->arr_len == 33);
50299         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50300         LDKChannelReady msg_conv;
50301         msg_conv.inner = untag_ptr(msg);
50302         msg_conv.is_owned = ptr_is_owned(msg);
50303         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50304         msg_conv = ChannelReady_clone(&msg_conv);
50305         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50306         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
50307         uint64_t ret_ref = tag_ptr(ret_copy, true);
50308         return ret_ref;
50309 }
50310
50311 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
50312         LDKPublicKey node_id_ref;
50313         CHECK(node_id->arr_len == 33);
50314         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50315         LDKAnnouncementSignatures msg_conv;
50316         msg_conv.inner = untag_ptr(msg);
50317         msg_conv.is_owned = ptr_is_owned(msg);
50318         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50319         msg_conv = AnnouncementSignatures_clone(&msg_conv);
50320         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50321         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
50322         uint64_t ret_ref = tag_ptr(ret_copy, true);
50323         return ret_ref;
50324 }
50325
50326 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
50327         LDKPublicKey node_id_ref;
50328         CHECK(node_id->arr_len == 33);
50329         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50330         LDKCommitmentUpdate updates_conv;
50331         updates_conv.inner = untag_ptr(updates);
50332         updates_conv.is_owned = ptr_is_owned(updates);
50333         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
50334         updates_conv = CommitmentUpdate_clone(&updates_conv);
50335         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50336         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
50337         uint64_t ret_ref = tag_ptr(ret_copy, true);
50338         return ret_ref;
50339 }
50340
50341 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
50342         LDKPublicKey node_id_ref;
50343         CHECK(node_id->arr_len == 33);
50344         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50345         LDKRevokeAndACK msg_conv;
50346         msg_conv.inner = untag_ptr(msg);
50347         msg_conv.is_owned = ptr_is_owned(msg);
50348         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50349         msg_conv = RevokeAndACK_clone(&msg_conv);
50350         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50351         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
50352         uint64_t ret_ref = tag_ptr(ret_copy, true);
50353         return ret_ref;
50354 }
50355
50356 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
50357         LDKPublicKey node_id_ref;
50358         CHECK(node_id->arr_len == 33);
50359         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50360         LDKClosingSigned msg_conv;
50361         msg_conv.inner = untag_ptr(msg);
50362         msg_conv.is_owned = ptr_is_owned(msg);
50363         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50364         msg_conv = ClosingSigned_clone(&msg_conv);
50365         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50366         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
50367         uint64_t ret_ref = tag_ptr(ret_copy, true);
50368         return ret_ref;
50369 }
50370
50371 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
50372         LDKPublicKey node_id_ref;
50373         CHECK(node_id->arr_len == 33);
50374         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50375         LDKShutdown msg_conv;
50376         msg_conv.inner = untag_ptr(msg);
50377         msg_conv.is_owned = ptr_is_owned(msg);
50378         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50379         msg_conv = Shutdown_clone(&msg_conv);
50380         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50381         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
50382         uint64_t ret_ref = tag_ptr(ret_copy, true);
50383         return ret_ref;
50384 }
50385
50386 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
50387         LDKPublicKey node_id_ref;
50388         CHECK(node_id->arr_len == 33);
50389         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50390         LDKChannelReestablish msg_conv;
50391         msg_conv.inner = untag_ptr(msg);
50392         msg_conv.is_owned = ptr_is_owned(msg);
50393         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50394         msg_conv = ChannelReestablish_clone(&msg_conv);
50395         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50396         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
50397         uint64_t ret_ref = tag_ptr(ret_copy, true);
50398         return ret_ref;
50399 }
50400
50401 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) {
50402         LDKPublicKey node_id_ref;
50403         CHECK(node_id->arr_len == 33);
50404         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50405         LDKChannelAnnouncement msg_conv;
50406         msg_conv.inner = untag_ptr(msg);
50407         msg_conv.is_owned = ptr_is_owned(msg);
50408         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50409         msg_conv = ChannelAnnouncement_clone(&msg_conv);
50410         LDKChannelUpdate update_msg_conv;
50411         update_msg_conv.inner = untag_ptr(update_msg);
50412         update_msg_conv.is_owned = ptr_is_owned(update_msg);
50413         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
50414         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
50415         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50416         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_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_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
50422         LDKChannelAnnouncement msg_conv;
50423         msg_conv.inner = untag_ptr(msg);
50424         msg_conv.is_owned = ptr_is_owned(msg);
50425         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50426         msg_conv = ChannelAnnouncement_clone(&msg_conv);
50427         LDKChannelUpdate update_msg_conv;
50428         update_msg_conv.inner = untag_ptr(update_msg);
50429         update_msg_conv.is_owned = ptr_is_owned(update_msg);
50430         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
50431         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
50432         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50433         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
50434         uint64_t ret_ref = tag_ptr(ret_copy, true);
50435         return ret_ref;
50436 }
50437
50438 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
50439         LDKChannelUpdate msg_conv;
50440         msg_conv.inner = untag_ptr(msg);
50441         msg_conv.is_owned = ptr_is_owned(msg);
50442         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50443         msg_conv = ChannelUpdate_clone(&msg_conv);
50444         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50445         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
50446         uint64_t ret_ref = tag_ptr(ret_copy, true);
50447         return ret_ref;
50448 }
50449
50450 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
50451         LDKNodeAnnouncement msg_conv;
50452         msg_conv.inner = untag_ptr(msg);
50453         msg_conv.is_owned = ptr_is_owned(msg);
50454         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50455         msg_conv = NodeAnnouncement_clone(&msg_conv);
50456         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50457         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
50458         uint64_t ret_ref = tag_ptr(ret_copy, true);
50459         return ret_ref;
50460 }
50461
50462 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
50463         LDKPublicKey node_id_ref;
50464         CHECK(node_id->arr_len == 33);
50465         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50466         LDKChannelUpdate msg_conv;
50467         msg_conv.inner = untag_ptr(msg);
50468         msg_conv.is_owned = ptr_is_owned(msg);
50469         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50470         msg_conv = ChannelUpdate_clone(&msg_conv);
50471         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50472         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
50473         uint64_t ret_ref = tag_ptr(ret_copy, true);
50474         return ret_ref;
50475 }
50476
50477 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
50478         LDKPublicKey node_id_ref;
50479         CHECK(node_id->arr_len == 33);
50480         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50481         void* action_ptr = untag_ptr(action);
50482         CHECK_ACCESS(action_ptr);
50483         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
50484         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
50485         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50486         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
50487         uint64_t ret_ref = tag_ptr(ret_copy, true);
50488         return ret_ref;
50489 }
50490
50491 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
50492         LDKPublicKey node_id_ref;
50493         CHECK(node_id->arr_len == 33);
50494         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50495         LDKQueryChannelRange msg_conv;
50496         msg_conv.inner = untag_ptr(msg);
50497         msg_conv.is_owned = ptr_is_owned(msg);
50498         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50499         msg_conv = QueryChannelRange_clone(&msg_conv);
50500         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50501         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
50502         uint64_t ret_ref = tag_ptr(ret_copy, true);
50503         return ret_ref;
50504 }
50505
50506 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
50507         LDKPublicKey node_id_ref;
50508         CHECK(node_id->arr_len == 33);
50509         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50510         LDKQueryShortChannelIds msg_conv;
50511         msg_conv.inner = untag_ptr(msg);
50512         msg_conv.is_owned = ptr_is_owned(msg);
50513         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50514         msg_conv = QueryShortChannelIds_clone(&msg_conv);
50515         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50516         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
50517         uint64_t ret_ref = tag_ptr(ret_copy, true);
50518         return ret_ref;
50519 }
50520
50521 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
50522         LDKPublicKey node_id_ref;
50523         CHECK(node_id->arr_len == 33);
50524         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50525         LDKReplyChannelRange msg_conv;
50526         msg_conv.inner = untag_ptr(msg);
50527         msg_conv.is_owned = ptr_is_owned(msg);
50528         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50529         msg_conv = ReplyChannelRange_clone(&msg_conv);
50530         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50531         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
50532         uint64_t ret_ref = tag_ptr(ret_copy, true);
50533         return ret_ref;
50534 }
50535
50536 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
50537         LDKPublicKey node_id_ref;
50538         CHECK(node_id->arr_len == 33);
50539         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
50540         LDKGossipTimestampFilter msg_conv;
50541         msg_conv.inner = untag_ptr(msg);
50542         msg_conv.is_owned = ptr_is_owned(msg);
50543         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50544         msg_conv = GossipTimestampFilter_clone(&msg_conv);
50545         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
50546         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
50547         uint64_t ret_ref = tag_ptr(ret_copy, true);
50548         return ret_ref;
50549 }
50550
50551 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
50552         if (!ptr_is_owned(this_ptr)) return;
50553         void* this_ptr_ptr = untag_ptr(this_ptr);
50554         CHECK_ACCESS(this_ptr_ptr);
50555         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
50556         FREE(untag_ptr(this_ptr));
50557         MessageSendEventsProvider_free(this_ptr_conv);
50558 }
50559
50560 void  __attribute__((export_name("TS_OnionMessageProvider_free"))) TS_OnionMessageProvider_free(uint64_t this_ptr) {
50561         if (!ptr_is_owned(this_ptr)) return;
50562         void* this_ptr_ptr = untag_ptr(this_ptr);
50563         CHECK_ACCESS(this_ptr_ptr);
50564         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
50565         FREE(untag_ptr(this_ptr));
50566         OnionMessageProvider_free(this_ptr_conv);
50567 }
50568
50569 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
50570         if (!ptr_is_owned(this_ptr)) return;
50571         void* this_ptr_ptr = untag_ptr(this_ptr);
50572         CHECK_ACCESS(this_ptr_ptr);
50573         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
50574         FREE(untag_ptr(this_ptr));
50575         EventsProvider_free(this_ptr_conv);
50576 }
50577
50578 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
50579         if (!ptr_is_owned(this_ptr)) return;
50580         void* this_ptr_ptr = untag_ptr(this_ptr);
50581         CHECK_ACCESS(this_ptr_ptr);
50582         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
50583         FREE(untag_ptr(this_ptr));
50584         EventHandler_free(this_ptr_conv);
50585 }
50586
50587 void  __attribute__((export_name("TS_GossipSync_free"))) TS_GossipSync_free(uint64_t this_ptr) {
50588         if (!ptr_is_owned(this_ptr)) return;
50589         void* this_ptr_ptr = untag_ptr(this_ptr);
50590         CHECK_ACCESS(this_ptr_ptr);
50591         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
50592         FREE(untag_ptr(this_ptr));
50593         GossipSync_free(this_ptr_conv);
50594 }
50595
50596 uint64_t  __attribute__((export_name("TS_GossipSync_p2_p"))) TS_GossipSync_p2_p(uint64_t a) {
50597         LDKP2PGossipSync a_conv;
50598         a_conv.inner = untag_ptr(a);
50599         a_conv.is_owned = ptr_is_owned(a);
50600         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50601         a_conv.is_owned = false;
50602         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
50603         *ret_copy = GossipSync_p2_p(&a_conv);
50604         uint64_t ret_ref = tag_ptr(ret_copy, true);
50605         return ret_ref;
50606 }
50607
50608 uint64_t  __attribute__((export_name("TS_GossipSync_rapid"))) TS_GossipSync_rapid(uint64_t a) {
50609         LDKRapidGossipSync a_conv;
50610         a_conv.inner = untag_ptr(a);
50611         a_conv.is_owned = ptr_is_owned(a);
50612         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50613         a_conv.is_owned = false;
50614         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
50615         *ret_copy = GossipSync_rapid(&a_conv);
50616         uint64_t ret_ref = tag_ptr(ret_copy, true);
50617         return ret_ref;
50618 }
50619
50620 uint64_t  __attribute__((export_name("TS_GossipSync_none"))) TS_GossipSync_none() {
50621         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
50622         *ret_copy = GossipSync_none();
50623         uint64_t ret_ref = tag_ptr(ret_copy, true);
50624         return ret_ref;
50625 }
50626
50627 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
50628         LDKRapidGossipSync this_obj_conv;
50629         this_obj_conv.inner = untag_ptr(this_obj);
50630         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50632         RapidGossipSync_free(this_obj_conv);
50633 }
50634
50635 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph, uint64_t logger) {
50636         LDKNetworkGraph network_graph_conv;
50637         network_graph_conv.inner = untag_ptr(network_graph);
50638         network_graph_conv.is_owned = ptr_is_owned(network_graph);
50639         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
50640         network_graph_conv.is_owned = false;
50641         void* logger_ptr = untag_ptr(logger);
50642         CHECK_ACCESS(logger_ptr);
50643         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
50644         if (logger_conv.free == LDKLogger_JCalls_free) {
50645                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50646                 LDKLogger_JCalls_cloned(&logger_conv);
50647         }
50648         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
50649         uint64_t ret_ref = 0;
50650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50652         return ret_ref;
50653 }
50654
50655 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) {
50656         LDKRapidGossipSync this_arg_conv;
50657         this_arg_conv.inner = untag_ptr(this_arg);
50658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50660         this_arg_conv.is_owned = false;
50661         LDKu8slice update_data_ref;
50662         update_data_ref.datalen = update_data->arr_len;
50663         update_data_ref.data = update_data->elems;
50664         void* current_time_unix_ptr = untag_ptr(current_time_unix);
50665         CHECK_ACCESS(current_time_unix_ptr);
50666         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
50667         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
50668         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
50669         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
50670         FREE(update_data);
50671         return tag_ptr(ret_conv, true);
50672 }
50673
50674 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
50675         LDKRapidGossipSync this_arg_conv;
50676         this_arg_conv.inner = untag_ptr(this_arg);
50677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50679         this_arg_conv.is_owned = false;
50680         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
50681         return ret_conv;
50682 }
50683
50684 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
50685         if (!ptr_is_owned(this_ptr)) return;
50686         void* this_ptr_ptr = untag_ptr(this_ptr);
50687         CHECK_ACCESS(this_ptr_ptr);
50688         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
50689         FREE(untag_ptr(this_ptr));
50690         GraphSyncError_free(this_ptr_conv);
50691 }
50692
50693 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
50694         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50695         *ret_copy = GraphSyncError_clone(arg);
50696         uint64_t ret_ref = tag_ptr(ret_copy, true);
50697         return ret_ref;
50698 }
50699 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
50700         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
50701         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
50702         return ret_conv;
50703 }
50704
50705 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
50706         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
50707         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50708         *ret_copy = GraphSyncError_clone(orig_conv);
50709         uint64_t ret_ref = tag_ptr(ret_copy, true);
50710         return ret_ref;
50711 }
50712
50713 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
50714         void* a_ptr = untag_ptr(a);
50715         CHECK_ACCESS(a_ptr);
50716         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
50717         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
50718         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50719         *ret_copy = GraphSyncError_decode_error(a_conv);
50720         uint64_t ret_ref = tag_ptr(ret_copy, true);
50721         return ret_ref;
50722 }
50723
50724 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
50725         LDKLightningError a_conv;
50726         a_conv.inner = untag_ptr(a);
50727         a_conv.is_owned = ptr_is_owned(a);
50728         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50729         a_conv = LightningError_clone(&a_conv);
50730         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50731         *ret_copy = GraphSyncError_lightning_error(a_conv);
50732         uint64_t ret_ref = tag_ptr(ret_copy, true);
50733         return ret_ref;
50734 }
50735
50736 void  __attribute__((export_name("TS_ParseError_free"))) TS_ParseError_free(uint64_t this_ptr) {
50737         if (!ptr_is_owned(this_ptr)) return;
50738         void* this_ptr_ptr = untag_ptr(this_ptr);
50739         CHECK_ACCESS(this_ptr_ptr);
50740         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
50741         FREE(untag_ptr(this_ptr));
50742         ParseError_free(this_ptr_conv);
50743 }
50744
50745 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
50746         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50747         *ret_copy = ParseError_clone(arg);
50748         uint64_t ret_ref = tag_ptr(ret_copy, true);
50749         return ret_ref;
50750 }
50751 int64_t  __attribute__((export_name("TS_ParseError_clone_ptr"))) TS_ParseError_clone_ptr(uint64_t arg) {
50752         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
50753         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
50754         return ret_conv;
50755 }
50756
50757 uint64_t  __attribute__((export_name("TS_ParseError_clone"))) TS_ParseError_clone(uint64_t orig) {
50758         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
50759         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50760         *ret_copy = ParseError_clone(orig_conv);
50761         uint64_t ret_ref = tag_ptr(ret_copy, true);
50762         return ret_ref;
50763 }
50764
50765 uint64_t  __attribute__((export_name("TS_ParseError_bech32_error"))) TS_ParseError_bech32_error(uint64_t a) {
50766         void* a_ptr = untag_ptr(a);
50767         CHECK_ACCESS(a_ptr);
50768         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
50769         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
50770         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50771         *ret_copy = ParseError_bech32_error(a_conv);
50772         uint64_t ret_ref = tag_ptr(ret_copy, true);
50773         return ret_ref;
50774 }
50775
50776 uint64_t  __attribute__((export_name("TS_ParseError_parse_amount_error"))) TS_ParseError_parse_amount_error(int32_t a) {
50777         
50778         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50779         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
50780         uint64_t ret_ref = tag_ptr(ret_copy, true);
50781         return ret_ref;
50782 }
50783
50784 uint64_t  __attribute__((export_name("TS_ParseError_malformed_signature"))) TS_ParseError_malformed_signature(uint32_t a) {
50785         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
50786         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50787         *ret_copy = ParseError_malformed_signature(a_conv);
50788         uint64_t ret_ref = tag_ptr(ret_copy, true);
50789         return ret_ref;
50790 }
50791
50792 uint64_t  __attribute__((export_name("TS_ParseError_bad_prefix"))) TS_ParseError_bad_prefix() {
50793         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50794         *ret_copy = ParseError_bad_prefix();
50795         uint64_t ret_ref = tag_ptr(ret_copy, true);
50796         return ret_ref;
50797 }
50798
50799 uint64_t  __attribute__((export_name("TS_ParseError_unknown_currency"))) TS_ParseError_unknown_currency() {
50800         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50801         *ret_copy = ParseError_unknown_currency();
50802         uint64_t ret_ref = tag_ptr(ret_copy, true);
50803         return ret_ref;
50804 }
50805
50806 uint64_t  __attribute__((export_name("TS_ParseError_unknown_si_prefix"))) TS_ParseError_unknown_si_prefix() {
50807         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50808         *ret_copy = ParseError_unknown_si_prefix();
50809         uint64_t ret_ref = tag_ptr(ret_copy, true);
50810         return ret_ref;
50811 }
50812
50813 uint64_t  __attribute__((export_name("TS_ParseError_malformed_hrp"))) TS_ParseError_malformed_hrp() {
50814         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50815         *ret_copy = ParseError_malformed_hrp();
50816         uint64_t ret_ref = tag_ptr(ret_copy, true);
50817         return ret_ref;
50818 }
50819
50820 uint64_t  __attribute__((export_name("TS_ParseError_too_short_data_part"))) TS_ParseError_too_short_data_part() {
50821         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50822         *ret_copy = ParseError_too_short_data_part();
50823         uint64_t ret_ref = tag_ptr(ret_copy, true);
50824         return ret_ref;
50825 }
50826
50827 uint64_t  __attribute__((export_name("TS_ParseError_unexpected_end_of_tagged_fields"))) TS_ParseError_unexpected_end_of_tagged_fields() {
50828         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50829         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
50830         uint64_t ret_ref = tag_ptr(ret_copy, true);
50831         return ret_ref;
50832 }
50833
50834 uint64_t  __attribute__((export_name("TS_ParseError_description_decode_error"))) TS_ParseError_description_decode_error(int32_t a) {
50835         
50836         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50837         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
50838         uint64_t ret_ref = tag_ptr(ret_copy, true);
50839         return ret_ref;
50840 }
50841
50842 uint64_t  __attribute__((export_name("TS_ParseError_padding_error"))) TS_ParseError_padding_error() {
50843         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50844         *ret_copy = ParseError_padding_error();
50845         uint64_t ret_ref = tag_ptr(ret_copy, true);
50846         return ret_ref;
50847 }
50848
50849 uint64_t  __attribute__((export_name("TS_ParseError_integer_overflow_error"))) TS_ParseError_integer_overflow_error() {
50850         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50851         *ret_copy = ParseError_integer_overflow_error();
50852         uint64_t ret_ref = tag_ptr(ret_copy, true);
50853         return ret_ref;
50854 }
50855
50856 uint64_t  __attribute__((export_name("TS_ParseError_invalid_seg_wit_program_length"))) TS_ParseError_invalid_seg_wit_program_length() {
50857         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50858         *ret_copy = ParseError_invalid_seg_wit_program_length();
50859         uint64_t ret_ref = tag_ptr(ret_copy, true);
50860         return ret_ref;
50861 }
50862
50863 uint64_t  __attribute__((export_name("TS_ParseError_invalid_pub_key_hash_length"))) TS_ParseError_invalid_pub_key_hash_length() {
50864         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50865         *ret_copy = ParseError_invalid_pub_key_hash_length();
50866         uint64_t ret_ref = tag_ptr(ret_copy, true);
50867         return ret_ref;
50868 }
50869
50870 uint64_t  __attribute__((export_name("TS_ParseError_invalid_script_hash_length"))) TS_ParseError_invalid_script_hash_length() {
50871         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50872         *ret_copy = ParseError_invalid_script_hash_length();
50873         uint64_t ret_ref = tag_ptr(ret_copy, true);
50874         return ret_ref;
50875 }
50876
50877 uint64_t  __attribute__((export_name("TS_ParseError_invalid_recovery_id"))) TS_ParseError_invalid_recovery_id() {
50878         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50879         *ret_copy = ParseError_invalid_recovery_id();
50880         uint64_t ret_ref = tag_ptr(ret_copy, true);
50881         return ret_ref;
50882 }
50883
50884 uint64_t  __attribute__((export_name("TS_ParseError_invalid_slice_length"))) TS_ParseError_invalid_slice_length(jstring a) {
50885         LDKStr a_conv = str_ref_to_owned_c(a);
50886         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50887         *ret_copy = ParseError_invalid_slice_length(a_conv);
50888         uint64_t ret_ref = tag_ptr(ret_copy, true);
50889         return ret_ref;
50890 }
50891
50892 uint64_t  __attribute__((export_name("TS_ParseError_skip"))) TS_ParseError_skip() {
50893         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
50894         *ret_copy = ParseError_skip();
50895         uint64_t ret_ref = tag_ptr(ret_copy, true);
50896         return ret_ref;
50897 }
50898
50899 jboolean  __attribute__((export_name("TS_ParseError_eq"))) TS_ParseError_eq(uint64_t a, uint64_t b) {
50900         LDKParseError* a_conv = (LDKParseError*)untag_ptr(a);
50901         LDKParseError* b_conv = (LDKParseError*)untag_ptr(b);
50902         jboolean ret_conv = ParseError_eq(a_conv, b_conv);
50903         return ret_conv;
50904 }
50905
50906 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
50907         if (!ptr_is_owned(this_ptr)) return;
50908         void* this_ptr_ptr = untag_ptr(this_ptr);
50909         CHECK_ACCESS(this_ptr_ptr);
50910         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
50911         FREE(untag_ptr(this_ptr));
50912         ParseOrSemanticError_free(this_ptr_conv);
50913 }
50914
50915 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
50916         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
50917         *ret_copy = ParseOrSemanticError_clone(arg);
50918         uint64_t ret_ref = tag_ptr(ret_copy, true);
50919         return ret_ref;
50920 }
50921 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
50922         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
50923         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
50924         return ret_conv;
50925 }
50926
50927 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
50928         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
50929         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
50930         *ret_copy = ParseOrSemanticError_clone(orig_conv);
50931         uint64_t ret_ref = tag_ptr(ret_copy, true);
50932         return ret_ref;
50933 }
50934
50935 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
50936         void* a_ptr = untag_ptr(a);
50937         CHECK_ACCESS(a_ptr);
50938         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
50939         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
50940         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
50941         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
50942         uint64_t ret_ref = tag_ptr(ret_copy, true);
50943         return ret_ref;
50944 }
50945
50946 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
50947         LDKSemanticError a_conv = LDKSemanticError_from_js(a);
50948         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
50949         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
50950         uint64_t ret_ref = tag_ptr(ret_copy, true);
50951         return ret_ref;
50952 }
50953
50954 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
50955         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
50956         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
50957         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
50958         return ret_conv;
50959 }
50960
50961 void  __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint64_t this_obj) {
50962         LDKInvoice this_obj_conv;
50963         this_obj_conv.inner = untag_ptr(this_obj);
50964         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50966         Invoice_free(this_obj_conv);
50967 }
50968
50969 jboolean  __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint64_t a, uint64_t b) {
50970         LDKInvoice a_conv;
50971         a_conv.inner = untag_ptr(a);
50972         a_conv.is_owned = ptr_is_owned(a);
50973         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50974         a_conv.is_owned = false;
50975         LDKInvoice b_conv;
50976         b_conv.inner = untag_ptr(b);
50977         b_conv.is_owned = ptr_is_owned(b);
50978         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50979         b_conv.is_owned = false;
50980         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
50981         return ret_conv;
50982 }
50983
50984 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
50985         LDKInvoice ret_var = Invoice_clone(arg);
50986         uint64_t ret_ref = 0;
50987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50989         return ret_ref;
50990 }
50991 int64_t  __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint64_t arg) {
50992         LDKInvoice arg_conv;
50993         arg_conv.inner = untag_ptr(arg);
50994         arg_conv.is_owned = ptr_is_owned(arg);
50995         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50996         arg_conv.is_owned = false;
50997         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
50998         return ret_conv;
50999 }
51000
51001 uint64_t  __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint64_t orig) {
51002         LDKInvoice orig_conv;
51003         orig_conv.inner = untag_ptr(orig);
51004         orig_conv.is_owned = ptr_is_owned(orig);
51005         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51006         orig_conv.is_owned = false;
51007         LDKInvoice ret_var = Invoice_clone(&orig_conv);
51008         uint64_t ret_ref = 0;
51009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51011         return ret_ref;
51012 }
51013
51014 int64_t  __attribute__((export_name("TS_Invoice_hash"))) TS_Invoice_hash(uint64_t o) {
51015         LDKInvoice o_conv;
51016         o_conv.inner = untag_ptr(o);
51017         o_conv.is_owned = ptr_is_owned(o);
51018         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51019         o_conv.is_owned = false;
51020         int64_t ret_conv = Invoice_hash(&o_conv);
51021         return ret_conv;
51022 }
51023
51024 void  __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint64_t this_obj) {
51025         LDKSignedRawInvoice this_obj_conv;
51026         this_obj_conv.inner = untag_ptr(this_obj);
51027         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51029         SignedRawInvoice_free(this_obj_conv);
51030 }
51031
51032 jboolean  __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint64_t a, uint64_t b) {
51033         LDKSignedRawInvoice a_conv;
51034         a_conv.inner = untag_ptr(a);
51035         a_conv.is_owned = ptr_is_owned(a);
51036         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51037         a_conv.is_owned = false;
51038         LDKSignedRawInvoice b_conv;
51039         b_conv.inner = untag_ptr(b);
51040         b_conv.is_owned = ptr_is_owned(b);
51041         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51042         b_conv.is_owned = false;
51043         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
51044         return ret_conv;
51045 }
51046
51047 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
51048         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
51049         uint64_t ret_ref = 0;
51050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51052         return ret_ref;
51053 }
51054 int64_t  __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint64_t arg) {
51055         LDKSignedRawInvoice arg_conv;
51056         arg_conv.inner = untag_ptr(arg);
51057         arg_conv.is_owned = ptr_is_owned(arg);
51058         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51059         arg_conv.is_owned = false;
51060         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
51061         return ret_conv;
51062 }
51063
51064 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint64_t orig) {
51065         LDKSignedRawInvoice orig_conv;
51066         orig_conv.inner = untag_ptr(orig);
51067         orig_conv.is_owned = ptr_is_owned(orig);
51068         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51069         orig_conv.is_owned = false;
51070         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
51071         uint64_t ret_ref = 0;
51072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51074         return ret_ref;
51075 }
51076
51077 int64_t  __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint64_t o) {
51078         LDKSignedRawInvoice o_conv;
51079         o_conv.inner = untag_ptr(o);
51080         o_conv.is_owned = ptr_is_owned(o);
51081         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51082         o_conv.is_owned = false;
51083         int64_t ret_conv = SignedRawInvoice_hash(&o_conv);
51084         return ret_conv;
51085 }
51086
51087 void  __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint64_t this_obj) {
51088         LDKRawInvoice this_obj_conv;
51089         this_obj_conv.inner = untag_ptr(this_obj);
51090         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51092         RawInvoice_free(this_obj_conv);
51093 }
51094
51095 uint64_t  __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint64_t this_ptr) {
51096         LDKRawInvoice this_ptr_conv;
51097         this_ptr_conv.inner = untag_ptr(this_ptr);
51098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51100         this_ptr_conv.is_owned = false;
51101         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
51102         uint64_t ret_ref = 0;
51103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51105         return ret_ref;
51106 }
51107
51108 void  __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint64_t this_ptr, uint64_t val) {
51109         LDKRawInvoice this_ptr_conv;
51110         this_ptr_conv.inner = untag_ptr(this_ptr);
51111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51113         this_ptr_conv.is_owned = false;
51114         LDKRawDataPart val_conv;
51115         val_conv.inner = untag_ptr(val);
51116         val_conv.is_owned = ptr_is_owned(val);
51117         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51118         val_conv = RawDataPart_clone(&val_conv);
51119         RawInvoice_set_data(&this_ptr_conv, val_conv);
51120 }
51121
51122 jboolean  __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint64_t a, uint64_t b) {
51123         LDKRawInvoice a_conv;
51124         a_conv.inner = untag_ptr(a);
51125         a_conv.is_owned = ptr_is_owned(a);
51126         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51127         a_conv.is_owned = false;
51128         LDKRawInvoice b_conv;
51129         b_conv.inner = untag_ptr(b);
51130         b_conv.is_owned = ptr_is_owned(b);
51131         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51132         b_conv.is_owned = false;
51133         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
51134         return ret_conv;
51135 }
51136
51137 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
51138         LDKRawInvoice ret_var = RawInvoice_clone(arg);
51139         uint64_t ret_ref = 0;
51140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51142         return ret_ref;
51143 }
51144 int64_t  __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint64_t arg) {
51145         LDKRawInvoice arg_conv;
51146         arg_conv.inner = untag_ptr(arg);
51147         arg_conv.is_owned = ptr_is_owned(arg);
51148         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51149         arg_conv.is_owned = false;
51150         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
51151         return ret_conv;
51152 }
51153
51154 uint64_t  __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint64_t orig) {
51155         LDKRawInvoice orig_conv;
51156         orig_conv.inner = untag_ptr(orig);
51157         orig_conv.is_owned = ptr_is_owned(orig);
51158         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51159         orig_conv.is_owned = false;
51160         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
51161         uint64_t ret_ref = 0;
51162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51164         return ret_ref;
51165 }
51166
51167 int64_t  __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint64_t o) {
51168         LDKRawInvoice o_conv;
51169         o_conv.inner = untag_ptr(o);
51170         o_conv.is_owned = ptr_is_owned(o);
51171         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51172         o_conv.is_owned = false;
51173         int64_t ret_conv = RawInvoice_hash(&o_conv);
51174         return ret_conv;
51175 }
51176
51177 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
51178         LDKRawDataPart this_obj_conv;
51179         this_obj_conv.inner = untag_ptr(this_obj);
51180         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51182         RawDataPart_free(this_obj_conv);
51183 }
51184
51185 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
51186         LDKRawDataPart this_ptr_conv;
51187         this_ptr_conv.inner = untag_ptr(this_ptr);
51188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51190         this_ptr_conv.is_owned = false;
51191         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
51192         uint64_t ret_ref = 0;
51193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51195         return ret_ref;
51196 }
51197
51198 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
51199         LDKRawDataPart this_ptr_conv;
51200         this_ptr_conv.inner = untag_ptr(this_ptr);
51201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51203         this_ptr_conv.is_owned = false;
51204         LDKPositiveTimestamp val_conv;
51205         val_conv.inner = untag_ptr(val);
51206         val_conv.is_owned = ptr_is_owned(val);
51207         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51208         val_conv = PositiveTimestamp_clone(&val_conv);
51209         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
51210 }
51211
51212 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
51213         LDKRawDataPart a_conv;
51214         a_conv.inner = untag_ptr(a);
51215         a_conv.is_owned = ptr_is_owned(a);
51216         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51217         a_conv.is_owned = false;
51218         LDKRawDataPart b_conv;
51219         b_conv.inner = untag_ptr(b);
51220         b_conv.is_owned = ptr_is_owned(b);
51221         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51222         b_conv.is_owned = false;
51223         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
51224         return ret_conv;
51225 }
51226
51227 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
51228         LDKRawDataPart ret_var = RawDataPart_clone(arg);
51229         uint64_t ret_ref = 0;
51230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51232         return ret_ref;
51233 }
51234 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
51235         LDKRawDataPart arg_conv;
51236         arg_conv.inner = untag_ptr(arg);
51237         arg_conv.is_owned = ptr_is_owned(arg);
51238         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51239         arg_conv.is_owned = false;
51240         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
51241         return ret_conv;
51242 }
51243
51244 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
51245         LDKRawDataPart orig_conv;
51246         orig_conv.inner = untag_ptr(orig);
51247         orig_conv.is_owned = ptr_is_owned(orig);
51248         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51249         orig_conv.is_owned = false;
51250         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
51251         uint64_t ret_ref = 0;
51252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51254         return ret_ref;
51255 }
51256
51257 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
51258         LDKRawDataPart o_conv;
51259         o_conv.inner = untag_ptr(o);
51260         o_conv.is_owned = ptr_is_owned(o);
51261         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51262         o_conv.is_owned = false;
51263         int64_t ret_conv = RawDataPart_hash(&o_conv);
51264         return ret_conv;
51265 }
51266
51267 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
51268         LDKPositiveTimestamp this_obj_conv;
51269         this_obj_conv.inner = untag_ptr(this_obj);
51270         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51272         PositiveTimestamp_free(this_obj_conv);
51273 }
51274
51275 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
51276         LDKPositiveTimestamp a_conv;
51277         a_conv.inner = untag_ptr(a);
51278         a_conv.is_owned = ptr_is_owned(a);
51279         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51280         a_conv.is_owned = false;
51281         LDKPositiveTimestamp b_conv;
51282         b_conv.inner = untag_ptr(b);
51283         b_conv.is_owned = ptr_is_owned(b);
51284         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51285         b_conv.is_owned = false;
51286         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
51287         return ret_conv;
51288 }
51289
51290 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
51291         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
51292         uint64_t ret_ref = 0;
51293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51295         return ret_ref;
51296 }
51297 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
51298         LDKPositiveTimestamp arg_conv;
51299         arg_conv.inner = untag_ptr(arg);
51300         arg_conv.is_owned = ptr_is_owned(arg);
51301         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51302         arg_conv.is_owned = false;
51303         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
51304         return ret_conv;
51305 }
51306
51307 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
51308         LDKPositiveTimestamp orig_conv;
51309         orig_conv.inner = untag_ptr(orig);
51310         orig_conv.is_owned = ptr_is_owned(orig);
51311         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51312         orig_conv.is_owned = false;
51313         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
51314         uint64_t ret_ref = 0;
51315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51317         return ret_ref;
51318 }
51319
51320 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
51321         LDKPositiveTimestamp o_conv;
51322         o_conv.inner = untag_ptr(o);
51323         o_conv.is_owned = ptr_is_owned(o);
51324         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51325         o_conv.is_owned = false;
51326         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
51327         return ret_conv;
51328 }
51329
51330 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
51331         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
51332         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
51333         return ret_conv;
51334 }
51335
51336 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
51337         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
51338         return ret_conv;
51339 }
51340
51341 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
51342         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
51343         return ret_conv;
51344 }
51345
51346 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
51347         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
51348         return ret_conv;
51349 }
51350
51351 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
51352         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
51353         return ret_conv;
51354 }
51355
51356 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
51357         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
51358         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
51359         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
51360         return ret_conv;
51361 }
51362
51363 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
51364         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
51365         int64_t ret_conv = SiPrefix_hash(o_conv);
51366         return ret_conv;
51367 }
51368
51369 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
51370         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
51371         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
51372         return ret_conv;
51373 }
51374
51375 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
51376         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
51377         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
51378         return ret_conv;
51379 }
51380
51381 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
51382         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
51383         return ret_conv;
51384 }
51385
51386 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
51387         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
51388         return ret_conv;
51389 }
51390
51391 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
51392         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
51393         return ret_conv;
51394 }
51395
51396 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
51397         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
51398         return ret_conv;
51399 }
51400
51401 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
51402         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
51403         return ret_conv;
51404 }
51405
51406 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
51407         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
51408         int64_t ret_conv = Currency_hash(o_conv);
51409         return ret_conv;
51410 }
51411
51412 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
51413         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
51414         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
51415         jboolean ret_conv = Currency_eq(a_conv, b_conv);
51416         return ret_conv;
51417 }
51418
51419 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
51420         LDKSha256 this_obj_conv;
51421         this_obj_conv.inner = untag_ptr(this_obj);
51422         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51424         Sha256_free(this_obj_conv);
51425 }
51426
51427 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
51428         LDKSha256 ret_var = Sha256_clone(arg);
51429         uint64_t ret_ref = 0;
51430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51432         return ret_ref;
51433 }
51434 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
51435         LDKSha256 arg_conv;
51436         arg_conv.inner = untag_ptr(arg);
51437         arg_conv.is_owned = ptr_is_owned(arg);
51438         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51439         arg_conv.is_owned = false;
51440         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
51441         return ret_conv;
51442 }
51443
51444 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
51445         LDKSha256 orig_conv;
51446         orig_conv.inner = untag_ptr(orig);
51447         orig_conv.is_owned = ptr_is_owned(orig);
51448         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51449         orig_conv.is_owned = false;
51450         LDKSha256 ret_var = Sha256_clone(&orig_conv);
51451         uint64_t ret_ref = 0;
51452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51454         return ret_ref;
51455 }
51456
51457 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
51458         LDKSha256 o_conv;
51459         o_conv.inner = untag_ptr(o);
51460         o_conv.is_owned = ptr_is_owned(o);
51461         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51462         o_conv.is_owned = false;
51463         int64_t ret_conv = Sha256_hash(&o_conv);
51464         return ret_conv;
51465 }
51466
51467 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
51468         LDKSha256 a_conv;
51469         a_conv.inner = untag_ptr(a);
51470         a_conv.is_owned = ptr_is_owned(a);
51471         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51472         a_conv.is_owned = false;
51473         LDKSha256 b_conv;
51474         b_conv.inner = untag_ptr(b);
51475         b_conv.is_owned = ptr_is_owned(b);
51476         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51477         b_conv.is_owned = false;
51478         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
51479         return ret_conv;
51480 }
51481
51482 uint64_t  __attribute__((export_name("TS_Sha256_from_bytes"))) TS_Sha256_from_bytes(int8_tArray bytes) {
51483         uint8_t bytes_arr[32];
51484         CHECK(bytes->arr_len == 32);
51485         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
51486         uint8_t (*bytes_ref)[32] = &bytes_arr;
51487         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
51488         uint64_t ret_ref = 0;
51489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51491         return ret_ref;
51492 }
51493
51494 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
51495         LDKDescription this_obj_conv;
51496         this_obj_conv.inner = untag_ptr(this_obj);
51497         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51499         Description_free(this_obj_conv);
51500 }
51501
51502 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
51503         LDKDescription ret_var = Description_clone(arg);
51504         uint64_t ret_ref = 0;
51505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51507         return ret_ref;
51508 }
51509 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
51510         LDKDescription arg_conv;
51511         arg_conv.inner = untag_ptr(arg);
51512         arg_conv.is_owned = ptr_is_owned(arg);
51513         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51514         arg_conv.is_owned = false;
51515         int64_t ret_conv = Description_clone_ptr(&arg_conv);
51516         return ret_conv;
51517 }
51518
51519 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
51520         LDKDescription orig_conv;
51521         orig_conv.inner = untag_ptr(orig);
51522         orig_conv.is_owned = ptr_is_owned(orig);
51523         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51524         orig_conv.is_owned = false;
51525         LDKDescription ret_var = Description_clone(&orig_conv);
51526         uint64_t ret_ref = 0;
51527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51529         return ret_ref;
51530 }
51531
51532 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
51533         LDKDescription o_conv;
51534         o_conv.inner = untag_ptr(o);
51535         o_conv.is_owned = ptr_is_owned(o);
51536         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51537         o_conv.is_owned = false;
51538         int64_t ret_conv = Description_hash(&o_conv);
51539         return ret_conv;
51540 }
51541
51542 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
51543         LDKDescription a_conv;
51544         a_conv.inner = untag_ptr(a);
51545         a_conv.is_owned = ptr_is_owned(a);
51546         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51547         a_conv.is_owned = false;
51548         LDKDescription b_conv;
51549         b_conv.inner = untag_ptr(b);
51550         b_conv.is_owned = ptr_is_owned(b);
51551         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51552         b_conv.is_owned = false;
51553         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
51554         return ret_conv;
51555 }
51556
51557 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
51558         LDKPayeePubKey this_obj_conv;
51559         this_obj_conv.inner = untag_ptr(this_obj);
51560         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51562         PayeePubKey_free(this_obj_conv);
51563 }
51564
51565 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
51566         LDKPayeePubKey this_ptr_conv;
51567         this_ptr_conv.inner = untag_ptr(this_ptr);
51568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51570         this_ptr_conv.is_owned = false;
51571         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
51572         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
51573         return ret_arr;
51574 }
51575
51576 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
51577         LDKPayeePubKey this_ptr_conv;
51578         this_ptr_conv.inner = untag_ptr(this_ptr);
51579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51581         this_ptr_conv.is_owned = false;
51582         LDKPublicKey val_ref;
51583         CHECK(val->arr_len == 33);
51584         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
51585         PayeePubKey_set_a(&this_ptr_conv, val_ref);
51586 }
51587
51588 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
51589         LDKPublicKey a_arg_ref;
51590         CHECK(a_arg->arr_len == 33);
51591         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
51592         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
51593         uint64_t ret_ref = 0;
51594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51596         return ret_ref;
51597 }
51598
51599 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
51600         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
51601         uint64_t ret_ref = 0;
51602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51604         return ret_ref;
51605 }
51606 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
51607         LDKPayeePubKey arg_conv;
51608         arg_conv.inner = untag_ptr(arg);
51609         arg_conv.is_owned = ptr_is_owned(arg);
51610         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51611         arg_conv.is_owned = false;
51612         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
51613         return ret_conv;
51614 }
51615
51616 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
51617         LDKPayeePubKey orig_conv;
51618         orig_conv.inner = untag_ptr(orig);
51619         orig_conv.is_owned = ptr_is_owned(orig);
51620         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51621         orig_conv.is_owned = false;
51622         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
51623         uint64_t ret_ref = 0;
51624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51626         return ret_ref;
51627 }
51628
51629 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
51630         LDKPayeePubKey o_conv;
51631         o_conv.inner = untag_ptr(o);
51632         o_conv.is_owned = ptr_is_owned(o);
51633         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51634         o_conv.is_owned = false;
51635         int64_t ret_conv = PayeePubKey_hash(&o_conv);
51636         return ret_conv;
51637 }
51638
51639 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
51640         LDKPayeePubKey a_conv;
51641         a_conv.inner = untag_ptr(a);
51642         a_conv.is_owned = ptr_is_owned(a);
51643         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51644         a_conv.is_owned = false;
51645         LDKPayeePubKey b_conv;
51646         b_conv.inner = untag_ptr(b);
51647         b_conv.is_owned = ptr_is_owned(b);
51648         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51649         b_conv.is_owned = false;
51650         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
51651         return ret_conv;
51652 }
51653
51654 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
51655         LDKExpiryTime this_obj_conv;
51656         this_obj_conv.inner = untag_ptr(this_obj);
51657         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51659         ExpiryTime_free(this_obj_conv);
51660 }
51661
51662 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
51663         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
51664         uint64_t ret_ref = 0;
51665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51667         return ret_ref;
51668 }
51669 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
51670         LDKExpiryTime arg_conv;
51671         arg_conv.inner = untag_ptr(arg);
51672         arg_conv.is_owned = ptr_is_owned(arg);
51673         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51674         arg_conv.is_owned = false;
51675         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
51676         return ret_conv;
51677 }
51678
51679 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
51680         LDKExpiryTime orig_conv;
51681         orig_conv.inner = untag_ptr(orig);
51682         orig_conv.is_owned = ptr_is_owned(orig);
51683         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51684         orig_conv.is_owned = false;
51685         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
51686         uint64_t ret_ref = 0;
51687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51689         return ret_ref;
51690 }
51691
51692 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
51693         LDKExpiryTime o_conv;
51694         o_conv.inner = untag_ptr(o);
51695         o_conv.is_owned = ptr_is_owned(o);
51696         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51697         o_conv.is_owned = false;
51698         int64_t ret_conv = ExpiryTime_hash(&o_conv);
51699         return ret_conv;
51700 }
51701
51702 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
51703         LDKExpiryTime a_conv;
51704         a_conv.inner = untag_ptr(a);
51705         a_conv.is_owned = ptr_is_owned(a);
51706         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51707         a_conv.is_owned = false;
51708         LDKExpiryTime b_conv;
51709         b_conv.inner = untag_ptr(b);
51710         b_conv.is_owned = ptr_is_owned(b);
51711         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51712         b_conv.is_owned = false;
51713         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
51714         return ret_conv;
51715 }
51716
51717 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_free"))) TS_MinFinalCltvExpiryDelta_free(uint64_t this_obj) {
51718         LDKMinFinalCltvExpiryDelta this_obj_conv;
51719         this_obj_conv.inner = untag_ptr(this_obj);
51720         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51722         MinFinalCltvExpiryDelta_free(this_obj_conv);
51723 }
51724
51725 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_get_a"))) TS_MinFinalCltvExpiryDelta_get_a(uint64_t this_ptr) {
51726         LDKMinFinalCltvExpiryDelta this_ptr_conv;
51727         this_ptr_conv.inner = untag_ptr(this_ptr);
51728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51730         this_ptr_conv.is_owned = false;
51731         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
51732         return ret_conv;
51733 }
51734
51735 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_set_a"))) TS_MinFinalCltvExpiryDelta_set_a(uint64_t this_ptr, int64_t val) {
51736         LDKMinFinalCltvExpiryDelta this_ptr_conv;
51737         this_ptr_conv.inner = untag_ptr(this_ptr);
51738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51740         this_ptr_conv.is_owned = false;
51741         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
51742 }
51743
51744 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_new"))) TS_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
51745         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
51746         uint64_t ret_ref = 0;
51747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51749         return ret_ref;
51750 }
51751
51752 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
51753         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
51754         uint64_t ret_ref = 0;
51755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51757         return ret_ref;
51758 }
51759 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone_ptr"))) TS_MinFinalCltvExpiryDelta_clone_ptr(uint64_t arg) {
51760         LDKMinFinalCltvExpiryDelta arg_conv;
51761         arg_conv.inner = untag_ptr(arg);
51762         arg_conv.is_owned = ptr_is_owned(arg);
51763         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51764         arg_conv.is_owned = false;
51765         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
51766         return ret_conv;
51767 }
51768
51769 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone"))) TS_MinFinalCltvExpiryDelta_clone(uint64_t orig) {
51770         LDKMinFinalCltvExpiryDelta orig_conv;
51771         orig_conv.inner = untag_ptr(orig);
51772         orig_conv.is_owned = ptr_is_owned(orig);
51773         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51774         orig_conv.is_owned = false;
51775         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
51776         uint64_t ret_ref = 0;
51777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51779         return ret_ref;
51780 }
51781
51782 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_hash"))) TS_MinFinalCltvExpiryDelta_hash(uint64_t o) {
51783         LDKMinFinalCltvExpiryDelta o_conv;
51784         o_conv.inner = untag_ptr(o);
51785         o_conv.is_owned = ptr_is_owned(o);
51786         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51787         o_conv.is_owned = false;
51788         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
51789         return ret_conv;
51790 }
51791
51792 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_eq"))) TS_MinFinalCltvExpiryDelta_eq(uint64_t a, uint64_t b) {
51793         LDKMinFinalCltvExpiryDelta a_conv;
51794         a_conv.inner = untag_ptr(a);
51795         a_conv.is_owned = ptr_is_owned(a);
51796         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51797         a_conv.is_owned = false;
51798         LDKMinFinalCltvExpiryDelta b_conv;
51799         b_conv.inner = untag_ptr(b);
51800         b_conv.is_owned = ptr_is_owned(b);
51801         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51802         b_conv.is_owned = false;
51803         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
51804         return ret_conv;
51805 }
51806
51807 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
51808         if (!ptr_is_owned(this_ptr)) return;
51809         void* this_ptr_ptr = untag_ptr(this_ptr);
51810         CHECK_ACCESS(this_ptr_ptr);
51811         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
51812         FREE(untag_ptr(this_ptr));
51813         Fallback_free(this_ptr_conv);
51814 }
51815
51816 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
51817         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51818         *ret_copy = Fallback_clone(arg);
51819         uint64_t ret_ref = tag_ptr(ret_copy, true);
51820         return ret_ref;
51821 }
51822 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
51823         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
51824         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
51825         return ret_conv;
51826 }
51827
51828 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
51829         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
51830         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51831         *ret_copy = Fallback_clone(orig_conv);
51832         uint64_t ret_ref = tag_ptr(ret_copy, true);
51833         return ret_ref;
51834 }
51835
51836 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
51837         
51838         LDKCVec_u8Z program_ref;
51839         program_ref.datalen = program->arr_len;
51840         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
51841         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
51842         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51843         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
51844         uint64_t ret_ref = tag_ptr(ret_copy, true);
51845         return ret_ref;
51846 }
51847
51848 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
51849         LDKTwentyBytes a_ref;
51850         CHECK(a->arr_len == 20);
51851         memcpy(a_ref.data, a->elems, 20); FREE(a);
51852         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51853         *ret_copy = Fallback_pub_key_hash(a_ref);
51854         uint64_t ret_ref = tag_ptr(ret_copy, true);
51855         return ret_ref;
51856 }
51857
51858 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
51859         LDKTwentyBytes a_ref;
51860         CHECK(a->arr_len == 20);
51861         memcpy(a_ref.data, a->elems, 20); FREE(a);
51862         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
51863         *ret_copy = Fallback_script_hash(a_ref);
51864         uint64_t ret_ref = tag_ptr(ret_copy, true);
51865         return ret_ref;
51866 }
51867
51868 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
51869         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
51870         int64_t ret_conv = Fallback_hash(o_conv);
51871         return ret_conv;
51872 }
51873
51874 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
51875         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
51876         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
51877         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
51878         return ret_conv;
51879 }
51880
51881 void  __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint64_t this_obj) {
51882         LDKInvoiceSignature this_obj_conv;
51883         this_obj_conv.inner = untag_ptr(this_obj);
51884         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51886         InvoiceSignature_free(this_obj_conv);
51887 }
51888
51889 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
51890         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
51891         uint64_t ret_ref = 0;
51892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51894         return ret_ref;
51895 }
51896 int64_t  __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint64_t arg) {
51897         LDKInvoiceSignature arg_conv;
51898         arg_conv.inner = untag_ptr(arg);
51899         arg_conv.is_owned = ptr_is_owned(arg);
51900         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51901         arg_conv.is_owned = false;
51902         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
51903         return ret_conv;
51904 }
51905
51906 uint64_t  __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint64_t orig) {
51907         LDKInvoiceSignature orig_conv;
51908         orig_conv.inner = untag_ptr(orig);
51909         orig_conv.is_owned = ptr_is_owned(orig);
51910         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51911         orig_conv.is_owned = false;
51912         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
51913         uint64_t ret_ref = 0;
51914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51916         return ret_ref;
51917 }
51918
51919 int64_t  __attribute__((export_name("TS_InvoiceSignature_hash"))) TS_InvoiceSignature_hash(uint64_t o) {
51920         LDKInvoiceSignature o_conv;
51921         o_conv.inner = untag_ptr(o);
51922         o_conv.is_owned = ptr_is_owned(o);
51923         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51924         o_conv.is_owned = false;
51925         int64_t ret_conv = InvoiceSignature_hash(&o_conv);
51926         return ret_conv;
51927 }
51928
51929 jboolean  __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint64_t a, uint64_t b) {
51930         LDKInvoiceSignature a_conv;
51931         a_conv.inner = untag_ptr(a);
51932         a_conv.is_owned = ptr_is_owned(a);
51933         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51934         a_conv.is_owned = false;
51935         LDKInvoiceSignature b_conv;
51936         b_conv.inner = untag_ptr(b);
51937         b_conv.is_owned = ptr_is_owned(b);
51938         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51939         b_conv.is_owned = false;
51940         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
51941         return ret_conv;
51942 }
51943
51944 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
51945         LDKPrivateRoute this_obj_conv;
51946         this_obj_conv.inner = untag_ptr(this_obj);
51947         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51949         PrivateRoute_free(this_obj_conv);
51950 }
51951
51952 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
51953         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
51954         uint64_t ret_ref = 0;
51955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51957         return ret_ref;
51958 }
51959 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
51960         LDKPrivateRoute arg_conv;
51961         arg_conv.inner = untag_ptr(arg);
51962         arg_conv.is_owned = ptr_is_owned(arg);
51963         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51964         arg_conv.is_owned = false;
51965         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
51966         return ret_conv;
51967 }
51968
51969 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
51970         LDKPrivateRoute orig_conv;
51971         orig_conv.inner = untag_ptr(orig);
51972         orig_conv.is_owned = ptr_is_owned(orig);
51973         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51974         orig_conv.is_owned = false;
51975         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
51976         uint64_t ret_ref = 0;
51977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51979         return ret_ref;
51980 }
51981
51982 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
51983         LDKPrivateRoute o_conv;
51984         o_conv.inner = untag_ptr(o);
51985         o_conv.is_owned = ptr_is_owned(o);
51986         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51987         o_conv.is_owned = false;
51988         int64_t ret_conv = PrivateRoute_hash(&o_conv);
51989         return ret_conv;
51990 }
51991
51992 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
51993         LDKPrivateRoute a_conv;
51994         a_conv.inner = untag_ptr(a);
51995         a_conv.is_owned = ptr_is_owned(a);
51996         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51997         a_conv.is_owned = false;
51998         LDKPrivateRoute b_conv;
51999         b_conv.inner = untag_ptr(b);
52000         b_conv.is_owned = ptr_is_owned(b);
52001         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52002         b_conv.is_owned = false;
52003         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
52004         return ret_conv;
52005 }
52006
52007 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint64_t this_arg) {
52008         LDKSignedRawInvoice this_arg_conv;
52009         this_arg_conv.inner = untag_ptr(this_arg);
52010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52012         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
52013         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
52014         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
52015         return tag_ptr(ret_conv, true);
52016 }
52017
52018 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint64_t this_arg) {
52019         LDKSignedRawInvoice this_arg_conv;
52020         this_arg_conv.inner = untag_ptr(this_arg);
52021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52023         this_arg_conv.is_owned = false;
52024         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
52025         uint64_t ret_ref = 0;
52026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52028         return ret_ref;
52029 }
52030
52031 int8_tArray  __attribute__((export_name("TS_SignedRawInvoice_signable_hash"))) TS_SignedRawInvoice_signable_hash(uint64_t this_arg) {
52032         LDKSignedRawInvoice this_arg_conv;
52033         this_arg_conv.inner = untag_ptr(this_arg);
52034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52036         this_arg_conv.is_owned = false;
52037         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52038         memcpy(ret_arr->elems, *SignedRawInvoice_signable_hash(&this_arg_conv), 32);
52039         return ret_arr;
52040 }
52041
52042 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint64_t this_arg) {
52043         LDKSignedRawInvoice this_arg_conv;
52044         this_arg_conv.inner = untag_ptr(this_arg);
52045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52047         this_arg_conv.is_owned = false;
52048         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
52049         uint64_t ret_ref = 0;
52050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52052         return ret_ref;
52053 }
52054
52055 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint64_t this_arg) {
52056         LDKSignedRawInvoice this_arg_conv;
52057         this_arg_conv.inner = untag_ptr(this_arg);
52058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52060         this_arg_conv.is_owned = false;
52061         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
52062         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
52063         return tag_ptr(ret_conv, true);
52064 }
52065
52066 jboolean  __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint64_t this_arg) {
52067         LDKSignedRawInvoice this_arg_conv;
52068         this_arg_conv.inner = untag_ptr(this_arg);
52069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52071         this_arg_conv.is_owned = false;
52072         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
52073         return ret_conv;
52074 }
52075
52076 int8_tArray  __attribute__((export_name("TS_RawInvoice_signable_hash"))) TS_RawInvoice_signable_hash(uint64_t this_arg) {
52077         LDKRawInvoice this_arg_conv;
52078         this_arg_conv.inner = untag_ptr(this_arg);
52079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52081         this_arg_conv.is_owned = false;
52082         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52083         memcpy(ret_arr->elems, RawInvoice_signable_hash(&this_arg_conv).data, 32);
52084         return ret_arr;
52085 }
52086
52087 uint64_t  __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint64_t this_arg) {
52088         LDKRawInvoice this_arg_conv;
52089         this_arg_conv.inner = untag_ptr(this_arg);
52090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52092         this_arg_conv.is_owned = false;
52093         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
52094         uint64_t ret_ref = 0;
52095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52097         return ret_ref;
52098 }
52099
52100 uint64_t  __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint64_t this_arg) {
52101         LDKRawInvoice this_arg_conv;
52102         this_arg_conv.inner = untag_ptr(this_arg);
52103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52105         this_arg_conv.is_owned = false;
52106         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
52107         uint64_t ret_ref = 0;
52108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52110         return ret_ref;
52111 }
52112
52113 uint64_t  __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint64_t this_arg) {
52114         LDKRawInvoice this_arg_conv;
52115         this_arg_conv.inner = untag_ptr(this_arg);
52116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52118         this_arg_conv.is_owned = false;
52119         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
52120         uint64_t ret_ref = 0;
52121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52123         return ret_ref;
52124 }
52125
52126 uint64_t  __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint64_t this_arg) {
52127         LDKRawInvoice this_arg_conv;
52128         this_arg_conv.inner = untag_ptr(this_arg);
52129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52131         this_arg_conv.is_owned = false;
52132         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
52133         uint64_t ret_ref = 0;
52134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52136         return ret_ref;
52137 }
52138
52139 uint64_t  __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint64_t this_arg) {
52140         LDKRawInvoice this_arg_conv;
52141         this_arg_conv.inner = untag_ptr(this_arg);
52142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52144         this_arg_conv.is_owned = false;
52145         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
52146         uint64_t ret_ref = 0;
52147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52149         return ret_ref;
52150 }
52151
52152 uint64_t  __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry_delta"))) TS_RawInvoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
52153         LDKRawInvoice this_arg_conv;
52154         this_arg_conv.inner = untag_ptr(this_arg);
52155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52157         this_arg_conv.is_owned = false;
52158         LDKMinFinalCltvExpiryDelta ret_var = RawInvoice_min_final_cltv_expiry_delta(&this_arg_conv);
52159         uint64_t ret_ref = 0;
52160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52162         return ret_ref;
52163 }
52164
52165 int8_tArray  __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint64_t this_arg) {
52166         LDKRawInvoice this_arg_conv;
52167         this_arg_conv.inner = untag_ptr(this_arg);
52168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52170         this_arg_conv.is_owned = false;
52171         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52172         memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
52173         return ret_arr;
52174 }
52175
52176 uint64_t  __attribute__((export_name("TS_RawInvoice_payment_metadata"))) TS_RawInvoice_payment_metadata(uint64_t this_arg) {
52177         LDKRawInvoice this_arg_conv;
52178         this_arg_conv.inner = untag_ptr(this_arg);
52179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52181         this_arg_conv.is_owned = false;
52182         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
52183         *ret_copy = RawInvoice_payment_metadata(&this_arg_conv);
52184         uint64_t ret_ref = tag_ptr(ret_copy, true);
52185         return ret_ref;
52186 }
52187
52188 uint64_t  __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint64_t this_arg) {
52189         LDKRawInvoice this_arg_conv;
52190         this_arg_conv.inner = untag_ptr(this_arg);
52191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52193         this_arg_conv.is_owned = false;
52194         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
52195         uint64_t ret_ref = 0;
52196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52198         return ret_ref;
52199 }
52200
52201 uint64_tArray  __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint64_t this_arg) {
52202         LDKRawInvoice this_arg_conv;
52203         this_arg_conv.inner = untag_ptr(this_arg);
52204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52206         this_arg_conv.is_owned = false;
52207         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
52208         uint64_tArray ret_arr = NULL;
52209         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52210         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52211         for (size_t o = 0; o < ret_var.datalen; o++) {
52212                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
52213                 uint64_t ret_conv_14_ref = 0;
52214                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
52215                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
52216                 ret_arr_ptr[o] = ret_conv_14_ref;
52217         }
52218         
52219         FREE(ret_var.data);
52220         return ret_arr;
52221 }
52222
52223 uint64_t  __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint64_t this_arg) {
52224         LDKRawInvoice this_arg_conv;
52225         this_arg_conv.inner = untag_ptr(this_arg);
52226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52228         this_arg_conv.is_owned = false;
52229         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
52230         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
52231         uint64_t ret_ref = tag_ptr(ret_copy, true);
52232         return ret_ref;
52233 }
52234
52235 uint32_t  __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint64_t this_arg) {
52236         LDKRawInvoice this_arg_conv;
52237         this_arg_conv.inner = untag_ptr(this_arg);
52238         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52240         this_arg_conv.is_owned = false;
52241         uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
52242         return ret_conv;
52243 }
52244
52245 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
52246         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
52247         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
52248         return tag_ptr(ret_conv, true);
52249 }
52250
52251 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
52252         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
52253         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
52254         return tag_ptr(ret_conv, true);
52255 }
52256
52257 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
52258         LDKPositiveTimestamp this_arg_conv;
52259         this_arg_conv.inner = untag_ptr(this_arg);
52260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52262         this_arg_conv.is_owned = false;
52263         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
52264         return ret_conv;
52265 }
52266
52267 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
52268         LDKPositiveTimestamp this_arg_conv;
52269         this_arg_conv.inner = untag_ptr(this_arg);
52270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52272         this_arg_conv.is_owned = false;
52273         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
52274         return ret_conv;
52275 }
52276
52277 int8_tArray  __attribute__((export_name("TS_Invoice_signable_hash"))) TS_Invoice_signable_hash(uint64_t this_arg) {
52278         LDKInvoice 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52284         memcpy(ret_arr->elems, Invoice_signable_hash(&this_arg_conv).data, 32);
52285         return ret_arr;
52286 }
52287
52288 uint64_t  __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint64_t this_arg) {
52289         LDKInvoice this_arg_conv;
52290         this_arg_conv.inner = untag_ptr(this_arg);
52291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52293         this_arg_conv = Invoice_clone(&this_arg_conv);
52294         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
52295         uint64_t ret_ref = 0;
52296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52298         return ret_ref;
52299 }
52300
52301 uint64_t  __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint64_t this_arg) {
52302         LDKInvoice this_arg_conv;
52303         this_arg_conv.inner = untag_ptr(this_arg);
52304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52306         this_arg_conv.is_owned = false;
52307         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
52308         *ret_conv = Invoice_check_signature(&this_arg_conv);
52309         return tag_ptr(ret_conv, true);
52310 }
52311
52312 uint64_t  __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint64_t signed_invoice) {
52313         LDKSignedRawInvoice signed_invoice_conv;
52314         signed_invoice_conv.inner = untag_ptr(signed_invoice);
52315         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
52316         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
52317         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
52318         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
52319         *ret_conv = Invoice_from_signed(signed_invoice_conv);
52320         return tag_ptr(ret_conv, true);
52321 }
52322
52323 int64_t  __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint64_t this_arg) {
52324         LDKInvoice this_arg_conv;
52325         this_arg_conv.inner = untag_ptr(this_arg);
52326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52328         this_arg_conv.is_owned = false;
52329         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
52330         return ret_conv;
52331 }
52332
52333 int8_tArray  __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint64_t this_arg) {
52334         LDKInvoice this_arg_conv;
52335         this_arg_conv.inner = untag_ptr(this_arg);
52336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52338         this_arg_conv.is_owned = false;
52339         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52340         memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
52341         return ret_arr;
52342 }
52343
52344 int8_tArray  __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint64_t this_arg) {
52345         LDKInvoice this_arg_conv;
52346         this_arg_conv.inner = untag_ptr(this_arg);
52347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52349         this_arg_conv.is_owned = false;
52350         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52351         memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
52352         return ret_arr;
52353 }
52354
52355 int8_tArray  __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint64_t this_arg) {
52356         LDKInvoice this_arg_conv;
52357         this_arg_conv.inner = untag_ptr(this_arg);
52358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52360         this_arg_conv.is_owned = false;
52361         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52362         memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
52363         return ret_arr;
52364 }
52365
52366 uint64_t  __attribute__((export_name("TS_Invoice_payment_metadata"))) TS_Invoice_payment_metadata(uint64_t this_arg) {
52367         LDKInvoice this_arg_conv;
52368         this_arg_conv.inner = untag_ptr(this_arg);
52369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52371         this_arg_conv.is_owned = false;
52372         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
52373         *ret_copy = Invoice_payment_metadata(&this_arg_conv);
52374         uint64_t ret_ref = tag_ptr(ret_copy, true);
52375         return ret_ref;
52376 }
52377
52378 uint64_t  __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint64_t this_arg) {
52379         LDKInvoice this_arg_conv;
52380         this_arg_conv.inner = untag_ptr(this_arg);
52381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52383         this_arg_conv.is_owned = false;
52384         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
52385         uint64_t ret_ref = 0;
52386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52388         return ret_ref;
52389 }
52390
52391 int8_tArray  __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint64_t this_arg) {
52392         LDKInvoice this_arg_conv;
52393         this_arg_conv.inner = untag_ptr(this_arg);
52394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52396         this_arg_conv.is_owned = false;
52397         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52398         memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
52399         return ret_arr;
52400 }
52401
52402 uint64_t  __attribute__((export_name("TS_Invoice_expires_at"))) TS_Invoice_expires_at(uint64_t this_arg) {
52403         LDKInvoice this_arg_conv;
52404         this_arg_conv.inner = untag_ptr(this_arg);
52405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52407         this_arg_conv.is_owned = false;
52408         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
52409         *ret_copy = Invoice_expires_at(&this_arg_conv);
52410         uint64_t ret_ref = tag_ptr(ret_copy, true);
52411         return ret_ref;
52412 }
52413
52414 int64_t  __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint64_t this_arg) {
52415         LDKInvoice this_arg_conv;
52416         this_arg_conv.inner = untag_ptr(this_arg);
52417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52419         this_arg_conv.is_owned = false;
52420         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
52421         return ret_conv;
52422 }
52423
52424 int64_t  __attribute__((export_name("TS_Invoice_expiration_remaining_from_epoch"))) TS_Invoice_expiration_remaining_from_epoch(uint64_t this_arg, int64_t time) {
52425         LDKInvoice this_arg_conv;
52426         this_arg_conv.inner = untag_ptr(this_arg);
52427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52429         this_arg_conv.is_owned = false;
52430         int64_t ret_conv = Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
52431         return ret_conv;
52432 }
52433
52434 jboolean  __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
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         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
52441         return ret_conv;
52442 }
52443
52444 int64_t  __attribute__((export_name("TS_Invoice_min_final_cltv_expiry_delta"))) TS_Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
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_min_final_cltv_expiry_delta(&this_arg_conv);
52451         return ret_conv;
52452 }
52453
52454 ptrArray  __attribute__((export_name("TS_Invoice_fallback_addresses"))) TS_Invoice_fallback_addresses(uint64_t this_arg) {
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         LDKCVec_AddressZ ret_var = Invoice_fallback_addresses(&this_arg_conv);
52461         ptrArray ret_arr = NULL;
52462         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
52463         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
52464         for (size_t i = 0; i < ret_var.datalen; i++) {
52465                 LDKStr ret_conv_8_str = ret_var.data[i];
52466                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
52467                 Str_free(ret_conv_8_str);
52468                 ret_arr_ptr[i] = ret_conv_8_conv;
52469         }
52470         
52471         FREE(ret_var.data);
52472         return ret_arr;
52473 }
52474
52475 uint64_tArray  __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint64_t this_arg) {
52476         LDKInvoice this_arg_conv;
52477         this_arg_conv.inner = untag_ptr(this_arg);
52478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52480         this_arg_conv.is_owned = false;
52481         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
52482         uint64_tArray ret_arr = NULL;
52483         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52484         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52485         for (size_t o = 0; o < ret_var.datalen; o++) {
52486                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
52487                 uint64_t ret_conv_14_ref = 0;
52488                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
52489                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
52490                 ret_arr_ptr[o] = ret_conv_14_ref;
52491         }
52492         
52493         FREE(ret_var.data);
52494         return ret_arr;
52495 }
52496
52497 uint64_tArray  __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint64_t this_arg) {
52498         LDKInvoice this_arg_conv;
52499         this_arg_conv.inner = untag_ptr(this_arg);
52500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52502         this_arg_conv.is_owned = false;
52503         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
52504         uint64_tArray ret_arr = NULL;
52505         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52506         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52507         for (size_t l = 0; l < ret_var.datalen; l++) {
52508                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
52509                 uint64_t ret_conv_11_ref = 0;
52510                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
52511                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
52512                 ret_arr_ptr[l] = ret_conv_11_ref;
52513         }
52514         
52515         FREE(ret_var.data);
52516         return ret_arr;
52517 }
52518
52519 uint32_t  __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint64_t this_arg) {
52520         LDKInvoice this_arg_conv;
52521         this_arg_conv.inner = untag_ptr(this_arg);
52522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52524         this_arg_conv.is_owned = false;
52525         uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
52526         return ret_conv;
52527 }
52528
52529 uint64_t  __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint64_t this_arg) {
52530         LDKInvoice this_arg_conv;
52531         this_arg_conv.inner = untag_ptr(this_arg);
52532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52534         this_arg_conv.is_owned = false;
52535         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
52536         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
52537         uint64_t ret_ref = tag_ptr(ret_copy, true);
52538         return ret_ref;
52539 }
52540
52541 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
52542         LDKStr description_conv = str_ref_to_owned_c(description);
52543         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
52544         *ret_conv = Description_new(description_conv);
52545         return tag_ptr(ret_conv, true);
52546 }
52547
52548 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
52549         LDKDescription this_arg_conv;
52550         this_arg_conv.inner = untag_ptr(this_arg);
52551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52553         this_arg_conv = Description_clone(&this_arg_conv);
52554         LDKStr ret_str = Description_into_inner(this_arg_conv);
52555         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
52556         Str_free(ret_str);
52557         return ret_conv;
52558 }
52559
52560 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
52561         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
52562         uint64_t ret_ref = 0;
52563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52565         return ret_ref;
52566 }
52567
52568 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
52569         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
52570         uint64_t ret_ref = 0;
52571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52573         return ret_ref;
52574 }
52575
52576 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
52577         LDKExpiryTime this_arg_conv;
52578         this_arg_conv.inner = untag_ptr(this_arg);
52579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52581         this_arg_conv.is_owned = false;
52582         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
52583         return ret_conv;
52584 }
52585
52586 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
52587         LDKExpiryTime this_arg_conv;
52588         this_arg_conv.inner = untag_ptr(this_arg);
52589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52591         this_arg_conv.is_owned = false;
52592         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
52593         return ret_conv;
52594 }
52595
52596 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
52597         LDKRouteHint hops_conv;
52598         hops_conv.inner = untag_ptr(hops);
52599         hops_conv.is_owned = ptr_is_owned(hops);
52600         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
52601         hops_conv = RouteHint_clone(&hops_conv);
52602         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
52603         *ret_conv = PrivateRoute_new(hops_conv);
52604         return tag_ptr(ret_conv, true);
52605 }
52606
52607 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
52608         LDKPrivateRoute this_arg_conv;
52609         this_arg_conv.inner = untag_ptr(this_arg);
52610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52612         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
52613         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
52614         uint64_t ret_ref = 0;
52615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52617         return ret_ref;
52618 }
52619
52620 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
52621         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
52622         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
52623         return ret_conv;
52624 }
52625
52626 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
52627         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
52628         return ret_conv;
52629 }
52630
52631 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
52632         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
52633         return ret_conv;
52634 }
52635
52636 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
52637         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
52638         return ret_conv;
52639 }
52640
52641 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
52642         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
52643         return ret_conv;
52644 }
52645
52646 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
52647         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
52648         return ret_conv;
52649 }
52650
52651 uint32_t  __attribute__((export_name("TS_CreationError_min_final_cltv_expiry_delta_too_short"))) TS_CreationError_min_final_cltv_expiry_delta_too_short() {
52652         uint32_t ret_conv = LDKCreationError_to_js(CreationError_min_final_cltv_expiry_delta_too_short());
52653         return ret_conv;
52654 }
52655
52656 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
52657         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
52658         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
52659         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
52660         return ret_conv;
52661 }
52662
52663 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
52664         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
52665         LDKStr ret_str = CreationError_to_str(o_conv);
52666         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
52667         Str_free(ret_str);
52668         return ret_conv;
52669 }
52670
52671 uint32_t  __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint64_t orig) {
52672         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
52673         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
52674         return ret_conv;
52675 }
52676
52677 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
52678         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
52679         return ret_conv;
52680 }
52681
52682 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
52683         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
52684         return ret_conv;
52685 }
52686
52687 uint32_t  __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
52688         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
52689         return ret_conv;
52690 }
52691
52692 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
52693         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
52694         return ret_conv;
52695 }
52696
52697 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
52698         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
52699         return ret_conv;
52700 }
52701
52702 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
52703         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
52704         return ret_conv;
52705 }
52706
52707 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
52708         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
52709         return ret_conv;
52710 }
52711
52712 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
52713         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
52714         return ret_conv;
52715 }
52716
52717 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
52718         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
52719         return ret_conv;
52720 }
52721
52722 uint32_t  __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
52723         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
52724         return ret_conv;
52725 }
52726
52727 jboolean  __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint64_t a, uint64_t b) {
52728         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
52729         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
52730         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
52731         return ret_conv;
52732 }
52733
52734 jstring  __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint64_t o) {
52735         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
52736         LDKStr ret_str = SemanticError_to_str(o_conv);
52737         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
52738         Str_free(ret_str);
52739         return ret_conv;
52740 }
52741
52742 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
52743         if (!ptr_is_owned(this_ptr)) return;
52744         void* this_ptr_ptr = untag_ptr(this_ptr);
52745         CHECK_ACCESS(this_ptr_ptr);
52746         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
52747         FREE(untag_ptr(this_ptr));
52748         SignOrCreationError_free(this_ptr_conv);
52749 }
52750
52751 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
52752         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
52753         *ret_copy = SignOrCreationError_clone(arg);
52754         uint64_t ret_ref = tag_ptr(ret_copy, true);
52755         return ret_ref;
52756 }
52757 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
52758         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
52759         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
52760         return ret_conv;
52761 }
52762
52763 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
52764         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
52765         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
52766         *ret_copy = SignOrCreationError_clone(orig_conv);
52767         uint64_t ret_ref = tag_ptr(ret_copy, true);
52768         return ret_ref;
52769 }
52770
52771 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
52772         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
52773         *ret_copy = SignOrCreationError_sign_error();
52774         uint64_t ret_ref = tag_ptr(ret_copy, true);
52775         return ret_ref;
52776 }
52777
52778 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
52779         LDKCreationError a_conv = LDKCreationError_from_js(a);
52780         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
52781         *ret_copy = SignOrCreationError_creation_error(a_conv);
52782         uint64_t ret_ref = tag_ptr(ret_copy, true);
52783         return ret_ref;
52784 }
52785
52786 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
52787         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
52788         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
52789         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
52790         return ret_conv;
52791 }
52792
52793 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
52794         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
52795         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
52796         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
52797         Str_free(ret_str);
52798         return ret_conv;
52799 }
52800
52801 uint64_t  __attribute__((export_name("TS_pay_invoice"))) TS_pay_invoice(uint64_t invoice, uint64_t retry_strategy, uint64_t channelmanager) {
52802         LDKInvoice invoice_conv;
52803         invoice_conv.inner = untag_ptr(invoice);
52804         invoice_conv.is_owned = ptr_is_owned(invoice);
52805         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
52806         invoice_conv.is_owned = false;
52807         void* retry_strategy_ptr = untag_ptr(retry_strategy);
52808         CHECK_ACCESS(retry_strategy_ptr);
52809         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
52810         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
52811         LDKChannelManager channelmanager_conv;
52812         channelmanager_conv.inner = untag_ptr(channelmanager);
52813         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
52814         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
52815         channelmanager_conv.is_owned = false;
52816         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
52817         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
52818         return tag_ptr(ret_conv, true);
52819 }
52820
52821 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) {
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         LDKThirtyTwoBytes payment_id_ref;
52828         CHECK(payment_id->arr_len == 32);
52829         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
52830         void* retry_strategy_ptr = untag_ptr(retry_strategy);
52831         CHECK_ACCESS(retry_strategy_ptr);
52832         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
52833         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
52834         LDKChannelManager channelmanager_conv;
52835         channelmanager_conv.inner = untag_ptr(channelmanager);
52836         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
52837         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
52838         channelmanager_conv.is_owned = false;
52839         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
52840         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
52841         return tag_ptr(ret_conv, true);
52842 }
52843
52844 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) {
52845         LDKInvoice invoice_conv;
52846         invoice_conv.inner = untag_ptr(invoice);
52847         invoice_conv.is_owned = ptr_is_owned(invoice);
52848         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
52849         invoice_conv.is_owned = false;
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_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
52860         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, 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_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) {
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         LDKThirtyTwoBytes payment_id_ref;
52871         CHECK(payment_id->arr_len == 32);
52872         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
52873         void* retry_strategy_ptr = untag_ptr(retry_strategy);
52874         CHECK_ACCESS(retry_strategy_ptr);
52875         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
52876         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
52877         LDKChannelManager channelmanager_conv;
52878         channelmanager_conv.inner = untag_ptr(channelmanager);
52879         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
52880         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
52881         channelmanager_conv.is_owned = false;
52882         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
52883         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
52884         return tag_ptr(ret_conv, true);
52885 }
52886
52887 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
52888         if (!ptr_is_owned(this_ptr)) return;
52889         void* this_ptr_ptr = untag_ptr(this_ptr);
52890         CHECK_ACCESS(this_ptr_ptr);
52891         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
52892         FREE(untag_ptr(this_ptr));
52893         PaymentError_free(this_ptr_conv);
52894 }
52895
52896 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
52897         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
52898         *ret_copy = PaymentError_clone(arg);
52899         uint64_t ret_ref = tag_ptr(ret_copy, true);
52900         return ret_ref;
52901 }
52902 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
52903         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
52904         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
52905         return ret_conv;
52906 }
52907
52908 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
52909         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
52910         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
52911         *ret_copy = PaymentError_clone(orig_conv);
52912         uint64_t ret_ref = tag_ptr(ret_copy, true);
52913         return ret_ref;
52914 }
52915
52916 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
52917         LDKStr a_conv = str_ref_to_owned_c(a);
52918         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
52919         *ret_copy = PaymentError_invoice(a_conv);
52920         uint64_t ret_ref = tag_ptr(ret_copy, true);
52921         return ret_ref;
52922 }
52923
52924 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) {
52925         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_js(a);
52926         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
52927         *ret_copy = PaymentError_sending(a_conv);
52928         uint64_t ret_ref = tag_ptr(ret_copy, true);
52929         return ret_ref;
52930 }
52931
52932 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) {
52933         void* amt_msat_ptr = untag_ptr(amt_msat);
52934         CHECK_ACCESS(amt_msat_ptr);
52935         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
52936         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
52937         LDKThirtyTwoBytes payment_hash_ref;
52938         CHECK(payment_hash->arr_len == 32);
52939         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
52940         LDKStr description_conv = str_ref_to_owned_c(description);
52941         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
52942         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
52943         if (phantom_route_hints_constr.datalen > 0)
52944                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
52945         else
52946                 phantom_route_hints_constr.data = NULL;
52947         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
52948         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
52949                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
52950                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
52951                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
52952                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
52953                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
52954                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
52955                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
52956         }
52957         FREE(phantom_route_hints);
52958         void* entropy_source_ptr = untag_ptr(entropy_source);
52959         CHECK_ACCESS(entropy_source_ptr);
52960         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
52961         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
52962                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52963                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
52964         }
52965         void* node_signer_ptr = untag_ptr(node_signer);
52966         CHECK_ACCESS(node_signer_ptr);
52967         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
52968         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
52969                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52970                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
52971         }
52972         void* logger_ptr = untag_ptr(logger);
52973         CHECK_ACCESS(logger_ptr);
52974         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
52975         if (logger_conv.free == LDKLogger_JCalls_free) {
52976                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52977                 LDKLogger_JCalls_cloned(&logger_conv);
52978         }
52979         LDKCurrency network_conv = LDKCurrency_from_js(network);
52980         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
52981         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
52982         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
52983         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
52984         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
52985         *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);
52986         return tag_ptr(ret_conv, true);
52987 }
52988
52989 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) {
52990         void* amt_msat_ptr = untag_ptr(amt_msat);
52991         CHECK_ACCESS(amt_msat_ptr);
52992         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
52993         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
52994         LDKThirtyTwoBytes payment_hash_ref;
52995         CHECK(payment_hash->arr_len == 32);
52996         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
52997         LDKSha256 description_hash_conv;
52998         description_hash_conv.inner = untag_ptr(description_hash);
52999         description_hash_conv.is_owned = ptr_is_owned(description_hash);
53000         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
53001         description_hash_conv = Sha256_clone(&description_hash_conv);
53002         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
53003         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
53004         if (phantom_route_hints_constr.datalen > 0)
53005                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
53006         else
53007                 phantom_route_hints_constr.data = NULL;
53008         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
53009         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
53010                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
53011                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
53012                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
53013                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
53014                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
53015                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
53016                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
53017         }
53018         FREE(phantom_route_hints);
53019         void* entropy_source_ptr = untag_ptr(entropy_source);
53020         CHECK_ACCESS(entropy_source_ptr);
53021         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
53022         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
53023                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53024                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
53025         }
53026         void* node_signer_ptr = untag_ptr(node_signer);
53027         CHECK_ACCESS(node_signer_ptr);
53028         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
53029         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
53030                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53031                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
53032         }
53033         void* logger_ptr = untag_ptr(logger);
53034         CHECK_ACCESS(logger_ptr);
53035         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53036         if (logger_conv.free == LDKLogger_JCalls_free) {
53037                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53038                 LDKLogger_JCalls_cloned(&logger_conv);
53039         }
53040         LDKCurrency network_conv = LDKCurrency_from_js(network);
53041         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
53042         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
53043         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
53044         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
53045         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
53046         *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);
53047         return tag_ptr(ret_conv, true);
53048 }
53049
53050 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) {
53051         LDKChannelManager channelmanager_conv;
53052         channelmanager_conv.inner = untag_ptr(channelmanager);
53053         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
53054         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
53055         channelmanager_conv.is_owned = false;
53056         void* node_signer_ptr = untag_ptr(node_signer);
53057         CHECK_ACCESS(node_signer_ptr);
53058         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
53059         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
53060                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53061                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
53062         }
53063         void* logger_ptr = untag_ptr(logger);
53064         CHECK_ACCESS(logger_ptr);
53065         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53066         if (logger_conv.free == LDKLogger_JCalls_free) {
53067                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53068                 LDKLogger_JCalls_cloned(&logger_conv);
53069         }
53070         LDKCurrency network_conv = LDKCurrency_from_js(network);
53071         void* amt_msat_ptr = untag_ptr(amt_msat);
53072         CHECK_ACCESS(amt_msat_ptr);
53073         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
53074         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
53075         LDKSha256 description_hash_conv;
53076         description_hash_conv.inner = untag_ptr(description_hash);
53077         description_hash_conv.is_owned = ptr_is_owned(description_hash);
53078         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
53079         description_hash_conv = Sha256_clone(&description_hash_conv);
53080         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
53081         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
53082         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
53083         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
53084         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
53085         *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);
53086         return tag_ptr(ret_conv, true);
53087 }
53088
53089 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) {
53090         LDKChannelManager channelmanager_conv;
53091         channelmanager_conv.inner = untag_ptr(channelmanager);
53092         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
53093         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
53094         channelmanager_conv.is_owned = false;
53095         void* node_signer_ptr = untag_ptr(node_signer);
53096         CHECK_ACCESS(node_signer_ptr);
53097         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
53098         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
53099                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53100                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
53101         }
53102         void* logger_ptr = untag_ptr(logger);
53103         CHECK_ACCESS(logger_ptr);
53104         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53105         if (logger_conv.free == LDKLogger_JCalls_free) {
53106                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53107                 LDKLogger_JCalls_cloned(&logger_conv);
53108         }
53109         LDKCurrency network_conv = LDKCurrency_from_js(network);
53110         void* amt_msat_ptr = untag_ptr(amt_msat);
53111         CHECK_ACCESS(amt_msat_ptr);
53112         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
53113         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
53114         LDKStr description_conv = str_ref_to_owned_c(description);
53115         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
53116         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
53117         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
53118         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
53119         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
53120         *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);
53121         return tag_ptr(ret_conv, true);
53122 }
53123
53124 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) {
53125         LDKChannelManager channelmanager_conv;
53126         channelmanager_conv.inner = untag_ptr(channelmanager);
53127         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
53128         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
53129         channelmanager_conv.is_owned = false;
53130         void* node_signer_ptr = untag_ptr(node_signer);
53131         CHECK_ACCESS(node_signer_ptr);
53132         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
53133         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
53134                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53135                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
53136         }
53137         void* logger_ptr = untag_ptr(logger);
53138         CHECK_ACCESS(logger_ptr);
53139         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53140         if (logger_conv.free == LDKLogger_JCalls_free) {
53141                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53142                 LDKLogger_JCalls_cloned(&logger_conv);
53143         }
53144         LDKCurrency network_conv = LDKCurrency_from_js(network);
53145         void* amt_msat_ptr = untag_ptr(amt_msat);
53146         CHECK_ACCESS(amt_msat_ptr);
53147         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
53148         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
53149         LDKStr description_conv = str_ref_to_owned_c(description);
53150         LDKThirtyTwoBytes payment_hash_ref;
53151         CHECK(payment_hash->arr_len == 32);
53152         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
53153         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
53154         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
53155         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
53156         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
53157         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
53158         *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);
53159         return tag_ptr(ret_conv, true);
53160 }
53161
53162 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
53163         LDKStr s_conv = str_ref_to_owned_c(s);
53164         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
53165         *ret_conv = SiPrefix_from_str(s_conv);
53166         return tag_ptr(ret_conv, true);
53167 }
53168
53169 uint64_t  __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
53170         LDKStr s_conv = str_ref_to_owned_c(s);
53171         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
53172         *ret_conv = Invoice_from_str(s_conv);
53173         return tag_ptr(ret_conv, true);
53174 }
53175
53176 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
53177         LDKStr s_conv = str_ref_to_owned_c(s);
53178         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
53179         *ret_conv = SignedRawInvoice_from_str(s_conv);
53180         return tag_ptr(ret_conv, true);
53181 }
53182
53183 jstring  __attribute__((export_name("TS_ParseError_to_str"))) TS_ParseError_to_str(uint64_t o) {
53184         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
53185         LDKStr ret_str = ParseError_to_str(o_conv);
53186         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53187         Str_free(ret_str);
53188         return ret_conv;
53189 }
53190
53191 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
53192         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
53193         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
53194         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53195         Str_free(ret_str);
53196         return ret_conv;
53197 }
53198
53199 jstring  __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint64_t o) {
53200         LDKInvoice o_conv;
53201         o_conv.inner = untag_ptr(o);
53202         o_conv.is_owned = ptr_is_owned(o);
53203         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53204         o_conv.is_owned = false;
53205         LDKStr ret_str = Invoice_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_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint64_t o) {
53212         LDKSignedRawInvoice o_conv;
53213         o_conv.inner = untag_ptr(o);
53214         o_conv.is_owned = ptr_is_owned(o);
53215         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53216         o_conv.is_owned = false;
53217         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
53218         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53219         Str_free(ret_str);
53220         return ret_conv;
53221 }
53222
53223 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
53224         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
53225         LDKStr ret_str = Currency_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_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
53232         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
53233         LDKStr ret_str = SiPrefix_to_str(o_conv);
53234         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53235         Str_free(ret_str);
53236         return ret_conv;
53237 }
53238